Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:10:33

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