CMS 3D CMS Logo

GEMNumberingScheme.cc
Go to the documentation of this file.
6 
7 //#define LOCAL_DEBUG
8 
10  initMe(muonConstants);
11 }
12 
14  MuonDDDConstants muonConstants(cpv);
15  initMe(muonConstants);
16 }
17 
18 void GEMNumberingScheme::initMe ( const MuonDDDConstants& muonConstants ) {
19  int theLevelPart= muonConstants.getValue("level");
20  theRegionLevel = muonConstants.getValue("mg_region")/theLevelPart;
21  theStationLevel = muonConstants.getValue("mg_station")/theLevelPart;
22  theRingLevel = muonConstants.getValue("mg_ring")/theLevelPart;
23  theSectorLevel = muonConstants.getValue("mg_sector")/theLevelPart;
24  theRollLevel = muonConstants.getValue("mg_roll")/theLevelPart;
25 #ifdef LOCAL_DEBUG
26  edm::LogVerbatim("GEMNumberingScheme")
27  << "Initialize GEMNumberingScheme"
28  << "\ntheRegionLevel " << theRegionLevel
29  << "\ntheStationLevel "<< theStationLevel
30  << "\ntheRingLevel " << theRingLevel
31  << "\ntheSectorLevel " << theSectorLevel
32  << "\ntheRollLevel " << theRollLevel;
33 #endif
34 }
35 
37 
38 #ifdef LOCAL_DEBUG
39  edm::LogVerbatim("GEMNumberingScheme") << "GEMNumbering " << num.getLevels();
40  for (int level=1;level<=num.getLevels();level++) {
41  edm::LogVerbatim("GEMNumberingScheme")
42  << level << " " << num.getSuperNo(level) << " " << num.getBaseNo(level);
43  }
44 #endif
45 
46  int maxLevel = theRollLevel;
47  if (num.getLevels()!=maxLevel) {
48  edm::LogWarning("GEMNumberingScheme")
49  << "MuonGEMNumberingScheme::BNToUN: BaseNumber has " << num.getLevels()
50  << " levels, need " << maxLevel;
51  return 0;
52  }
53 
54  int region(0), ring(0), station(0), layer(0), chamber(0), roll(0);
55 
56  //decode significant GEM levels
57 
58  if (num.getBaseNo(theRegionLevel) == 0) region = 1;
59  else region =-1;
60 
61  // All GEM super chambers in stations 1 and 2 are on ring 1.
62  // The long super chambers in station 2 are assigned *station 3* due
63  // to the current limitation in the definition of the GEMDetId,
64  // i.e. only 2 layers available per station.
65  // ring = num.getSuperNo(theRingLevel);
66  // GEM are only on the first ring
67  ring = 1;
69 #ifdef LOCAL_DEBUG
70  edm::LogVerbatim("GEMNumberingScheme")
71  << "GEMNumbering: Ring " << ring << " Station "
72  << num.getSuperNo(theStationLevel) << ":" << station;
73 #endif
74 
75  roll = num.getBaseNo(theRollLevel)+1;
76  const int copyno = num.getBaseNo(theSectorLevel) + 1;
77  if (copyno < 50) {
78  if (copyno%2 == 0) {
79  layer = 2;
80  chamber = copyno-1;
81  } else {
82  layer = 1;
83  chamber = copyno;
84  }
85  } else {
86  int copynp = copyno - 50;
87  if (copynp%2 != 0) {
88  layer = 2;
89  chamber = copynp-1;
90  } else {
91  layer = 1;
92  chamber = copynp;
93  }
94  }
95 
96  // collect all info
97 
98 #ifdef LOCAL_DEBUG
99  edm::LogVerbatim("GEMNumberingScheme")
100  << "GEMNumberingScheme: Region " << region << " Ring "
101  << ring << " Station " << station << " Layer " << layer
102  << " Chamber " << chamber << " Roll " << roll;
103 #endif
104 
105  // Build the actual numbering
106  GEMDetId id(region,ring,station,layer,chamber, roll);
107 
108 
109 #ifdef LOCAL_DEBUG
110  edm::LogVerbatim("GEMNumberingScheme") << id.rawId() << " DetId " << id;
111 #endif
112 
113  return id.rawId();
114 }
void initMe(const MuonDDDConstants &muonConstants)
int getBaseNo(int level) const
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
int getValue(const std::string &name) const
int getLevels() const
int getSuperNo(int level) const
GEMNumberingScheme(const DDCompactView &cpv)
int baseNumberToUnitNumber(const MuonBaseNumber &) override