CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
virtual IndexType stripChannelsPerOfflineLayer(IndexType is, IndexType ir) const =0
virtual IndexType maxChipIndex() const =0
uint32_t LongIndexType
IndexType chamberIndex(IndexType ie, IndexType is, IndexType ir, IndexType ic) const
IndexType sectorsPerOnlineLayer(IndexType is, IndexType ir) const
LongIndexType stripChannelIndex(const CSCDetId &id, IndexType istrip) const
virtual IndexType sectorStart(IndexType ie, IndexType is, IndexType ir) const =0
virtual IndexType onlineRingsInStation(IndexType is) const =0
virtual IndexType maxGasGainIndex() const =0
virtual std::pair< CSCDetId, IndexType > detIdFromStripChannelIndex(LongIndexType ichi) const =0
CSCDetId detIdFromChamberIndex(IndexType ici) const
virtual LongIndexType stripChannelStart(IndexType ie, IndexType is, IndexType ir) const =0
IndexType chambersInRingOfStation(IndexType is, IndexType ir) const
IndexType layerIndex(const CSCDetId &id) const
IndexType maxLayerIndex() const
virtual IndexType stripChannelsPerOnlineLayer(IndexType is, IndexType ir) const =0
constexpr std::array< uint8_t, layerIndexSize > layer
CSCDetId detIdFromChamberLabel(IndexType ie, IndexType icl) const
virtual IndexType chipsPerOnlineLayer(IndexType is, IndexType ir) const =0
IndexType hvSegmentsPerLayer(IndexType is, IndexType ir) const
IndexType maxChamberIndex() const
IndexType gasGainIndex(IndexType ie, IndexType is, IndexType ir, IndexType ic, IndexType il, IndexType ihvsegment, IndexType ichip) const
IndexType gasGainIndex(const CSCDetId &id, IndexType istrip, IndexType iwire) const
uint16_t IndexType
IndexType sectorsPerLayer(IndexType is, IndexType ir) const
virtual GasGainIndexType detIdFromGasGainIndex(IndexType igg) const =0
IndexType hvSegmentIndex(IndexType is, IndexType ir, IndexType iwire) const
IndexType startChamberIndexInEndcap(IndexType ie, IndexType is, IndexType ir) const
CSCDetId detIdFromLayerIndex(IndexType ili) const
virtual IndexType chipsPerLayer(IndexType is, IndexType ir) const =0
IndexType chipIndex(IndexType ie, IndexType is, IndexType ir, IndexType ic, IndexType il, IndexType ichip) const
virtual IndexType chipStart(IndexType ie, IndexType is, IndexType ir) const =0
IndexType chamberLabelFromChamberIndex(IndexType) const
virtual std::pair< CSCDetId, IndexType > detIdFromChipIndex(IndexType ichi) const =0
IndexType offlineRingsInStation(IndexType is) const
IndexType chipIndex(IndexType istrip) const
virtual LongIndexType maxStripChannelIndex() const =0
IndexType chipIndex(const CSCDetId &id, IndexType ichip) const
IndexType ringsInStation(IndexType is) const
IndexType layerIndex(IndexType ie, IndexType is, IndexType ir, IndexType ic, IndexType il) const
virtual int dbIndex(const CSCDetId &id, int &channel) const =0
LongIndexType stripChannelIndex(IndexType ie, IndexType is, IndexType ir, IndexType ic, IndexType il, IndexType istrip) const
virtual std::string name() const
std::tuple< CSCDetId, IndexType, IndexType > GasGainIndexType
IndexType gasGainIndex(IndexType ihvsegment, IndexType ichip, const CSCDetId &id) const
IndexType chamberIndex(const CSCDetId &id) const
virtual ~CSCIndexerBase()
virtual IndexType stripChannelsPerLayer(IndexType is, IndexType ir) const =0
std::vector< IndexType > chamberLabel_