CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
JetCalibrationMethods.cc
Go to the documentation of this file.
1 // JetCalibrationMethods.cc
2 // Authors: Inga Bucinskaite, UIC
3 //
4 // This file should contain the different algorithms used for Jet Calibration
5 //
6 
8 #include <vector>
9 
10 namespace l1t {
11 
13  return (m.hwPt() < n.hwPt() );
14  }
15 
16  void JetCalibration1(std::vector<l1t::Jet> * uncalibjets,
17  std::vector<double> jetSF,
18  std::vector<l1t::Jet> * jets,
19  bool applyJetCalibration,
20  double jetLSB)
21  {
22 
23  for (std::vector<l1t::Jet>::const_iterator uncalibjet = uncalibjets->begin(); uncalibjet != uncalibjets->end(); ++uncalibjet){
24 
25  if (!applyJetCalibration) {
26  l1t::Jet corrjets = *uncalibjet;
27  jets->push_back(corrjets);
28  continue;
29  }
30 
31  int jetPt = (uncalibjet->hwPt())*jetLSB; // correction factors are parameterized as functions of physical pt
32  int jetPhi = uncalibjet->hwPhi();
33  int jetEta = uncalibjet->hwEta();
34  int jetQual = uncalibjet->hwQual();
35  double jpt = 0.0;
36 
37  double alpha = jetSF[2*jetEta + 0]; //Scale factor (See jetSF_cfi.py)
38  double gamma = ((jetSF[2*jetEta + 1])); //Offset
39 
40  jpt = jetPt*alpha+gamma;
41  unsigned int corjetET =(int) (jpt/jetLSB);
42 
43  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > *jetLorentz =
44  new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> >();
45  l1t::Jet corrjets(*jetLorentz, corjetET, jetEta, jetPhi, jetQual);
46 
47  jets->push_back(corrjets);
48 
49 
50  }
51 
52  std::sort(jets->begin(), jets->end(), compareCorrJets);
53  std::reverse(jets->begin(), jets->end());
54  }
55 }
56 
57 
58 
59 
float alpha
Definition: AMPTWrapper.h:95
Definition: Jet.h:13
vector< PseudoJet > jets
int hwPt() const
Definition: L1Candidate.cc:69
bool compareCorrJets(l1t::Jet m, l1t::Jet n)
void JetCalibration1(std::vector< l1t::Jet > *uncalibjets, std::vector< double > jetSF, std::vector< l1t::Jet > *jets, bool applyJetCalibration, double jetLSB)