Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:38

0001 #ifndef DataFormats_L1Trigger_HOTPDigiTwinMux_h
0002 #define DataFormats_L1Trigger_HOTPDigiTwinMux_h
0003 
0004 #include <ostream>
0005 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
0006 #include <cstdint>
0007 
0008 /** \class HOTPDigiTwinMux
0009   *  Simple container packer/unpacker for HO TriggerPrimittive in TwinMUX
0010   *  Trigger Primitive from HO HTR
0011   *
0012   *  \author Saxena, Pooja - DESY
0013   */
0014 
0015 class HOTPDigiTwinMux {
0016 public:
0017   typedef HcalDetId key_type;  /// For the sorted collection
0018 
0019   HOTPDigiTwinMux() { theTP_HO = 0; }
0020   HOTPDigiTwinMux(uint64_t data) { theTP_HO = data; }
0021 
0022   /// ////////////////////////////
0023   /// Summary of the bits
0024   /// ////////////////////////////
0025   /// raw ieta value = theTP_HO &0 0x1F
0026   /// sign of ieta (int: +/- 1) = (theTP_HO &0 0x10)?(-1):(+1))
0027   /// absolute value of ieta = (theTP_HO &0 0x000F)
0028   /// raw iphi value = (theTP_HO>>5) &0 0x007F;
0029   /// bx() = (theTP_HO>>12) &0 0x1;
0030   /// bx signn = ( ( (theTP_HO>>13) &0 0x1) ?(-1):(+1));
0031   /// mip value = (theTP_HO>>14) &0 0x1;
0032   /// valid bit = (theTP_HO>>15) &0 0x1;
0033   /// raw wheel value = (theTP_HO>>16) &0 0x7;
0034   /// sign of wheel (int: +/- 1) =  ( ( (theTP_HO>>18) &0 0x1) ?(-1):(+1));
0035   /// absolute value of wheel = (theTP_HO>>16) &0 0x03;
0036   /// sector value = (theTP_HO>>19) &0 0xF;
0037   /// index = (theTP_HO>>23) &0 0x1F;
0038   /// link value = (theTP_HO>>28) &0 0x3;
0039 
0040   HOTPDigiTwinMux(int ieta, int iphi, int bx, int mip, int validbit, int wheel, int sector, int index, int link);
0041 
0042   const HcalDetId id() const { return HcalDetId(HcalOuter, ieta(), iphi(), 4); }
0043 
0044   /// get raw packed HO
0045   uint64_t raw() const { return theTP_HO; }
0046 
0047   /// get the raw ieta value
0048   int raw_ieta() const { return theTP_HO & 0x1F; }
0049 
0050   /// get the sign of ieta (int: +/- 1)
0051   int ieta_sign() const { return ((theTP_HO & 0x10) ? (-1) : (+1)); }
0052 
0053   /// get the absolute value of ieta
0054   int ieta_abs() const { return (theTP_HO & 0x000F); }
0055 
0056   /// get the signed ieta value
0057   int ieta() const { return (ieta_abs() * ieta_sign()); }
0058 
0059   /// get the raw iphi value
0060   int iphi() const { return (theTP_HO >> 5) & 0x007F; }
0061 
0062   /// get the bx()
0063   int bx_abs() const { return (theTP_HO >> 12) & 0x1; }
0064 
0065   /// get the bx sign
0066   //  int bx_sign() const {return ( ( (theTP_HO>>13)&0x2000) ?(-1):(+1)); }
0067   int bx_sign() const { return (((theTP_HO >> 13) & 0x1) ? (-1) : (+1)); }
0068 
0069   //get bx
0070   int bx() const { return (bx_abs() * bx_sign()); }
0071 
0072   /// get the mip value
0073   int mip() const { return (theTP_HO >> 14) & 0x1; }
0074 
0075   /// get the valid bit
0076   int validbit() const { return (theTP_HO >> 15) & 0x1; }  //MIP consistency check with HO FEDs
0077 
0078   /// get the raw wheel value
0079   int raw_wheel() const { return (theTP_HO >> 16) & 0x7; }
0080 
0081   /// get the sign of wheel (int: +/- 1)
0082   int wheel_sign() const { return (((theTP_HO >> 18) & 0x1) ? (-1) : (+1)); }
0083 
0084   /// get the absolute value of wheel
0085   int wheel_abs() const { return (theTP_HO >> 16) & 0x03; }
0086 
0087   /// get the signed wheel value
0088   int wheel() const { return (wheel_abs() * wheel_sign()); }
0089 
0090   /// get the sector value
0091   int sector() const { return (theTP_HO >> 19) & 0xF; }
0092 
0093   /// get the index
0094   int index() const { return (theTP_HO >> 23) & 0x1F; }  //channel index in Twinmux protocal
0095 
0096   /// get the link value
0097   int link() const { return (theTP_HO >> 28) & 0x3; }  //two link for all HO wheels
0098 
0099   static const int HO_SECTOR_MAX = 12;
0100 
0101 private:
0102   uint64_t theTP_HO;
0103 };
0104 
0105 std::ostream& operator<<(std::ostream&, const HOTPDigiTwinMux&);
0106 
0107 #endif