CMS 3D CMS Logo

CSCIndexerBase.h
Go to the documentation of this file.
1 #ifndef CSCIndexerBase_H
2 #define CSCIndexerBase_H
3 
65 #include <tuple>
66 #include <utility> // for pair
67 #include <vector>
68 
70 public:
71  typedef uint16_t IndexType;
72  typedef uint32_t LongIndexType;
73  typedef std::tuple<CSCDetId, // id
74  IndexType, // HV segment
75  IndexType // chip
76  >
78 
80  virtual ~CSCIndexerBase();
81 
82  virtual std::string name() const { return "CSCIndexerBase"; }
83 
92  IndexType maxChamberIndex() const { return 540; }
93  IndexType maxLayerIndex() const { return 3240; }
94  virtual LongIndexType maxStripChannelIndex() const = 0;
95  virtual IndexType maxChipIndex() const = 0;
96  virtual IndexType maxGasGainIndex() const = 0;
98 
100 
101 
105  const IndexType nrins[5] = {0, 3, 2, 2, 2}; // physical rings per station
106  return nrins[is];
107  }
108 
112  virtual IndexType onlineRingsInStation(IndexType is) const = 0;
113 
122  const IndexType nrings[5] = {0, 4, 2, 2, 2}; // offline rings per station
123  return nrings[is];
124  }
125 
131  const IndexType nCinR[16] = {36, 36, 36, 36, 18, 36, 0, 0, 18, 36, 0, 0, 18, 36, 0, 0}; // chambers in ring
132  return nCinR[(is - 1) * 4 + ir - 1];
133  }
134 
140  virtual IndexType stripChannelsPerOfflineLayer(IndexType is, IndexType ir) const = 0;
141 
147  virtual IndexType stripChannelsPerOnlineLayer(IndexType is, IndexType ir) const = 0;
148 
154  virtual IndexType chipsPerOnlineLayer(IndexType is, IndexType ir) const = 0;
155 
165  return chipsPerOnlineLayer(is, ir) * hvSegmentsPerLayer(is, ir);
166  }
167 
169 
171 
172 
180  const IndexType nschin[32] = {1, 37, 73, 1, 109, 127, 0, 0, 163, 181, 0, 0, 217, 469, 0, 0,
181  235, 271, 307, 235, 343, 361, 0, 0, 397, 415, 0, 0, 451, 505, 0, 0};
182  return nschin[(ie - 1) * 16 + (is - 1) * 4 + ir - 1];
183  }
184 
194  return startChamberIndexInEndcap(ie, is, ir) + ic - 1; // -1 so start index _is_ ic=1
195  }
196 
207  IndexType chamberIndex(const CSCDetId &id) const {
208  return chamberIndex(id.endcap(), id.station(), id.ring(), id.chamber());
209  }
211 
213 
214 
223  const IndexType layersInChamber = 6;
224  return (chamberIndex(ie, is, ir, ic) - 1) * layersInChamber + il;
225  }
226 
237  IndexType layerIndex(const CSCDetId &id) const {
238  return layerIndex(id.endcap(), id.station(), id.ring(), id.chamber(), id.layer());
239  }
241 
243 
244 
260  virtual IndexType stripChannelsPerLayer(IndexType is, IndexType ir) const = 0;
261 
269  virtual LongIndexType stripChannelStart(IndexType ie, IndexType is, IndexType ir) const = 0;
270 
279  IndexType ie, IndexType is, IndexType ir, IndexType ic, IndexType il, IndexType istrip) const {
280  return stripChannelStart(ie, is, ir) + ((ic - 1) * 6 + il - 1) * stripChannelsPerLayer(is, ir) + (istrip - 1);
281  }
282 
290  return stripChannelIndex(id.endcap(), id.station(), id.ring(), id.chamber(), id.layer(), istrip);
291  }
293 
295 
296 
302  virtual IndexType chipsPerLayer(IndexType is, IndexType ir) const = 0;
303 
311  virtual IndexType chipStart(IndexType ie, IndexType is, IndexType ir) const = 0;
312 
323  return chipStart(ie, is, ir) + ((ic - 1) * 6 + il - 1) * chipsPerLayer(is, ir) + (ichip - 1);
324  }
325 
334  IndexType chipIndex(const CSCDetId &id, IndexType ichip) const {
335  return chipIndex(id.endcap(), id.station(), id.ring(), id.chamber(), id.layer(), ichip);
336  }
337 
347  IndexType chipIndex(IndexType istrip) const { return (istrip - 1) / 16 + 1; }
349 
351 
352 
361  const IndexType nSinL[16] = {1, 3, 3, 1, 3, 5, 0, 0, 3, 5, 0, 0, 3, 5, 0, 0};
362  return nSinL[(is - 1) * 4 + ir - 1];
363  }
364 
375 
385  return chipsPerLayer(is, ir) * hvSegmentsPerLayer(is, ir);
386  }
387 
401  virtual IndexType sectorStart(IndexType ie, IndexType is, IndexType ir) const = 0;
402 
416  IndexType is,
417  IndexType ir,
418  IndexType ic,
419  IndexType il,
420  IndexType ihvsegment,
421  IndexType ichip) const {
422  return sectorStart(ie, is, ir) + ((ic - 1) * 6 + il - 1) * sectorsPerLayer(is, ir) +
423  (ihvsegment - 1) * chipsPerLayer(is, ir) + (ichip - 1);
424  }
425 
436  IndexType gasGainIndex(const CSCDetId &id, IndexType istrip, IndexType iwire) const {
437  return gasGainIndex(id.endcap(),
438  id.station(),
439  id.ring(),
440  id.chamber(),
441  id.layer(),
442  hvSegmentIndex(id.station(), id.ring(), iwire),
443  chipIndex(istrip));
444  }
445 
459  IndexType gasGainIndex(IndexType ihvsegment, IndexType ichip, const CSCDetId &id) const {
460  return gasGainIndex(id.endcap(), id.station(), id.ring(), id.chamber(), id.layer(), ihvsegment, ichip);
461  }
463 
466 
467 
474 
482 
491  virtual std::pair<CSCDetId, IndexType> detIdFromStripChannelIndex(LongIndexType ichi) const = 0;
492 
501  virtual std::pair<CSCDetId, IndexType> detIdFromChipIndex(IndexType ichi) const = 0;
502 
512  virtual GasGainIndexType detIdFromGasGainIndex(IndexType igg) const = 0;
513 
515 
525  virtual int dbIndex(const CSCDetId &id, int &channel) const = 0;
526 
532 
533 protected:
539 
545  std::vector<IndexType> chamberLabel_;
546 };
547 
548 #endif
CSCIndexerBase::sectorsPerLayer
IndexType sectorsPerLayer(IndexType is, IndexType ir) const
Definition: CSCIndexerBase.h:384
CSCIndexerBase::chamberLabel_
std::vector< IndexType > chamberLabel_
Definition: CSCIndexerBase.h:545
CSCIndexerBase::stripChannelsPerOfflineLayer
virtual IndexType stripChannelsPerOfflineLayer(IndexType is, IndexType ir) const =0
relativeConstraints.station
station
Definition: relativeConstraints.py:67
CSCIndexerBase::stripChannelsPerLayer
virtual IndexType stripChannelsPerLayer(IndexType is, IndexType ir) const =0
CSCIndexerBase::layerIndex
IndexType layerIndex(const CSCDetId &id) const
Definition: CSCIndexerBase.h:237
CSCIndexerBase::chipIndex
IndexType chipIndex(IndexType istrip) const
Definition: CSCIndexerBase.h:347
CSCIndexerBase::chamberIndex
IndexType chamberIndex(const CSCDetId &id) const
Definition: CSCIndexerBase.h:207
CSCIndexerBase::layerIndex
IndexType layerIndex(IndexType ie, IndexType is, IndexType ir, IndexType ic, IndexType il) const
Definition: CSCIndexerBase.h:222
CSCIndexerBase::onlineRingsInStation
virtual IndexType onlineRingsInStation(IndexType is) const =0
CSCIndexerBase::maxStripChannelIndex
virtual LongIndexType maxStripChannelIndex() const =0
CSCIndexerBase::maxGasGainIndex
virtual IndexType maxGasGainIndex() const =0
CSCIndexerBase::detIdFromStripChannelIndex
virtual std::pair< CSCDetId, IndexType > detIdFromStripChannelIndex(LongIndexType ichi) const =0
CSCIndexerBase::gasGainIndex
IndexType gasGainIndex(IndexType ie, IndexType is, IndexType ir, IndexType ic, IndexType il, IndexType ihvsegment, IndexType ichip) const
Definition: CSCIndexerBase.h:415
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
CSCIndexerBase::chipStart
virtual IndexType chipStart(IndexType ie, IndexType is, IndexType ir) const =0
CSCDetId.h
CSCIndexerBase::name
virtual std::string name() const
Definition: CSCIndexerBase.h:82
CSCIndexerBase::ringsInStation
IndexType ringsInStation(IndexType is) const
Definition: CSCIndexerBase.h:104
CSCIndexerBase::sectorsPerOnlineLayer
IndexType sectorsPerOnlineLayer(IndexType is, IndexType ir) const
Definition: CSCIndexerBase.h:164
CSCIndexerBase::chipsPerLayer
virtual IndexType chipsPerLayer(IndexType is, IndexType ir) const =0
CSCIndexerBase::detIdFromLayerIndex
CSCDetId detIdFromLayerIndex(IndexType ili) const
Definition: CSCIndexerBase.cc:127
CSCIndexerBase::stripChannelIndex
LongIndexType stripChannelIndex(const CSCDetId &id, IndexType istrip) const
Definition: CSCIndexerBase.h:289
CSCIndexerBase::hvSegmentsPerLayer
IndexType hvSegmentsPerLayer(IndexType is, IndexType ir) const
Definition: CSCIndexerBase.h:360
CSCIndexerBase::dbIndex
virtual int dbIndex(const CSCDetId &id, int &channel) const =0
CSCIndexerBase::chamberLabelFromChamberIndex
IndexType chamberLabelFromChamberIndex(IndexType) const
Definition: CSCIndexerBase.cc:25
CSCIndexerBase::IndexType
uint16_t IndexType
Definition: CSCIndexerBase.h:71
CSCIndexerBase::detIdFromChipIndex
virtual std::pair< CSCDetId, IndexType > detIdFromChipIndex(IndexType ichi) const =0
CSCIndexerBase::chipIndex
IndexType chipIndex(IndexType ie, IndexType is, IndexType ir, IndexType ic, IndexType il, IndexType ichip) const
Definition: CSCIndexerBase.h:322
CSCIndexerBase::stripChannelIndex
LongIndexType stripChannelIndex(IndexType ie, IndexType is, IndexType ir, IndexType ic, IndexType il, IndexType istrip) const
Definition: CSCIndexerBase.h:278
CSCIndexerBase::startChamberIndexInEndcap
IndexType startChamberIndexInEndcap(IndexType ie, IndexType is, IndexType ir) const
Definition: CSCIndexerBase.h:179
CSCIndexerBase::chipsPerOnlineLayer
virtual IndexType chipsPerOnlineLayer(IndexType is, IndexType ir) const =0
CSCIndexerBase::maxLayerIndex
IndexType maxLayerIndex() const
Definition: CSCIndexerBase.h:93
CSCIndexerBase::stripChannelsPerOnlineLayer
virtual IndexType stripChannelsPerOnlineLayer(IndexType is, IndexType ir) const =0
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
CSCIndexerBase::LongIndexType
uint32_t LongIndexType
Definition: CSCIndexerBase.h:72
CSCIndexerBase::detIdFromChamberIndex
CSCDetId detIdFromChamberIndex(IndexType ici) const
Definition: CSCIndexerBase.cc:101
CSCDetId
Definition: CSCDetId.h:26
CSCIndexerBase::chamberIndex
IndexType chamberIndex(IndexType ie, IndexType is, IndexType ir, IndexType ic) const
Definition: CSCIndexerBase.h:193
CSCIndexerBase::maxChipIndex
virtual IndexType maxChipIndex() const =0
CSCIndexerBase::gasGainIndex
IndexType gasGainIndex(IndexType ihvsegment, IndexType ichip, const CSCDetId &id) const
Definition: CSCIndexerBase.h:459
CSCIndexerBase
Definition: CSCIndexerBase.h:69
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CSCIndexerBase::CSCIndexerBase
CSCIndexerBase()
Definition: CSCIndexerBase.cc:3
CSCIndexerBase::detIdFromGasGainIndex
virtual GasGainIndexType detIdFromGasGainIndex(IndexType igg) const =0
CSCIndexerBase::offlineRingsInStation
IndexType offlineRingsInStation(IndexType is) const
Definition: CSCIndexerBase.h:121
CSCIndexerBase::sectorStart
virtual IndexType sectorStart(IndexType ie, IndexType is, IndexType ir) const =0
CSCIndexerBase::maxChamberIndex
IndexType maxChamberIndex() const
Definition: CSCIndexerBase.h:92
CSCIndexerBase::hvSegmentIndex
IndexType hvSegmentIndex(IndexType is, IndexType ir, IndexType iwire) const
Definition: CSCIndexerBase.cc:48
CSCIndexerBase::stripChannelStart
virtual LongIndexType stripChannelStart(IndexType ie, IndexType is, IndexType ir) const =0
CSCIndexerBase::chambersInRingOfStation
IndexType chambersInRingOfStation(IndexType is, IndexType ir) const
Definition: CSCIndexerBase.h:130
CSCIndexerBase::~CSCIndexerBase
virtual ~CSCIndexerBase()
Definition: CSCIndexerBase.cc:23
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
CSCIndexerBase::GasGainIndexType
std::tuple< CSCDetId, IndexType, IndexType > GasGainIndexType
Definition: CSCIndexerBase.h:77
CSCIndexerBase::detIdFromChamberLabel
CSCDetId detIdFromChamberLabel(IndexType ie, IndexType icl) const
Definition: CSCIndexerBase.cc:91
CSCIndexerBase::chipIndex
IndexType chipIndex(const CSCDetId &id, IndexType ichip) const
Definition: CSCIndexerBase.h:334
CSCIndexerBase::gasGainIndex
IndexType gasGainIndex(const CSCDetId &id, IndexType istrip, IndexType iwire) const
Definition: CSCIndexerBase.h:436