CMS 3D CMS Logo

legacyGtHelper.cc
Go to the documentation of this file.
1 // legacyGtHelper.cc
2 // Authors: Alex Barbieri
3 //
4 // This is a collection of helper methods to make sure that
5 // the objects passed to the legacy GT are using the proper
6 // Et scales and eta coordinates.
7 
9 
10 namespace l1t {
11 
13  const std::vector<l1t::Jet> *input,
14  std::vector<l1t::Jet> *output) {
15  for (std::vector<l1t::Jet>::const_iterator itJet = input->begin(); itJet != input->end(); ++itJet) {
16  unsigned int pt = itJet->hwPt();
17  if (pt > ((1 << 10) - 1))
18  pt = ((1 << 10) - 1);
19  unsigned int eta = itJet->hwEta();
20  if (eta > 10) { // LUT is symmetric in eta. For eta>10 map to corresponding eta<10 bin
21  int offset = 2 * (eta - 10) - 1;
22  eta = eta - offset;
23  }
24  unsigned int lutAddress = (eta << 10) + pt;
25 
26  unsigned int rank = params->jetCalibrationLUT()->data(lutAddress);
27 
28  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > ldummy(0, 0, 0, 0);
29  l1t::Jet outJet(*&ldummy, rank, itJet->hwEta(), itJet->hwPhi(), itJet->hwQual());
30  output->push_back(outJet);
31  }
32  }
33 
35  const std::vector<l1t::Tau> *input,
36  std::vector<l1t::Tau> *output) {
37  for (std::vector<l1t::Tau>::const_iterator itTau = input->begin(); itTau != input->end(); ++itTau) {
38  unsigned int pt = itTau->hwPt();
39  if (pt > ((1 << 10) - 1))
40  pt = ((1 << 10) - 1);
41  unsigned int eta = itTau->hwEta();
42  unsigned int lutAddress = (eta << 10) + pt;
43 
44  unsigned int rank = params->tauCalibrationLUT()->data(lutAddress);
45 
46  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > ldummy(0, 0, 0, 0);
47  l1t::Tau outTau(*&ldummy, rank, itTau->hwEta(), itTau->hwPhi(), itTau->hwQual());
48  output->push_back(outTau);
49  }
50  }
51 
53  const std::vector<l1t::Jet> *input,
54  std::vector<l1t::Jet> *output) {
55  for (std::vector<l1t::Jet>::const_iterator itJet = input->begin(); itJet != input->end(); ++itJet) {
56  unsigned newPhi = itJet->hwPhi();
57  unsigned newEta = gtEta(itJet->hwEta());
58 
59  // jets with hwQual & 10 ==10 are "padding" jets from a sort, set their eta and phi
60  // to the max value
61  if ((itJet->hwQual() & 0x10) == 0x10) {
62  newEta = 0x0;
63  newPhi = 0x0;
64  }
65 
66  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > ldummy(0, 0, 0, 0);
67 
68  l1t::Jet gtJet(*&ldummy, itJet->hwPt(), newEta, newPhi, itJet->hwQual());
69  output->push_back(gtJet);
70  }
71  }
72 
74  const std::vector<l1t::Jet> *input,
75  std::vector<l1t::Jet> *output) {
76  for (std::vector<l1t::Jet>::const_iterator itJet = input->begin(); itJet != input->end(); ++itJet) {
77  uint16_t linPt = (uint16_t)itJet->hwPt();
78  if (linPt > params->jetScale().linScaleMax())
79  linPt = params->jetScale().linScaleMax();
80  const uint16_t rankPt = params->jetScale().rank(linPt);
81 
82  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > ldummy(0, 0, 0, 0);
83 
84  l1t::Jet gtJet(*&ldummy, rankPt, itJet->hwEta(), itJet->hwPhi(), itJet->hwQual());
85  output->push_back(gtJet);
86  }
87  }
88 
90  const std::vector<l1t::EGamma> *input,
91  std::vector<l1t::EGamma> *output) {
92  for (std::vector<l1t::EGamma>::const_iterator itEGamma = input->begin(); itEGamma != input->end(); ++itEGamma) {
93  unsigned newEta = gtEta(itEGamma->hwEta());
94  unsigned newPhi = itEGamma->hwPhi();
95  const uint16_t rankPt = (uint16_t)itEGamma->hwPt(); //max value?
96 
97  //hwQual &10 == 10 means that the object came from a sort and is padding
98  if ((itEGamma->hwQual() & 0x10) == 0x10) {
99  newEta = 0x0;
100  newPhi = 0x0;
101  }
102 
103  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > ldummy(0, 0, 0, 0);
104 
105  l1t::EGamma gtEGamma(*&ldummy, rankPt, newEta, newPhi, itEGamma->hwQual(), itEGamma->hwIso());
106  output->push_back(gtEGamma);
107  }
108  }
109 
111  const std::vector<l1t::Tau> *input,
112  std::vector<l1t::Tau> *output) {
113  for (std::vector<l1t::Tau>::const_iterator itTau = input->begin(); itTau != input->end(); ++itTau) {
114  unsigned newPhi = itTau->hwPhi();
115  unsigned newEta = gtEta(itTau->hwEta());
116 
117  // taus with hwQual & 10 ==10 are "padding" jets from a sort, set their eta and phi
118  // to the max value
119  if ((itTau->hwQual() & 0x10) == 0x10) {
120  newEta = 0x0;
121  newPhi = 0x0;
122  }
123 
124  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > ldummy(0, 0, 0, 0);
125 
126  l1t::Tau gtTau(*&ldummy, itTau->hwPt(), newEta, newPhi, itTau->hwQual(), itTau->hwIso());
127  output->push_back(gtTau);
128  }
129  }
130 
132  const std::vector<l1t::Tau> *input,
133  std::vector<l1t::Tau> *output) {
134  for (std::vector<l1t::Tau>::const_iterator itTau = input->begin(); itTau != input->end(); ++itTau) {
135  uint16_t linPt = (uint16_t)itTau->hwPt();
136  if (linPt > params->jetScale().linScaleMax())
137  linPt = params->jetScale().linScaleMax();
138  const uint16_t rankPt = params->jetScale().rank(linPt);
139 
140  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > ldummy(0, 0, 0, 0);
141 
142  l1t::Tau gtTau(*&ldummy, rankPt, itTau->hwEta(), itTau->hwPhi(), itTau->hwQual(), itTau->hwIso());
143  output->push_back(gtTau);
144  }
145  }
146 
148  const std::vector<l1t::EtSum> *input,
149  std::vector<l1t::EtSum> *output) {
150  for (std::vector<l1t::EtSum>::const_iterator itEtSum = input->begin(); itEtSum != input->end(); ++itEtSum) {
151  uint16_t rankPt;
152  // Hack for now to make sure they come out with the right scale
153  //rankPt = params->jetScale().rank((uint16_t)itEtSum->hwPt());
154  rankPt = (uint16_t)itEtSum->hwPt();
155  if (EtSum::EtSumType::kMissingHt == itEtSum->getType()) {
156  // if(rankPt > params->HtMissScale().linScaleMax()) rankPt = params->HtMissScale().linScaleMax();
157  // params->HtMissScale().linScaleMax() always returns zero. Hardcode 512 for now
158 
159  // comment out for mht/ht (already in GT scale)
160  //if(rankPt > 512) rankPt = 512;
161  //rankPt = params->HtMissScale().rank(rankPt*params->emScale().linearLsb());
162  }
163 
164  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > ldummy(0, 0, 0, 0);
165 
166  l1t::EtSum gtEtSum(*&ldummy, itEtSum->getType(), rankPt, 0, itEtSum->hwPhi(), itEtSum->hwQual());
167 
168  output->push_back(gtEtSum);
169  }
170  }
171 
172  const unsigned int gtEta(const unsigned int iEta) {
173  unsigned rctEta = (iEta < 11 ? 10 - iEta : iEta - 11);
174  return (((rctEta % 7) & 0x7) | (iEta < 11 ? 0x8 : 0));
175  }
176 } // namespace l1t
input
static const std::string input
Definition: EdmProvDump.cc:48
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:32
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
l1t::EtSumToGtScales
void EtSumToGtScales(CaloParamsHelper const *params, const std::vector< l1t::EtSum > *input, std::vector< l1t::EtSum > *output)
Definition: legacyGtHelper.cc:147
l1t::TauToGtEtaScales
void TauToGtEtaScales(CaloParamsHelper const *params, const std::vector< l1t::Tau > *input, std::vector< l1t::Tau > *output)
Definition: legacyGtHelper.cc:110
l1t::TauToGtPtScales
void TauToGtPtScales(CaloParamsHelper const *params, const std::vector< l1t::Tau > *input, std::vector< l1t::Tau > *output)
Definition: legacyGtHelper.cc:131
l1t::JetToGtPtScales
void JetToGtPtScales(CaloParamsHelper const *params, const std::vector< l1t::Jet > *input, std::vector< l1t::Jet > *output)
Definition: legacyGtHelper.cc:73
l1t::gtJet
Definition: GlobalObject.h:19
l1t::Tau
Definition: Tau.h:20
PVValHelper::eta
Definition: PVValidationHelpers.h:69
l1t::Jet
Definition: Jet.h:20
l1t
delete x;
Definition: CaloConfig.h:22
l1t::EtSum
Definition: EtSum.h:20
l1t::EGammaToGtScales
void EGammaToGtScales(CaloParamsHelper const *params, const std::vector< l1t::EGamma > *input, std::vector< l1t::EGamma > *output)
Definition: legacyGtHelper.cc:89
L1Analysis::kMissingHt
Definition: L1AnalysisL1UpgradeDataFormat.h:20
l1t::EGamma
Definition: EGamma.h:20
l1t::CaloParamsHelper
Definition: CaloParamsHelper.h:21
l1t::gtEta
const unsigned int gtEta(const unsigned int iEta)
Definition: legacyGtHelper.cc:172
l1t::gtTau
Definition: GlobalObject.h:20
legacyGtHelper.h
l1t::calibrateAndRankTaus
void calibrateAndRankTaus(CaloParamsHelper const *params, const std::vector< l1t::Tau > *input, std::vector< l1t::Tau > *output)
Definition: legacyGtHelper.cc:34
L1TowerCalibrationProducer_cfi.iEta
iEta
Definition: L1TowerCalibrationProducer_cfi.py:60
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
l1t::calibrateAndRankJets
void calibrateAndRankJets(CaloParamsHelper const *params, const std::vector< l1t::Jet > *input, std::vector< l1t::Jet > *output)
Definition: legacyGtHelper.cc:12
l1t::JetToGtEtaScales
void JetToGtEtaScales(CaloParamsHelper const *params, const std::vector< l1t::Jet > *input, std::vector< l1t::Jet > *output)
Definition: legacyGtHelper.cc:52