Skip to content

Commit 8a7e27c

Browse files
authored
Merge pull request cms-sw#31978 from alja/gem2021
Fireworks 11_2_X Updates for GEM detector visualization
2 parents 5d5e0ee + 446c78a commit 8a7e27c

File tree

2 files changed

+40
-46
lines changed

2 files changed

+40
-46
lines changed

Fireworks/Core/src/FW3DViewGeometry.cc

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "Fireworks/Core/interface/TEveElementIter.h"
2626
#include "Fireworks/Core/interface/Context.h"
2727
#include "Fireworks/Core/interface/FWColorManager.h"
28+
#include "Fireworks/Core/interface/fwLog.h"
2829

2930
#include "DataFormats/MuonDetId/interface/DTChamberId.h"
3031
#include "DataFormats/MuonDetId/interface/CSCDetId.h"
@@ -184,46 +185,46 @@ void FW3DViewGeometry::showMuonEndcap(bool showMuonEndcap) {
184185
}
185186
}
186187
}
188+
187189
// hardcoded gem and me0; need to find better way for different gem geometries
188-
for (Int_t iRegion = GEMDetId::minRegionId; iRegion <= GEMDetId::maxRegionId; iRegion = iRegion + 2) {
190+
for (Int_t iRegion = GEMDetId::minRegionId; iRegion <= GEMDetId::maxRegionId; iRegion += 2) {
189191
TEveElementList* teEndcap = nullptr;
190-
if (iRegion == 1)
191-
teEndcap = new TEveElementList("GEM Forward");
192-
else
193-
teEndcap = new TEveElementList("GEM Backward");
192+
teEndcap = new TEveElementList(Form("GEM Reg=%d", iRegion));
194193
m_muonEndcapElements->AddElement(teEndcap);
195-
196-
int mxSt = m_geom->versionInfo().haveExtraDet("GE2") ? GEMDetId::maxStationId : 1;
197-
198-
for (Int_t iStation = GEMDetId::minStationId; iStation <= mxSt; ++iStation) {
194+
int iStation = 1;
195+
{
199196
std::ostringstream s;
200197
s << "Station" << iStation;
201198
TEveElementList* cStation = new TEveElementList(s.str().c_str());
202199
teEndcap->AddElement(cStation);
203200

204-
Int_t iRing = 1;
205201
for (Int_t iLayer = GEMDetId::minLayerId; iLayer <= GEMDetId::maxLayerId; ++iLayer) {
206-
int maxChamber = 36;
207-
if (iStation >= 2)
208-
maxChamber = 18;
202+
int maxChamber = GEMDetId::maxChamberId;
203+
std::ostringstream sl;
204+
sl << "Layer" << iLayer;
205+
TEveElementList* elayer = new TEveElementList(sl.str().c_str());
206+
cStation->AddElement(elayer);
209207

210208
for (Int_t iChamber = 1; iChamber <= maxChamber; ++iChamber) {
211-
int maxRoll = iChamber % 2 ? 9 : 10;
212-
if (iStation == 2)
213-
maxRoll = 8;
214-
if (iStation == 3)
215-
maxRoll = 12;
216-
217-
for (Int_t iRoll = GEMDetId::minRollId; iRoll <= maxRoll; ++iRoll) {
209+
std::ostringstream cl;
210+
cl << "Chamber" << iChamber;
211+
TEveElementList* cha = new TEveElementList(cl.str().c_str());
212+
elayer->AddElement(cha);
213+
214+
Int_t iRing = 1;
215+
Int_t iRoll = 0;
216+
try {
218217
GEMDetId id(iRegion, iRing, iStation, iLayer, iChamber, iRoll);
219218
TEveGeoShape* shape = m_geom->getEveShape(id.rawId());
220219
if (shape) {
221220
shape->SetTitle(TString::Format(
222221
"GEM: , Rng=%d, St=%d, Ch=%d Rl=%d\ndet-id=%u", iRing, iStation, iChamber, iRoll, id.rawId()));
223222

224-
cStation->AddElement(shape);
223+
cha->AddElement(shape);
225224
addToCompound(shape, kFWMuonEndcapLineColorIndex);
226225
}
226+
} catch (cms::Exception& e) {
227+
fwLog(fwlog::kError) << "FW3DViewGeomtery " << e << std::endl;
227228
}
228229
}
229230
}

Fireworks/Core/src/FWRPZViewGeometry.cc

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -537,39 +537,32 @@ void FWRPZViewGeometry::showGEM(bool show) {
537537
m_GEMElements = new TEveElementList("GEM");
538538

539539
for (Int_t iRegion = GEMDetId::minRegionId; iRegion <= GEMDetId::maxRegionId; iRegion = iRegion + 2) {
540-
int mxSt = m_geom->versionInfo().haveExtraDet("GE2") ? 3 : 1;
541-
542-
for (Int_t iStation = GEMDetId::minStationId; iStation <= mxSt; ++iStation) {
543-
Int_t iRing = 1;
544-
for (Int_t iLayer = GEMDetId::minLayerId; iLayer <= GEMDetId::maxLayerId; ++iLayer) {
545-
int maxChamber = 36;
546-
if (iStation >= 2)
547-
maxChamber = 18;
548-
549-
for (Int_t iChamber = 1; iChamber <= maxChamber; ++iChamber) {
550-
int maxRoll = iChamber % 2 ? 9 : 10;
551-
if (iStation == 2)
552-
maxRoll = 8;
553-
if (iStation == 3)
554-
maxRoll = 12;
555-
556-
for (Int_t iRoll = GEMDetId::minRollId; iRoll <= maxRoll; ++iRoll) {
557-
GEMDetId id(iRegion, iRing, iStation, iLayer, iChamber, iRoll);
558-
TEveGeoShape* shape = m_geom->getEveShape(id.rawId());
559-
if (shape) {
560-
addToCompound(shape, kFWMuonEndcapLineColorIndex);
561-
m_GEMElements->AddElement(shape);
562-
gEve->AddToListTree(shape, true);
563-
}
564-
}
540+
int iStation = 1;
541+
int iRing = 1;
542+
int iLayer = 1;
543+
544+
int carr[4] = {10, 11, 29, 30};
545+
for (int i = 0; i < 4; ++i) {
546+
int iChamber = carr[i];
547+
int iRoll = 0;
548+
try {
549+
GEMDetId id(iRegion, iRing, iStation, iLayer, iChamber, iRoll);
550+
TEveGeoShape* shape = m_geom->getEveShape(id.rawId());
551+
if (shape) {
552+
addToCompound(shape, kFWMuonEndcapLineColorIndex);
553+
m_GEMElements->AddElement(shape);
554+
gEve->AddToListTree(shape, true);
565555
}
556+
} catch (cms::Exception& e) {
557+
fwLog(fwlog::kError) << "FWRPZViewGeomtery " << e << std::endl;
566558
}
567559
}
568560
}
569561

570562
AddElement(m_GEMElements);
571563
importNew(m_GEMElements);
572564
}
565+
573566
if (m_GEMElements) {
574567
m_GEMElements->SetRnrState(show);
575568
gEve->Redraw3D();

0 commit comments

Comments
 (0)