CMS 3D CMS Logo

CSCIndexerBase.h
Go to the documentation of this file.
1 #ifndef CSCIndexerBase_H
2 #define CSCIndexerBase_H
3 
65 #include <boost/tuple/tuple.hpp>
66 #include <utility> // for pair
67 #include <vector>
68 
70 public:
71  typedef uint16_t IndexType;
72  typedef uint32_t LongIndexType;
73  typedef boost::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 
104  IndexType ringsInStation(IndexType is) const {
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 
121  IndexType offlineRingsInStation(IndexType is) const {
122  const IndexType nrings[5] = {0, 4, 2, 2, 2}; // offline rings per station
123  return nrings[is];
124  }
125 
130  IndexType chambersInRingOfStation(IndexType is, IndexType ir) const {
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 
164  IndexType sectorsPerOnlineLayer(IndexType is, IndexType ir) const {
165  return chipsPerOnlineLayer(is, ir) * hvSegmentsPerLayer(is, ir);
166  }
167 
169 
171 
172 
179  IndexType startChamberIndexInEndcap(IndexType ie, IndexType is, IndexType ir) const {
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 
193  IndexType chamberIndex(IndexType ie, IndexType is, IndexType ir, IndexType ic) const {
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 
222  IndexType layerIndex(IndexType ie, IndexType is, IndexType ir, IndexType ic, IndexType il) const {
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 
278  LongIndexType stripChannelIndex(
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 
289  LongIndexType stripChannelIndex(const CSCDetId &id, IndexType istrip) const {
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 
322  IndexType chipIndex(IndexType ie, IndexType is, IndexType ir, IndexType ic, IndexType il, IndexType ichip) const {
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 
360  IndexType hvSegmentsPerLayer(IndexType is, IndexType ir) const {
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 
374  IndexType hvSegmentIndex(IndexType is, IndexType ir, IndexType iwire) const;
375 
384  IndexType sectorsPerLayer(IndexType is, IndexType ir) const {
385  return chipsPerLayer(is, ir) * hvSegmentsPerLayer(is, ir);
386  }
387 
401  virtual IndexType sectorStart(IndexType ie, IndexType is, IndexType ir) const = 0;
402 
415  IndexType gasGainIndex(IndexType ie,
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 
473  CSCDetId detIdFromChamberIndex(IndexType ici) const;
474 
481  CSCDetId detIdFromLayerIndex(IndexType ili) const;
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 
531  IndexType chamberLabelFromChamberIndex(IndexType) const;
532 
533 protected:
538  CSCDetId detIdFromChamberLabel(IndexType ie, IndexType icl) const;
539 
545  std::vector<IndexType> chamberLabel_;
546 };
547 
548 #endif
virtual IndexType onlineRingsInStation(IndexType is) const =0
virtual IndexType chipsPerOnlineLayer(IndexType is, IndexType ir) const =0
uint32_t LongIndexType
virtual IndexType stripChannelsPerLayer(IndexType is, IndexType ir) const =0
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
boost::tuple< CSCDetId, IndexType, IndexType > GasGainIndexType
CSCDetId detIdFromChamberIndex(IndexType ici) const
virtual std::pair< CSCDetId, IndexType > detIdFromStripChannelIndex(LongIndexType ichi) const =0
IndexType chambersInRingOfStation(IndexType is, IndexType ir) const
virtual LongIndexType stripChannelStart(IndexType ie, IndexType is, IndexType ir) const =0
virtual LongIndexType maxStripChannelIndex() const =0
IndexType layerIndex(const CSCDetId &id) const
virtual IndexType stripChannelsPerOfflineLayer(IndexType is, IndexType ir) const =0
IndexType maxLayerIndex() const
virtual GasGainIndexType detIdFromGasGainIndex(IndexType igg) const =0
CSCDetId detIdFromChamberLabel(IndexType ie, IndexType icl) const
virtual int dbIndex(const CSCDetId &id, int &channel) 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
virtual IndexType chipsPerLayer(IndexType is, IndexType ir) const =0
IndexType sectorsPerLayer(IndexType is, IndexType ir) const
virtual IndexType stripChannelsPerOnlineLayer(IndexType is, IndexType ir) 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 maxGasGainIndex() const =0
virtual IndexType maxChipIndex() const =0
IndexType chipIndex(IndexType ie, IndexType is, IndexType ir, IndexType ic, IndexType il, IndexType ichip) const
virtual IndexType sectorStart(IndexType ie, IndexType is, IndexType ir) const =0
IndexType chamberLabelFromChamberIndex(IndexType) const
IndexType offlineRingsInStation(IndexType is) const
IndexType chipIndex(IndexType istrip) const
virtual std::pair< CSCDetId, IndexType > detIdFromChipIndex(IndexType ichi) 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
LongIndexType stripChannelIndex(IndexType ie, IndexType is, IndexType ir, IndexType ic, IndexType il, IndexType istrip) const
virtual std::string name() const
virtual IndexType chipStart(IndexType ie, IndexType is, IndexType ir) const =0
IndexType gasGainIndex(IndexType ihvsegment, IndexType ichip, const CSCDetId &id) const
IndexType chamberIndex(const CSCDetId &id) const
virtual ~CSCIndexerBase()
std::vector< IndexType > chamberLabel_