CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10/src/DataFormats/EcalDetId/interface/EcalTrigTowerDetId.h

Go to the documentation of this file.
00001 #ifndef ECALDETID_ECALTRIGTOWERDETID_H
00002 #define ECALDETID_ECALTRIGTOWERDETID_H
00003 
00004 #include <ostream>
00005 #include "DataFormats/DetId/interface/DetId.h"
00006 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
00007 
00008 
00017 class EcalTrigTowerDetId : public DetId {
00018  public:
00020   EcalTrigTowerDetId();
00022   EcalTrigTowerDetId(uint32_t rawid);  
00025   EcalTrigTowerDetId(int zside, EcalSubdetector subdet, int i, int j, int mode=SUBDETIJMODE);
00026   
00028   EcalTrigTowerDetId(const DetId& id);
00030   EcalTrigTowerDetId& operator=(const DetId& id);
00031   
00032 
00034   int zside() const { return (id_&0x8000)?(1):(-1); }
00035 
00037   EcalSubdetector subDet() const { return (id_&0x4000) ? EcalBarrel:EcalEndcap; }
00038 
00040   int ietaAbs() const 
00041    { 
00042      /*       if ( subDet() == EcalBarrel) */
00043      return (id_>>7)&0x7f; 
00044      /*       else */
00045      /*         throw(std::runtime_error("EcalTrigTowerDetId: ietaAbs not applicable for this subDetector.")); */
00046    }  
00047 
00049   int ieta() const 
00050     { 
00051       /*       if ( subDet() == EcalBarrel) */
00052       return zside()*ietaAbs(); 
00053       /*       else */
00054       /*        throw(std::runtime_error("EcalTrigTowerDetId: ieta not applicable for this subDetector.")); */
00055     } 
00056   
00058   int iphi() const 
00059     { 
00060       /*       if ( subDet() == EcalBarrel) */
00061       return id_&0x7F; 
00062       /*       else */
00063       /*        throw(std::runtime_error("EcalTrigTowerDetId: iphi not applicable for this subDetector.")); */
00064       
00065     } 
00066 
00067   int iquadrant() const ; 
00068 
00069 
00070 /*   /// get the tower ix (Endcap case) */
00071 /*   int ix() const  */
00072 /*     {  */
00073 /*       if ( subDet() == EcalEndcap) */
00074 /*      return (id_>>7)&0x7f;  */
00075 /*       else */
00076 /*      throw(std::runtime_error("EcalTrigTowerDetId: ix not applicable for this subDetector.")); */
00077 /*     }  */
00078   
00079 /*   /// get the tower iy (Endcap case) */
00080 /*   int iy() const throw(std::runtime_error) */
00081 /*     {  */
00082 /*       if ( subDet() == EcalEndcap) */
00083 /*      return id_&0x7F;  */
00084 /*       else */
00085 /*      throw(std::runtime_error("EcalTrigTowerDetId: ix not applicable for this subDetector.")); */
00086 /*     }  */
00087   
00088 
00090   int hashedIndex() const;
00091 
00092   uint32_t denseIndex() const { return hashedIndex() ; }
00093 
00094   static bool validDenseIndex( uint32_t din ) { return ( din < kSizeForDenseIndexing ) ; }
00095 
00096   static EcalTrigTowerDetId detIdFromDenseIndex( uint32_t di ) ;
00097 
00099   static bool validDetId( int iz, 
00100                           EcalSubdetector sd, 
00101                           int i, int j ) ;
00102 
00104   int iDCC() const ; 
00105 
00107   int iTT() const ; 
00108 
00109 
00110 
00111   static const int MIN_I = 1;
00112   static const int MIN_J = 1;
00113   static const int MAX_I = 127;
00114   static const int MAX_J = 127;
00115 
00116   static const int kEBTowersInPhi = 4; // per SM (in the Barrel)
00117   static const int kEBTowersPerSM = 68; // per SM (in the Barrel)
00118   static const int kEBTowersInEta = 17; // per SM (in the Barrel)
00119 //  static const int kEETowersInEta = 11; // Endcap
00120   static const int kEETowersInPhiPerQuadrant = 18; // per Quadrant (in the Endcap)
00121 
00122   // function modes for (int, int) constructor
00123   static const int SUBDETIJMODE = 0;
00124   static const int SUBDETDCCTTMODE = 1;
00125 
00126       enum { kEETowersInPhiPerEndcap = 4* kEETowersInPhiPerQuadrant ,
00127              kEEOuterEta             = 18 ,
00128              kEEInnerEta             = 28 ,
00129              kEETowersInEta          = ( kEEInnerEta - kEEOuterEta + 1 ) ,
00130              kEBHalfTowers           = kEBTowersPerSM*18 ,
00131              kEBTotalTowers          = kEBHalfTowers*2 ,
00132              kEETowersPerEndcap      = kEETowersInEta*kEETowersInPhiPerEndcap - 72,
00133              kEETotalTowers          = kEETowersPerEndcap*2,
00134              kSizeForDenseIndexing   = kEBTotalTowers + kEETotalTowers } ;
00135 };
00136 
00137 std::ostream& operator<<(std::ostream&,const EcalTrigTowerDetId& id);
00138 
00139 #endif