Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 #ifndef DataFormats_HcalDetId_HcalDcsDetId_h
0003 #define DataFormats_HcalDetId_HcalDcsDetId_h
0004 
0005 #include <iosfwd>
0006 //#include <string>
0007 #include "DataFormats/HcalDetId/interface/HcalOtherDetId.h"
0008 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
0009 
0010 /** \class HcalDcsDetId
0011 
0012 for use to identify HcalDcsChannels
0013 
0014 bit packing
0015 [31:28] from DetId to identify detector (Hcal)
0016 [27:25] from DetId to identify subdetector (HcalOther)
0017 [24:20] other subdet id
0018 [19:19] zside +/-
0019 [18:17] HO ring (not important in other subdets)
0020 [16:12] Slice (phi slice for HB HE, Sector for HO, Quadrant for HF)
0021 [11:8]  Type from the DCSType list
0022 [7:4]   sub-channel a number to identify the channel can be from 0 to 15
0023 [3:0]   still open
0024 
0025  */
0026 
0027 class HcalDcsDetId : public HcalOtherDetId {
0028 public:
0029   enum DcsType {
0030     HV = 1,
0031     BV = 2,
0032     CATH = 3,
0033     DYN7 = 4,
0034     DYN8 = 5,
0035     RM_TEMP = 6,
0036     CCM_TEMP = 7,
0037     CALIB_TEMP = 8,
0038     LVTTM_TEMP = 9,
0039     TEMP = 10,
0040     QPLL_LOCK = 11,
0041     STATUS = 12,
0042     DCSUNKNOWN = 15,
0043     DCS_MAX = 16
0044   };
0045 
0046   HcalDcsDetId();
0047   HcalDcsDetId(uint32_t rawid);
0048   HcalDcsDetId(const DetId& id);
0049   HcalDcsDetId(HcalOtherSubdetector subd, int side_or_ring, unsigned int slc, DcsType ty, unsigned int subchan);
0050 
0051   static DcsType DcsTypeFromString(const std::string& str);
0052   static std::string typeString(DcsType typ);
0053 
0054   int zside() const { return (((id_ >> kSideOffset) & 0x1) ? 1 : -1); }
0055   int ring() const { return zside() * ((id_ >> kRingOffset) & 0x3); }
0056   int slice() const { return ((id_ >> kSliceOffset) & 0x1F); }
0057   DcsType type() const { return DcsType((id_ >> kTypeOffset) & 0xF); }
0058   int subchannel() const { return ((id_ >> kSubChannelOffset) & 0xF); }
0059 
0060   static const int maxLinearIndex = 0x16800;
0061 
0062 protected:
0063   static unsigned int const kSideOffset = 19;
0064   static unsigned int const kRingOffset = 17;
0065   static unsigned int const kSliceOffset = 12;
0066   static unsigned int const kTypeOffset = 8;
0067   static unsigned int const kSubChannelOffset = 4;
0068 };
0069 
0070 std::ostream& operator<<(std::ostream&, const HcalDcsDetId& id);
0071 
0072 #endif