File indexing completed on 2024-04-06 12:20:16
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef L1Trigger_L1TCommon_CaloTools_h
0015 #define L1Trigger_L1TCommon_CaloTools_h
0016
0017 #include "DataFormats/L1TCalorimeter/interface/CaloTower.h"
0018 #include "DataFormats/L1TCalorimeter/interface/CaloCluster.h"
0019
0020 #include "DataFormats/L1Trigger/interface/EGamma.h"
0021 #include "DataFormats/L1Trigger/interface/Tau.h"
0022 #include "DataFormats/L1Trigger/interface/Jet.h"
0023 #include "DataFormats/L1Trigger/interface/EtSum.h"
0024
0025 #include "DataFormats/Math/interface/LorentzVector.h"
0026
0027 namespace l1t {
0028
0029 class CaloTools {
0030
0031 private:
0032 CaloTools() {}
0033 ~CaloTools() {}
0034
0035 public:
0036
0037
0038 static const int kHBHEEnd = 28;
0039 static const int kHFBegin = 29;
0040 static const int kHFEnd = 41;
0041 static const int kHFPhiSeg = 1;
0042 static const int kHFNrPhi = 72 / kHFPhiSeg;
0043 static const int kHBHENrPhi = 72;
0044 static const int kNPhi = 72;
0045 static const int kNrTowers = ((kHFEnd - kHFBegin + 1) * kHFNrPhi + kHBHEEnd * kHBHENrPhi) * 2;
0046 static const int kNrHBHETowers = kHBHEEnd * kHBHENrPhi * 2;
0047
0048
0049
0050
0051
0052 static const int kSatHcal = 509;
0053 static const int kSatEcal = 510;
0054 static const int kSatTower = 511;
0055
0056
0057 static const int kSatJet = 65535;
0058
0059 public:
0060 enum SubDet { ECAL = 0x1, HCAL = 0x2, CALO = 0x3 };
0061
0062 static bool insertTower(std::vector<l1t::CaloTower>& towers, const l1t::CaloTower& tower);
0063
0064 static const l1t::CaloTower& getTower(const std::vector<l1t::CaloTower>& towers, int iEta, int iPhi);
0065 static const l1t::CaloCluster& getCluster(const std::vector<l1t::CaloCluster>& clusters, int iEta, int iPhi);
0066
0067
0068 static size_t caloTowerHash(int iEta, int iPhi);
0069
0070
0071 static size_t caloTowerHashMax();
0072
0073
0074 static bool isValidIEtaIPhi(int iEta, int iPhi);
0075
0076
0077
0078 static int calHwEtSum(int iEta,
0079 int iPhi,
0080 const std::vector<l1t::CaloTower>& towers,
0081 int localEtaMin,
0082 int localEtaMax,
0083 int localPhiMin,
0084 int localPhiMax,
0085 SubDet etMode = CALO);
0086 static int calHwEtSum(int iEta,
0087 int iPhi,
0088 const std::vector<l1t::CaloTower>& towers,
0089 int localEtaMin,
0090 int localEtaMax,
0091 int localPhiMin,
0092 int localPhiMax,
0093 int iEtaAbsMax,
0094 SubDet etMode = CALO);
0095
0096
0097
0098 static size_t calNrTowers(int iEtaMin,
0099 int iEtaMax,
0100 int iPhiMin,
0101 int iPhiMax,
0102 const std::vector<l1t::CaloTower>& towers,
0103 int minHwEt,
0104 int maxHwEt,
0105 SubDet etMode = CALO);
0106
0107
0108 static float towerEta(int ieta);
0109 static float towerPhi(int ieta, int iphi);
0110 static float towerEtaSize(int ieta);
0111 static float towerPhiSize(int ieta);
0112
0113
0114 static int mpEta(int ieta);
0115 static int caloEta(int ietaMP);
0116 static int regionEta(int ieta);
0117 static int bin16Eta(int ieta);
0118 static int gtEta(int ieta);
0119 static int gtPhi(int ieta, int iphi);
0120
0121
0122 static unsigned int gloriousDivision(uint32_t aNumerator, uint32_t aDenominator);
0123
0124
0125 static math::PtEtaPhiMLorentzVector p4Demux(l1t::L1Candidate*);
0126 static l1t::EGamma egP4Demux(l1t::EGamma&);
0127 static l1t::Tau tauP4Demux(l1t::Tau&);
0128 static l1t::Jet jetP4Demux(l1t::Jet&);
0129 static l1t::EtSum etSumP4Demux(l1t::EtSum&);
0130
0131 static math::PtEtaPhiMLorentzVector p4MP(l1t::L1Candidate*);
0132 static l1t::EGamma egP4MP(l1t::EGamma&);
0133 static l1t::Tau tauP4MP(l1t::Tau&);
0134 static l1t::Jet jetP4MP(l1t::Jet&);
0135 static l1t::EtSum etSumP4MP(l1t::EtSum&);
0136
0137 static const int64_t cos_coeff[72];
0138 static const int64_t sin_coeff[72];
0139
0140
0141 static const int emul_to_data_sum_index_map[31];
0142
0143 private:
0144
0145 static std::pair<float, float> towerEtaBounds(int ieta);
0146
0147 static const l1t::CaloTower
0148 nullTower_;
0149 static const l1t::CaloCluster
0150 nullCluster_;
0151
0152 static const float kGTEtaLSB;
0153 static const float kGTPhiLSB;
0154 static const float kGTEtLSB;
0155 };
0156
0157 }
0158
0159 #endif