CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2/src/Geometry/CaloTopology/interface/HcalTopology.h

Go to the documentation of this file.
00001 #ifndef GEOMETRY_CALOTOPOLOGY_HCALTOPOLOGY_H
00002 #define GEOMETRY_CALOTOPOLOGY_HCALTOPOLOGY_H 1
00003 
00004 #include <vector>
00005 #include <map>
00006 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
00007 #include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h"
00008 #include "Geometry/CaloTopology/interface/HcalTopologyMode.h"
00009 
00026 class HcalTopology : public CaloSubdetectorTopology {
00027 public:
00028 
00029   HcalTopology( HcalTopologyMode::Mode mode, int maxDepthHB, int maxDepthHE, HcalTopologyMode::TriggerMode tmode=HcalTopologyMode::tm_LHC_PreLS1);
00030         
00031   HcalTopologyMode::Mode mode() const {return mode_;}
00032   HcalTopologyMode::TriggerMode triggerMode() const { return triggerMode_; }
00034   void exclude(const HcalDetId& id);
00036   void excludeSubdetector(HcalSubdetector subdet);
00038   int exclude(HcalSubdetector subdet, int ieta1, int ieta2, int iphi1, int iphi2, int depth1=1, int depth2=4);
00039 
00040 
00042   virtual unsigned int detId2denseId(const DetId& id) const;
00044   virtual DetId denseId2detId(unsigned int /*denseid*/) const;
00046   virtual unsigned int ncells() const;
00048   virtual int topoVersion() const;
00049 
00051   virtual bool valid(const DetId& id) const;
00053   bool validHcal(const HcalDetId& id) const;
00055   virtual std::vector<DetId> east(const DetId& id) const;
00057   virtual std::vector<DetId> west(const DetId& id) const;
00059   virtual std::vector<DetId> north(const DetId& id) const;
00061   virtual std::vector<DetId> south(const DetId& id) const;
00063   virtual std::vector<DetId> up(const DetId& id) const;
00065   virtual std::vector<DetId> down(const DetId& id) const;
00066 
00068   int incIEta(const HcalDetId& id, HcalDetId neighbors[2]) const;
00070   int decIEta(const HcalDetId& id, HcalDetId neighbors[2]) const;
00072   bool incIPhi(const HcalDetId& id, HcalDetId &neighbor) const;
00074   bool decIPhi(const HcalDetId& id, HcalDetId &neighbor) const;
00076   bool incrementDepth(HcalDetId& id) const;
00077 
00078   int firstHBRing() const {return firstHBRing_;}
00079   int lastHBRing()  const {return lastHBRing_;}
00080   int firstHERing() const {return firstHERing_;}
00081   int lastHERing()  const {return lastHERing_;}
00082   int firstHFRing() const {return firstHFRing_;}
00083   int lastHFRing()  const {return lastHFRing_;}
00084   int firstHORing() const {return firstHORing_;}
00085   int lastHORing()  const {return lastHORing_;}
00086 
00087   int firstHEDoublePhiRing() const {return firstHEDoublePhiRing_;} 
00088   int firstHFQuadPhiRing() const { return firstHFQuadPhiRing_; }
00089   int firstHETripleDepthRing() const {return firstHETripleDepthRing_;}
00090   int singlePhiBins() const {return singlePhiBins_;}
00091   int doublePhiBins() const {return doublePhiBins_;}
00092 
00094   void depthBinInformation(HcalSubdetector subdet, int etaRing,
00095                            int & nDepthBins, int & startingBin) const;
00096 
00098   int nPhiBins(int etaRing) const;
00099 
00102   void getDepthSegmentation(unsigned ring, std::vector<int> & readoutDepths) const;
00103   void setDepthSegmentation(unsigned ring, const std::vector<int> & readoutDepths);
00107   std::pair<int, int> segmentBoundaries(unsigned ring, unsigned depth) const;
00108 
00109 
00110   unsigned int getHBSize() const {return HBSize_;}
00111   unsigned int getHESize() const {return HESize_;}
00112   unsigned int getHOSize() const {return HOSize_;}
00113   unsigned int getHFSize() const {return HFSize_;}
00114   unsigned int getHTSize() const {return HTSize_;}
00115   unsigned int getCALIBSize() const {return CALIBSize_;}
00116 
00117   int maxDepthHB() const { return maxDepthHB_;}
00118   int maxDepthHE() const { return maxDepthHE_;}
00119 
00121   unsigned int detId2denseIdHB(const DetId& id) const;
00123   unsigned int detId2denseIdHE(const DetId& id) const;
00125   unsigned int detId2denseIdHO(const DetId& id) const;
00127   unsigned int detId2denseIdHF(const DetId& id) const;
00129   unsigned int detId2denseIdHT(const DetId& id) const;
00131   unsigned int detId2denseIdCALIB(const DetId& id) const;
00132 
00133   unsigned int getNumberOfShapes() const { return numberOfShapes_; }
00134       
00135 private:
00137   int incAIEta(const HcalDetId& id, HcalDetId neighbors[2]) const;
00139   int decAIEta(const HcalDetId& id, HcalDetId neighbors[2]) const;
00140 
00142   bool validDetIdPreLS1(const HcalDetId& id) const;
00143   bool validRaw(const HcalDetId& id) const;
00144   unsigned int detId2denseIdPreLS1 (const DetId& id) const;
00145 
00146   std::vector<HcalDetId> exclusionList_;
00147   bool excludeHB_, excludeHE_, excludeHO_, excludeHF_;
00148 
00149   HcalTopologyMode::Mode mode_;
00150   HcalTopologyMode::TriggerMode triggerMode_;
00151   bool isExcluded(const HcalDetId& id) const;
00152 
00153   const int firstHBRing_;
00154   const int lastHBRing_;
00155   const int firstHERing_;
00156   const int lastHERing_;
00157   const int firstHFRing_;
00158   const int lastHFRing_;
00159   const int firstHORing_;
00160   const int lastHORing_;
00161 
00162   const int firstHEDoublePhiRing_;
00163   const int firstHFQuadPhiRing_;
00164   const int firstHETripleDepthRing_;
00165   const int singlePhiBins_;
00166   const int doublePhiBins_;
00167   const int maxDepthHB_;
00168   const int maxDepthHE_;
00169 
00170   unsigned int HBSize_;
00171   unsigned int HESize_;
00172   unsigned int HOSize_;
00173   unsigned int HFSize_;
00174   unsigned int HTSize_;
00175   unsigned int CALIBSize_;
00176   const unsigned int numberOfShapes_;
00177 
00178   int topoVersion_;
00179     
00180   // index is ring;
00181   typedef std::map<unsigned, std::vector<int> > SegmentationMap;
00182   SegmentationMap depthSegmentation_;
00183 
00184   enum { kHBhalf = 1296 ,
00185          kHEhalf = 1296 ,
00186          kHOhalf = 1080 ,
00187          kHFhalf = 864  ,
00188          kHThalf = 2088,
00189          kZDChalf = 11,
00190          kCASTORhalf = 224,
00191          kCALIBhalf = 693,
00192          kHcalhalf = kHBhalf + kHEhalf + kHOhalf + kHFhalf } ;
00193   enum { kSizeForDenseIndexingPreLS1 = 2*kHcalhalf } ;
00194   enum { kHBSizePreLS1 = 2*kHBhalf } ;
00195   enum { kHESizePreLS1 = 2*kHEhalf } ;
00196   enum { kHOSizePreLS1 = 2*kHOhalf } ;
00197   enum { kHFSizePreLS1 = 2*kHFhalf } ;
00198   enum { kHTSizePreLS1 = 2*kHThalf };
00199   enum { kCALIBSizePreLS1 = 2*kCALIBhalf };
00200 };
00201 
00202 
00203 #endif