Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-08-09 03:14:58

0001 #ifndef DataFormats_ForwardDetId_HGCalTriggerModuleDetId_H
0002 #define DataFormats_ForwardDetId_HGCalTriggerModuleDetId_H 1
0003 
0004 #include "DataFormats/DetId/interface/DetId.h"
0005 #include "DataFormats/ForwardDetId/interface/HGCalTriggerBackendCommon.h"
0006 #include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h"
0007 
0008 /* \brief description of the bit assigment
0009    [0:3]  u-coordinate of the silicon module (u-axis points along -x axis)
0010           or eta-coordinate of the scintillator module
0011    [4:7]  v-coordinate of the silicon module (v-axis points 60-degree wrt x-axis)
0012           or phi-coordinate of the scintillator module
0013    [8:9] sector (0,1,2 counter-clockwise from u-axis)
0014 
0015    [10:13] reserved for future use
0016 
0017    [14:18] layer number 
0018    [19:20] Type (0 fine divisions of wafer with 120 mum thick silicon
0019                  1 coarse divisions of wafer with 200 mum thick silicon
0020                  2 coarse divisions of wafer with 300 mum thick silicon
0021                  0 fine divisions of scintillators
0022                  1 coarse divisions of scintillators)
0023 
0024    [21:21] z-side (0 for +z; 1 for -z)
0025    [22:23] Trigger Subdetector Type(HGCEE/HGCHEF/HGCHEB/HFNose) 
0026    [24:24] Class identifier (0 for HGCalTriggerModuleDetID, 1 for HGCalTriggerBackendDetID)
0027    [25:27] Subdetector Type (HGCTrigger)
0028    [28:31] Detector type (Forward)
0029 */
0030 
0031 class HGCalTriggerModuleDetId : public DetId {
0032 public:
0033   /** Create a null module id*/
0034   HGCalTriggerModuleDetId();
0035   /** Create module id from raw id (0=invalid id) */
0036   HGCalTriggerModuleDetId(uint32_t rawid);
0037   /** Constructor from subdetector, zplus, type, layer, sector, module numbers */
0038   HGCalTriggerModuleDetId(
0039       HGCalTriggerSubdetector subdet, int zp, int type, int layer, int sector, int moduleU, int moduleV);
0040   /** Constructor from a generic det id */
0041   HGCalTriggerModuleDetId(const DetId& id);
0042   /** Assignment from a generic det id */
0043   HGCalTriggerModuleDetId& operator=(const DetId& id);
0044 
0045   /// get the trigger sub-detector
0046   int triggerSubdetId() const { return (id_ >> kHGCalTriggerSubdetOffset) & kHGCalTriggerSubdetMask; }
0047 
0048   /// get the class
0049   int classId() const { return (id_ >> kHGCalTriggerClassIdentifierOffset) & kHGCalTriggerClassIdentifierMask; }
0050 
0051   /// get the type
0052   int type() const { return (id_ >> kHGCalTypeOffset) & kHGCalTypeMask; }
0053 
0054   /// get the z-side of the module (1/-1)
0055   int zside() const { return ((id_ >> kHGCalZsideOffset) & kHGCalZsideMask ? -1 : 1); }
0056 
0057   /// get the layer #
0058   int layer() const { return (id_ >> kHGCalLayerOffset) & kHGCalLayerMask; }
0059 
0060   /// get the sector #
0061   int sector() const { return (id_ >> kHGCalSectorOffset) & kHGCalSectorMask; }
0062 
0063   /// get the module U
0064   int moduleU() const { return (id_ >> kHGCalModuleUOffset) & kHGCalModuleUMask; }
0065 
0066   /// get the module V
0067   int moduleV() const { return (id_ >> kHGCalModuleVOffset) & kHGCalModuleVMask; }
0068 
0069   /// get the scintillator panel eta
0070   int eta() const { return moduleU(); }
0071 
0072   /// get the scintillator panel phi
0073   int phi() const { return moduleV(); }
0074 
0075   /// consistency check : no bits left => no overhead
0076   bool isHFNose() const { return (triggerSubdetId() == HFNoseTrigger); }
0077   bool isEE() const { return (triggerSubdetId() == HGCalEETrigger); }
0078   bool isHSilicon() const { return (triggerSubdetId() == HGCalHSiTrigger); }
0079   bool isHScintillator() const { return (triggerSubdetId() == HGCalHScTrigger); }
0080   bool isForward() const { return true; }
0081   bool isHGCTrigger() const { return true; }
0082   bool isHGCalModuleDetId() const { return (classId() == HGCalTriggerClassIdentifier::ModuleDetId); }
0083   bool isHGCalBackendDetId() const { return (classId() == HGCalTriggerClassIdentifier::BackendDetId); }
0084 
0085   static const HGCalTriggerModuleDetId Undefined;
0086 
0087   static const int kHGCalModuleUOffset = 0;
0088   static const int kHGCalModuleUMask = 0xF;
0089   static const int kHGCalModuleVOffset = 4;
0090   static const int kHGCalModuleVMask = 0xF;
0091   static const int kHGCalSectorOffset = 8;
0092   static const int kHGCalSectorMask = 0x3;
0093   static const int kHGCalLayerOffset = 14;
0094   static const int kHGCalLayerMask = 0x1F;
0095   static const int kHGCalTypeOffset = 19;
0096   static const int kHGCalTypeMask = 0x3;
0097   static const int kHGCalZsideOffset = 24;
0098   static const int kHGCalZsideMask = 0x1;
0099   static const int kHGCalTriggerSubdetOffset = 22;
0100   static const int kHGCalTriggerSubdetMask = 0x3;
0101   static const int kHGCalTriggerClassIdentifierOffset = 24;
0102   static const int kHGCalTriggerClassIdentifierMask = 0x1;
0103 };
0104 
0105 std::ostream& operator<<(std::ostream&, const HGCalTriggerModuleDetId& id);
0106 
0107 #endif