CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
PatJetHitFitTranslator.cc
Go to the documentation of this file.
1 
17 
18 namespace hitfit {
19 
20  template <>
22  [[clang::suppress]]
23  std::string CMSSW_BASE(std::getenv("CMSSW_BASE"));
24  std::string resolution_filename =
25  CMSSW_BASE + std::string("/src/TopQuarkAnalysis/PatHitFit/data/exampleJetResolution.txt");
26  udscResolution_ = EtaDepResolution(resolution_filename);
27  bResolution_ = EtaDepResolution(resolution_filename);
28  jetCorrectionLevel_ = "L7Parton";
29  jes_ = 1.0;
30  jesB_ = 1.0;
31 
32  } // JetTranslatorBase<pat::Jet>::JetTranslatorBase()
33 
34  template <>
36  [[clang::suppress]]
37  std::string CMSSW_BASE(std::getenv("CMSSW_BASE"));
38  std::string udscResolution_filename;
39  std::string bResolution_filename;
40 
41  if (udscFile.empty()) {
42  udscResolution_filename =
43  CMSSW_BASE + std::string("/src/TopQuarkAnalysis/PatHitFit/data/exampleJetResolution.txt");
44  } else {
45  udscResolution_filename = udscFile;
46  }
47 
48  if (bFile.empty()) {
49  bResolution_filename = CMSSW_BASE + std::string("/src/TopQuarkAnalysis/PatHitFit/data/exampleJetResolution.txt");
50  } else {
51  bResolution_filename = bFile;
52  }
53 
54  udscResolution_ = EtaDepResolution(udscResolution_filename);
55  bResolution_ = EtaDepResolution(bResolution_filename);
56  jetCorrectionLevel_ = "L7Parton";
57  jes_ = 1.0;
58  jesB_ = 1.0;
59 
60  } // JetTranslatorBase<pat::Jet>::JetTranslatorBase(const std::string& ifile)
61 
62  template <>
64  const std::string& bFile,
66  double jes,
67  double jesB) {
68  [[clang::suppress]]
69  std::string CMSSW_BASE(std::getenv("CMSSW_BASE"));
70  std::string udscResolution_filename;
71  std::string bResolution_filename;
72 
73  if (udscFile.empty()) {
74  udscResolution_filename =
75  CMSSW_BASE + std::string("/src/TopQuarkAnalysis/TopHitFit/data/resolution/tqafUdscJetResolution.txt");
76  } else {
77  udscResolution_filename = udscFile;
78  }
79 
80  if (bFile.empty()) {
81  bResolution_filename =
82  CMSSW_BASE + std::string("/src/TopQuarkAnalysis/TopHitFit/data/resolution/tqafBJetResolution.txt");
83  } else {
84  bResolution_filename = bFile;
85  }
86 
87  udscResolution_ = EtaDepResolution(udscResolution_filename);
88  bResolution_ = EtaDepResolution(bResolution_filename);
89  jetCorrectionLevel_ = jetCorrectionLevel;
90  jes_ = jes;
91  jesB_ = jesB;
92 
93  } // JetTranslatorBase<pat::Jet>::JetTranslatorBase(const std::string& ifile)
94 
95  template <>
96  JetTranslatorBase<pat::Jet>::~JetTranslatorBase() {} // JetTranslatorBase<pat::Jet>::~JetTranslatorBase()
97 
98  template <>
100  int type /*= hitfit::unknown_label */,
101  bool useObjEmbRes /* = false */) {
102  Fourvec p;
103 
104  double jet_eta = jet.eta();
105 
106  if (jet.isCaloJet()) {
107  jet_eta = static_cast<const reco::CaloJet*>(jet.originalObject())->detectorP4().eta();
108  }
109  if (jet.isPFJet()) {
110  // do nothing at the moment!
111  }
112 
113  Vector_Resolution jet_resolution;
114 
116  jet_resolution = bResolution_.GetResolution(jet_eta);
117  pat::Jet bPartonCorrJet(jet.correctedJet(jetCorrectionLevel_, "BOTTOM"));
118  bPartonCorrJet.scaleEnergy(jesB_);
119  p = Fourvec(bPartonCorrJet.px(), bPartonCorrJet.py(), bPartonCorrJet.pz(), bPartonCorrJet.energy());
120 
121  } else {
122  jet_resolution = udscResolution_.GetResolution(jet_eta);
123  pat::Jet udsPartonCorrJet(jet.correctedJet(jetCorrectionLevel_, "UDS"));
124  udsPartonCorrJet.scaleEnergy(jes_);
125  p = Fourvec(udsPartonCorrJet.px(), udsPartonCorrJet.py(), udsPartonCorrJet.pz(), udsPartonCorrJet.energy());
126  }
127 
128  Lepjets_Event_Jet retjet(p, type, jet_resolution);
129  return retjet;
130 
131  } // Lepjets_Event_Jet JetTranslatorBase<pat::Jet>::operator()(const pat::Jet& j,int type)
132 
133  template <>
135  return udscResolution_;
136  }
137 
138  template <>
140  return bResolution_;
141  }
142 
143  template <>
145  double jet_eta = jet.eta();
146 
147  if (jet.isCaloJet()) {
148  jet_eta = static_cast<const reco::CaloJet*>(jet.originalObject())->detectorP4().eta();
149  }
150  if (jet.isPFJet()) {
151  // do nothing at the moment!
152  }
153  return bResolution_.CheckEta(jet_eta) && udscResolution_.CheckEta(jet_eta);
154  }
155 
156  //
157 
158 } // namespace hitfit
Jets made from CaloTowers.
Definition: CaloJet.h:27
JetTranslatorBase()
Default constructor.
void scaleEnergy(double fScale) override
Scale energy and correspondingly adjust raw jec factors.
Definition: Jet.h:177
Hold on to -dependent resolution. This class acts as a function object and returns Vector_Resolution ...
CLHEP::HepLorentzVector Fourvec
Typedef for a HepLorentzVector.
Definition: fourvec.h:55
A class to represent a jet in an instance of Lepjets_Event class. The class is derived from the Lepje...
Template class of function object to translate jet physics object to HitFit&#39;s Lepjets_Event_Jet objec...
Analysis-level calorimeter jet class.
Definition: Jet.h:77
Template class of function object to translate jet physics object to HitFit&#39;s Lepjets_Event_Jet objec...
Calculate and represent resolution for a vector of , pseudorapidity , and azimuthal angle ...
udscResolution
<— these resolutions do not exist yet —> tauResolution = stringResolution.clone(parametrization = &#39;...
double eta() const final
momentum pseudorapidity