Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:14

0001 #ifndef DATAFORMATS_ECALDETID_ECALTRIGGERELECTRONICSID_H
0002 #define DATAFORMATS_ECALDETID_ECALTRIGGERELECTRONICSID_H 1
0003 
0004 #include <ostream>
0005 #include <cstdint>
0006 
0007 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
0008 
0009 /** \brief Ecal trigger electronics identification
0010     [32:20] Unused (so far)
0011     [19:13]  TCC id
0012     [12:6]   TT id
0013     [5:3]    pseudo strip (in EB == strip)
0014     [2:0]    channel in pseudostrip 
0015     Index starts from 1
0016  */
0017 
0018 class EcalTriggerElectronicsId {
0019 public:
0020   /** Default constructor -- invalid value */
0021   EcalTriggerElectronicsId();
0022   /** from raw */
0023   EcalTriggerElectronicsId(uint32_t);
0024   /** Constructor from tcc,tt,pseudostrip,channel **/
0025   EcalTriggerElectronicsId(int tccid, int towerid, int pseudostripid, int channelid);
0026 
0027   uint32_t operator()() { return EcalTriggerElectronicsId_; }
0028   uint32_t rawId() const { return EcalTriggerElectronicsId_; }
0029 
0030   /// get the DCC (Ecal Local DCC value not global one) id
0031   int tccId() const { return (EcalTriggerElectronicsId_ >> 13) & 0x7F; }
0032   /// get the tower id
0033   int ttId() const { return (EcalTriggerElectronicsId_ >> 6) & 0x7F; }
0034   /// get the tower id
0035   int pseudoStripId() const { return (EcalTriggerElectronicsId_ >> 3) & 0x7; }
0036   /// get the channel id
0037   int channelId() const { return (EcalTriggerElectronicsId_ & 0x7); }
0038   /// get a fast, compact, unique index for linear lookups (maximum value = 1048575)
0039   int linearIndex() const { return (EcalTriggerElectronicsId_)&0xFFFFF; }
0040 
0041   /// get the zside() +1 / -1
0042   int zside() const;
0043 
0044   /// get the subdet
0045   EcalSubdetector subdet() const;
0046 
0047   static const int MAX_TCCID = 108;  //To be updated with correct and final number
0048   static const int MIN_TCCID = 1;
0049   static const int MAX_TTID = 68;
0050   static const int MIN_TTID = 1;
0051   static const int MAX_PSEUDOSTRIPID = 5;
0052   static const int MIN_PSEUDOSTRIPID = 1;
0053   static const int MAX_CHANNELID = 5;
0054   static const int MIN_CHANNELID = 1;
0055 
0056   static const int MIN_TCCID_EEM = 1;
0057   static const int MAX_TCCID_EEM = 36;
0058   static const int MIN_TCCID_EBM = 37;
0059   static const int MAX_TCCID_EBM = 54;
0060   static const int MIN_TCCID_EBP = 55;
0061   static const int MAX_TCCID_EBP = 72;
0062   static const int MIN_TCCID_EEP = 73;
0063   static const int MAX_TCCID_EEP = 108;
0064 
0065   static const int TCCID_PHI0_EEM_IN = 1;    // id of the inner TCC in EE- which contains phi=0 deg.
0066   static const int TCCID_PHI0_EEM_OUT = 19;  // id of the outer TCC in EE- which contains phi=0 deg.
0067   static const int TCCID_PHI0_EEP_IN = 91;   // id of the inner TCC in EE+ which contains phi=0 deg.
0068   static const int TCCID_PHI0_EEP_OUT = 73;  // id of the outer TCC in EE+ which contains phi=0 deg.
0069   static const int TCCID_PHI0_EBM = 37;      // id of the TCC in EB- which contains phi=0 deg.
0070   static const int TCCID_PHI0_EBP = 55;      // id of the TCC in EB+ which contains phi=0 deg.
0071 
0072   /** Equality operator */
0073   int operator==(const EcalTriggerElectronicsId& id) const {
0074     return id.EcalTriggerElectronicsId_ == EcalTriggerElectronicsId_;
0075   }
0076   /** Non-Equality operator */
0077   int operator!=(const EcalTriggerElectronicsId& id) const {
0078     return id.EcalTriggerElectronicsId_ != EcalTriggerElectronicsId_;
0079   }
0080   /// Compare the id to another id for use in a map
0081   int operator<(const EcalTriggerElectronicsId& id) const {
0082     return EcalTriggerElectronicsId_ < id.EcalTriggerElectronicsId_;
0083   }
0084 
0085 private:
0086   uint32_t EcalTriggerElectronicsId_;
0087 };
0088 
0089 std::ostream& operator<<(std::ostream&, const EcalTriggerElectronicsId&);
0090 
0091 #endif