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  unsigned newPhi = itJet->hwPhi();
19  unsigned newEta = gtEta(itJet->hwEta());
20 
21  // jets with hwQual & 10 ==10 are "padding" jets from a sort, set their eta and phi
22  // to the max value
23  if((itJet->hwQual() & 0x10) == 0x10)
24  {
25  newEta = 0x0;
26  newPhi = 0x0;
27  }
28 
29  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > ldummy(0,0,0,0);
30 
31  l1t::Jet gtJet(*&ldummy, itJet->hwPt(), newEta, newPhi, itJet->hwQual());
32  output->push_back(gtJet);
33  }
34  }
35 
37  const std::vector<l1t::Jet> * input,
38  std::vector<l1t::Jet> *output){
39 
40  for(std::vector<l1t::Jet>::const_iterator itJet = input->begin();
41  itJet != input->end(); ++itJet){
42  uint16_t linPt = (uint16_t)itJet->hwPt();
43  if(linPt > params->jetScale().linScaleMax() ) linPt = params->jetScale().linScaleMax();
44  const uint16_t rankPt = params->jetScale().rank(linPt);
45 
46  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > ldummy(0,0,0,0);
47 
48  l1t::Jet gtJet(*&ldummy, rankPt, itJet->hwEta(), itJet->hwPhi(), itJet->hwQual());
49  output->push_back(gtJet);
50  }
51  }
52 
53 
55  const std::vector<l1t::EGamma> * input,
56  std::vector<l1t::EGamma> *output){
57 
58  for(std::vector<l1t::EGamma>::const_iterator itEGamma = input->begin();
59  itEGamma != input->end(); ++itEGamma){
60  unsigned newEta = gtEta(itEGamma->hwEta());
61  unsigned newPhi = itEGamma->hwPhi();
62  const uint16_t rankPt = (uint16_t)itEGamma->hwPt(); //max value?
63 
64  //hwQual &10 == 10 means that the object came from a sort and is padding
65  if((itEGamma->hwQual() & 0x10) == 0x10)
66  {
67  newEta = 0x0;
68  newPhi = 0x0;
69  }
70 
71  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > ldummy(0,0,0,0);
72 
73  l1t::EGamma gtEGamma(*&ldummy, rankPt, newEta, newPhi,
74  itEGamma->hwQual(), itEGamma->hwIso());
75  output->push_back(gtEGamma);
76  }
77  }
78 
80  const std::vector<l1t::Tau> * input,
81  std::vector<l1t::Tau> *output){
82  for(std::vector<l1t::Tau>::const_iterator itTau = input->begin();
83  itTau != input->end(); ++itTau){
84  const unsigned newEta = gtEta(itTau->hwEta());
85  uint16_t linPt = (uint16_t)itTau->hwPt();
86  if(linPt > params->jetScale().linScaleMax() ) linPt = params->jetScale().linScaleMax();
87  const uint16_t rankPt = params->jetScale().rank(linPt);
88 
89  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > ldummy(0,0,0,0);
90 
91  l1t::Tau gtTau(*&ldummy, rankPt, newEta, itTau->hwPhi(), itTau->hwQual(), itTau->hwIso());
92  output->push_back(gtTau);
93  }
94  }
95 
97  const std::vector<l1t::EtSum> * input,
98  std::vector<l1t::EtSum> *output){
99  for(std::vector<l1t::EtSum>::const_iterator itEtSum = input->begin();
100  itEtSum != input->end(); ++itEtSum){
101 
102  uint16_t rankPt;
103  // Hack for now to make sure they come out with the right scale
104  //rankPt = params->jetScale().rank((uint16_t)itEtSum->hwPt());
105  rankPt = (uint16_t)itEtSum->hwPt();
106  if (EtSum::EtSumType::kMissingHt == itEtSum->getType())
107  {
108  // if(rankPt > params->HtMissScale().linScaleMax()) rankPt = params->HtMissScale().linScaleMax();
109  // params->HtMissScale().linScaleMax() always returns zero. Hardcode 512 for now
110 
111  // comment out for mht/ht (already in GT scale)
112  //if(rankPt > 512) rankPt = 512;
113  //rankPt = params->HtMissScale().rank(rankPt*params->emScale().linearLsb());
114  }
115 
116  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > ldummy(0,0,0,0);
117 
118  l1t::EtSum gtEtSum(*&ldummy, itEtSum->getType(), rankPt, 0,
119  itEtSum->hwPhi(), itEtSum->hwQual());
120 
121  output->push_back(gtEtSum);
122  }
123  }
124 
125  const unsigned int gtEta(const unsigned int iEta)
126  {
127  unsigned rctEta = (iEta<11 ? 10-iEta : iEta-11);
128  return (((rctEta % 7) & 0x7) | (iEta<11 ? 0x8 : 0));
129  }
130 }
L1CaloEtScale jetScale()
void JetToGtEtaScales(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)
uint16_t rank(const uint16_t linear) const
convert from linear Et scale to rank scale
void JetToGtPtScales(CaloParamsStage1 *params, const std::vector< l1t::Jet > *input, std::vector< l1t::Jet > *output)
static std::string const input
Definition: EdmProvDump.cc:44
Definition: Jet.h:13
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)