CMS 3D CMS Logo

CSCNumberingScheme.cc
Go to the documentation of this file.
6 
7 //#define EDM_ML_DEBUG
8 
9 CSCNumberingScheme::CSCNumberingScheme(const MuonGeometryConstants& muonConstants) { initMe(muonConstants); }
10 
12  int theLevelPart = muonConstants.getValue("level");
13  theRegionLevel = muonConstants.getValue("me_region") / theLevelPart;
14  theStationLevel = muonConstants.getValue("me_station") / theLevelPart;
15  theSubringLevel = muonConstants.getValue("me_subring") / theLevelPart;
16  theSectorLevel = muonConstants.getValue("me_sector") / theLevelPart;
17  theRingLevel = muonConstants.getValue("me_ring") / theLevelPart;
18  theLayerLevel = muonConstants.getValue("me_layer") / theLevelPart;
19 #ifdef EDM_ML_DEBUG
20  edm::LogVerbatim("CSCNumbering") << "Initialize CSCNumberingScheme"
21  << "\ntheRegionLevel " << theRegionLevel << "\ntheStationLevel " << theStationLevel
22  << "\ntheSubringLevel " << theSubringLevel << "\ntheSectorLevel " << theSectorLevel
23  << "\ntheRingLevel " << theRingLevel << "\ntheLayerLevel " << theLayerLevel;
24 #endif
25 }
26 
28 #ifdef EDM_ML_DEBUG
29  edm::LogVerbatim("CSCNumbering") << "CSCNumbering " << num.getLevels();
30  for (int level = 1; level <= num.getLevels(); level++) {
31  edm::LogVerbatim("CSCNumbering") << level << " " << num.getSuperNo(level) << " " << num.getBaseNo(level);
32  }
33 #endif
34  int fwbw_id = 0;
35  int station_id = 0;
36  int ring_id = 0;
37  int subring_id = 0;
38  int sector_id = 0;
39  int layer_id = 0;
40 
41  // Decode endcap levels
42  // We should be able to work with 6 (layer-level) or 5 (chamber-level)
43 
44  for (int level = 1; level <= num.getLevels(); level++) {
45  if (level == theRegionLevel) {
46  const int copyno = num.getBaseNo(level);
47  fwbw_id = copyno + 1;
48  LogDebug("CSCNumbering") << "endcap=" << fwbw_id;
49 
50  } else if (level == theStationLevel) {
51  const int station_tag = num.getSuperNo(level);
52  station_id = station_tag;
53  LogDebug("CSCNumbering") << "station=" << station_id;
54  } else if (level == theSubringLevel) {
55  const int copyno = num.getBaseNo(level);
56  subring_id = copyno + 1;
57  LogDebug("CSCNumbering") << "subring=" << subring_id;
58  } else if (level == theSectorLevel) {
59  const int copyno = num.getBaseNo(level);
60  sector_id = copyno + 1;
61  LogDebug("CSCNumbering") << "sector=" << sector_id;
62  } else if (level == theLayerLevel) {
63  const int copyno = num.getBaseNo(level);
64  layer_id = copyno + 1;
65  LogDebug("CSCNumbering") << "layer=" << layer_id;
66  } else if (level == theRingLevel) {
67  const int ring_tag = num.getSuperNo(level);
68  ring_id = ring_tag;
69  LogDebug("CSCNumbering") << "ring=" << ring_id;
70  }
71  }
72 
73  // check validity
74 
75  if ((fwbw_id < 1) || (fwbw_id > 2)) {
76  edm::LogError("CSCNumbering") << "@SUB=CSCNumberingScheme::baseNumberToUnitNumber"
77  << "forward/backward id out of range:" << fwbw_id;
78  }
79 
80  if ((station_id < 1) || (station_id > 4)) {
81  edm::LogError("CSCNumbering") << "@SUB=CSCNumberingScheme::baseNumberToUnitNumber"
82  << "station id out of range:" << station_id;
83  }
84 
85  if ((ring_id < 1) || (ring_id > 4)) {
86  edm::LogError("CSCNumbering") << "@SUB=CSCNumberingScheme::baseNumberToUnitNumber"
87  << "ring id out of range:" << ring_id;
88  }
89 
90  if ((subring_id < 1) || (subring_id > 2)) {
91  edm::LogError("CSCNumbering") << "@SUB=CSCNumberingScheme::baseNumberToUnitNumber"
92  << "subring id out of range:" << subring_id;
93  }
94 
95  if ((sector_id < 1) || (sector_id > 36)) {
96  edm::LogError("CSCNumbering") << "@SUB=CSCNumberingScheme::baseNumberToUnitNumber"
97  << "sector id out of range:" << sector_id;
98  }
99 
100  // Allow id=0 since that means a chamber
101  if ((layer_id < 0) || (layer_id > 6)) {
102  edm::LogError("CSCNumbering") << "@SUB=CSCNumberingScheme::baseNumberToUnitNumber"
103  << "layer id out of range" << layer_id;
104  }
105 
106  // find appropriate chamber label
107 
108  int chamber_id = chamberIndex(station_id, ring_id, subring_id, sector_id);
109 
110  // convert into raw id of appropriate DetId
111 
112  int intIndex = CSCDetId::rawIdMaker(fwbw_id, station_id, ring_id, chamber_id, layer_id);
113 
114 #ifdef EDM_ML_DEBUG
115  edm::LogVerbatim("CSCNumbering") << "CSCNumberingScheme : fw/bw " << fwbw_id << " station " << station_id << " ring "
116  << ring_id << " subring " << subring_id << " chamber " << chamber_id << " sector "
117  << sector_id << " layer " << layer_id;
118 #endif
119 
120  return intIndex;
121 }
122 
123 int CSCNumberingScheme::chamberIndex(int station_id, int ring_id, int subring_id, int sector_id) const {
124  int chamber_id = 0;
125 
126  // chamber label is related to sector_id but we need to
127  // adjust to real hardware labelling
128  // Tim confirms this works properly according to CMS IN 2000/004 Version 2.5 March 2007.
129 
130  if (ring_id == 3) {
131  chamber_id = sector_id;
132  } else {
133  if (subring_id == 1) {
134  chamber_id = 2 * sector_id - 1;
135  } else {
136  chamber_id = 2 * sector_id;
137  }
138  }
139 
140  return chamber_id;
141 }
personalPlayback.level
level
Definition: personalPlayback.py:22
MuonGeometryConstants
Definition: MuonGeometryConstants.h:20
CSCNumberingScheme::initMe
void initMe(const MuonGeometryConstants &muonConstants)
Definition: CSCNumberingScheme.cc:11
MessageLogger.h
MuonGeometryConstants.h
CSCNumberingScheme::theStationLevel
int theStationLevel
Definition: CSCNumberingScheme.h:33
CSCNumberingScheme::baseNumberToUnitNumber
int baseNumberToUnitNumber(const MuonBaseNumber &) const override
Definition: CSCNumberingScheme.cc:27
CSCDetId::rawIdMaker
static int rawIdMaker(int iendcap, int istation, int iring, int ichamber, int ilayer)
Definition: CSCDetId.h:131
CSCDetId.h
alignCSCRings.ring_id
string ring_id
Definition: alignCSCRings.py:79
CSCNumberingScheme::CSCNumberingScheme
CSCNumberingScheme(const MuonGeometryConstants &muonConstants)
Definition: CSCNumberingScheme.cc:9
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
CSCNumberingScheme::theRegionLevel
int theRegionLevel
Definition: CSCNumberingScheme.h:32
MuonBaseNumber.h
MuonGeometryConstants::getValue
int getValue(const std::string &name) const
Definition: MuonGeometryConstants.cc:8
CSCNumberingScheme::chamberIndex
int chamberIndex(int, int, int, int) const
Definition: CSCNumberingScheme.cc:123
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
CSCNumberingScheme.h
EgammaValidation_cff.num
num
Definition: EgammaValidation_cff.py:34
MuonBaseNumber
Definition: MuonBaseNumber.h:21
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
CSCNumberingScheme::theSectorLevel
int theSectorLevel
Definition: CSCNumberingScheme.h:35
CSCNumberingScheme::theRingLevel
int theRingLevel
Definition: CSCNumberingScheme.h:37
CSCNumberingScheme::theLayerLevel
int theLayerLevel
Definition: CSCNumberingScheme.h:36
CSCNumberingScheme::theSubringLevel
int theSubringLevel
Definition: CSCNumberingScheme.h:34