Skip to content

Commit

Permalink
Code format
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunanda committed Oct 7, 2021
1 parent d46ca6e commit 071f4e9
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 29 deletions.
29 changes: 22 additions & 7 deletions Geometry/HGCalGeometry/test/HGCalWaferInFileCheck.cc
Expand Up @@ -73,7 +73,8 @@ void HGCalWaferInFileCheck::analyze(const edm::Event& iEvent, const edm::EventSe
const HGCalGeometry* geom = &geomR;
const auto& hgdc = geom->topology().dddConstants();

edm::LogVerbatim("HGCalGeom") << nameDetector_ << "\nCheck Wafers in file are all valid for " << nameDetector_ << "\n";
edm::LogVerbatim("HGCalGeom") << nameDetector_ << "\nCheck Wafers in file are all valid for " << nameDetector_
<< "\n";
if (hgdc.waferHexagon8()) {
DetId::Detector det = (nameSense_ == "HGCalHESiliconSensitive") ? DetId::HGCalHSi : DetId::HGCalEE;
static std::vector<std::string> types = {"F", "b", "g", "gm", "a", "d", "dm", "c", "am", "bm", "X"};
Expand All @@ -90,11 +91,14 @@ void HGCalWaferInFileCheck::analyze(const edm::Event& iEvent, const edm::EventSe
int part = std::get<1>(hgdc.waferFileInfoFromIndex(indx));
std::string typex = (part < static_cast<int>(types.size())) ? types[part] : "X";
const auto& xy = hgdc.waferPosition(layer, waferU, waferV, true, false);
edm::LogVerbatim("HGCalGeom") << "ID[" << k << "]: (" << (hgdc.getLayerOffset() + layer) << ", " << waferU << ", " << waferV << ", " << typex << ") at (" << std::setprecision(4) << xy.first << ", " << xy.second << ", " << hgdc.waferZ(layer, true) << ") not valid";
edm::LogVerbatim("HGCalGeom") << "ID[" << k << "]: (" << (hgdc.getLayerOffset() + layer) << ", " << waferU
<< ", " << waferV << ", " << typex << ") at (" << std::setprecision(4) << xy.first
<< ", " << xy.second << ", " << hgdc.waferZ(layer, true) << ") not valid";
++bad1;
}
}
edm::LogVerbatim("HGCalGeom") << "\n\nFinds " << bad1 << " invalid wafers among " << hgdc.waferFileSize() << " wafers in the list\n";
edm::LogVerbatim("HGCalGeom") << "\n\nFinds " << bad1 << " invalid wafers among " << hgdc.waferFileSize()
<< " wafers in the list\n";

// See if some of the valid wafers are missing
auto const& ids = geom->getValidGeomDetIds();
Expand All @@ -109,15 +113,19 @@ void HGCalWaferInFileCheck::analyze(const edm::Event& iEvent, const edm::EventSe
if (part != HGCalTypes::WaferOut) {
std::string typex = (part < static_cast<int>(types.size())) ? types[part] : "X";
const auto& xy = hgdc.waferPosition(id.layer(), id.waferU(), id.waferV(), true, false);
edm::LogVerbatim("HGCalGeom") << "ID[" << k << "]: (" << (hgdc.getLayerOffset() + id.layer()) << ", " << id.waferU() << ", " << id.waferV() << ", " << typex << ") at (" << std::setprecision(4) << xy.first << ", " << xy.second << ", " << hgdc.waferZ(id.layer(), true) << ") not in wafer-list";
edm::LogVerbatim("HGCalGeom")
<< "ID[" << k << "]: (" << (hgdc.getLayerOffset() + id.layer()) << ", " << id.waferU() << ", "
<< id.waferV() << ", " << typex << ") at (" << std::setprecision(4) << xy.first << ", " << xy.second
<< ", " << hgdc.waferZ(id.layer(), true) << ") not in wafer-list";
++bad2;
} else {
++xtra;
}
}
}
}
edm::LogVerbatim("HGCalGeom") << "\n\nFinds " << bad2 << " missing wafers among " << all << " valid wafers and " << xtra << " extra ones\n";
edm::LogVerbatim("HGCalGeom") << "\n\nFinds " << bad2 << " missing wafers among " << all << " valid wafers and "
<< xtra << " extra ones\n";

// Now cross check the content
int allG(0), badT(0), badP(0), badP2(0), badR(0), badG(0), badT1(0), badT2(0);
Expand Down Expand Up @@ -156,11 +164,18 @@ void HGCalWaferInFileCheck::analyze(const edm::Event& iEvent, const edm::EventSe
std::string partx1 = (part1 < static_cast<int>(types.size())) ? types[part1] : "X";
std::string partx2 = (part2 < static_cast<int>(types.size())) ? types[part2] : "X";
const auto& xy = hgdc.waferPosition(layer, waferU, waferV, true, false);
edm::LogVerbatim("HGCalGeom") << "ID[" << k << "]: (" << (hgdc.getLayerOffset() + layer) << ", " << waferU << ", " << waferV << ", " << type1 << ":" << type2 << ", " << partx1 << ":" << partx2 << ", " << rotn1 << ":" << rotn2 << ") at (" << std::setprecision(4) << xy.first << ", " << xy.second << ", " << hgdc.waferZ(layer, true) << ") failure flag " << typeOK << ":" << partOK << ":" << rotnOK << ":" << (part1 >= part2);
edm::LogVerbatim("HGCalGeom") << "ID[" << k << "]: (" << (hgdc.getLayerOffset() + layer) << ", " << waferU
<< ", " << waferV << ", " << type1 << ":" << type2 << ", " << partx1 << ":"
<< partx2 << ", " << rotn1 << ":" << rotn2 << ") at (" << std::setprecision(4)
<< xy.first << ", " << xy.second << ", " << hgdc.waferZ(layer, true)
<< ") failure flag " << typeOK << ":" << partOK << ":" << rotnOK << ":"
<< (part1 >= part2);
}
}
}
edm::LogVerbatim("HGCalGeom") << "\n\nFinds " << badG << " (" << badT << "[" << badT1 << ":" << badT2 << "]:" << badP << ":" << badP2 << ":" << badR << ") mismatch among " << allG << " wafers with the same indices";
edm::LogVerbatim("HGCalGeom") << "\n\nFinds " << badG << " (" << badT << "[" << badT1 << ":" << badT2
<< "]:" << badP << ":" << badP2 << ":" << badR << ") mismatch among " << allG
<< " wafers with the same indices";
}
}

Expand Down
17 changes: 11 additions & 6 deletions Geometry/HGCalGeometry/test/HGCalWaferInFileOrientation.cc
Expand Up @@ -57,8 +57,9 @@ class HGCalWaferInFileOrientation : public edm::one::EDAnalyzer<edm::one::WatchR
};

HGCalWaferInFileOrientation::HGCalWaferInFileOrientation(const edm::ParameterSet& iC)
: nameDetector_(iC.getParameter<std::string>("detectorName")),
geomToken_(esConsumes<HGCalGeometry, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", nameDetector_})),
: nameDetector_(iC.getParameter<std::string>("detectorName")),
geomToken_(esConsumes<HGCalGeometry, IdealGeometryRecord, edm::Transition::BeginRun>(
edm::ESInputTag{"", nameDetector_})),
layers_(iC.getParameter<std::vector<int>>("layers")),
waferU_(iC.getParameter<std::vector<int>>("waferUs")),
waferV_(iC.getParameter<std::vector<int>>("waferVs")),
Expand Down Expand Up @@ -107,19 +108,23 @@ void HGCalWaferInFileOrientation::beginRun(edm::Run const&, edm::EventSetup cons
bool rotnOK = (rotn1 == rotn2);
if (!partOK)
++badP;
if (!rotnOK)
++badR;
if (!rotnOK)
++badR;
if ((!partOK) || (!rotnOK)) {
++badG;
std::string partx1 = (part1 < static_cast<int>(types.size())) ? types[part1] : "X";
std::string partx2 = (part2 < static_cast<int>(types.size())) ? types[part2] : "X";
std::string partx3 = (part3 < static_cast<int>(types.size())) ? types[part3] : "X";
const auto& xy = hgdc.waferPosition(layer, waferU_[k], waferV_[k], true, false);
edm::LogVerbatim("HGCalGeom") << "ID[" << k << "]: " << id << " (" << partx1 << ":" << partx2 << ":" << partx3 << ", " << rotn1 << ":" << rotn2 << ":" << rotn3 << ") at (" << std::setprecision(4) << xy.first << ", " << xy.second << ", " << hgdc.waferZ(layer, true) << ") failure flag " << partOK << ":" << rotnOK;
edm::LogVerbatim("HGCalGeom") << "ID[" << k << "]: " << id << " (" << partx1 << ":" << partx2 << ":" << partx3
<< ", " << rotn1 << ":" << rotn2 << ":" << rotn3 << ") at ("
<< std::setprecision(4) << xy.first << ", " << xy.second << ", "
<< hgdc.waferZ(layer, true) << ") failure flag " << partOK << ":" << rotnOK;
}
}
}
edm::LogVerbatim("HGCalGeom") << "\n\nFinds " << badG << " (" << badP << ":" << badR << ") mismatch among " << allG << ":" << layers_.size() << " wafers\n";
edm::LogVerbatim("HGCalGeom") << "\n\nFinds " << badG << " (" << badP << ":" << badR << ") mismatch among " << allG
<< ":" << layers_.size() << " wafers\n";
}
}

Expand Down
48 changes: 32 additions & 16 deletions Geometry/HGCalGeometry/test/HGCalWaferInFileTest.cc
Expand Up @@ -73,7 +73,8 @@ HGCalWaferInFileTest::HGCalWaferInFileTest(const edm::ParameterSet& iC)
nameDetector_(iC.getParameter<std::string>("NameDevice")),
verbosity_(iC.getParameter<int>("Verbosity")),
geomToken_(esConsumes<HGCalGeometry, IdealGeometryRecord>(edm::ESInputTag{"", nameSense_})) {
edm::LogVerbatim("HGCalGeom") << "Test wafer characteristics for " << nameDetector_ << " using constants of " << nameSense_ << " with verbosity " << verbosity_;
edm::LogVerbatim("HGCalGeom") << "Test wafer characteristics for " << nameDetector_ << " using constants of "
<< nameSense_ << " with verbosity " << verbosity_;
}

void HGCalWaferInFileTest::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
Expand All @@ -92,7 +93,8 @@ void HGCalWaferInFileTest::analyze(const edm::Event& iEvent, const edm::EventSet
double delX = 0.5 * hgdc.getParameter()->waferSize_;
double delY = 2.0 * delX / std::sqrt(3.0);

edm::LogVerbatim("HGCalGeom") << nameDetector_ << "\nCheck Wafers in file are all valid for " << nameDetector_ << std::endl;
edm::LogVerbatim("HGCalGeom") << nameDetector_ << "\nCheck Wafers in file are all valid for " << nameDetector_
<< std::endl;
if (hgdc.waferHexagon8()) {
DetId::Detector det = (nameSense_ == "HGCalHESiliconSensitive") ? DetId::HGCalHSi : DetId::HGCalEE;
static std::vector<std::string> types = {"F", "b", "g", "gm", "a", "d", "dm", "c", "am", "bm", "X"};
Expand All @@ -115,8 +117,10 @@ void HGCalWaferInFileTest::analyze(const edm::Event& iEvent, const edm::EventSet
const auto& rr = hgdc.rangeRLayer(layer, true);
auto points = getPoints(xy.first, xy.second, delX, delY, rr.first, rr.second, layer, waferU, waferV);
auto rpos = getCorners(xy.first, xy.second, delX, delY);
std::ostringstream st1;
st1 << "ID[" << k << "]: (" << (hgdc.getLayerOffset() + layer) << ", " << waferU << ", " << waferV << ", " << typex << ") at (" << std::setprecision(4) << xy.first << ", " << xy.second << ", " << hgdc.waferZ(layer, true) << ") not present with " << points.size() << " points:";
std::ostringstream st1;
st1 << "ID[" << k << "]: (" << (hgdc.getLayerOffset() + layer) << ", " << waferU << ", " << waferV << ", "
<< typex << ") at (" << std::setprecision(4) << xy.first << ", " << xy.second << ", "
<< hgdc.waferZ(layer, true) << ") not present with " << points.size() << " points:";
for (auto point : points)
st1 << " " << point;
st1 << " in the region " << rr.first << ":" << rr.second << " Corners";
Expand All @@ -128,7 +132,8 @@ void HGCalWaferInFileTest::analyze(const edm::Event& iEvent, const edm::EventSet
++miss[layer - layerf];
}
}
edm::LogVerbatim("HGCalGeom") << "\n\nFinds " << bad1 << " invalid wafers among " << hgdc.waferFileSize() << " wafers in the list";
edm::LogVerbatim("HGCalGeom") << "\n\nFinds " << bad1 << " invalid wafers among " << hgdc.waferFileSize()
<< " wafers in the list";
for (unsigned int k = 0; k < miss.size(); ++k) {
if (miss[k] > 0)
edm::LogVerbatim("HGCalGeom") << "Layer[" << k << ":" << (layerf + k) << "] " << miss[k];
Expand All @@ -155,11 +160,15 @@ void HGCalWaferInFileTest::analyze(const edm::Event& iEvent, const edm::EventSet
else if (type2 == 0)
++badT2;
const auto& xy = hgdc.waferPosition(layer, waferU, waferV, true, false);
edm::LogVerbatim("HGCalGeom") << "ID[" << k << "]: (" << (hgdc.getLayerOffset() + layer) << ", " << waferU << ", " << waferV << ", " << type1 << ":" << type2 << ") at (" << std::setprecision(4) << xy.first << ", " << xy.second << ", " << hgdc.waferZ(layer, true) << ") failure flag " << typeOK;
edm::LogVerbatim("HGCalGeom") << "ID[" << k << "]: (" << (hgdc.getLayerOffset() + layer) << ", " << waferU
<< ", " << waferV << ", " << type1 << ":" << type2 << ") at ("
<< std::setprecision(4) << xy.first << ", " << xy.second << ", "
<< hgdc.waferZ(layer, true) << ") failure flag " << typeOK;
}
}
}
edm::LogVerbatim("HGCalGeom") << "\n\nFinds " << badT << "[" << badT1 << ":" << badT2 << "] mismatch in type among " << allG << " wafers with the same indices\n";
edm::LogVerbatim("HGCalGeom") << "\n\nFinds " << badT << "[" << badT1 << ":" << badT2 << "] mismatch in type among "
<< allG << " wafers with the same indices\n";

// Now cross check the content (partial and orientation)
int allX(0), badG(0), badP(0), badP2(0), badR(0), badR2(0);
Expand Down Expand Up @@ -216,8 +225,12 @@ void HGCalWaferInFileTest::analyze(const edm::Event& iEvent, const edm::EventSet
std::string partx2 = (part2 < static_cast<int>(types.size())) ? types[part2] : "X";
auto points = getPoints(xy.first, xy.second, delX, delY, rr.first, rr.second, layer, waferU, waferV);
auto rpos = getCorners(xy.first, xy.second, delX, delY);
std::ostringstream st1;
st1 << "ID[" << k << "]: (" << (hgdc.getLayerOffset() + layer) << ", " << waferU << ", " << waferV << "," << type2 << ", " << partx1 << ":" << partx2 << ":" << part1 << ":" << part2 << ", " << rotn1 << ":" << rotn2 << ") at (" << std::setprecision(4) << xy.first << ", " << xy.second << ", " << hgdc.waferZ(layer, true) << ") failure flags (part = " << partOK << ":" << partOK2 << " rotn " << rotnOK << ":" << rotnOK2 << " at " << miss << " with " << points.size() << " points:";
std::ostringstream st1;
st1 << "ID[" << k << "]: (" << (hgdc.getLayerOffset() + layer) << ", " << waferU << ", " << waferV << ","
<< type2 << ", " << partx1 << ":" << partx2 << ":" << part1 << ":" << part2 << ", " << rotn1 << ":"
<< rotn2 << ") at (" << std::setprecision(4) << xy.first << ", " << xy.second << ", "
<< hgdc.waferZ(layer, true) << ") failure flags (part = " << partOK << ":" << partOK2 << " rotn "
<< rotnOK << ":" << rotnOK2 << " at " << miss << " with " << points.size() << " points:";
for (auto point : points)
st1 << " " << point;
st1 << " in the region " << rr.first << ":" << rr.second << " Corners";
Expand All @@ -229,11 +242,12 @@ void HGCalWaferInFileTest::analyze(const edm::Event& iEvent, const edm::EventSet
}
}
edm::LogVerbatim("HGCalGeom") << "\n\nFinds " << badG << " (" << badP << ":" << badP2 << ":" << badR << ":" << badR2
<< ") mismatch in partial|orientation among " << allX << " wafers with the same indices";
<< ") mismatch in partial|orientation among " << allX
<< " wafers with the same indices";
for (int k = 0; k < layers; ++k) {
if ((wrongP[k] > 0) || (wrongR[k] > 0))
edm::LogVerbatim("HGCalGeom") << "Layer[" << k << ":" << (layerf + k) << "] " << wrongP[k] << ":" << wrongP2[k] << ":" << wrongR[k]
<< ":" << wrongR2[k];
edm::LogVerbatim("HGCalGeom") << "Layer[" << k << ":" << (layerf + k) << "] " << wrongP[k] << ":" << wrongP2[k]
<< ":" << wrongR[k] << ":" << wrongR2[k];
}
edm::LogVerbatim("HGCalGeom") << std::endl;
}
Expand Down Expand Up @@ -268,8 +282,9 @@ std::vector<std::string> HGCalWaferInFileTest::getPoints(
}
}
if (verbosity_ > 1)
edm::LogVerbatim("HGCalGeom") << "I/p " << layer << ":" << waferU << ":" << waferV << ":" << xpos << ":" << ypos << ":" << delX << ":"
<< delY << ":" << rin << ":" << rout << " Corners " << ncor << " iok " << iok;
edm::LogVerbatim("HGCalGeom") << "I/p " << layer << ":" << waferU << ":" << waferV << ":" << xpos << ":" << ypos
<< ":" << delX << ":" << delY << ":" << rin << ":" << rout << " Corners " << ncor
<< " iok " << iok;

static const int parts = 3;
static const std::string c1[parts] = {"A1", "A2", "A3"};
Expand Down Expand Up @@ -707,8 +722,9 @@ std::pair<bool, std::string> HGCalWaferInFileTest::getPoints(double xpos,
}
}
if (verbosity_ > 1)
edm::LogVerbatim("HGCalGeom") << "I/p " << layer << ":" << waferU << ":" << waferV << ":" << xpos << ":" << ypos << ":" << delX << ":"
<< delY << ":" << rin << ":" << rout << " Results " << ok << " point " << point;
edm::LogVerbatim("HGCalGeom") << "I/p " << layer << ":" << waferU << ":" << waferV << ":" << xpos << ":" << ypos
<< ":" << delX << ":" << delY << ":" << rin << ":" << rout << " Results " << ok
<< " point " << point;
return std::make_pair(ok, point);
}

Expand Down

0 comments on commit 071f4e9

Please sign in to comment.