test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CaloTools.h
Go to the documentation of this file.
1 
12 //
13 
14 #ifndef L1Trigger_L1TCommon_CaloTools_h
15 #define L1Trigger_L1TCommon_CaloTools_h
16 
19 
20 namespace l1t {
21 
22  class CaloTools{
23 
24  //class is not designed to be instanced
25  private:
28 
29  private:
30  //temporary location of these key parameters, probably should be read in from a database
31  //they are private to stop people using them as they will change (naming is invalid for a start)
32  static const int kHBHEEnd=28;
33  static const int kHFBegin=29;
34  static const int kHFEnd=32;
35  static const int kHFPhiSeg=4;
36  static const int kHFNrPhi=72/kHFPhiSeg;
37  static const int kHBHENrPhi=72;
38  static const int kNrTowers = ((kHFEnd-kHFBegin+1)*kHFNrPhi + kHBHEEnd*kHBHENrPhi )*2;
39  static const int kNrHBHETowers = kHBHEEnd*kHBHENrPhi*2;
40 
41  public:
42  enum SubDet{ECAL=0x1,HCAL=0x2,CALO=0x3}; //CALO is a short cut for ECAL|HCAL
43 
44  static const l1t::CaloTower& getTower(const std::vector<l1t::CaloTower>& towers,int iEta,int iPhi);
45  static const l1t::CaloCluster& getCluster(const std::vector<l1t::CaloCluster>& clusters,int iEta,int iPhi);
46 
47  //returns a hash suitable for indexing a vector, returns caloTowerHashMax if invalid iEta,iPhi
48  static size_t caloTowerHash(int iEta,int iPhi);
49 
50  //returns maximum size of hash, for vector allocation
51  static size_t caloTowerHashMax();
52 
53  //checks if the iEta, iPhi is valid (ie -28->28, 1->72; |29|->|32|,1-72, %4=1)
54  static bool isValidIEtaIPhi(int iEta,int iPhi);
55 
56  //returns the hw Et sum of of a rectangle bounded by iEta-localEtaMin,iEta+localEtaMax,iPhi-localPhiMin,iPhi-localPhiMax (inclusive)
57  //sum is either ECAL, HCAL or CALO (ECAL+HCAL) Et
58  static int calHwEtSum(int iEta,int iPhi,const std::vector<l1t::CaloTower>& towers,
59  int localEtaMin,int localEtaMax,int localPhiMin,int localPhiMax,SubDet etMode=CALO);
60  static int calHwEtSum(int iEta,int iPhi,const std::vector<l1t::CaloTower>& towers,
61  int localEtaMin,int localEtaMax,int localPhiMin,int localPhiMax,
62  int iEtaAbsMax,SubDet etMode=CALO);
63 
64 
65  //returns the number of towers with minHwEt<=hwEt<=maxHwEt and iEtaMin<=iEta<=iEtaMax and iPhiMin<=iPhi<=iPhiMax
66  //hwEt is either ECAL, HCAL or CALO (ECAL+HCAL) Et
67  static size_t calNrTowers(int iEtaMin,int iEtaMax,int iPhiMin,int iPhiMax,const std::vector<l1t::CaloTower>& towers,int minHwEt,int maxHwEt,SubDet etMode=CALO);
68 
69  // physical eta/phi position and sizes of trigger towers
70  static float towerEta(int ieta);
71  static float towerPhi(int ieta, int iphi);
72  static float towerEtaSize(int ieta);
73  static float towerPhiSize(int ieta);
74 
75 
76  private:
77  // trigger tower eta boundaries
78  static std::pair<float,float> towerEtaBounds(int ieta);
79 
80  static const l1t::CaloTower nullTower_; //to return when we need to return a tower which was not found/invalid rather than throwing an exception
81  static const l1t::CaloCluster nullCluster_; //to return when we need to return a cluster which was not found/invalid rather than throwing an exception
82  };
83 
84 }
85 
86 
87 #endif
static float towerEta(int ieta)
Definition: CaloTools.cc:141
static const int kHFPhiSeg
Definition: CaloTools.h:35
static bool isValidIEtaIPhi(int iEta, int iPhi)
Definition: CaloTools.cc:71
static float towerPhi(int ieta, int iphi)
Definition: CaloTools.cc:149
static const int kHBHEEnd
Definition: CaloTools.h:32
static float towerEtaSize(int ieta)
Definition: CaloTools.cc:154
static int calHwEtSum(int iEta, int iPhi, const std::vector< l1t::CaloTower > &towers, int localEtaMin, int localEtaMax, int localPhiMin, int localPhiMax, SubDet etMode=CALO)
Definition: CaloTools.cc:81
static const int kNrHBHETowers
Definition: CaloTools.h:39
static size_t caloTowerHash(int iEta, int iPhi)
Definition: CaloTools.cc:45
static const int kHFBegin
Definition: CaloTools.h:33
static const int kHFNrPhi
Definition: CaloTools.h:36
static size_t calNrTowers(int iEtaMin, int iEtaMax, int iPhiMin, int iPhiMax, const std::vector< l1t::CaloTower > &towers, int minHwEt, int maxHwEt, SubDet etMode=CALO)
Definition: CaloTools.cc:110
static const int kHFEnd
Definition: CaloTools.h:34
static const l1t::CaloCluster & getCluster(const std::vector< l1t::CaloCluster > &clusters, int iEta, int iPhi)
Definition: CaloTools.cc:32
static const int kNrTowers
Definition: CaloTools.h:38
static float towerPhiSize(int ieta)
Definition: CaloTools.cc:161
static const int kHBHENrPhi
Definition: CaloTools.h:37
static std::pair< float, float > towerEtaBounds(int ieta)
Definition: CaloTools.cc:132
static size_t caloTowerHashMax()
Definition: CaloTools.cc:65
static const l1t::CaloTower nullTower_
Definition: CaloTools.h:80
static const l1t::CaloTower & getTower(const std::vector< l1t::CaloTower > &towers, int iEta, int iPhi)
Definition: CaloTools.cc:11
static const l1t::CaloCluster nullCluster_
Definition: CaloTools.h:81