CMS 3D CMS Logo

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=41;
42  static const int kHFPhiSeg=1; // to be deprecated!
43  static const int kHFNrPhi=72/kHFPhiSeg; // to be deprecated!
44  static const int kHBHENrPhi=72; // to be deprecated!
45  static const int kNPhi=72;
46  static const int kNrTowers = ((kHFEnd-kHFBegin+1)*kHFNrPhi + kHBHEEnd*kHBHENrPhi )*2;
47  static const int kNrHBHETowers = kHBHEEnd*kHBHENrPhi*2;
48 
49  // These are the saturation codes sent from Layer 1 as the tower pT to Layer 2
50  // 509 = Layer 1 received saturated HCAL TP
51  // 510 = Layer 1 received saturated ECAL TP
52  // 511 = Layer 1 received both saturated ECAL & HCAL TPs
53  static const int kSatHcal = 509;
54  static const int kSatEcal = 510;
55  static const int kSatTower = 511;
56 
57  // Jet saturation value
58  static const int kSatJet = 65535;
59 
60  public:
61  enum SubDet{ECAL=0x1,HCAL=0x2,CALO=0x3}; //CALO is a short cut for ECAL|HCAL
62 
63  static bool insertTower( std::vector<l1t::CaloTower>& towers, const l1t::CaloTower& tower);
64 
65  static const l1t::CaloTower& getTower(const std::vector<l1t::CaloTower>& towers,int iEta,int iPhi);
66  static const l1t::CaloCluster& getCluster(const std::vector<l1t::CaloCluster>& clusters,int iEta,int iPhi);
67 
68  //returns a hash suitable for indexing a vector, returns caloTowerHashMax if invalid iEta,iPhi
69  static size_t caloTowerHash(int iEta,int iPhi);
70 
71  //returns maximum size of hash, for vector allocation
72  static size_t caloTowerHashMax();
73 
74  //checks if the iEta, iPhi is valid (ie -28->28, 1->72; |29|->|32|,1-72, %4=1)
75  static bool isValidIEtaIPhi(int iEta,int iPhi);
76 
77  //returns the hw Et sum of of a rectangle bounded by iEta-localEtaMin,iEta+localEtaMax,iPhi-localPhiMin,iPhi-localPhiMax (inclusive)
78  //sum is either ECAL, HCAL or CALO (ECAL+HCAL) Et
79  static int calHwEtSum(int iEta,int iPhi,const std::vector<l1t::CaloTower>& towers,
80  int localEtaMin,int localEtaMax,int localPhiMin,int localPhiMax,SubDet etMode=CALO);
81  static int calHwEtSum(int iEta,int iPhi,const std::vector<l1t::CaloTower>& towers,
82  int localEtaMin,int localEtaMax,int localPhiMin,int localPhiMax,
83  int iEtaAbsMax,SubDet etMode=CALO);
84 
85 
86  //returns the number of towers with minHwEt<=hwEt<=maxHwEt and iEtaMin<=iEta<=iEtaMax and iPhiMin<=iPhi<=iPhiMax
87  //hwEt is either ECAL, HCAL or CALO (ECAL+HCAL) Et
88  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);
89 
90  // physical eta/phi position and sizes of trigger towers
91  static float towerEta(int ieta);
92  static float towerPhi(int ieta, int iphi);
93  static float towerEtaSize(int ieta);
94  static float towerPhiSize(int ieta);
95 
96  // conversion to other index systems
97  static int mpEta(int ieta); // convert to internal MP numbering
98  static int caloEta(int ietaMP); // convert from internal MP to Calo ieta
99  static int regionEta(int ieta); // RCT region
100  static int bin16Eta(int ieta); // gives the eta bin label
101  static int gtEta(int ieta); // GT eta scale
102  static int gtPhi(int ieta, int iphi); // GT phi scale
103 
104  // integer divide for HI asymmetry
105  static unsigned int gloriousDivision(uint32_t aNumerator, uint32_t aDenominator);
106 
107  // conversion methods
110  static l1t::Tau tauP4Demux(l1t::Tau&);
111  static l1t::Jet jetP4Demux(l1t::Jet&);
113 
115  static l1t::EGamma egP4MP(l1t::EGamma&);
116  static l1t::Tau tauP4MP(l1t::Tau&);
117  static l1t::Jet jetP4MP(l1t::Jet&);
119 
120  static const int64_t cos_coeff[72];
121  static const int64_t sin_coeff[72];
122 
123  // mapping between sums in emulator and data
124  static const int emul_to_data_sum_index_map[31];
125 
126  private:
127  // trigger tower eta boundaries
128  static std::pair<float,float> towerEtaBounds(int ieta);
129 
130  static const l1t::CaloTower nullTower_; //to return when we need to return a tower which was not found/invalid rather than throwing an exception
131  static const l1t::CaloCluster nullCluster_; //to return when we need to return a cluster which was not found/invalid rather than throwing an exception
132 
133  static const float kGTEtaLSB;
134  static const float kGTPhiLSB;
135  static const float kGTEtLSB;
136 
137  };
138 
139 }
140 
141 
142 #endif
static float towerEta(int ieta)
Definition: CaloTools.cc:171
static l1t::Tau tauP4MP(l1t::Tau &)
Definition: CaloTools.cc:411
static const int kHFPhiSeg
Definition: CaloTools.h:42
static l1t::EtSum etSumP4MP(l1t::EtSum &)
Definition: CaloTools.cc:452
static bool isValidIEtaIPhi(int iEta, int iPhi)
Definition: CaloTools.cc:99
static const float kGTPhiLSB
Definition: CaloTools.h:134
static unsigned int gloriousDivision(uint32_t aNumerator, uint32_t aDenominator)
Definition: CaloTools.cc:462
static float towerPhi(int ieta, int iphi)
Definition: CaloTools.cc:179
static int mpEta(int ieta)
Definition: CaloTools.cc:200
static const int64_t cos_coeff[72]
Definition: CaloTools.h:120
static const int kHBHEEnd
Definition: CaloTools.h:39
static const int emul_to_data_sum_index_map[31]
Definition: CaloTools.h:124
static l1t::EGamma egP4MP(l1t::EGamma &)
Definition: CaloTools.cc:389
static int regionEta(int ieta)
Definition: CaloTools.cc:220
Definition: Tau.h:21
static float towerEtaSize(int ieta)
Definition: CaloTools.cc:186
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:109
static const int kNrHBHETowers
Definition: CaloTools.h:47
static const int kNPhi
Definition: CaloTools.h:45
static const float kGTEtaLSB
Definition: CaloTools.h:133
static math::PtEtaPhiMLorentzVector p4MP(l1t::L1Candidate *)
Definition: CaloTools.cc:380
delete x;
Definition: CaloConfig.h:22
static int gtPhi(int ieta, int iphi)
Definition: CaloTools.cc:277
static const int64_t sin_coeff[72]
Definition: CaloTools.h:121
static const int kSatHcal
Definition: CaloTools.h:53
static size_t caloTowerHash(int iEta, int iPhi)
Definition: CaloTools.cc:73
static const int kHFBegin
Definition: CaloTools.h:40
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
Definition: Jet.h:21
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:139
static l1t::EGamma egP4Demux(l1t::EGamma &)
Definition: CaloTools.cc:300
static const int kHFEnd
Definition: CaloTools.h:41
static int gtEta(int ieta)
Definition: CaloTools.cc:270
static const int kSatTower
Definition: CaloTools.h:55
static const l1t::CaloCluster & getCluster(const std::vector< l1t::CaloCluster > &clusters, int iEta, int iPhi)
Definition: CaloTools.cc:60
static l1t::Jet jetP4MP(l1t::Jet &)
Definition: CaloTools.cc:431
static l1t::Jet jetP4Demux(l1t::Jet &)
Definition: CaloTools.cc:343
static const int kNrTowers
Definition: CaloTools.h:46
Definition: HCAL.py:1
static float towerPhiSize(int ieta)
Definition: CaloTools.cc:193
static l1t::Tau tauP4Demux(l1t::Tau &)
Definition: CaloTools.cc:322
static const int kHBHENrPhi
Definition: CaloTools.h:44
static std::pair< float, float > towerEtaBounds(int ieta)
Definition: CaloTools.cc:161
static size_t caloTowerHashMax()
Definition: CaloTools.cc:93
static const l1t::CaloTower nullTower_
Definition: CaloTools.h:130
static const int kSatJet
Definition: CaloTools.h:58
static bool insertTower(std::vector< l1t::CaloTower > &towers, const l1t::CaloTower &tower)
Definition: CaloTools.cc:26
static int caloEta(int ietaMP)
Definition: CaloTools.cc:210
static const l1t::CaloTower & getTower(const std::vector< l1t::CaloTower > &towers, int iEta, int iPhi)
Definition: CaloTools.cc:37
static const float kGTEtLSB
Definition: CaloTools.h:135
static int bin16Eta(int ieta)
Definition: CaloTools.cc:246
static math::PtEtaPhiMLorentzVector p4Demux(l1t::L1Candidate *)
Definition: CaloTools.cc:290
static const int kSatEcal
Definition: CaloTools.h:54
static const l1t::CaloCluster nullCluster_
Definition: CaloTools.h:131
static l1t::EtSum etSumP4Demux(l1t::EtSum &)
Definition: CaloTools.cc:366