CMS 3D CMS Logo

GEMNumberingScheme.cc
Go to the documentation of this file.
6 
7 //#define EDM_ML_DEBUG
8 
9 GEMNumberingScheme::GEMNumberingScheme(const MuonGeometryConstants& muonConstants) { initMe(muonConstants); }
10 
12  int theLevelPart = muonConstants.getValue("level");
13  theRegionLevel = muonConstants.getValue("mg_region") / theLevelPart;
14  theStationLevel = muonConstants.getValue("mg_station") / theLevelPart;
15  theRingLevel = muonConstants.getValue("mg_ring") / theLevelPart;
16  theSectorLevel = muonConstants.getValue("mg_sector") / theLevelPart;
17  theRollLevel = muonConstants.getValue("mg_roll") / theLevelPart;
18 #ifdef EDM_ML_DEBUG
19  edm::LogVerbatim("MuonGeom") << "Initialize GEMNumberingScheme"
20  << "\ntheRegionLevel " << theRegionLevel << "\ntheStationLevel " << theStationLevel
21  << "\ntheRingLevel " << theRingLevel << "\ntheSectorLevel " << theSectorLevel
22  << "\ntheRollLevel " << theRollLevel;
23 #endif
24 }
25 
27 #ifdef EDM_ML_DEBUG
28  edm::LogVerbatim("MuonGeom") << "GEMNumbering " << num.getLevels();
29  for (int level = 1; level <= num.getLevels(); level++) {
30  edm::LogVerbatim("MuonGeom") << level << " " << num.getSuperNo(level) << " " << num.getBaseNo(level);
31  }
32 #endif
33 
34  int levels = num.getLevels();
35 #ifdef EDM_ML_DEBUG
36  if (levels != theRollLevel)
37  edm::LogVerbatim("MuonGeom") << "MuonGEMNumberingScheme::BNToUN: BaseNumber has " << num.getLevels()
38  << " levels, need at least till " << theRollLevel;
39 #endif
40 
44 
45  //decode significant GEM levels
46 
47  if (levels >= theRegionLevel) {
48  if (num.getBaseNo(theRegionLevel) == 0)
49  region = 1;
50  else
51  region = -1;
52  }
53 
54  // All GEM super chambers in stations 1 and 2 are on ring 1.
55  // The long super chambers in station 2 are assigned *station 3* due
56  // to the current limitation in the definition of the GEMDetId,
57  // i.e. only 2 layers available per station.
58  // ring = num.getSuperNo(theRingLevel);
59  // GEM are only on the first ring
60  ring = 1;
61 
62  // GE0 has the layer encoded in the ring level
63  if (levels > theRingLevel) {
64  if (num.getBaseNo(theRingLevel) == 0) { // 0 => GE1/1, GE2/1
65  station = num.getSuperNo(theStationLevel);
66 #ifdef EDM_ML_DEBUG
67  edm::LogVerbatim("MuonGeom") << "GEMNumbering: Ring " << ring << " Station " << num.getSuperNo(theStationLevel)
68  << ":" << station;
69 #endif
70  if (levels >= theRollLevel)
71  roll = num.getBaseNo(theRollLevel) + 1;
72  if (levels >= theSectorLevel) {
73  const int copyno = num.getBaseNo(theSectorLevel) + 1;
74  // Half the chambers are flipped back to front, this is encoded in
75  // the chamber number, which affects the layer numbering. Layer 1
76  // is always the closest layer to the interaction point.
77  const int layerDemarcation = 50;
78  if (copyno < layerDemarcation) {
79  if (copyno % 2 == 0) {
80  layer = 2;
81  chamber = copyno - 1;
82  } else {
83  layer = 1;
84  chamber = copyno;
85  }
86  } else {
87  int copynp = copyno - layerDemarcation;
88  if (copynp % 2 != 0) {
89  layer = 2;
90  chamber = copynp - 1;
91  } else {
92  layer = 1;
93  chamber = copynp;
94  }
95  }
96  }
97  } else { // GE0 encodes the layer
99  layer = num.getBaseNo(theRingLevel);
100  if (levels >= theSectorLevel)
101  chamber = num.getBaseNo(theSectorLevel) + 1;
102  if (levels >= theRollLevel)
103  roll = num.getBaseNo(theRollLevel) + 1;
104  }
105  } else if (levels == theRingLevel) {
107  layer = 1;
108  }
109 
110  // collect all info
111 
112 #ifdef EDM_ML_DEBUG
113  edm::LogVerbatim("MuonGeom") << "GEMNumberingScheme: Region " << region << " Ring " << ring << " Station " << station
114  << " Layer " << layer << " Chamber " << chamber << " Roll " << roll;
115 #endif
116 
117  // Build the actual numbering
119 
120 #ifdef EDM_ML_DEBUG
121  edm::LogVerbatim("MuonGeom") << id.rawId() << " DetId " << id;
122 #endif
123 
124  return id.rawId();
125 }
int getValue(const std::string &name) const
Log< level::Info, true > LogVerbatim
GEMNumberingScheme(const MuonGeometryConstants &muonConstants)
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
static constexpr int32_t minStationId0
Definition: GEMDetId.h:24
void initMe(const MuonGeometryConstants &muonConstants)
static constexpr int32_t minRingId
Definition: GEMDetId.h:22
static constexpr int32_t minRollId
Definition: GEMDetId.h:35
static constexpr int32_t minChamberId
Definition: GEMDetId.h:28
int baseNumberToUnitNumber(const MuonBaseNumber &) const override
static constexpr int32_t minLayerId
Definition: GEMDetId.h:30
static constexpr int32_t minRegionId
Definition: GEMDetId.h:20