Skip to content

Commit

Permalink
Merge pull request #41190 from bsunanda/Phase2-hgx336D
Browse files Browse the repository at this point in the history
Phase2-hgx336D Improve testing of cassette shift computation for HGCal geometries
  • Loading branch information
cmsbuild authored Mar 28, 2023
2 parents 9283eb9 + 7fc8eb7 commit 357677c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
4 changes: 2 additions & 2 deletions Geometry/HGCalCommonData/interface/HGCalDDDConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ class HGCalDDDConstants {
std::pair<double, double> waferPosition(int lay, int waferU, int waferV, bool reco, bool debug) const;
inline unsigned int waferFileSize() const { return hgpar_->waferInfoMap_.size(); }
int waferFileIndex(unsigned int kk) const;
std::tuple<int, int, int> waferFileInfo(unsigned int kk) const;
std::tuple<int, int, int> waferFileInfoFromIndex(int kk) const;
std::tuple<int, int, int, int> waferFileInfo(unsigned int kk) const;
std::tuple<int, int, int, int> waferFileInfoFromIndex(int kk) const;
inline bool waferFileInfoExist(int kk) const {
return (hgpar_->waferInfoMap_.find(kk) != hgpar_->waferInfoMap_.end());
}
Expand Down
12 changes: 6 additions & 6 deletions Geometry/HGCalCommonData/src/HGCalDDDConstants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1609,21 +1609,21 @@ int HGCalDDDConstants::waferFileIndex(unsigned int kk) const {
return 0;
}

std::tuple<int, int, int> HGCalDDDConstants::waferFileInfo(unsigned int kk) const {
std::tuple<int, int, int, int> HGCalDDDConstants::waferFileInfo(unsigned int kk) const {
if (kk < hgpar_->waferInfoMap_.size()) {
auto itr = hgpar_->waferInfoMap_.begin();
std::advance(itr, kk);
return std::make_tuple(itr->second.type, itr->second.part, itr->second.orient);
return std::make_tuple(itr->second.type, itr->second.part, itr->second.orient, itr->second.cassette);
} else
return std::make_tuple(0, 0, 0);
return std::make_tuple(0, 0, 0, 0);
}

std::tuple<int, int, int> HGCalDDDConstants::waferFileInfoFromIndex(int kk) const {
std::tuple<int, int, int, int> HGCalDDDConstants::waferFileInfoFromIndex(int kk) const {
auto itr = hgpar_->waferInfoMap_.find(kk);
if (itr != hgpar_->waferInfoMap_.end()) {
return std::make_tuple(itr->second.type, itr->second.part, itr->second.orient);
return std::make_tuple(itr->second.type, itr->second.part, itr->second.orient, itr->second.cassette);
} else
return std::make_tuple(0, 0, 0);
return std::make_tuple(0, 0, 0, 0);
}

GlobalPoint HGCalDDDConstants::waferLocal2Global(
Expand Down
2 changes: 0 additions & 2 deletions Geometry/HGCalCommonData/test/HGCalPartialCellTester.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,8 @@ void HGCalPartialCellTester::analyze(const edm::Event&, const edm::EventSetup&)
partialType_ == 24) {
ug = nCells + 1;
vg = 2 * (nCells - 1);
//std::cout << ug << " " << vg << std::endl;
}
std::pair<double, double> xyg = wafer2.cellUV2XY2(ug, vg, placeIndex_, waferType_);
//std::cout << xyg.first << ":" << xyg.second << std::endl;
std::vector<std::pair<double, double> > wxy =
HGCalWaferMask::waferXY(partialType_, placeIndex_, waferSize_, 0.0, 0.0, 0.0);
for (unsigned int i = 0; i < (wxy.size() - 1); ++i) {
Expand Down
16 changes: 13 additions & 3 deletions Geometry/HGCalCommonData/test/HGCalWaferIDTester.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,21 +144,31 @@ void HGCalWaferIDTester::analyze(const edm::Event& iEvent, const edm::EventSetup
double wt(0);
int layer = detIds_[k].layer();
int zside = detIds_[k].zside();
int indx = HGCalWaferIndex::waferIndex(layer, detIds_[k].waferU(), detIds_[k].waferV());
st1 << " Part:Orient:Cassette:Shift " << std::get<1>(hgdc.waferFileInfo(indx)) << ":"
<< std::get<2>(hgdc.waferFileInfo(indx)) << ":" << std::get<3>(hgdc.waferFileInfo(indx)) << ":"
<< hgdc.cassetteShiftSilicon(layer, detIds_[k].waferU(), detIds_[k].waferV());
double xx = (zside < 0) ? -posXY_[k].first : posXY_[k].first;
double yy = posXY_[k].second;
hgdc.waferFromPosition(xx, yy, zside, layer, waferU, waferV, cellU, cellV, waferType, wt, false, debug);
HGCSiliconDetId id(detIds_[k].det(), detIds_[k].zside(), waferType, layer, waferU, waferV, cellU, cellV);
if (id.rawId() != detIds_[k].rawId())
st1 << " non-matching DetId: new ID " << id;
else
st1 << " new ID " << id;
indx = HGCalWaferIndex::waferIndex(layer, id.waferU(), id.waferV());
st1 << " Part:Orient:Cassette:Shift " << std::get<1>(hgdc.waferFileInfo(indx)) << ":"
<< std::get<2>(hgdc.waferFileInfo(indx)) << ":" << std::get<3>(hgdc.waferFileInfo(indx)) << ":"
<< hgdc.cassetteShiftSilicon(layer, id.waferU(), id.waferV());
auto xy = hgdc.locateCell(id, true);
double xx0 = (id.zside() > 0) ? xy.first : -xy.first;
double yy0 = xy.second;
double dx = xx0 - (posXY_[k].first / CLHEP::cm);
double dy = yy0 - (yy / CLHEP::cm);
double diff = std::sqrt(dx * dx + dy * dy);
st1 << " input position: (" << xx / CLHEP::cm << ", " << yy / CLHEP::cm << "); position from ID (" << xx0 << ", "
<< yy0 << ") distance " << diff;
constexpr double tol = 1.0;
st1 << " input position: (" << posXY_[k].first / CLHEP::cm << ", " << yy / CLHEP::cm << "); position from ID ("
<< xx0 << ", " << yy0 << ") distance " << diff;
constexpr double tol = 1.5;
if (diff > tol)
st1 << " ***** CheckID *****";
bool valid1 = hgdc.isValidHex8(
Expand Down

0 comments on commit 357677c

Please sign in to comment.