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("GEMNumberingScheme") << "Initialize GEMNumberingScheme"
20  << "\ntheRegionLevel " << theRegionLevel << "\ntheStationLevel "
21  << theStationLevel << "\ntheRingLevel " << theRingLevel << "\ntheSectorLevel "
22  << theSectorLevel << "\ntheRollLevel " << theRollLevel;
23 #endif
24 }
25 
27 #ifdef EDM_ML_DEBUG
28  edm::LogVerbatim("GEMNumberingScheme") << "GEMNumbering " << num.getLevels();
29  for (int level = 1; level <= num.getLevels(); level++) {
30  edm::LogVerbatim("GEMNumberingScheme") << 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("GEMNumberingScheme") << "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("GEMNumberingScheme")
68  << "GEMNumbering: Ring " << ring << " Station " << num.getSuperNo(theStationLevel) << ":" << 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("GEMNumberingScheme") << "GEMNumberingScheme: Region " << region << " Ring " << ring << " Station "
114  << station << " Layer " << layer << " Chamber " << chamber << " Roll " << roll;
115 #endif
116 
117  // Build the actual numbering
119 
120 #ifdef EDM_ML_DEBUG
121  edm::LogVerbatim("GEMNumberingScheme") << id.rawId() << " DetId " << id;
122 #endif
123 
124  return id.rawId();
125 }
personalPlayback.level
level
Definition: personalPlayback.py:22
MuonGeometryConstants
Definition: MuonGeometryConstants.h:20
GEMNumberingScheme::baseNumberToUnitNumber
int baseNumberToUnitNumber(const MuonBaseNumber &) const override
Definition: GEMNumberingScheme.cc:26
MessageLogger.h
relativeConstraints.station
station
Definition: relativeConstraints.py:67
MuonGeometryConstants.h
GEMDetId::minChamberId
static constexpr int32_t minChamberId
Definition: GEMDetId.h:28
GEMDetId::minLayerId
static constexpr int32_t minLayerId
Definition: GEMDetId.h:30
GEMNumberingScheme.h
GEMNumberingScheme::theRegionLevel
int theRegionLevel
Definition: GEMNumberingScheme.h:20
GEMDetId::minStationId0
static constexpr int32_t minStationId0
Definition: GEMDetId.h:24
GEMNumberingScheme::theRingLevel
int theRingLevel
Definition: GEMNumberingScheme.h:22
GEMDetId::minRingId
static constexpr int32_t minRingId
Definition: GEMDetId.h:22
GEMNumberingScheme::theSectorLevel
int theSectorLevel
Definition: GEMNumberingScheme.h:23
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
MuonBaseNumber.h
GEMDetId
Definition: GEMDetId.h:18
HLT_FULL_cff.region
region
Definition: HLT_FULL_cff.py:88267
GEMNumberingScheme::theStationLevel
int theStationLevel
Definition: GEMNumberingScheme.h:21
GEMDetId::minRegionId
static constexpr int32_t minRegionId
Definition: GEMDetId.h:20
MuonGeometryConstants::getValue
int getValue(const std::string &name) const
Definition: MuonGeometryConstants.cc:8
EgammaValidation_cff.num
num
Definition: EgammaValidation_cff.py:34
MuonBaseNumber
Definition: MuonBaseNumber.h:21
GEMDetId.h
GEMNumberingScheme::initMe
void initMe(const MuonGeometryConstants &muonConstants)
Definition: GEMNumberingScheme.cc:11
GEMNumberingScheme::GEMNumberingScheme
GEMNumberingScheme(const MuonGeometryConstants &muonConstants)
Definition: GEMNumberingScheme.cc:9
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
GEMNumberingScheme::theRollLevel
int theRollLevel
Definition: GEMNumberingScheme.h:24
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
GEMDetId::minRollId
static constexpr int32_t minRollId
Definition: GEMDetId.h:35
jets_cff.levels
levels
Definition: jets_cff.py:21