CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
16  for(std::vector<l1t::Jet>::const_iterator itJet = input->begin();
17  itJet != input->end(); ++itJet){
18  const unsigned newEta = gtEta(itJet->hwEta());
19  uint16_t linPt = (uint16_t)itJet->hwPt();
20  if(linPt > params->jetScale().linScaleMax() ) linPt = params->jetScale().linScaleMax();
21  const uint16_t rankPt = params->jetScale().rank(linPt);
22 
23  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > ldummy(0,0,0,0);
24 
25  l1t::Jet gtJet(*&ldummy, rankPt, newEta, itJet->hwPhi(), itJet->hwQual());
26  output->push_back(gtJet);
27  }
28  }
29 
31  const std::vector<l1t::EGamma> * input,
32  std::vector<l1t::EGamma> *output){
33 
34  for(std::vector<l1t::EGamma>::const_iterator itEGamma = input->begin();
35  itEGamma != input->end(); ++itEGamma){
36  const unsigned newEta = gtEta(itEGamma->hwEta());
37  const uint16_t rankPt = (uint16_t)itEGamma->hwPt(); //max value?
38 
39  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > ldummy(0,0,0,0);
40 
41  l1t::EGamma gtEGamma(*&ldummy, rankPt, newEta, itEGamma->hwPhi(),
42  itEGamma->hwQual(), itEGamma->hwIso());
43  output->push_back(gtEGamma);
44  }
45  }
46 
48  const std::vector<l1t::Tau> * input,
49  std::vector<l1t::Tau> *output){
50  for(std::vector<l1t::Tau>::const_iterator itTau = input->begin();
51  itTau != input->end(); ++itTau){
52  const unsigned newEta = gtEta(itTau->hwEta());
53  uint16_t linPt = (uint16_t)itTau->hwPt();
54  if(linPt > params->jetScale().linScaleMax() ) linPt = params->jetScale().linScaleMax();
55  const uint16_t rankPt = params->jetScale().rank(linPt);
56 
57  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > ldummy(0,0,0,0);
58 
59  l1t::Tau gtTau(*&ldummy, rankPt, newEta, itTau->hwPhi(), itTau->hwQual(), itTau->hwIso());
60  output->push_back(gtTau);
61  }
62  }
63 
65  const std::vector<l1t::EtSum> * input,
66  std::vector<l1t::EtSum> *output){
67  for(std::vector<l1t::EtSum>::const_iterator itEtSum = input->begin();
68  itEtSum != input->end(); ++itEtSum){
69 
70  uint16_t rankPt;
71  // Hack for now to make sure they come out with the right scale
72  //rankPt = params->jetScale().rank((uint16_t)itEtSum->hwPt());
73  rankPt = (uint16_t)itEtSum->hwPt();
74  if (EtSum::EtSumType::kMissingHt == itEtSum->getType())
75  {
76  // if(rankPt > params->HtMissScale().linScaleMax()) rankPt = params->HtMissScale().linScaleMax();
77  // params->HtMissScale().linScaleMax() always returns zero. Hardcode 512 for now
78  if(rankPt > 512) rankPt = 512;
79  rankPt = params->HtMissScale().rank(rankPt*params->emScale().linearLsb());
80  }
81 
82  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > ldummy(0,0,0,0);
83 
84  l1t::EtSum gtEtSum(*&ldummy, itEtSum->getType(), rankPt, 0,
85  itEtSum->hwPhi(), itEtSum->hwQual());
86 
87  output->push_back(gtEtSum);
88  }
89  }
90 
91  const unsigned int gtEta(const unsigned int iEta)
92  {
93  unsigned rctEta = (iEta<11 ? 10-iEta : iEta-11);
94  return (((rctEta % 7) & 0x7) | (iEta<11 ? 0x8 : 0));
95  }
96 }
L1CaloEtScale jetScale()
void JetToGtScales(CaloParamsStage1 *params, const std::vector< l1t::Jet > *input, std::vector< l1t::Jet > *output)
Definition: Tau.h:13
const unsigned int gtEta(const unsigned int iEta)
void TauToGtScales(CaloParamsStage1 *params, const std::vector< l1t::Tau > *input, std::vector< l1t::Tau > *output)
double linearLsb() const
get LSB of linear input scale
Definition: L1CaloEtScale.h:53
L1CaloEtScale emScale()
uint16_t rank(const uint16_t linear) const
convert from linear Et scale to rank scale
static std::string const input
Definition: EdmProvDump.cc:44
Definition: Jet.h:13
L1CaloEtScale HtMissScale()
void EGammaToGtScales(CaloParamsStage1 *params, const std::vector< l1t::EGamma > *input, std::vector< l1t::EGamma > *output)
unsigned linScaleMax() const
Definition: L1CaloEtScale.h:47
void EtSumToGtScales(CaloParamsStage1 *params, const std::vector< l1t::EtSum > *input, std::vector< l1t::EtSum > *output)