@@ -146,91 +146,89 @@ void FW3DViewGeometry::showMuonEndcap(bool showMuonEndcap) {
146146
147147 for (Int_t iEndcap = 1 ; iEndcap <= 2 ; ++iEndcap) // 1=forward (+Z), 2=backward(-Z)
148148 {
149- TEveElementList* cEndcap = nullptr ;
150- if (iEndcap == 1 )
151- cEndcap = new TEveElementList (" CSC Forward" );
152- else
153- cEndcap = new TEveElementList (" CSC Backward" );
154- m_muonEndcapElements->AddElement (cEndcap);
155- // Actual CSC geometry:
156- // Station 1 has 4 rings with 36 chambers in each
157- // Station 2: ring 1 has 18 chambers, ring 2 has 36 chambers
158- // Station 3: ring 1 has 18 chambers, ring 2 has 36 chambers
159- // Station 4: ring 1 has 18 chambers
160- Int_t maxChambers = 36 ;
161- for (Int_t iStation = 1 ; iStation <= 4 ; ++iStation) {
149+ TEveElementList* cEndcap = nullptr ;
150+ if (iEndcap == 1 )
151+ cEndcap = new TEveElementList (" CSC Forward" );
152+ else
153+ cEndcap = new TEveElementList (" CSC Backward" );
154+ m_muonEndcapElements->AddElement (cEndcap);
155+ // Actual CSC geometry:
156+ // Station 1 has 4 rings with 36 chambers in each
157+ // Station 2: ring 1 has 18 chambers, ring 2 has 36 chambers
158+ // Station 3: ring 1 has 18 chambers, ring 2 has 36 chambers
159+ // Station 4: ring 1 has 18 chambers
160+ Int_t maxChambers = 36 ;
161+ for (Int_t iStation = 1 ; iStation <= 4 ; ++iStation) {
162+ std::ostringstream s;
163+ s << " Station" << iStation;
164+ TEveElementList* cStation = new TEveElementList (s.str ().c_str ());
165+ cEndcap->AddElement (cStation);
166+ for (Int_t iRing = 1 ; iRing <= 4 ; ++iRing) {
167+ if (iStation > 1 && iRing > 2 )
168+ continue ;
169+ // if( iStation > 3 && iRing > 1 ) continue;
162170 std::ostringstream s;
163- s << " Station" << iStation;
164- TEveElementList* cStation = new TEveElementList (s.str ().c_str ());
165- cEndcap->AddElement (cStation);
166- for (Int_t iRing = 1 ; iRing <= 4 ; ++iRing) {
167- if (iStation > 1 && iRing > 2 )
168- continue ;
169- // if( iStation > 3 && iRing > 1 ) continue;
170- std::ostringstream s;
171- s << " Ring" << iRing;
172- TEveElementList* cRing = new TEveElementList (s.str ().c_str ());
173- cStation->AddElement (cRing);
174- (iRing == 1 && iStation > 1 ) ? (maxChambers = 18 ) : (maxChambers = 36 );
175- for (Int_t iChamber = 1 ; iChamber <= maxChambers; ++iChamber) {
176- Int_t iLayer = 0 ; // chamber
177- CSCDetId id (iEndcap, iStation, iRing, iChamber, iLayer);
178- TEveGeoShape* shape = m_geom->getEveShape (id.rawId ());
179- shape->SetTitle (TString::Format (
180- " CSC: %s, S=%d, R=%d, C=%d\n det-id=%u" , cEndcap->GetName (), iStation, iRing, iChamber, id.rawId ()));
171+ s << " Ring" << iRing;
172+ TEveElementList* cRing = new TEveElementList (s.str ().c_str ());
173+ cStation->AddElement (cRing);
174+ (iRing == 1 && iStation > 1 ) ? (maxChambers = 18 ) : (maxChambers = 36 );
175+ for (Int_t iChamber = 1 ; iChamber <= maxChambers; ++iChamber) {
176+ Int_t iLayer = 0 ; // chamber
177+ CSCDetId id (iEndcap, iStation, iRing, iChamber, iLayer);
178+ TEveGeoShape* shape = m_geom->getEveShape (id.rawId ());
179+ shape->SetTitle (TString::Format (
180+ " CSC: %s, S=%d, R=%d, C=%d\n det-id=%u" , cEndcap->GetName (), iStation, iRing, iChamber, id.rawId ()));
181181
182- addToCompound (shape, kFWMuonEndcapLineColorIndex );
183- cRing->AddElement (shape);
184- }
182+ addToCompound (shape, kFWMuonEndcapLineColorIndex );
183+ cRing->AddElement (shape);
185184 }
186- }
185+ }
186+ }
187187 }
188188
189189 // hardcoded gem and me0; need to find better way for different gem geometries
190- for (Int_t iRegion = GEMDetId::minRegionId; iRegion <= GEMDetId::maxRegionId; iRegion+=2 ) {
191- TEveElementList* teEndcap = nullptr ;
192- teEndcap = new TEveElementList (Form (" GEM Reg=%d" , iRegion));
193- m_muonEndcapElements->AddElement (teEndcap);
194- int iStation = 1 ;
195- {
196- std::ostringstream s;
197- s << " Station" << iStation;
198- TEveElementList* cStation = new TEveElementList (s.str ().c_str ());
199- teEndcap->AddElement (cStation);
200-
201-
202- for (Int_t iLayer = GEMDetId::minLayerId; iLayer <= GEMDetId::maxLayerId; ++iLayer) {
203- int maxChamber = GEMDetId::maxChamberId;
204- std::ostringstream sl;
205- sl << " Layer" << iLayer;
206- TEveElementList* elayer = new TEveElementList (sl.str ().c_str ());
207- cStation->AddElement (elayer);
208-
209- for (Int_t iChamber = 1 ; iChamber <= maxChamber; ++iChamber) {
210- std::ostringstream cl;
211- cl << " Chamber" << iChamber;
212- TEveElementList* cha = new TEveElementList (cl.str ().c_str ());
213- elayer->AddElement (cha);
214-
215- Int_t iRing = 1 ;
216- Int_t iRoll = 0 ;
217- try {
218- GEMDetId id (iRegion, iRing, iStation, iLayer, iChamber, iRoll);
219- TEveGeoShape* shape = m_geom->getEveShape (id.rawId ());
220- if (shape) {
221- shape->SetTitle (TString::Format (
222- " GEM: , Rng=%d, St=%d, Ch=%d Rl=%d\n det-id=%u" , iRing, iStation, iChamber, iRoll, id.rawId ()));
223-
224- cha->AddElement (shape);
225- addToCompound (shape, kFWMuonEndcapLineColorIndex );
226- }
227- }
228- catch (cms::Exception& e){
229- fwLog (fwlog::kError ) << " FW3DViewGeomtery " << e << std::endl;
230- }
231- }
190+ for (Int_t iRegion = GEMDetId::minRegionId; iRegion <= GEMDetId::maxRegionId; iRegion += 2 ) {
191+ TEveElementList* teEndcap = nullptr ;
192+ teEndcap = new TEveElementList (Form (" GEM Reg=%d" , iRegion));
193+ m_muonEndcapElements->AddElement (teEndcap);
194+ int iStation = 1 ;
195+ {
196+ std::ostringstream s;
197+ s << " Station" << iStation;
198+ TEveElementList* cStation = new TEveElementList (s.str ().c_str ());
199+ teEndcap->AddElement (cStation);
200+
201+ for (Int_t iLayer = GEMDetId::minLayerId; iLayer <= GEMDetId::maxLayerId; ++iLayer) {
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);
207+
208+ for (Int_t iChamber = 1 ; iChamber <= maxChamber; ++iChamber) {
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 {
217+ GEMDetId id (iRegion, iRing, iStation, iLayer, iChamber, iRoll);
218+ TEveGeoShape* shape = m_geom->getEveShape (id.rawId ());
219+ if (shape) {
220+ shape->SetTitle (TString::Format (
221+ " GEM: , Rng=%d, St=%d, Ch=%d Rl=%d\n det-id=%u" , iRing, iStation, iChamber, iRoll, id.rawId ()));
222+
223+ cha->AddElement (shape);
224+ addToCompound (shape, kFWMuonEndcapLineColorIndex );
225+ }
226+ } catch (cms::Exception& e) {
227+ fwLog (fwlog::kError ) << " FW3DViewGeomtery " << e << std::endl;
228+ }
232229 }
233- }
230+ }
231+ }
234232 }
235233
236234 // adding me0
0 commit comments