CMS 3D CMS Logo

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