test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCIndexerBase.h
Go to the documentation of this file.
1 #ifndef CSCIndexerBase_H
2 #define CSCIndexerBase_H
3 
51 #include <vector>
52 #include <utility> // for pair
53 #include <boost/tuple/tuple.hpp>
54 
56 {
57 public:
58 
59  typedef uint16_t IndexType;
60  typedef uint32_t LongIndexType;
61  typedef boost::tuple<CSCDetId, // id
62  IndexType, // HV segment
63  IndexType // chip
65 
67  virtual ~CSCIndexerBase();
68 
69  virtual std::string name() const { return "CSCIndexerBase"; }
70 
78  IndexType maxChamberIndex() const { return 540; }
79  IndexType maxLayerIndex() const { return 3240; }
80  virtual LongIndexType maxStripChannelIndex() const = 0;
81  virtual IndexType maxChipIndex() const = 0;
82  virtual IndexType maxGasGainIndex() const = 0;
84 
85 
87 
88 
92  {
93  const IndexType nrins[5] = {0, 3, 2, 2, 2}; // physical rings per station
94  return nrins[is];
95  }
96 
100  virtual IndexType onlineRingsInStation( IndexType is ) const = 0;
101 
109  {
110  const IndexType nrings[5] = { 0, 4, 2, 2, 2 }; // offline rings per station
111  return nrings[is];
112  }
113 
119  {
120  const IndexType nCinR[16] = { 36,36,36,36, 18,36,0,0, 18,36,0,0, 18,36,0,0 }; // chambers in ring
121  return nCinR[(is - 1)*4 + ir - 1];
122  }
123 
129  virtual IndexType stripChannelsPerOfflineLayer( IndexType is, IndexType ir ) const = 0;
130 
136  virtual IndexType stripChannelsPerOnlineLayer( IndexType is, IndexType ir ) const = 0;
137 
143  virtual IndexType chipsPerOnlineLayer( IndexType is, IndexType ir ) const = 0;
144 
154  {
155  return chipsPerOnlineLayer(is, ir) * hvSegmentsPerLayer(is, ir);
156  }
157 
159 
160 
162 
163 
171  {
172  const IndexType nschin[32] =
173  { 1,37,73,1, 109,127,0,0, 163,181,0,0, 217,469,0,0,
174  235,271,307,235, 343,361,0,0, 397,415,0,0, 451,505,0,0 };
175  return nschin[(ie - 1)*16 + (is - 1)*4 + ir - 1];
176  }
177 
187  {
188  return startChamberIndexInEndcap(ie, is, ir) + ic - 1; // -1 so start index _is_ ic=1
189  }
190 
201  IndexType chamberIndex( const CSCDetId& id ) const
202  {
203  return chamberIndex( id.endcap(), id.station(), id.ring(), id.chamber() );
204  }
206 
207 
209 
210 
219  {
220  const IndexType layersInChamber = 6;
221  return (chamberIndex(ie, is, ir, ic) - 1 ) * layersInChamber + il;
222  }
223 
234  IndexType layerIndex(const CSCDetId& id) const
235  {
236  return layerIndex(id.endcap(), id.station(), id.ring(), id.chamber(), id.layer());
237  }
239 
240 
242 
243 
258  virtual IndexType stripChannelsPerLayer( IndexType is, IndexType ir ) const = 0;
259 
265  virtual LongIndexType stripChannelStart( IndexType ie, IndexType is, IndexType ir ) const = 0;
266 
274  {
275  return stripChannelStart(ie, is, ir)
276  + ( (ic - 1)*6 + il - 1 ) * stripChannelsPerLayer(is, ir)
277  + (istrip - 1);
278  }
279 
286  {
287  return stripChannelIndex(id.endcap(), id.station(), id.ring(), id.chamber(), id.layer(), istrip );
288  }
290 
291 
293 
294 
299  virtual IndexType chipsPerLayer( IndexType is, IndexType ir ) const = 0;
300 
306  virtual IndexType chipStart( IndexType ie, IndexType is, IndexType ir ) const = 0;
307 
317  {
318  return chipStart(ie, is, ir)
319  + ( (ic - 1)*6 + il - 1 ) * chipsPerLayer(is, ir)
320  + (ichip - 1);
321  }
322 
331  IndexType chipIndex( const CSCDetId& id, IndexType ichip ) const
332  {
333  return chipIndex(id.endcap(), id.station(), id.ring(), id.chamber(), id.layer(), ichip );
334  }
335 
344  IndexType chipIndex( IndexType istrip ) const
345  {
346  return (istrip - 1)/16 + 1;
347  }
349 
350 
352 
353 
361  {
362  const IndexType nSinL[16] = { 1,3,3,1, 3,5,0,0, 3,5,0,0, 3,5,0,0 };
363  return nSinL[(is - 1) * 4 + ir - 1];
364  }
365 
374  IndexType hvSegmentIndex(IndexType is, IndexType ir, IndexType iwire ) const;
375 
384  {
385  return chipsPerLayer(is, ir) * hvSegmentsPerLayer(is, ir);
386  }
387 
399  virtual IndexType sectorStart( IndexType ie, IndexType is, IndexType ir ) const = 0;
400 
412  IndexType ihvsegment, IndexType ichip ) const
413  {
414  return sectorStart(ie,is,ir)
415  + ( (ic-1)*6 + il - 1 ) * sectorsPerLayer(is,ir)
416  + (ihvsegment - 1) * chipsPerLayer(is,ir)
417  + (ichip - 1);
418  }
419 
428  IndexType gasGainIndex( const CSCDetId& id, IndexType istrip, IndexType iwire ) const
429  {
430  return gasGainIndex( id.endcap(), id.station(), id.ring(), id.chamber(), id.layer(),
431  hvSegmentIndex( id.station(), id.ring(), iwire ),
432  chipIndex(istrip) );
433  }
434 
447  IndexType gasGainIndex( IndexType ihvsegment, IndexType ichip, const CSCDetId& id ) const
448  {
449  return gasGainIndex(id.endcap(), id.station(), id.ring(), id.chamber(), id.layer(), ihvsegment, ichip);
450  }
452 
453 
456 
457 
463 
470 
478  virtual std::pair<CSCDetId, IndexType> detIdFromStripChannelIndex( LongIndexType ichi ) const = 0;
479 
487  virtual std::pair<CSCDetId, IndexType> detIdFromChipIndex( IndexType ichi ) const = 0;
488 
496  virtual GasGainIndexType detIdFromGasGainIndex( IndexType igg ) const = 0;
497 
499 
500 
509  virtual int dbIndex(const CSCDetId & id, int & channel) const = 0;
510 
511 
517 
518 protected:
519 
525 
530  std::vector<IndexType> chamberLabel_;
531 };
532 
533 #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
boost::tuple< CSCDetId, IndexType, IndexType > GasGainIndexType
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
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
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_