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  //class is not designed to be instanced
31  private:
32  CaloTools() {}
34 
35  public:
36  //temporary location of these key parameters, probably should be read in from a database
37  //they are private to stop people using them as they will change (naming is invalid for a start)
38  static const int kHBHEEnd = 28;
39  static const int kHFBegin = 29;
40  static const int kHFEnd = 41;
41  static const int kHFPhiSeg = 1; // to be deprecated!
42  static const int kHFNrPhi = 72 / kHFPhiSeg; // to be deprecated!
43  static const int kHBHENrPhi = 72; // to be deprecated!
44  static const int kNPhi = 72;
45  static const int kNrTowers = ((kHFEnd - kHFBegin + 1) * kHFNrPhi + kHBHEEnd * kHBHENrPhi) * 2;
46  static const int kNrHBHETowers = kHBHEEnd * kHBHENrPhi * 2;
47 
48  // These are the saturation codes sent from Layer 1 as the tower pT to Layer 2
49  // 509 = Layer 1 received saturated HCAL TP
50  // 510 = Layer 1 received saturated ECAL TP
51  // 511 = Layer 1 received both saturated ECAL & HCAL TPs
52  static const int kSatHcal = 509;
53  static const int kSatEcal = 510;
54  static const int kSatTower = 511;
55 
56  // Jet saturation value
57  static const int kSatJet = 65535;
58 
59  public:
60  enum SubDet { ECAL = 0x1, HCAL = 0x2, CALO = 0x3 }; //CALO is a short cut for ECAL|HCAL
61 
62  static bool insertTower(std::vector<l1t::CaloTower>& towers, const l1t::CaloTower& tower);
63 
64  static const l1t::CaloTower& getTower(const std::vector<l1t::CaloTower>& towers, int iEta, int iPhi);
65  static const l1t::CaloCluster& getCluster(const std::vector<l1t::CaloCluster>& clusters, int iEta, int iPhi);
66 
67  //returns a hash suitable for indexing a vector, returns caloTowerHashMax if invalid iEta,iPhi
68  static size_t caloTowerHash(int iEta, int iPhi);
69 
70  //returns maximum size of hash, for vector allocation
71  static size_t caloTowerHashMax();
72 
73  //checks if the iEta, iPhi is valid (ie -28->28, 1->72; |29|->|32|,1-72, %4=1)
74  static bool isValidIEtaIPhi(int iEta, int iPhi);
75 
76  //returns the hw Et sum of of a rectangle bounded by iEta-localEtaMin,iEta+localEtaMax,iPhi-localPhiMin,iPhi-localPhiMax (inclusive)
77  //sum is either ECAL, HCAL or CALO (ECAL+HCAL) Et
78  static int calHwEtSum(int iEta,
79  int iPhi,
80  const std::vector<l1t::CaloTower>& towers,
81  int localEtaMin,
82  int localEtaMax,
83  int localPhiMin,
84  int localPhiMax,
85  SubDet etMode = CALO);
86  static int calHwEtSum(int iEta,
87  int iPhi,
88  const std::vector<l1t::CaloTower>& towers,
89  int localEtaMin,
90  int localEtaMax,
91  int localPhiMin,
92  int localPhiMax,
93  int iEtaAbsMax,
94  SubDet etMode = CALO);
95 
96  //returns the number of towers with minHwEt<=hwEt<=maxHwEt and iEtaMin<=iEta<=iEtaMax and iPhiMin<=iPhi<=iPhiMax
97  //hwEt is either ECAL, HCAL or CALO (ECAL+HCAL) Et
98  static size_t calNrTowers(int iEtaMin,
99  int iEtaMax,
100  int iPhiMin,
101  int iPhiMax,
102  const std::vector<l1t::CaloTower>& towers,
103  int minHwEt,
104  int maxHwEt,
105  SubDet etMode = CALO);
106 
107  // physical eta/phi position and sizes of trigger towers
108  static float towerEta(int ieta);
109  static float towerPhi(int ieta, int iphi);
110  static float towerEtaSize(int ieta);
111  static float towerPhiSize(int ieta);
112 
113  // conversion to other index systems
114  static int mpEta(int ieta); // convert to internal MP numbering
115  static int caloEta(int ietaMP); // convert from internal MP to Calo ieta
116  static int regionEta(int ieta); // RCT region
117  static int bin16Eta(int ieta); // gives the eta bin label
118  static int gtEta(int ieta); // GT eta scale
119  static int gtPhi(int ieta, int iphi); // GT phi scale
120 
121  // integer divide for HI asymmetry
122  static unsigned int gloriousDivision(uint32_t aNumerator, uint32_t aDenominator);
123 
124  // conversion methods
127  static l1t::Tau tauP4Demux(l1t::Tau&);
128  static l1t::Jet jetP4Demux(l1t::Jet&);
130 
132  static l1t::EGamma egP4MP(l1t::EGamma&);
133  static l1t::Tau tauP4MP(l1t::Tau&);
134  static l1t::Jet jetP4MP(l1t::Jet&);
136 
137  static const int64_t cos_coeff[72];
138  static const int64_t sin_coeff[72];
139 
140  // mapping between sums in emulator and data
141  static const int emul_to_data_sum_index_map[31];
142 
143  private:
144  // trigger tower eta boundaries
145  static std::pair<float, float> towerEtaBounds(int ieta);
146 
147  static const l1t::CaloTower
148  nullTower_; //to return when we need to return a tower which was not found/invalid rather than throwing an exception
149  static const l1t::CaloCluster
150  nullCluster_; //to return when we need to return a cluster which was not found/invalid rather than throwing an exception
151 
152  static const float kGTEtaLSB;
153  static const float kGTPhiLSB;
154  static const float kGTEtLSB;
155  };
156 
157 } // namespace l1t
158 
159 #endif
l1t::CaloTools::kSatHcal
static const int kSatHcal
Definition: CaloTools.h:52
HLT_FULL_cff.towers
towers
Definition: HLT_FULL_cff.py:36362
l1t::CaloTools::towerEtaBounds
static std::pair< float, float > towerEtaBounds(int ieta)
Definition: CaloTools.cc:186
l1t::CaloTools::caloEta
static int caloEta(int ietaMP)
Definition: CaloTools.cc:234
l1t::CaloTools::insertTower
static bool insertTower(std::vector< l1t::CaloTower > &towers, const l1t::CaloTower &tower)
Definition: CaloTools.cc:32
l1t::CaloTools::getTower
static const l1t::CaloTower & getTower(const std::vector< l1t::CaloTower > &towers, int iEta, int iPhi)
Definition: CaloTools.cc:43
l1t::CaloTools::caloTowerHashMax
static size_t caloTowerHashMax()
Definition: CaloTools.cc:102
l1t::CaloTools::kSatJet
static const int kSatJet
Definition: CaloTools.h:57
l1t::CaloTools::kHFBegin
static const int kHFBegin
Definition: CaloTools.h:39
l1t::CaloCluster
Definition: CaloCluster.h:9
l1t::CaloTools::bin16Eta
static int bin16Eta(int ieta)
Definition: CaloTools.cc:265
l1t::CaloTools::gtEta
static int gtEta(int ieta)
Definition: CaloTools.cc:304
l1t::CaloTools::kHFNrPhi
static const int kHFNrPhi
Definition: CaloTools.h:42
l1t::CaloTools::p4Demux
static math::PtEtaPhiMLorentzVector p4Demux(l1t::L1Candidate *)
Definition: CaloTools.cc:317
l1t::CaloTools::jetP4MP
static l1t::Jet jetP4MP(l1t::Jet &)
Definition: CaloTools.cc:401
l1t::CaloTools::kSatTower
static const int kSatTower
Definition: CaloTools.h:54
l1t::CaloTools::SubDet
SubDet
Definition: CaloTools.h:60
l1t::CaloTools::nullCluster_
static const l1t::CaloCluster nullCluster_
Definition: CaloTools.h:150
hgcalTowerProducer_cfi.tower
tower
Definition: hgcalTowerProducer_cfi.py:4
l1t::CaloTools::kGTEtLSB
static const float kGTEtLSB
Definition: CaloTools.h:154
Jet.h
l1t::CaloTools::kNrTowers
static const int kNrTowers
Definition: CaloTools.h:45
l1t::CaloTools::calNrTowers
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:153
l1t::CaloTools::~CaloTools
~CaloTools()
Definition: CaloTools.h:33
l1t::CaloTools::kHFEnd
static const int kHFEnd
Definition: CaloTools.h:40
CaloCluster.h
l1t::CaloTower
Definition: CaloTower.h:12
l1t::CaloTools::CALO
Definition: CaloTools.h:60
l1t::CaloTools::kHFPhiSeg
static const int kHFPhiSeg
Definition: CaloTools.h:41
l1t::CaloTools::tauP4MP
static l1t::Tau tauP4MP(l1t::Tau &)
Definition: CaloTools.cc:388
l1t::CaloTools::towerPhiSize
static float towerPhiSize(int ieta)
Definition: CaloTools.cc:221
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
hcalTTPDigis_cfi.iEtaMin
iEtaMin
Definition: hcalTTPDigis_cfi.py:15
l1t::Tau
Definition: Tau.h:20
l1t::CaloTools::kGTPhiLSB
static const float kGTPhiLSB
Definition: CaloTools.h:153
l1t::CaloTools::towerPhi
static float towerPhi(int ieta, int iphi)
Definition: CaloTools.cc:208
l1t::CaloTools
Definition: CaloTools.h:29
l1t::L1Candidate
Definition: L1Candidate.h:15
l1t::CaloTools::cos_coeff
static const int64_t cos_coeff[72]
Definition: CaloTools.h:137
CaloTower.h
EGamma.h
l1t::CaloTools::etSumP4MP
static l1t::EtSum etSumP4MP(l1t::EtSum &)
Definition: CaloTools.cc:416
l1t::CaloTools::gloriousDivision
static unsigned int gloriousDivision(uint32_t aNumerator, uint32_t aDenominator)
Definition: CaloTools.cc:419
l1t::CaloTools::isValidIEtaIPhi
static bool isValidIEtaIPhi(int iEta, int iPhi)
Definition: CaloTools.cc:104
l1t::CaloTools::nullTower_
static const l1t::CaloTower nullTower_
Definition: CaloTools.h:148
HCAL
Definition: HCAL.py:1
l1t::Jet
Definition: Jet.h:20
l1t::CaloTools::kGTEtaLSB
static const float kGTEtaLSB
Definition: CaloTools.h:152
l1t::CaloTools::emul_to_data_sum_index_map
static const int emul_to_data_sum_index_map[31]
Definition: CaloTools.h:141
bsc_activity_cfg.clusters
clusters
Definition: bsc_activity_cfg.py:36
l1t::CaloTools::egP4MP
static l1t::EGamma egP4MP(l1t::EGamma &)
Definition: CaloTools.cc:374
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
l1t
delete x;
Definition: CaloConfig.h:22
l1t::CaloTools::kNrHBHETowers
static const int kNrHBHETowers
Definition: CaloTools.h:46
l1t::EtSum
Definition: EtSum.h:20
LorentzVector.h
l1t::CaloTools::kNPhi
static const int kNPhi
Definition: CaloTools.h:44
l1t::CaloTools::CaloTools
CaloTools()
Definition: CaloTools.h:32
l1t::CaloTools::kSatEcal
static const int kSatEcal
Definition: CaloTools.h:53
l1t::EGamma
Definition: EGamma.h:20
l1t::CaloTools::etSumP4Demux
static l1t::EtSum etSumP4Demux(l1t::EtSum &)
Definition: CaloTools.cc:364
l1t::CaloTools::caloTowerHash
static size_t caloTowerHash(int iEta, int iPhi)
Definition: CaloTools.cc:81
l1t::CaloTools::egP4Demux
static l1t::EGamma egP4Demux(l1t::EGamma &)
Definition: CaloTools.cc:322
l1t::CaloTools::mpEta
static int mpEta(int ieta)
Definition: CaloTools.cc:224
l1t::CaloTools::ECAL
Definition: CaloTools.h:60
l1t::CaloTools::towerEta
static float towerEta(int ieta)
Definition: CaloTools.cc:201
l1t::CaloTools::getCluster
static const l1t::CaloCluster & getCluster(const std::vector< l1t::CaloCluster > &clusters, int iEta, int iPhi)
Definition: CaloTools.cc:70
hcalTTPDigis_cfi.iEtaMax
iEtaMax
Definition: hcalTTPDigis_cfi.py:16
l1t::CaloTools::kHBHEEnd
static const int kHBHEEnd
Definition: CaloTools.h:38
l1t::CaloTools::jetP4Demux
static l1t::Jet jetP4Demux(l1t::Jet &)
Definition: CaloTools.cc:349
l1t::CaloTools::towerEtaSize
static float towerEtaSize(int ieta)
Definition: CaloTools.cc:215
L1TowerCalibrationProducer_cfi.iEta
iEta
Definition: L1TowerCalibrationProducer_cfi.py:60
l1t::CaloTools::calHwEtSum
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:114
math::PtEtaPhiMLorentzVector
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
l1t::CaloTools::regionEta
static int regionEta(int ieta)
Definition: CaloTools.cc:244
l1t::CaloTools::gtPhi
static int gtPhi(int ieta, int iphi)
Definition: CaloTools.cc:309
EtSum.h
l1t::CaloTools::tauP4Demux
static l1t::Tau tauP4Demux(l1t::Tau &)
Definition: CaloTools.cc:336
l1t::CaloTools::sin_coeff
static const int64_t sin_coeff[72]
Definition: CaloTools.h:138
l1t::CaloTools::kHBHENrPhi
static const int kHBHENrPhi
Definition: CaloTools.h:43
Tau.h
l1t::CaloTools::p4MP
static math::PtEtaPhiMLorentzVector p4MP(l1t::L1Candidate *)
Definition: CaloTools.cc:369