CMS 3D CMS Logo

EBDetId.h

Go to the documentation of this file.
00001 #ifndef ECALDETID_EBDETID_H
00002 #define ECALDETID_EBDETID_H
00003 
00004 #include <ostream>
00005 #include <cmath>
00006 #include "DataFormats/DetId/interface/DetId.h"
00007 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
00008 #include "DataFormats/EcalDetId/interface/EcalTrigTowerDetId.h"
00009 
00010 
00019 class EBDetId : public DetId {
00020  public:
00021   enum { Subdet=EcalBarrel};
00023   EBDetId() {}
00025   EBDetId(uint32_t rawid) : DetId(rawid) {}
00028   EBDetId(int index1, int index2, int mode = ETAPHIMODE);
00030   EBDetId(const DetId& id);
00032   EBDetId& operator=(const DetId& id);
00033 
00035   // EcalSubdetector subdet() const { return EcalSubdetector(subdetId()); }
00036   static EcalSubdetector subdet() { return EcalBarrel;}
00037 
00039   int zside() const { return (id_&0x10000)?(1):(-1); }
00041   int ietaAbs() const { return (id_>>9)&0x7F; }
00043   int ieta() const { return zside()*ietaAbs(); }
00045   int iphi() const { return id_&0x1FF; }
00047   int tower_ieta() const { return ((ietaAbs()-1)/5+1)*zside(); }
00049   int tower_iphi() const;
00051   EcalTrigTowerDetId tower() const { return EcalTrigTowerDetId(zside(),EcalBarrel,abs(tower_ieta()),tower_iphi()); }
00053   int ism() const;
00055   int im() const;
00057   int ic() const;
00059   int ietaSM() const { return ietaAbs(); }
00061   int iphiSM() const { return (( ic() -1 ) % kCrystalsInPhi ) + 1; }
00062   
00063   // is z positive?
00064   bool positiveZ() const { return id_&0x10000;}
00065   // crystal number in eta-phi grid
00066   int numberByEtaPhi() const { 
00067     return (MAX_IETA + (positiveZ() ? ietaAbs()-1 : -ietaAbs()) )*MAX_IPHI+ iphi()-1;
00068   }
00069   // index numbering crystal by SM
00070   int numberBySM() const; 
00072   int hashedIndex() const { return numberByEtaPhi(); }
00073 
00075   static EBDetId unhashIndex(int hi)  {
00076     int pseudo_eta = hi/MAX_IPHI - MAX_IETA;
00077     return EBDetId(pseudo_eta<0 ? pseudo_eta :  pseudo_eta+1, hi%MAX_IPHI+1);
00078   }
00079 
00080   static bool validHashIndex(int i) {
00081     return !(i<MIN_HASH || i>MAX_HASH);
00082   }
00083 
00085   static bool validDetId(int i, int j) ;
00086 
00087   static bool isNextToBoundary(EBDetId id);
00088 
00089   static bool isNextToEtaBoundary(EBDetId id);
00090 
00091   static bool isNextToPhiBoundary(EBDetId id);
00092 
00094   static const int MIN_IETA = 1;
00095   static const int MIN_IPHI = 1;
00096   static const int MAX_IETA = 85;
00097   static const int MAX_IPHI = 360;
00098   static const int kChannelsPerCard = 5;
00099   static const int kTowersInPhi = 4;  // per SM
00100   static const int kModulesPerSM = 4;
00101   static const int kModuleBoundaries[4] ;
00102   static const int kCrystalsInPhi = 20; // per SM
00103   static const int kCrystalsInEta = 85; // per SM
00104   static const int kCrystalsPerSM = 1700;
00105   static const int MIN_SM = 1;
00106   static const int MAX_SM = 36;
00107   static const int MIN_C = 1;
00108   static const int MAX_C = kCrystalsPerSM;
00109   static const int MIN_HASH =  0; // always 0 ...
00110   static const int MAX_HASH =  2*MAX_IPHI*MAX_IETA-1;
00111   static const int SIZE_HASH = 2*MAX_IPHI*MAX_IETA;
00112   
00113 
00114   // function modes for (int, int) constructor
00115   static const int ETAPHIMODE = 0;
00116   static const int SMCRYSTALMODE = 1;
00117 };
00118 
00119 std::ostream& operator<<(std::ostream& s,const EBDetId& id);
00120 
00121 
00122 #endif

Generated on Tue Jun 9 17:30:41 2009 for CMSSW by  doxygen 1.5.4