Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef DATAFORMATS_HCALDETID_HCALTRIGTOWERDETID_H
0002 #define DATAFORMATS_HCALDETID_HCALTRIGTOWERDETID_H 1
0003 
0004 #include <ostream>
0005 #include "DataFormats/DetId/interface/DetId.h"
0006 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
0007 
0008 /** \class HcalTrigTowerDetId
0009     
0010 Cell id for an Calo Trigger tower
0011 
0012    \author J. Mans - Minnesota
0013 */
0014 class HcalTrigTowerDetId : public DetId {
0015 public:
0016   static const int kHcalPhiMask = 0x7F;
0017   static const int kHcalEtaOffset = 7;
0018   static const int kHcalEtaMask = 0x3F;
0019   static const int kHcalZsideMask = 0x2000;
0020   static const int kHcalDepthOffset = 14;
0021   static const int kHcalDepthMask = 0x7;
0022   static const int kHcalVersOffset = 17;
0023   static const int kHcalVersMask = 0x7;
0024 
0025 public:
0026   /** Constructor of a null id */
0027   HcalTrigTowerDetId();
0028   /** Constructor from a raw value */
0029   HcalTrigTowerDetId(uint32_t rawid);
0030   /** \brief Constructor from signed ieta, iphi
0031   */
0032   HcalTrigTowerDetId(int ieta, int iphi);
0033   /** \brief Constructor from signed ieta, iphi, depth
0034   */
0035   HcalTrigTowerDetId(int ieta, int iphi, int depth);
0036   /** \brief Constructor from signed ieta, iphi, depth, version
0037   */
0038   HcalTrigTowerDetId(int ieta, int iphi, int depth, int version);
0039 
0040   /** Constructor from a generic cell id */
0041   HcalTrigTowerDetId(const DetId& id);
0042   /** Assignment from a generic cell id */
0043   HcalTrigTowerDetId& operator=(const DetId& id);
0044 
0045   void setVersion(int version);
0046 
0047   /// get the subdetector
0048   HcalSubdetector subdet() const { return (HcalSubdetector)(subdetId()); }
0049   /// get the z-side of the tower (1/-1)
0050   int zside() const { return (id_ & kHcalZsideMask) ? (1) : (-1); }
0051   /// get the absolute value of the tower ieta
0052   int ietaAbs() const { return (id_ >> kHcalEtaOffset) & kHcalEtaMask; }
0053   /// get the tower ieta
0054   int ieta() const { return zside() * ietaAbs(); }
0055   /// get the tower iphi
0056   int iphi() const { return id_ & kHcalPhiMask; }
0057   /// get the depth (zero for LHC Run 1, may be nonzero for later runs)
0058   int depth() const { return (id_ >> kHcalDepthOffset) & kHcalDepthMask; }
0059   /// get the version code for the trigger tower
0060   int version() const { return (id_ >> kHcalVersOffset) & kHcalVersMask; }
0061 
0062   static const HcalTrigTowerDetId Undefined;
0063 };
0064 
0065 std::ostream& operator<<(std::ostream&, const HcalTrigTowerDetId& id);
0066 
0067 #endif