Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run3-alca192B Change std::cout to edm::LogVerbatim in a number of classes in Calibration/IsolatedParticles #34823

Merged
merged 2 commits into from
Aug 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
39 changes: 13 additions & 26 deletions Calibration/IsolatedParticles/src/DetIdFromEtaPhi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
#include "DataFormats/EcalDetId/interface/EBDetId.h"
#include "DataFormats/EcalDetId/interface/EEDetId.h"
#include "DataFormats/HcalDetId/interface/HcalDetId.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

//#define EDM_ML_DEBUG
#include <sstream>

namespace spr {

Expand All @@ -23,11 +24,9 @@ namespace spr {
subdet = EcalBarrel;
}
const CaloSubdetectorGeometry* gECAL = geo->getSubdetectorGeometry(DetId::Ecal, subdet);
#ifdef EDM_ML_DEBUG
if (debug)
std::cout << "findDetIdECAL: eta " << eta << " theta " << theta << " phi " << phi << " radius " << radius
<< " subdet " << subdet << std::endl;
#endif
edm::LogVerbatim("IsoTrack") << "findDetIdECAL: eta " << eta << " theta " << theta << " phi " << phi << " radius "
<< radius << " subdet " << subdet;
return spr::findDetIdCalo(gECAL, theta, phi, radius, debug);
}

Expand All @@ -39,42 +38,30 @@ namespace spr {
else
radius = spr::rFrontHB / std::sin(theta);
const CaloSubdetectorGeometry* gHCAL = geo->getSubdetectorGeometry(DetId::Hcal, HcalBarrel);
#ifdef EDM_ML_DEBUG
if (debug)
std::cout << "findDetIdHCAL: eta " << eta << " theta " << theta << " phi " << phi << " radius " << radius
<< std::endl;
#endif
edm::LogVerbatim("IsoTrack") << "findDetIdHCAL: eta " << eta << " theta " << theta << " phi " << phi << " radius "
<< radius;
return spr::findDetIdCalo(gHCAL, theta, phi, radius, debug);
}

const DetId findDetIdCalo(const CaloSubdetectorGeometry* geo,
double theta,
double phi,
double radius,
bool
#ifdef EDM_ML_DEBUG
debug
#endif
) {

const DetId findDetIdCalo(const CaloSubdetectorGeometry* geo, double theta, double phi, double radius, bool debug) {
double rcyl = radius * std::sin(theta);
double z = radius * std::cos(theta);
GlobalPoint point(rcyl * std::cos(phi), rcyl * std::sin(phi), z);
const DetId cell = geo->getClosestCell(point);
#ifdef EDM_ML_DEBUG
if (debug) {
std::cout << "findDetIdCalo: rcyl " << rcyl << " z " << z << " Point " << point << " DetId ";
std::ostringstream st1;
if (cell.det() == DetId::Ecal) {
if (cell.subdetId() == EcalBarrel)
std::cout << (EBDetId)(cell);
st1 << (EBDetId)(cell);
else
std::cout << (EEDetId)(cell);
st1 << (EEDetId)(cell);
} else {
std::cout << (HcalDetId)(cell);
st1 << (HcalDetId)(cell);
}
std::cout << std::endl;
edm::LogVerbatim("IsoTrack") << "findDetIdCalo: rcyl " << rcyl << " z " << z << " Point " << point << " DetId "
<< st1.str();
}
#endif
return cell;
}

Expand Down
5 changes: 3 additions & 2 deletions Calibration/IsolatedParticles/src/FindCaloHitCone.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "Calibration/IsolatedParticles/interface/FindDistCone.h"
#include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
#include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include <iostream>

namespace spr {
Expand Down Expand Up @@ -67,7 +68,7 @@ namespace spr {
if (spr::getDistInPlaneTrackDir(point1, trackMom, rechitPoint, debug) < dR)
keepHit = true;
} else {
std::cout << "PROBLEM : Endcap RecHits in Barrel Collection!?" << std::endl;
edm::LogWarning("IsoTrack") << "PROBLEM : Endcap RecHits in Barrel Collection!?";
}
if (keepHit)
hit.push_back(j);
Expand All @@ -84,7 +85,7 @@ namespace spr {
if (spr::getDistInPlaneTrackDir(point1, trackMom, rechitPoint, debug) < dR)
keepHit = true;
} else {
std::cout << "PROBLEM : Barrel RecHits in Endcap Collection!?" << std::endl;
edm::LogWarning("IsoTrack") << "PROBLEM : Barrel RecHits in Endcap Collection!?";
}
if (keepHit)
hit.push_back(j);
Expand Down
54 changes: 11 additions & 43 deletions Calibration/IsolatedParticles/src/FindDistCone.cc
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
#include "Calibration/IsolatedParticles/interface/CaloConstants.h"
#include "Calibration/IsolatedParticles/interface/FindDistCone.h"
#include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h"

#include <iostream>

//#define EDM_ML_DEBUG
#include "FWCore/MessageLogger/interface/MessageLogger.h"

namespace spr {

// Cone clustering core
double getDistInPlaneTrackDir(const GlobalPoint& caloPoint,
const GlobalVector& caloVector,
const GlobalPoint& rechitPoint,
bool
#ifdef EDM_ML_DEBUG
debug
#endif
) {

bool debug) {
const GlobalVector caloIntersectVector(caloPoint.x(), caloPoint.y(),
caloPoint.z()); //p

Expand All @@ -31,13 +23,11 @@ namespace spr {
const GlobalPoint effectiveRechitPoint(
effectiveRechitVector.x(), effectiveRechitVector.y(), effectiveRechitVector.z());
GlobalVector distance_vector = effectiveRechitPoint - caloPoint;
#ifdef EDM_ML_DEBUG
if (debug) {
std::cout << "getDistInPlaneTrackDir: point " << caloPoint << " dirn " << caloVector << " numerator "
<< dotprod_numerator << " denominator " << dotprod_denominator << " distance " << distance_vector.mag()
<< std::endl;
edm::LogVerbatim("IsoTrack") << "getDistInPlaneTrackDir: point " << caloPoint << " dirn " << caloVector
<< " numerator " << dotprod_numerator << " denominator " << dotprod_denominator
<< " distance " << distance_vector.mag();
}
#endif
if (dotprod_denominator > 0. && dotprod_numerator > 0.) {
return distance_vector.mag();
} else {
Expand All @@ -46,16 +36,7 @@ namespace spr {
}

// Not used, but here for reference
double getDistInCMatEcal(double eta1,
double phi1,
double eta2,
double phi2,
bool
#ifdef EDM_ML_DEBUG
debug
#endif
) {

double getDistInCMatEcal(double eta1, double phi1, double eta2, double phi2, bool debug) {
double dR, Rec;
if (fabs(eta1) < spr::etaBEEcal)
Rec = spr::rFrontEB;
Expand All @@ -71,25 +52,14 @@ namespace spr {
dR = fabs(Rec * ce1 * sqrt(1. / z / z - 1.));
else
dR = 999999.;
#ifdef EDM_ML_DEBUG
if (debug)
std::cout << "getDistInCMatEcal: between (" << eta1 << ", " << phi1 << ") and (" << eta2 << ", " << phi2 << " is "
<< dR << std::endl;
#endif
edm::LogVerbatim("IsoTrack") << "getDistInCMatEcal: between (" << eta1 << ", " << phi1 << ") and (" << eta2
<< ", " << phi2 << " is " << dR;
return dR;
}

// Not used, but here for reference
double getDistInCMatHcal(double eta1,
double phi1,
double eta2,
double phi2,
bool
#ifdef EDM_ML_DEBUG
debug
#endif
) {

double getDistInCMatHcal(double eta1, double phi1, double eta2, double phi2, bool debug) {
// Radii and eta from Geometry/HcalCommonData/data/hcalendcapalgo.xml
// and Geometry/HcalCommonData/data/hcalbarrelalgo.xml

Expand All @@ -109,11 +79,9 @@ namespace spr {
else
dR = 999999.;
return dR;
#ifdef EDM_ML_DEBUG
if (debug)
std::cout << "getDistInCMatHcal: between (" << eta1 << ", " << phi1 << ") and (" << eta2 << ", " << phi2 << " is "
<< dR << std::endl;
#endif
edm::LogVerbatim("IsoTrack") << "getDistInCMatHcal: between (" << eta1 << ", " << phi1 << ") and (" << eta2
<< ", " << phi2 << " is " << dR;
}

void getEtaPhi(HBHERecHitCollection::const_iterator hit,
Expand Down
24 changes: 7 additions & 17 deletions Calibration/IsolatedParticles/src/FindEtaPhi.cc
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
#include "Calibration/IsolatedParticles/interface/FindEtaPhi.h"
#include <iostream>

//#define EDM_ML_DEBUG
#include "FWCore/MessageLogger/interface/MessageLogger.h"

namespace spr {

spr::EtaPhi getEtaPhi(int ieta,
int iphi,
bool
#ifdef EDM_ML_DEBUG
debug
#endif
) {

spr::EtaPhi getEtaPhi(int ieta, int iphi, bool debug) {
int ietal = (ieta - 1) / 2;
int ietar = ieta - ietal - 1;
int iphil = (iphi - 1) / 2;
Expand Down Expand Up @@ -46,16 +37,15 @@ namespace spr {
etaphi.iphiS[1] = iphil;
}

#ifdef EDM_ML_DEBUG
if (debug) {
std::cout << "getEtaPhi:: Has " << etaphi.ntrys << " possibilites for " << ieta << "X" << iphi << " matrix"
<< std::endl;
edm::LogVerbatim("IsoTrack") << "getEtaPhi:: Has " << etaphi.ntrys << " possibilites for " << ieta << "X" << iphi
<< " matrix";
for (int itry = 0; itry < etaphi.ntrys; itry++) {
std::cout << "Trial " << itry << " with etaE|etaW " << etaphi.ietaE[itry] << "|" << etaphi.ietaW[itry]
<< " and phiN|PhiS " << etaphi.iphiN[itry] << "|" << etaphi.iphiS[itry] << std::endl;
edm::LogVerbatim("IsoTrack") << "Trial " << itry << " with etaE|etaW " << etaphi.ietaE[itry] << "|"
<< etaphi.ietaW[itry] << " and phiN|PhiS " << etaphi.iphiN[itry] << "|"
<< etaphi.iphiS[itry];
}
}
#endif
return etaphi;
}
} // namespace spr