Skip to content

Commit

Permalink
Merge pull request #36835 from watson-ij/ge21-demo-validation
Browse files Browse the repository at this point in the history
fix ge2/1 demonstrator in validation
  • Loading branch information
cmsbuild committed Feb 2, 2022
2 parents d3944b6 + 66f0620 commit fddd406
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 14 deletions.
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();

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

0 comments on commit fddd406

Please sign in to comment.