CMS 3D CMS Logo

GEMNumberingScheme.cc
Go to the documentation of this file.
6 
7 //#define LOCAL_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 LOCAL_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 LOCAL_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 maxLevel = theRollLevel;
35  if (num.getLevels() != maxLevel) {
36  edm::LogWarning("GEMNumberingScheme")
37  << "MuonGEMNumberingScheme::BNToUN: BaseNumber has " << num.getLevels() << " levels, need " << maxLevel;
38  return 0;
39  }
40 
41  int region(0), ring(0), station(0), layer(0), chamber(0), roll(0);
42 
43  //decode significant GEM levels
44 
45  if (num.getBaseNo(theRegionLevel) == 0)
46  region = 1;
47  else
48  region = -1;
49 
50  // All GEM super chambers in stations 1 and 2 are on ring 1.
51  // The long super chambers in station 2 are assigned *station 3* due
52  // to the current limitation in the definition of the GEMDetId,
53  // i.e. only 2 layers available per station.
54  // ring = num.getSuperNo(theRingLevel);
55  // GEM are only on the first ring
56  ring = 1;
57 
58  // GE0 has the layer encoded in the ring level
59  if (num.getBaseNo(theRingLevel) == 0) { // 0 => GE1/1, GE2/1
60  station = num.getSuperNo(theStationLevel);
61 #ifdef LOCAL_DEBUG
62  edm::LogVerbatim("GEMNumberingScheme")
63  << "GEMNumbering: Ring " << ring << " Station " << num.getSuperNo(theStationLevel) << ":" << station;
64 #endif
65 
66  roll = num.getBaseNo(theRollLevel) + 1;
67  const int copyno = num.getBaseNo(theSectorLevel) + 1;
68  // Half the chambers are flipped back to front, this is encoded in
69  // the chamber number, which affects the layer numbering. Layer 1
70  // is always the closest layer to the interaction point.
71  const int layerDemarcation = 50;
72  if (copyno < layerDemarcation) {
73  if (copyno % 2 == 0) {
74  layer = 2;
75  chamber = copyno - 1;
76  } else {
77  layer = 1;
78  chamber = copyno;
79  }
80  } else {
81  int copynp = copyno - layerDemarcation;
82  if (copynp % 2 != 0) {
83  layer = 2;
84  chamber = copynp - 1;
85  } else {
86  layer = 1;
87  chamber = copynp;
88  }
89  }
90  } else { // GE0 encodes the layer
92  layer = num.getBaseNo(theRingLevel);
93  chamber = num.getBaseNo(theSectorLevel) + 1;
94  roll = num.getBaseNo(theRollLevel) + 1;
95  }
96 
97  // collect all info
98 
99 #ifdef LOCAL_DEBUG
100  edm::LogVerbatim("GEMNumberingScheme") << "GEMNumberingScheme: Region " << region << " Ring " << ring << " Station "
101  << station << " Layer " << layer << " Chamber " << chamber << " Roll " << roll;
102 #endif
103 
104  // Build the actual numbering
105  GEMDetId id(region, ring, station, layer, chamber, roll);
106 
107 #ifdef LOCAL_DEBUG
108  edm::LogVerbatim("GEMNumberingScheme") << id.rawId() << " DetId " << id;
109 #endif
110 
111  return id.rawId();
112 }
personalPlayback.level
level
Definition: personalPlayback.py:22
MuonGeometryConstants
Definition: MuonGeometryConstants.h:20
MessageLogger.h
relativeConstraints.station
station
Definition: relativeConstraints.py:67
MuonGeometryConstants.h
GEMNumberingScheme.h
GEMNumberingScheme::baseNumberToUnitNumber
int baseNumberToUnitNumber(const MuonBaseNumber &) override
Definition: GEMNumberingScheme.cc:26
GEMNumberingScheme::theRegionLevel
int theRegionLevel
Definition: GEMNumberingScheme.h:20
GEMDetId::minStationId0
static constexpr int32_t minStationId0
Definition: GEMDetId.h:23
GEMNumberingScheme::theRingLevel
int theRingLevel
Definition: GEMNumberingScheme.h:22
GEMNumberingScheme::theSectorLevel
int theSectorLevel
Definition: GEMNumberingScheme.h:23
edm::LogWarning
Definition: MessageLogger.h:141
MuonBaseNumber.h
GEMDetId
Definition: GEMDetId.h:17
GEMNumberingScheme::theStationLevel
int theStationLevel
Definition: GEMNumberingScheme.h:21
edm::LogVerbatim
Definition: MessageLogger.h:297
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
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
GEMNumberingScheme::theRollLevel
int theRollLevel
Definition: GEMNumberingScheme.h:24
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
HLT_2018_cff.region
region
Definition: HLT_2018_cff.py:81479
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53