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

fix ge2/1 demonstrator in validation #36835

Merged
merged 7 commits into from
Feb 2, 2022
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
54 changes: 51 additions & 3 deletions Geometry/GEMGeometryBuilder/src/GEMGeometryParsFromDD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,32 @@ void GEMGeometryParsFromDD::buildGeometry(DDFilteredView& fv,
MuonGeometryNumbering muonDDDNumbering(muonConstants);
GEMNumberingScheme gemNumbering(muonConstants);

bool doSuper = fv.firstChild();
// Check for the demonstrator geometry (only 1 chamber of GE2/1)
DDFilteredView fvGE2{fv};
int nGE21 = 0;
bool doSuper = fvGE2.firstChild();
while (doSuper) {
// getting chamber id from eta partitions
fvGE2.firstChild();
fvGE2.firstChild();
int rawidCh = gemNumbering.baseNumberToUnitNumber(muonDDDNumbering.geoHistoryToBaseNumber(fvGE2.geoHistory()));
GEMDetId detIdCh = GEMDetId(rawidCh);
if (detIdCh.station() == 2)
nGE21++;

// back to chambers
fvGE2.parent();
fvGE2.parent();
doSuper = (nGE21 < 2 && fvGE2.nextSibling());
}
bool demonstratorGeometry = nGE21 == 1;

#ifdef EDM_ML_DEBUG
edm::LogVerbatim("Geometry") << "Found " << nGE21 << " GE2/1 chambers. Demonstrator geometry on? "
<< demonstratorGeometry;
#endif

doSuper = fv.firstChild();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand the logic here. doSuper is now used first on GE2/1, but then is it overwritten by the original line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doSuper is true while there are more superchambers to process, I run through the whole sim geometry initially to see if we are in the demonstrator condition with the fvGE2 view, then start over again here with the fv to actually build the reco geometry. The doSuper variable is just being reused for the same purpose


LogDebug("GEMGeometryParsFromDD") << "doSuperChamber = " << doSuper;
// loop over superchambers
Expand All @@ -75,7 +100,12 @@ void GEMGeometryParsFromDD::buildGeometry(DDFilteredView& fv,
// currently there is no superchamber in the geometry
// only 2 chambers are present separated by a gap.
// making superchamber out of the first chamber layer including the gap between chambers
if (detIdCh.layer() == 1) { // only make superChambers when doing layer 1

// In Run 3 we also have a single GE2/1 chamber at layer 2. We
// make sure the superchamber gets built but also we build on the
// first layer for the other stations so the superchamber is in
// the right position there.
if ((detIdCh.layer() == 1) || (detIdCh.layer() == 2 and detIdCh.station() == 2 and demonstratorGeometry)) {
buildSuperChamber(fv, detIdCh, rgeo);
}
buildChamber(fv, detIdCh, rgeo);
Expand Down Expand Up @@ -246,6 +276,24 @@ void GEMGeometryParsFromDD::buildGeometry(cms::DDFilteredView& fv,
int theRingLevel = muonConstants.getValue("mg_ring") / theLevelPart;
int theSectorLevel = muonConstants.getValue("mg_sector") / theLevelPart;

// Check for the demonstrator geometry (only 1 chamber of GE2/1)
auto start = fv.copyNos();
int nGE21 = 0;
while (nGE21 < 2 && fv.firstChild()) {
const auto& history = fv.history();
MuonBaseNumber num(mdddnum.geoHistoryToBaseNumber(history));
GEMDetId detId(gemNum.baseNumberToUnitNumber(num));
if (fv.level() == levelChamb && detId.station() == 2) {
nGE21++;
}
}
bool demonstratorGeometry = nGE21 == 1;
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("Geometry") << "Found " << nGE21 << " GE2/1 chambers. Demonstrator geometry on? "
<< demonstratorGeometry;
#endif

fv.goTo(start);
while (fv.firstChild()) {
const auto& history = fv.history();
MuonBaseNumber num(mdddnum.geoHistoryToBaseNumber(history));
Expand All @@ -267,7 +315,7 @@ void GEMGeometryParsFromDD::buildGeometry(cms::DDFilteredView& fv,
}
} else {
if (fv.level() == levelChamb) {
if (detId.layer() == 1) {
if ((detId.layer() == 1) || (detId.layer() == 2 and detId.station() == 2 and demonstratorGeometry)) {
buildSuperChamber(fv, detId, rgeo);
}
buildChamber(fv, detId, rgeo);
Expand Down
28 changes: 17 additions & 11 deletions Validation/MuonGEMHits/plugins/GEMSimHitValidation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,27 @@ void GEMSimHitValidation::bookHistograms(DQMStore::IBooker& booker, edm::Run con
TString eloss_xtitle = "Energy loss [eV]";
TString eloss_ytitle = "Entries / 0.5 keV";

for (const auto& station : gem->regions()[0]->stations()) {
Int_t station_id = station->station();
// Demonstrator chamber means we could have a missing station,
// process both regions to make sure we include it
for (const auto& region : gem->regions()) {
for (const auto& station : region->stations()) {
Int_t station_id = station->station();
if (me_eloss_mu_.find(station_id) != me_eloss_mu_.end())
continue;

auto eloss_mu_name = TString::Format("sim_eloss_muon_GE%d1", station_id);
auto eloss_mu_title = TString::Format("SimHit Energy Loss (Muon only) : GE%d1", station_id);
auto eloss_mu_name = TString::Format("sim_eloss_muon_GE%d1", station_id);
auto eloss_mu_title = TString::Format("SimHit Energy Loss (Muon only) : GE%d1", station_id);

me_eloss_mu_[station_id] =
booker.book1D(eloss_mu_name, eloss_mu_title + ";" + eloss_xtitle + ";" + eloss_ytitle, 20, 0.0, 10.0);
me_eloss_mu_[station_id] =
booker.book1D(eloss_mu_name, eloss_mu_title + ";" + eloss_xtitle + ";" + eloss_ytitle, 20, 0.0, 10.0);

auto eloss_others_name = TString::Format("sim_eloss_others_GE%d1", station_id);
auto eloss_others_title = TString::Format("SimHit Energy Loss (Other Particles) : GE%d1", station_id);
auto eloss_others_name = TString::Format("sim_eloss_others_GE%d1", station_id);
auto eloss_others_title = TString::Format("SimHit Energy Loss (Other Particles) : GE%d1", station_id);

me_eloss_others_[station_id] =
booker.book1D(eloss_others_name, eloss_others_title + ";" + eloss_xtitle + ";" + eloss_ytitle, 20, 0.0, 10.0);
} // station loop
me_eloss_others_[station_id] =
booker.book1D(eloss_others_name, eloss_others_title + ";" + eloss_xtitle + ";" + eloss_ytitle, 20, 0.0, 10.0);
} // station loop
} // region loop

if (detail_plot_) {
for (const auto& region : gem->regions()) {
Expand Down