Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-10 02:58:36

0001 #ifndef DATAFORMATS_ECALDETID_ECALELECTRONICSID_H
0002 #define DATAFORMATS_ECALDETID_ECALELECTRONICSID_H 1
0003 
0004 #include <ostream>
0005 #include <cstdint>
0006 
0007 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
0008 
0009 /** \brief Ecal readout channel identification
0010     [32:20] Unused (so far)
0011     [19:13]  DCC id
0012     [12:6]   tower
0013     [5:3]    strip
0014     [2:0]    xtal
0015     Index starts from 1
0016  */
0017 
0018 class EcalElectronicsId {
0019 public:
0020   /** Default constructor -- invalid value */
0021   EcalElectronicsId();
0022   /** from raw */
0023   EcalElectronicsId(uint32_t);
0024   /** Constructor from dcc,tower,channel **/
0025   EcalElectronicsId(int dccid, int towerid, int stripid, int xtalid);
0026 
0027   uint32_t operator()() { return EcalElectronicsId_; }
0028   uint32_t rawId() const { return EcalElectronicsId_; }
0029 
0030   /// get the DCC (Ecal Local DCC value not global one) id
0031   int dccId() const { return (EcalElectronicsId_ >> 13) & 0x7F; }
0032   /// get the tower id
0033   int towerId() const { return (EcalElectronicsId_ >> 6) & 0x7F; }
0034   /// get the tower id
0035   int stripId() const { return (EcalElectronicsId_ >> 3) & 0x7; }
0036   /// get the channel id
0037   int xtalId() const { return (EcalElectronicsId_ & 0x7); }
0038 
0039   /// zside = +1 or -1
0040   int zside() const;
0041 
0042   /// get the subdet
0043   EcalSubdetector subdet() const;
0044 
0045   /// get a fast, compact, unique index for linear lookups (maximum value = 4194303)
0046   int linearIndex() const { return (EcalElectronicsId_) & 0x3FFFFF; }
0047 
0048   /// so far for EndCap only :
0049   int channelId() const;  // xtal id between 1 and 25
0050 
0051   static const int MAX_DCCID = 54;  //To be updated with correct and final number
0052   static const int MIN_DCCID = 1;
0053   static const int MAX_TOWERID = 70;
0054   static const int MIN_TOWERID = 1;
0055   static const int MAX_STRIPID = 5;
0056   static const int MIN_STRIPID = 1;
0057   static const int MAX_CHANNELID = 25;
0058   static const int MIN_CHANNELID = 1;
0059   static const int MAX_XTALID = 5;
0060   static const int MIN_XTALID = 1;
0061 
0062   static const int MIN_DCCID_EEM = 1;
0063   static const int MAX_DCCID_EEM = 9;
0064   static const int MIN_DCCID_EBM = 10;
0065   static const int MAX_DCCID_EBM = 27;
0066   static const int MIN_DCCID_EBP = 28;
0067   static const int MAX_DCCID_EBP = 45;
0068   static const int MIN_DCCID_EEP = 46;
0069   static const int MAX_DCCID_EEP = 54;
0070 
0071   static const int DCCID_PHI0_EBM = 10;
0072   static const int DCCID_PHI0_EBP = 28;
0073 
0074   static const int kDCCChannelBoundary = 17;
0075   static const int DCC_EBM = 10;  // id of the DCC in EB- which contains phi=0 deg.
0076   static const int DCC_EBP = 28;  // id of the DCC in EB+ which contains phi=0 deg.
0077   static const int DCC_EEM = 1;   // id of the DCC in EE- which contains phi=0 deg.
0078   static const int DCC_EEP = 46;  // id of the DCC in EE+ which contains phi=0 deg.
0079 
0080   /** Equality operator */
0081   int operator==(const EcalElectronicsId& id) const { return id.EcalElectronicsId_ == EcalElectronicsId_; }
0082   /** Non-Equality operator */
0083   int operator!=(const EcalElectronicsId& id) const { return id.EcalElectronicsId_ != EcalElectronicsId_; }
0084   /// Compare the id to another id for use in a map
0085   int operator<(const EcalElectronicsId& id) const { return EcalElectronicsId_ < id.EcalElectronicsId_; }
0086 
0087 private:
0088   uint32_t EcalElectronicsId_;
0089 };
0090 
0091 std::ostream& operator<<(std::ostream&, const EcalElectronicsId&);
0092 
0093 #endif