CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PatJetHitFitTranslator.cc
Go to the documentation of this file.
1 
17 
18 namespace hitfit {
19 
20  template <>
22  std::string CMSSW_BASE(std::getenv("CMSSW_BASE"));
23  std::string resolution_filename =
24  CMSSW_BASE + std::string("/src/TopQuarkAnalysis/PatHitFit/data/exampleJetResolution.txt");
25  udscResolution_ = EtaDepResolution(resolution_filename);
26  bResolution_ = EtaDepResolution(resolution_filename);
27  jetCorrectionLevel_ = "L7Parton";
28  jes_ = 1.0;
29  jesB_ = 1.0;
30 
31  } // JetTranslatorBase<pat::Jet>::JetTranslatorBase()
32 
33  template <>
35  std::string CMSSW_BASE(std::getenv("CMSSW_BASE"));
36  std::string udscResolution_filename;
37  std::string bResolution_filename;
38 
39  if (udscFile.empty()) {
40  udscResolution_filename =
41  CMSSW_BASE + std::string("/src/TopQuarkAnalysis/PatHitFit/data/exampleJetResolution.txt");
42  } else {
43  udscResolution_filename = udscFile;
44  }
45 
46  if (bFile.empty()) {
47  bResolution_filename = CMSSW_BASE + std::string("/src/TopQuarkAnalysis/PatHitFit/data/exampleJetResolution.txt");
48  } else {
49  bResolution_filename = bFile;
50  }
51 
52  udscResolution_ = EtaDepResolution(udscResolution_filename);
53  bResolution_ = EtaDepResolution(bResolution_filename);
54  jetCorrectionLevel_ = "L7Parton";
55  jes_ = 1.0;
56  jesB_ = 1.0;
57 
58  } // JetTranslatorBase<pat::Jet>::JetTranslatorBase(const std::string& ifile)
59 
60  template <>
62  const std::string& bFile,
63  const std::string& jetCorrectionLevel,
64  double jes,
65  double jesB) {
66  std::string CMSSW_BASE(std::getenv("CMSSW_BASE"));
67  std::string udscResolution_filename;
68  std::string bResolution_filename;
69 
70  if (udscFile.empty()) {
71  udscResolution_filename =
72  CMSSW_BASE + std::string("/src/TopQuarkAnalysis/TopHitFit/data/resolution/tqafUdscJetResolution.txt");
73  } else {
74  udscResolution_filename = udscFile;
75  }
76 
77  if (bFile.empty()) {
78  bResolution_filename =
79  CMSSW_BASE + std::string("/src/TopQuarkAnalysis/TopHitFit/data/resolution/tqafBJetResolution.txt");
80  } else {
81  bResolution_filename = bFile;
82  }
83 
84  udscResolution_ = EtaDepResolution(udscResolution_filename);
85  bResolution_ = EtaDepResolution(bResolution_filename);
86  jetCorrectionLevel_ = jetCorrectionLevel;
87  jes_ = jes;
88  jesB_ = jesB;
89 
90  } // JetTranslatorBase<pat::Jet>::JetTranslatorBase(const std::string& ifile)
91 
92  template <>
93  JetTranslatorBase<pat::Jet>::~JetTranslatorBase() {} // JetTranslatorBase<pat::Jet>::~JetTranslatorBase()
94 
95  template <>
97  int type /*= hitfit::unknown_label */,
98  bool useObjEmbRes /* = false */) {
99  Fourvec p;
100 
101  double jet_eta = jet.eta();
102 
103  if (jet.isCaloJet()) {
104  jet_eta = static_cast<const reco::CaloJet*>(jet.originalObject())->detectorP4().eta();
105  }
106  if (jet.isPFJet()) {
107  // do nothing at the moment!
108  }
109 
110  Vector_Resolution jet_resolution;
111 
112  if (type == hitfit::hadb_label || type == hitfit::lepb_label || type == hitfit::higgs_label) {
113  jet_resolution = bResolution_.GetResolution(jet_eta);
114  pat::Jet bPartonCorrJet(jet.correctedJet(jetCorrectionLevel_, "BOTTOM"));
115  bPartonCorrJet.scaleEnergy(jesB_);
116  p = Fourvec(bPartonCorrJet.px(), bPartonCorrJet.py(), bPartonCorrJet.pz(), bPartonCorrJet.energy());
117 
118  } else {
119  jet_resolution = udscResolution_.GetResolution(jet_eta);
120  pat::Jet udsPartonCorrJet(jet.correctedJet(jetCorrectionLevel_, "UDS"));
121  udsPartonCorrJet.scaleEnergy(jes_);
122  p = Fourvec(udsPartonCorrJet.px(), udsPartonCorrJet.py(), udsPartonCorrJet.pz(), udsPartonCorrJet.energy());
123  }
124 
125  Lepjets_Event_Jet retjet(p, type, jet_resolution);
126  return retjet;
127 
128  } // Lepjets_Event_Jet JetTranslatorBase<pat::Jet>::operator()(const pat::Jet& j,int type)
129 
130  template <>
132  return udscResolution_;
133  }
134 
135  template <>
137  return bResolution_;
138  }
139 
140  template <>
142  double jet_eta = jet.eta();
143 
144  if (jet.isCaloJet()) {
145  jet_eta = static_cast<const reco::CaloJet*>(jet.originalObject())->detectorP4().eta();
146  }
147  if (jet.isPFJet()) {
148  // do nothing at the moment!
149  }
150  return bResolution_.CheckEta(jet_eta) && udscResolution_.CheckEta(jet_eta);
151  }
152 
153  //
154 
155 } // namespace hitfit
Jets made from CaloTowers.
Definition: CaloJet.h:27
JetTranslatorBase()
Default constructor.
tuple udscResolution
&lt;— these resolutions do not exist yet —&gt; tauResolution = stringResolution.clone(parametrization = &#39;EtE...
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 ...
bool isCaloJet() const
check to see if the jet is a reco::CaloJet
Definition: Jet.h:271
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...
bool isPFJet() const
check to see if the jet is a reco::PFJet
Definition: Jet.h:275
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
const reco::Candidate * originalObject() const
access to the original object; returns zero for null Ref and throws for unavailable collection ...
Definition: PATObject.h:522
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 ...
Jet correctedJet(const std::string &level, const std::string &flavor="none", const std::string &set="") const
double eta() const final
momentum pseudorapidity