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 
24 
26 
27 namespace l1t {
28 
29  class CaloTools{
30 
31  //class is not designed to be instanced
32  private:
35 
36  public:
37  //temporary location of these key parameters, probably should be read in from a database
38  //they are private to stop people using them as they will change (naming is invalid for a start)
39  static const int kHBHEEnd=28;
40  static const int kHFBegin=29;
41  static const int kHFEnd=40;
42  static const int kHFPhiSeg=1;
43  static const int kHFNrPhi=72/kHFPhiSeg;
44  static const int kHBHENrPhi=72;
45  static const int kNrTowers = ((kHFEnd-kHFBegin+1)*kHFNrPhi + kHBHEEnd*kHBHENrPhi )*2;
46  static const int kNrHBHETowers = kHBHEEnd*kHBHENrPhi*2;
47 
48  public:
49  enum SubDet{ECAL=0x1,HCAL=0x2,CALO=0x3}; //CALO is a short cut for ECAL|HCAL
50 
51  static bool insertTower( std::vector<l1t::CaloTower>& towers, const l1t::CaloTower& tower);
52 
53  static const l1t::CaloTower& getTower(const std::vector<l1t::CaloTower>& towers,int iEta,int iPhi);
54  static const l1t::CaloCluster& getCluster(const std::vector<l1t::CaloCluster>& clusters,int iEta,int iPhi);
55 
56  //returns a hash suitable for indexing a vector, returns caloTowerHashMax if invalid iEta,iPhi
57  static size_t caloTowerHash(int iEta,int iPhi);
58 
59  //returns maximum size of hash, for vector allocation
60  static size_t caloTowerHashMax();
61 
62  //checks if the iEta, iPhi is valid (ie -28->28, 1->72; |29|->|32|,1-72, %4=1)
63  static bool isValidIEtaIPhi(int iEta,int iPhi);
64 
65  //returns the hw Et sum of of a rectangle bounded by iEta-localEtaMin,iEta+localEtaMax,iPhi-localPhiMin,iPhi-localPhiMax (inclusive)
66  //sum is either ECAL, HCAL or CALO (ECAL+HCAL) Et
67  static int calHwEtSum(int iEta,int iPhi,const std::vector<l1t::CaloTower>& towers,
68  int localEtaMin,int localEtaMax,int localPhiMin,int localPhiMax,SubDet etMode=CALO);
69  static int calHwEtSum(int iEta,int iPhi,const std::vector<l1t::CaloTower>& towers,
70  int localEtaMin,int localEtaMax,int localPhiMin,int localPhiMax,
71  int iEtaAbsMax,SubDet etMode=CALO);
72 
73 
74  //returns the number of towers with minHwEt<=hwEt<=maxHwEt and iEtaMin<=iEta<=iEtaMax and iPhiMin<=iPhi<=iPhiMax
75  //hwEt is either ECAL, HCAL or CALO (ECAL+HCAL) Et
76  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);
77 
78  // physical eta/phi position and sizes of trigger towers
79  static float towerEta(int ieta);
80  static float towerPhi(int ieta, int iphi);
81  static float towerEtaSize(int ieta);
82  static float towerPhiSize(int ieta);
83 
84  // conversion methods
87  static l1t::Tau tauP4Demux(l1t::Tau&);
88  static l1t::Jet jetP4Demux(l1t::Jet&);
90 
93  static l1t::Tau tauP4MP(l1t::Tau&);
94  static l1t::Jet jetP4MP(l1t::Jet&);
96 
97 
98  private:
99  // trigger tower eta boundaries
100  static std::pair<float,float> towerEtaBounds(int ieta);
101 
102  static const l1t::CaloTower nullTower_; //to return when we need to return a tower which was not found/invalid rather than throwing an exception
103  static const l1t::CaloCluster nullCluster_; //to return when we need to return a cluster which was not found/invalid rather than throwing an exception
104  };
105 
106 }
107 
108 
109 #endif
static float towerEta(int ieta)
Definition: CaloTools.cc:153
static l1t::Tau tauP4MP(l1t::Tau &)
Definition: CaloTools.cc:262
static const int kHFPhiSeg
Definition: CaloTools.h:42
static l1t::EtSum etSumP4MP(l1t::EtSum &)
Definition: CaloTools.cc:283
static bool isValidIEtaIPhi(int iEta, int iPhi)
Definition: CaloTools.cc:81
static float towerPhi(int ieta, int iphi)
Definition: CaloTools.cc:161
static const int kHBHEEnd
Definition: CaloTools.h:39
static l1t::EGamma egP4MP(l1t::EGamma &)
Definition: CaloTools.cc:251
Definition: Tau.h:16
static float towerEtaSize(int ieta)
Definition: CaloTools.cc:166
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:91
static const int kNrHBHETowers
Definition: CaloTools.h:46
static math::PtEtaPhiMLorentzVector p4MP(l1t::L1Candidate *)
Definition: CaloTools.cc:242
static size_t caloTowerHash(int iEta, int iPhi)
Definition: CaloTools.cc:55
static const int kHFBegin
Definition: CaloTools.h:40
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
Definition: Jet.h:16
static const int kHFNrPhi
Definition: CaloTools.h:43
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:121
static l1t::EGamma egP4Demux(l1t::EGamma &)
Definition: CaloTools.cc:193
static const int kHFEnd
Definition: CaloTools.h:41
static const l1t::CaloCluster & getCluster(const std::vector< l1t::CaloCluster > &clusters, int iEta, int iPhi)
Definition: CaloTools.cc:42
static l1t::Jet jetP4MP(l1t::Jet &)
Definition: CaloTools.cc:273
static l1t::Jet jetP4Demux(l1t::Jet &)
Definition: CaloTools.cc:217
static const int kNrTowers
Definition: CaloTools.h:45
static float towerPhiSize(int ieta)
Definition: CaloTools.cc:173
static l1t::Tau tauP4Demux(l1t::Tau &)
Definition: CaloTools.cc:205
static const int kHBHENrPhi
Definition: CaloTools.h:44
static std::pair< float, float > towerEtaBounds(int ieta)
Definition: CaloTools.cc:143
static size_t caloTowerHashMax()
Definition: CaloTools.cc:75
static const l1t::CaloTower nullTower_
Definition: CaloTools.h:102
static bool insertTower(std::vector< l1t::CaloTower > &towers, const l1t::CaloTower &tower)
Definition: CaloTools.cc:10
static const l1t::CaloTower & getTower(const std::vector< l1t::CaloTower > &towers, int iEta, int iPhi)
Definition: CaloTools.cc:21
static math::PtEtaPhiMLorentzVector p4Demux(l1t::L1Candidate *)
Definition: CaloTools.cc:183
static const l1t::CaloCluster nullCluster_
Definition: CaloTools.h:103
static l1t::EtSum etSumP4Demux(l1t::EtSum &)
Definition: CaloTools.cc:228