Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:42:10

0001 #ifndef CSCIndexerPostls1_H
0002 #define CSCIndexerPostls1_H
0003 
0004 /** \class CSCIndexerPostls1
0005  * Concrete CSCIndexer class appropriate for CSC Conditions Data access after
0006  * CMS long shutdown 1 (2013-2014) in which most ME4/2 rings are complete and
0007  * the 48 strips in ME1/1A are unganged and so have 48 channels. <br> The
0008  * conditions data are stored in an order based on the hadrware channel order so
0009  * this class has to jump through hoops in order to map between that order and a
0010  * CSCDetID order offline.
0011  *
0012  * See documentation in base class CSCIndexerBase for more information.
0013  *
0014  * \warning This class is hard-wired for the CSC system expected after long
0015  * shutdown 2013-2014 (LS1) of CMS.<br> The basic order is as for startup
0016  * (pre-LS1) with rings ME11, ME12, ME13, ME21, ME22, ME31, ME32, ME41 totalling
0017  * 234 chambers per endcap. Then ME42 is appended, so the chamber order is <br>
0018  * +z ME11, ME12, ME13, ME21, ME22, ME31, ME32, ME41, <br>
0019  * -z ME11, ME12, ME13, ME21, ME22, ME31, ME32, ME41, <br>
0020  * +z ME42, -z ME42 <br>
0021  *
0022  * It is further extended for unganged ME1a strip channels by appending +z ME1a,
0023  * -z ME1a.
0024  *
0025  *  CSCIndexerBase::stripChannelIndex returns <br>
0026  *      1-217728 (CSCs 2008), 217729-252288 (ME42), 252289-273024 (unganged
0027  * ME1a)
0028  *
0029  *  CSCIndexerBase::chipIndex returns <br>
0030  *      1-13608 (CSCs 2008), 13609-15768 (ME42), 15769-17064 (unganged ME1a).
0031  *
0032  *  CSCIndexerBase::gasGainIndex returns <br>
0033  *     1-45144 (CSCs 2008), 45145-55944 (ME42), 55945-57240 (unganged ME1a)
0034  *
0035  * \warning This has "magic numbers galore".
0036  * \warning EVERY LABEL COUNTS FROM ONE NOT ZERO.
0037  *
0038  */
0039 
0040 #include <CalibMuon/CSCCalibration/interface/CSCIndexerBase.h>
0041 
0042 class CSCIndexerPostls1 : public CSCIndexerBase {
0043 public:
0044   ~CSCIndexerPostls1() override;
0045 
0046   std::string name() const override { return "CSCIndexerPostls1"; }
0047 
0048   /// \name maxIndexMethods
0049   //@{
0050   LongIndexType maxStripChannelIndex() const override { return 273024; }
0051   IndexType maxChipIndex() const override { return 17064; }
0052   IndexType maxGasGainIndex() const override { return 57240; }
0053   //@}
0054 
0055   /// \name nonIndexCountingMethods
0056   //@{
0057   /**
0058    * How many online rings are there in station 'is'=1, 2, 3, 4 ?
0059    *
0060    * \warning: ME1a and ME1b are considered as two separate
0061    * 'online' rings for the upgrade
0062    */
0063   IndexType onlineRingsInStation(IndexType is) const override {
0064     const IndexType nrings[5] = {0, 4, 2, 2, 2};
0065     return nrings[is];
0066   }
0067 
0068   /**
0069    * Number of strip readout channels per layer in an offline chamber
0070    * with ring 'ir' and station 'is'.
0071    *
0072    * Assume ME1a has 48 unganged readout channels.
0073    */
0074   IndexType stripChannelsPerOfflineLayer(IndexType is, IndexType ir) const override {
0075     const IndexType nSC[16] = {64, 80, 64, 48, 80, 80, 0, 0, 80, 80, 0, 0, 80, 80, 0, 0};
0076     return nSC[(is - 1) * 4 + ir - 1];
0077   }
0078 
0079   /**
0080    * Number of strip readout channels per layer in an online chamber
0081    * with ring 'ir' and station 'is'.
0082    *
0083    * Assume ME1a has 48 unganged readout channels.
0084    * Online chambers ME1a and ME1b are separate.
0085    */
0086   IndexType stripChannelsPerOnlineLayer(IndexType is, IndexType ir) const override {
0087     const IndexType nSC[16] = {64, 80, 64, 48, 80, 80, 0, 0, 80, 80, 0, 0, 80, 80, 0, 0};
0088     return nSC[(is - 1) * 4 + ir - 1];
0089   }
0090 
0091   /**
0092    * Number of Buckeye chips per layer in an online chamber
0093    * in ring 'ir' of station 'is'.
0094    * Works for ME1a (ring 4 of ME1) too.
0095    *
0096    * 'Online' ME11 for the upgrade is considered as split into 1a and 1b
0097    * chambers with 3 and 4 CFEBs respectively
0098    */
0099   IndexType chipsPerOnlineLayer(IndexType is, IndexType ir) const override {
0100     const IndexType nCinL[16] = {4, 5, 4, 3, 5, 5, 0, 0, 5, 5, 0, 0, 5, 5, 0, 0};
0101     return nCinL[(is - 1) * 4 + ir - 1];
0102   }
0103 
0104   //@}
0105 
0106   /// \name stripIndexMethods
0107   //@{
0108   /**
0109    * Number of strip channel indices for a layer in a chamber
0110    * defined by station number 'is' and ring number 'ir'.
0111    *
0112    * Station label range 1-4, Ring label range 1-4 (4=ME1a)
0113    *
0114    * This depends on the ordering of the channels in the database.
0115    * In the currently implemented upgrade scenario, the ME1b still keeps the
0116    * 80 indices wide ranges inherited from Startup (with the last 65-80 indices
0117    * remaining unused), while the ME1/1A unganged channels get their own 48
0118    * indices wide ranges.
0119    */
0120   IndexType stripChannelsPerLayer(IndexType is, IndexType ir) const override {
0121     const IndexType nSCinC[16] = {80, 80, 64, 48, 80, 80, 0, 0, 80, 80, 0, 0, 80, 80, 0, 0};
0122     return nSCinC[(is - 1) * 4 + ir - 1];
0123   }
0124 
0125   /**
0126    * Linear index for 1st strip channel in ring 'ir' of station 'is' in endcap
0127    * 'ie'.
0128    *
0129    * Endcap label range 1-2, Station label range 1-4, Ring label range 1-4
0130    * (4=ME1a)
0131    *
0132    * WARNING: ME1a channels are  NOT  considered the last 16 of the 80 total in
0133    * each layer of an ME11 chamber!
0134    */
0135   LongIndexType stripChannelStart(IndexType ie, IndexType is, IndexType ir) const override {
0136     // These are in the ranges 1-217728 (CSCs 2008), 217729-252288 (ME42), and
0137     // 252289-273024 (unganged ME1a) There are 1-108884 channels per endcap
0138     // (CSCs 2008), 17280 channels per endcap (ME42), and 10368 channels per
0139     // endcap (unganged ME1a) Start of -z channels (CSCs 2008) is 108864 + 1 =
0140     // 108865 Start of +z (ME42) is 217728 + 1                  = 217729 Start
0141     // of -z (ME42) is 217728 + 1 + 17280          = 235009 Start of +z
0142     // (unganged ME1a) is 252288 + 1         = 252289 Start of -z (unganged
0143     // ME1a) is 252288 + 1 + 10368 = 262657
0144     const LongIndexType nStart[32] = {1, 17281,  34561,  252289, 48385, 57025,  0,      0,      74305,  82945,  0,
0145                                       0, 100225, 217729, 0,      0,     108865, 126145, 143425, 262657, 157249, 165889,
0146                                       0, 0,      183169, 191809, 0,     0,      209089, 235009, 0,      0};
0147     return nStart[(ie - 1) * 16 + (is - 1) * 4 + ir - 1];
0148   }
0149   //@}
0150 
0151   /// \name chipIndexMethods
0152   //@{
0153   /**
0154    * Number of Buckeye chips indices per layer in a chamber
0155    * in offline ring 'ir' of station 'is'.
0156    *
0157    * Station label range 1-4, Ring label range 1-4 (4=ME1a)
0158    *
0159    * Works for ME1a input as is=1, ir=4
0160    * Considers ME42 as standard 5 chip per layer chambers.
0161    *
0162    * WARNING:
0163    * - ME1a channels are considered to be unganged and have their own 3 chips
0164    * (ME1b has 4 chips).
0165    * - ME1b keeps 5 chips for the indexing purposes, however indices for the
0166    * chip #5 are ignored in the unganged case.
0167    */
0168   IndexType chipsPerLayer(IndexType is, IndexType ir) const override {
0169     const IndexType nCinL[16] = {5, 5, 4, 3, 5, 5, 0, 0, 5, 5, 0, 0, 5, 5, 0, 0};
0170     return nCinL[(is - 1) * 4 + ir - 1];
0171   }
0172 
0173   /**
0174    * Linear index for 1st Buckeye chip in offline ring 'ir' of station 'is' in
0175    * endcap 'ie'.
0176    *
0177    * Endcap label range 1-2, Station label range 1-4, Ring label range 1-4
0178    * (4=ME1a) Works for ME1a input as is=1, ir=4
0179    *
0180    * \warning: ME1a chips are the last 3 of the 7 chips total in each layer of
0181    * an ME11 chamber,
0182    */
0183   IndexType chipStart(IndexType ie, IndexType is, IndexType ir) const override {
0184     // These are in the ranges 1-13608 (CSCs 2008) and 13609-15768 (ME42) and
0185     // 15769-17064 (ME1a). There are 1-6804 chips per endcap (CSCs 2008) and
0186     // 1080 chips per endcap (ME42) and 648 chips per endcap (ME1a). Start of -z
0187     // channels (CSCs 2008) is 6804 + 1 = 6805 Start of +z (ME42) is 13608 + 1 =
0188     // 13609 Start of -z (ME42) is 13608 + 1 + 1080 = 14689 Start of +z (ME1a)
0189     // is 15768 + 1 = 15769 Start of -z (ME1a) is 15768 + 1 + 648 = 16417
0190     const IndexType nStart[32] = {1,    1081, 2161, 15769, 3025, 3565,  0, 0, 4645,  5185,  0, 0, 6265,  13609, 0, 0,
0191                                   6805, 7885, 8965, 16417, 9829, 10369, 0, 0, 11449, 11989, 0, 0, 13069, 14689, 0, 0};
0192     return nStart[(ie - 1) * 16 + (is - 1) * 4 + ir - 1];
0193   }
0194   //@}
0195 
0196   /// \name gasGainIndexMethods
0197   //@{
0198   /**
0199    * Linear index for 1st Gas gain sector in ring 'ir' of station 'is' in endcap
0200    * 'ie'.
0201    *
0202    * Endcap label range 1-2, Station label range 1-4, Ring label range 1-4
0203    * (4=ME1a)
0204    *
0205    * \warning:  unganged ME1a has 3 own chips, which are currently appended to
0206    * the end of the index range, ME1b still keeps 5 chips with the chip #5 index
0207    * being unused.
0208    */
0209   IndexType sectorStart(IndexType ie, IndexType is, IndexType ir) const override {
0210     // There are 36 chambers * 6 layers * 5 CFEB's * 1 HV segment = 1080
0211     // gas-gain sectors in ME1/1 (non-upgraded) There are 36 chambers * 6 layers
0212     // * 3 CFEB's * 1 HV segment = 648 gas-gain sectors in ME1/1a (upgraded)
0213     // There are 36*6*5*3 = 3240 gas-gain sectors in ME1/2
0214     // There are 36*6*4*3 = 2592 gas-gain sectors in ME1/3
0215     // There are 18*6*5*3 = 1620 gas-gain sectors in ME[2-4]/1
0216     // There are 36*6*5*5 = 5400 gas-gain sectors in ME[2-4]/2
0217     // Start of -z channels (CSCs 2008) is 22572 + 1 = 22573
0218     // Start of +z (ME42) is 45144 + 1 = 45145
0219     // Start of -z (ME42) is 45144 + 1 + 5400 = 50545
0220     // Start of +z (ME1a) is 45144 + 1 + 2*5400 = 55945
0221     // Start of -z (ME42) is 45144 + 1 + 2*5400 + 648 = 56593
0222     const IndexType nStart[32] = {1,     1081,  4321,  55945,  // ME+1/1,ME+1/2,ME+1/3,ME+1/a
0223                                   6913,  8533,  0,     0,      // ME+2/1,ME+2/2
0224                                   13933, 15553, 0,     0,      // ME+3/1,ME+3/2
0225                                   20953, 45145, 0,     0,      // ME+4/1,ME+4/2 (note, ME+4/2 index follows ME-4/1...)
0226                                   22573, 23653, 26893, 56593,  // ME-1/1,ME-1/2,ME-1/3,ME+1/a
0227                                   29485, 31105, 0,     0,      // ME-2/1,ME-2/2
0228                                   36505, 38125, 0,     0,      // ME-3/1,ME-3/2
0229                                   43525, 50545, 0,     0};     // ME-4/1,ME-4/2 (note, ME-4/2 index follows ME+4/2...)
0230     return nStart[(ie - 1) * 16 + (is - 1) * 4 + ir - 1];
0231   }
0232   //@}
0233 
0234   /**
0235    *  Decode CSCDetId from various indexes and labels
0236    */
0237   std::pair<CSCDetId, IndexType> detIdFromStripChannelIndex(LongIndexType ichi) const override;
0238   std::pair<CSCDetId, IndexType> detIdFromChipIndex(IndexType ichi) const override;
0239   CSCIndexerBase::GasGainIndexType detIdFromGasGainIndex(IndexType igg) const override;
0240 
0241   /**
0242    * Build index used internally in online CSC conditions databases (the 'Igor
0243    * Index')
0244    *
0245    * This is the decimal integer ie*100000 + is*10000 + ir*1000 + ic*10 + il
0246    * <br> (ie=1-2, is=1-4, ir=1-4, ic=1-36, il=1-6) <br> Channels 1-16 in ME1A
0247    * (is=1, ir=4) are NOT reset to channels 65-80 of ME11. WARNING: This is now
0248    * ADAPTED for unganged ME1a channels (we expect that the online conditions DB
0249    * will adopt it too).
0250    */
0251   int dbIndex(const CSCDetId &id, int &channel) const override;
0252 };
0253 
0254 #endif