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-gex157A Replace use of cout's with LogVerbatim in Geometry/CaloTopology and Geometry/CommonTopologies #41173

Merged
merged 9 commits into from
Mar 29, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Geometry/CaloTopology/interface/EcalBarrelHardcodedTopology.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <vector>
#include <iostream>
#include "DataFormats/EcalDetId/interface/EBDetId.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h"

class EcalBarrelHardcodedTopology final : public CaloSubdetectorTopology {
Expand Down Expand Up @@ -54,13 +55,13 @@ class EcalBarrelHardcodedTopology final : public CaloSubdetectorTopology {
}

std::vector<DetId> up(const DetId& /*id*/) const override {
std::cout << "EcalBarrelHardcodedTopology::up() not yet implemented" << std::endl;
edm::LogVerbatim("CaloTopology") << "EcalBarrelHardcodedTopology::up() not yet implemented";
std::vector<DetId> vNeighborsDetId;
return vNeighborsDetId;
}

std::vector<DetId> down(const DetId& /*id*/) const override {
std::cout << "EcalBarrelHardcodedTopology::down() not yet implemented" << std::endl;
edm::LogVerbatim("CaloTopology") << "EcalBarrelHardcodedTopology::down() not yet implemented";
std::vector<DetId> vNeighborsDetId;
return vNeighborsDetId;
}
Expand Down
5 changes: 3 additions & 2 deletions Geometry/CaloTopology/interface/EcalBarrelTopology.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <vector>
#include <iostream>
#include "DataFormats/EcalDetId/interface/EBDetId.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h"
#include "Geometry/CaloGeometry/interface/CaloGeometry.h"
#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
Expand Down Expand Up @@ -63,13 +64,13 @@ class EcalBarrelTopology final : public CaloSubdetectorTopology {
}

std::vector<DetId> up(const DetId& /*id*/) const override {
std::cout << "EcalBarrelTopology::up() not yet implemented" << std::endl;
edm::LogVerbatim("CaloTopology") << "EcalBarrelTopology::up() not yet implemented";
std::vector<DetId> vNeighborsDetId;
return vNeighborsDetId;
}

std::vector<DetId> down(const DetId& /*id*/) const override {
std::cout << "EcalBarrelTopology::down() not yet implemented" << std::endl;
edm::LogVerbatim("CaloTopology") << "EcalBarrelTopology::down() not yet implemented";
std::vector<DetId> vNeighborsDetId;
return vNeighborsDetId;
}
Expand Down
5 changes: 3 additions & 2 deletions Geometry/CaloTopology/interface/EcalEndcapHardcodedTopology.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <vector>
#include <iostream>
#include "DataFormats/EcalDetId/interface/EEDetId.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h"

class EcalEndcapHardcodedTopology final : public CaloSubdetectorTopology {
Expand Down Expand Up @@ -54,13 +55,13 @@ class EcalEndcapHardcodedTopology final : public CaloSubdetectorTopology {
}

std::vector<DetId> up(const DetId& /*id*/) const override {
std::cout << "EcalEndcapHardcodedTopology::up() not yet implemented" << std::endl;
edm::LogVerbatim("CaloTopology") << "EcalEndcapHardcodedTopology::up() not yet implemented";
std::vector<DetId> vNeighborsDetId;
return vNeighborsDetId;
}

std::vector<DetId> down(const DetId& /*id*/) const override {
std::cout << "EcalEndcapHardcodedTopology::down() not yet implemented" << std::endl;
edm::LogVerbatim("CaloTopology") << "EcalEndcapHardcodedTopology::down() not yet implemented";
std::vector<DetId> vNeighborsDetId;
return vNeighborsDetId;
}
Expand Down
5 changes: 3 additions & 2 deletions Geometry/CaloTopology/interface/EcalEndcapTopology.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define GEOMETRY_CALOTOPOLOGY_ECALENDCAPTOPOLOGY_H 1

#include "DataFormats/EcalDetId/interface/EEDetId.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h"
#include "Geometry/CaloGeometry/interface/CaloGeometry.h"
#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
Expand Down Expand Up @@ -63,13 +64,13 @@ class EcalEndcapTopology final : public CaloSubdetectorTopology {
}

std::vector<DetId> up(const DetId& /*id*/) const override {
std::cout << "EcalBarrelTopology::up() not yet implemented" << std::endl;
edm::LogVerbatim("CaloTopology") << "EcalBarrelTopology::up() not yet implemented";
std::vector<DetId> vNeighborsDetId;
return vNeighborsDetId;
}

std::vector<DetId> down(const DetId& /*id*/) const override {
std::cout << "EcalBarrelTopology::down() not yet implemented" << std::endl;
edm::LogVerbatim("CaloTopology") << "EcalBarrelTopology::down() not yet implemented";
std::vector<DetId> vNeighborsDetId;
return vNeighborsDetId;
}
Expand Down
3 changes: 2 additions & 1 deletion Geometry/CaloTopology/src/EcalTrigTowerConstituentsMap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ EcalTrigTowerDetId EcalTrigTowerConstituentsMap::towerOf(const DetId& id) const
//..........from file and done only for 1 quadrant
//move from quadrant 1 to the actual one:
// phiTower = changeTowerQuadrant(phiTower, 1, originalId.iquadrant());
// std::cout << originalId.zside() << " " << etaTower << " " << phiTower << std::endl;
edm::LogVerbatim("EcalTrigTowerConstituentsMap")
<< "EcalTrigTowerConstituentsMap " << originalId.zside() << " " << etaTower << " " << phiTower;
return EcalTrigTowerDetId(originalId.zside(), EcalEndcap, etaTower, phiTower);
}
}
Expand Down
5 changes: 3 additions & 2 deletions Geometry/CommonTopologies/src/RectangularStripTopology.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "Geometry/CommonTopologies/interface/RectangularStripTopology.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include <iostream>
#include <cmath>
Expand All @@ -9,8 +10,8 @@ RectangularStripTopology::RectangularStripTopology(int ns, float p, float l)
theOffset = -0.5f * theNumberOfStrips * thePitch;

#ifdef VERBOSE
cout << "Constructing RectangularStripTopology with"
<< " nstrips = " << ns << " pitch = " << p << " length = " << l << endl;
edm::LogVerbatim("CommonTopologies") << "Constructing RectangularStripTopology with"
<< " nstrips = " << ns << " pitch = " << p << " length = " << l;
#endif
}

Expand Down
9 changes: 4 additions & 5 deletions Geometry/CommonTopologies/src/TkRadialStripTopology.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ namespace {
struct Stat {
Stat(const char* in) : name(in){};
~Stat() {
std::cout << name << ": atan0 calls tot/large/over1: " << natan << "/" << nlarge << "/" << over1 << std::endl;
edm::LogVerbatim("CommonTopologies")
<< name << ": atan0 calls tot/large/over1: " << natan << "/" << nlarge << "/" << over1;
}

void add(float t) {
Expand Down Expand Up @@ -133,9 +134,7 @@ float TkRadialStripTopology::coveredStrips(const LocalPoint& lp1, const LocalPoi
#ifdef MATH_STS
statS.add(t);
#endif
// std::cout << "atans " << atanClip(t)
// <<" "<< std::atan2(lp1.x(),yDistanceToIntersection(lp1.y()) )
// -std::atan2(lp2.x(),yDistanceToIntersection(lp2.y()) ) << std::endl;
// edm::LogVerbatim("CommonTopologies") << "atans " << atanClip(t) << " " << std::atan2(lp1.x(), yDistanceToIntersection(lp1.y())) - std::atan2(lp2.x(),yDistanceToIntersection(lp2.y()));
// clip???
return atanClip(t) * theAWidthInverse;
// return (measurementPosition(lp1)-measurementPosition(lp2)).x();
Expand Down Expand Up @@ -231,7 +230,7 @@ float TkRadialStripTopology::localPitch(const LocalPoint& lp) const {
float y = yDistanceToIntersection( lp.y() );
float x = std::abs(lp.x());
float myP = y*(y*theTanAW+x)/(y-theTanAW*x)-x; // (y*theTanAW+x)/(1.f-theTanAW*x/y)-x;
std::cout << "localPitch " << p << " " << myP << std::endl;
edm::LogVerbatim("CommonTopologies") << "localPitch " << p << " " << myP;
return p;
Expand Down
17 changes: 10 additions & 7 deletions Geometry/CommonTopologies/src/TrapezoidalStripTopology.cc
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
#include "Geometry/CommonTopologies/interface/TrapezoidalStripTopology.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include <iostream>
#include <cmath>
#include <algorithm>

//#define EDM_ML_DEBUG

TrapezoidalStripTopology::TrapezoidalStripTopology(int ns, float p, float l, float r0)
: theNumberOfStrips(ns), thePitch(p), theDistToBeam(r0), theDetHeight(l) {
theOffset = -theNumberOfStrips / 2. * thePitch;
theYAxOr = 1;
#ifdef VERBOSE
cout << "Constructing TrapezoidalStripTopology with"
<< " nstrips = " << ns << " pitch = " << p << " length = " << l << " r0 =" << r0 << endl;
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("CommonTopologies") << "Constructing TrapezoidalStripTopology with nstrips = " << ns
<< " pitch = " << p << " length = " << l << " r0 =" << r0;
#endif
}

TrapezoidalStripTopology::TrapezoidalStripTopology(int ns, float p, float l, float r0, int yAx)
: theNumberOfStrips(ns), thePitch(p), theDistToBeam(r0), theDetHeight(l), theYAxOr(yAx) {
theOffset = -theNumberOfStrips / 2. * thePitch;
#ifdef VERBOSE
cout << "Constructing TrapezoidalStripTopology with"
<< " nstrips = " << ns << " pitch = " << p << " length = " << l << " r0 =" << r0 << " yAxOrientation =" << yAx
<< endl;
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("CommonTopologies") << "Constructing TrapezoidalStripTopology with nstrips = " << ns
<< " pitch = " << p << " length = " << l << " r0 =" << r0
<< " yAxOrientation =" << yAx;
#endif
}

Expand Down
5 changes: 2 additions & 3 deletions Geometry/CommonTopologies/src/TwoBowedSurfacesDeformation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ SurfaceDeformation::Local2DVector TwoBowedSurfacesDeformation::positionCorrectio

// treatment of different widthes at high/low y could be done by theRelWidthLowY or so
// if (widthLowY > 0. && widthHighY != widthLowY) {
// std::cout << "SurfaceDeformation::positionCorrection2Bowed: Cannot yet deal "
// << " with different widthes, take " << widthHighY << " not " << widthLowY
// << std::endl;
// edm::LogVerbatim("CommonTopologies") << "SurfaceDeformation::positionCorrection2Bowed: Cannot yet deal "
// << " with different widthes, take " << widthHighY << " not " << widthLowY;
// }
// const double width = widthHighY;

Expand Down
2 changes: 1 addition & 1 deletion Geometry/CommonTopologies/test/ValidateRadial.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h"
#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
Expand Down Expand Up @@ -116,7 +117,6 @@ void compare(const TkRadialStripTopology& t,
std::cout << "FAILED " << le.yy() << " " << ole.xy() << std::endl;
if (fabs(le.xy() - ole.xy()) > 0.001)
std::cout << "FAILED " << le.xy() << " " << ole.yy() << std::endl;

if (fabs(mp.x() - omp.x()) > 0.001)
std::cout << "FAILED " << mp.x() << " " << omp.x() << std::endl;
if (fabs(me.uu() - ome.uu()) > 0.001)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from Configuration.AlCa.GlobalTag import GlobalTag
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:startup', '')

process.MessageLogger.CommonTopologies=dict()

process.test = cms.EDAnalyzer('ValidateRadial',
Epsilon = cms.double(3e-1),
Expand Down
27 changes: 14 additions & 13 deletions Geometry/CommonTopologies/test/testDetSort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "Geometry/CommonTopologies/interface/DetSorting.h"
#include "DataFormats/GeometrySurface/interface/BoundPlane.h"
#include "DataFormats/GeometrySurface/interface/RectangularPlaneBounds.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include <iostream>
#include <iterator>
Expand All @@ -29,8 +30,8 @@ class MyDet : public GeomDet {
// A simple helper for printing the object
struct dump {
void operator()(const GeomDet& o) {
cout << o.position() << " R : " << o.position().perp() << " Phi: " << o.position().phi()
<< " Z : " << o.position().z() << endl;
edm::LogVerbatim("CommonTopologies") << o.position() << " R : " << o.position().perp()
<< " Phi: " << o.position().phi() << " Z : " << o.position().z();
}
void operator()(const GeomDet* o) { operator()(*o); }
};
Expand All @@ -41,51 +42,51 @@ int main() {
//

// Fill the vector to be sorted
vector<MyDet> v;
std::vector<MyDet> v;
v.emplace_back(MyDet(PositionType(2, 1, 1)));
v.emplace_back(MyDet(PositionType(1, 1, 2)));
v.emplace_back(MyDet(PositionType(1, 2, 3)));
v.emplace_back(MyDet(PositionType(2, 2, 4)));

cout << "Original vector: " << endl;
edm::LogVerbatim("CommonTopologies") << "Original vector: ";
for_each(v.begin(), v.end(), dump());

cout << "Sort in R : " << endl;
edm::LogVerbatim("CommonTopologies") << "Sort in R : ";
// Here we sort in R
precomputed_value_sort(v.begin(), v.end(), DetR());
for_each(v.begin(), v.end(), dump());

cout << "Sort in phi : " << endl;
edm::LogVerbatim("CommonTopologies") << "Sort in phi : ";
// Here we sort in phi
precomputed_value_sort(v.begin(), v.end(), DetPhi());
for_each(v.begin(), v.end(), dump());

cout << "Sort in z : " << endl;
edm::LogVerbatim("CommonTopologies") << "Sort in z : ";
// Here we sort in Z
precomputed_value_sort(v.begin(), v.end(), DetZ());
for_each(v.begin(), v.end(), dump());

//
// Now do the same with a vector of pointers
//
cout << endl << "Again with pointers" << endl;
edm::LogVerbatim("CommonTopologies") << std::endl << "Again with pointers";

vector<const MyDet*> vp;
for (vector<MyDet>::const_iterator i = v.begin(); i != v.end(); i++) {
std::vector<const MyDet*> vp;
for (std::vector<MyDet>::const_iterator i = v.begin(); i != v.end(); i++) {
vp.emplace_back(&(*i));
}

cout << "Sort in R : " << endl;
edm::LogVerbatim("CommonTopologies") << "Sort in R : ";
// Here we sort in R
precomputed_value_sort(vp.begin(), vp.end(), DetR());
for_each(vp.begin(), vp.end(), dump());

cout << "Sort in phi : " << endl;
edm::LogVerbatim("CommonTopologies") << "Sort in phi : ";
// Here we sort in phi
precomputed_value_sort(vp.begin(), vp.end(), DetPhi());
for_each(vp.begin(), vp.end(), dump());

cout << "Sort in z : " << endl;
edm::LogVerbatim("CommonTopologies") << "Sort in z : ";
// Here we sort in Z
precomputed_value_sort(vp.begin(), vp.end(), DetZ());
for_each(vp.begin(), vp.end(), dump());
Expand Down
7 changes: 5 additions & 2 deletions Geometry/CommonTopologies/test/testGeomDetEnumerators.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "Geometry/CommonTopologies/interface/GeomDetEnumerators.h"

#include <iostream>
Expand All @@ -10,11 +11,13 @@ int main(void) {
auto subdet = static_cast<GeomDetEnumerators::SubDetector>(subdetRaw);
if (!(GeomDetEnumerators::isBarrel(subdet) || GeomDetEnumerators::isEndcap(subdet))) {
success = false;
std::cout << "GeomDetEnumerator::SubDetector " << subdet << " (" << subdetRaw << ") is not barrel or endcap!";
edm::LogVerbatim("CommonTopologies")
<< "GeomDetEnumerator::SubDetector " << subdet << " (" << subdetRaw << ") is not barrel or endcap!";
}
if (GeomDetEnumerators::isBarrel(subdet) && GeomDetEnumerators::isEndcap(subdet)) {
success = false;
std::cout << "GeomDetEnumerator::SubDetector " << subdet << " (" << subdetRaw << ") is both barrel and endcap!";
edm::LogVerbatim("CommonTopologies")
<< "GeomDetEnumerator::SubDetector " << subdet << " (" << subdetRaw << ") is both barrel and endcap!";
}
}

Expand Down