Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef HcalCastorDetId_h_included
0002 #define HcalCastorDetId_h_included 1
0003 
0004 #include <ostream>
0005 #include "DataFormats/DetId/interface/DetId.h"
0006 
0007 /** \class HcalCastorDetId
0008   *  
0009   *  Contents of the HcalCastorDetId :
0010   *     [9]   Z position (true for positive)
0011   *     [8:7] Section (EM/HAD)
0012   *     [6:4] sector (depth)
0013   * [3:0] module
0014 
0015   * NEW:
0016   * [8]   z position
0017   * [7:4] sector 
0018   * [3:0] module
0019 
0020   * \author P. Katsas, T. McCauley
0021   */
0022 
0023 class HcalCastorDetId : public DetId {
0024 public:
0025   enum Section { Unknown = 0, EM = 1, HAD = 2 };
0026 
0027   // 1 => CaloTower, 2 => ZDC, 3 => Castor
0028   static const int SubdetectorId = 3;
0029 
0030   /** Create a null cellid*/
0031   HcalCastorDetId();
0032 
0033   /** Create cellid from raw id (0=invalid tower id) */
0034   HcalCastorDetId(uint32_t rawid);
0035 
0036   /** Constructor from section, z-side, sector and module */
0037   HcalCastorDetId(Section section, bool true_for_positive_eta, int sector, int module);
0038 
0039   // constructor without section
0040   HcalCastorDetId(bool true_for_positive_eta, int sector, int module);
0041 
0042   /** Constructor from a generic cell id */
0043   HcalCastorDetId(const DetId& id);
0044 
0045   /** Assignment from a generic cell id */
0046   HcalCastorDetId& operator=(const DetId& id);
0047 
0048   /// get the z-side of the cell (1/-1)
0049   //int zside() const { return (id_&0x40)?(1):(-1); }
0050   int zside() const { return 2 * ((id_ >> 8) & 0x1) - 1; }
0051 
0052   /// get the section
0053   //Section section() const { return (Section)((id_>>7)&0x3); }
0054   Section section() const;
0055 
0056   /// get the module (1-2 for EM, 1-12 for HAD)
0057   //int module() const { return id_&0xF; }
0058   int module() const { return (id_ & 0xF); }
0059 
0060   /// get the sector (1-16)
0061   //int sector() const { return (id_>>6)&0x3; }
0062   int sector() const { return ((id_ >> 4) & 0xF) + 1; }
0063 
0064   // get the individual cell id
0065   //  int channel() const;
0066 
0067   enum {
0068     kNumberModulesPerEnd = 14,
0069     kNumberSectorsPerEnd = 16,
0070     kNumberCellsPerEnd = kNumberModulesPerEnd * kNumberSectorsPerEnd,
0071     kSizeForDenseIndexing = kNumberCellsPerEnd
0072   };
0073 
0074   uint32_t denseIndex() const;
0075 
0076   static bool validDetId(Section iSection, bool posEta, int iSector, int iMod);
0077 
0078   static bool validDenseIndex(uint32_t din) { return (din < kSizeForDenseIndexing); }
0079 
0080   static HcalCastorDetId detIdFromDenseIndex(uint32_t di);
0081 
0082 private:
0083   void buildMe(Section section, bool true_for_positive_eta, int sector, int module);
0084 };
0085 
0086 std::ostream& operator<<(std::ostream&, const HcalCastorDetId& id);
0087 
0088 #endif  // HcalCastorDetId_h_included