CMS 3D CMS Logo

CLHEPHitFitTranslator.cc
Go to the documentation of this file.
1 //
2 //
3 
20 #include <cstdlib>
21 #include "CLHEP/Vector/LorentzVector.h"
22 
26 
27 namespace hitfit {
28 
29  template <>
31  std::string CMSSW_BASE(std::getenv("CMSSW_BASE"));
32  std::string resolution_filename =
33  CMSSW_BASE + std::string("/src/TopQuarkAnalysis/TopHitFit/data/exampleElectronResolution.txt");
34  resolution_ = EtaDepResolution(resolution_filename);
35 
36  } // LeptonTranslatorBase<CLHEP::HepLorentzVector>::LeptonTranslatorBase()
37 
38  template <>
40  std::string CMSSW_BASE(std::getenv("CMSSW_BASE"));
41  std::string resolution_filename;
42 
43  if (ifile.empty()) {
44  resolution_filename =
45  CMSSW_BASE + std::string("/src/TopQuarkAnalysis/TopHitFit/data/exampleElectronResolution.txt");
46  } else {
47  resolution_filename = ifile;
48  }
49 
50  resolution_ = EtaDepResolution(resolution_filename);
51 
52  } // LeptonTranslatorBase<CLHEP::HepLorentzVector>::LeptonTranslatorBase(const std::string& ifile)
53 
54  template <>
56 
57  template <>
59  int type /* = hitfit::lepton_label */,
60  bool useObjEmbRes /* = false */) {
61  Fourvec p(lepton.px(), lepton.py(), lepton.pz(), lepton.e());
62 
63  double lepton_eta(lepton.eta());
64  Vector_Resolution lepton_resolution = resolution_.GetResolution(lepton_eta);
65  Lepjets_Event_Lep retlep(p, type, lepton_resolution);
66  return retlep;
67 
68  } // Lepjets_Event_Lep LeptonTranslatorBase<CLHEP::HepLorentzVector>::operator()(const CLHEP::HepLorentzVector& lepton)
69 
70  template <>
72  return resolution_;
73  }
74 
75  template <>
76  bool LeptonTranslatorBase<CLHEP::HepLorentzVector>::CheckEta(const CLHEP::HepLorentzVector& lepton) const {
77  return resolution_.CheckEta(lepton.eta());
78  }
79 
80  template <>
82  std::string CMSSW_BASE(std::getenv("CMSSW_BASE"));
83  std::string udsc_resolution_filename =
84  CMSSW_BASE + std::string("/src/TopQuarkAnalysis/TopHitFit/data/exampleJetResolution.txt");
85  const std::string& b_resolution_filename = udsc_resolution_filename;
86 
87  udscResolution_ = EtaDepResolution(udsc_resolution_filename);
88  bResolution_ = EtaDepResolution(b_resolution_filename);
89 
90  } // JetTranslatorBase<CLHEP::HepLorentzVector>::JetTranslatorBase()
91 
92  template <>
94  std::string CMSSW_BASE(std::getenv("CMSSW_BASE"));
95  std::string udsc_resolution_filename;
96  std::string b_resolution_filename;
97 
98  if (udscFile.empty()) {
99  udsc_resolution_filename =
100  CMSSW_BASE + std::string("/src/TopQuarkAnalysis/TopHitFit/data/exampleJetResolution.txt");
101  } else {
102  udsc_resolution_filename = udscFile;
103  }
104 
105  if (bFile.empty()) {
106  b_resolution_filename = CMSSW_BASE + std::string("/src/TopQuarkAnalysis/TopHitFit/data/exampleJetResolution.txt");
107  } else {
108  b_resolution_filename = bFile;
109  }
110 
111  udscResolution_ = EtaDepResolution(udsc_resolution_filename);
112  bResolution_ = EtaDepResolution(b_resolution_filename);
113 
114  } // JetTranslatorBase<CLHEP::HepLorentzVector>::JetTranslatorBase(const std::string& udscFile,const std::string& bFile)
115 
116  template <>
118  } // JetTranslatorBase<CLHEP::HepLorentzVector>::~JetTranslatorBase()
119 
120  template <>
122  int type /* = hitfit::unknown_label */,
123  bool useObjEmbRes /* = false */) {
124  Fourvec p(jet.px(), jet.py(), jet.pz(), jet.e());
125 
126  double jet_eta = jet.eta();
127  Vector_Resolution jet_resolution;
128 
130  jet_resolution = bResolution_.GetResolution(jet_eta);
131  } else {
132  jet_resolution = udscResolution_.GetResolution(jet_eta);
133  }
134 
135  Lepjets_Event_Jet retjet(p, type, jet_resolution);
136  return retjet;
137 
138  } // Lepjets_Event_Jet JetTranslatorBase<CLHEP::HepLorentzVector>::operator()(const CLHEP::HepLorentzVector& j,int type)
139 
140  template <>
142  return udscResolution_;
143  }
144 
145  template <>
147  return bResolution_;
148  }
149 
150  template <>
151  bool JetTranslatorBase<CLHEP::HepLorentzVector>::CheckEta(const CLHEP::HepLorentzVector& jet) const {
152  return udscResolution_.CheckEta(jet.eta()) && bResolution_.CheckEta(jet.eta());
153  }
154 
155  template <>
157  resolution_ = Resolution(std::string("0,0,12"));
158  } // METTranslatorBase<CLHEP::HepLorentzVector>::METTranslatorBase()
159 
160  template <>
162  const Defaults_Text defs(ifile);
163  std::string resolution_string(defs.get_string("met_resolution"));
164  resolution_ = Resolution(resolution_string);
165 
166  } // METTranslatorBase<CLHEP::HepLorentzVector>::METTranslatorBase(const std::string& ifile)
167 
168  template <>
170  } // METTranslatorBase<CLHEP::HepLorentzVector>::~METTranslatorBase()
171 
172  template <>
174  bool useObjEmbRes /* = false */) {
175  return Fourvec(m.px(), m.py(), 0.0, m.e());
176 
177  } // Fourvec METTranslatorBase<CLHEP::HepLorentzVector>::operator()(const CLHEP::HepLorentzVector& m)
178 
179  template <>
181  bool useObjEmbRes /* = false */) const {
182  return resolution_;
183  } // Resolution METTranslatorBase<CLHEP::HepLorentzVector>::KtResolution(const CLHEP::HepLorentzVector& m)
184 
185  template <>
187  bool useObjEmbRes /* = false */) const {
188  return KtResolution(m, useObjEmbRes);
189  } // Resolution METTranslatorBase<CLHEP::HepLorentzVector>::METResolution(const CLHEP::HepLorentzVector& m)
190 
191 } // namespace hitfit
hitfit
Definition: Base_Constrainer.h:43
hitfit::Fourvec
CLHEP::HepLorentzVector Fourvec
Typedef for a HepLorentzVector.
Definition: fourvec.h:55
hitfit::hadb_label
Definition: Lepjets_Event_Jet.h:57
hitfit::lepb_label
Definition: Lepjets_Event_Jet.h:56
hitfit::Defaults_Text::get_string
std::string get_string(std::string name) const override
Definition: Defaults_Text.cc:416
hitfit::Vector_Resolution
Definition: Vector_Resolution.h:89
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
hitfit::EtaDepResolution
Hold on to -dependent resolution. This class acts as a function object and returns Vector_Resolution ...
Definition: EtaDepResolution.h:86
TkMap_script_phase1.CMSSW_BASE
CMSSW_BASE
Definition: TkMap_script_phase1.py:158
hitfit::LeptonTranslatorBase::LeptonTranslatorBase
LeptonTranslatorBase()
Default constructor.
hitfit::LeptonTranslatorBase::operator()
Lepjets_Event_Lep operator()(const ALepton &lepton, int type=hitfit::lepton_label, bool useObjEmbRes=false)
Convert a lepton physics object of type ALepton into HitFit lepton physics object of type Lepjets_Eve...
hitfit::LeptonTranslatorBase::resolution
const EtaDepResolution & resolution() const
Return the dependent resolution of the lepton.
hitfit::JetTranslatorBase::~JetTranslatorBase
~JetTranslatorBase()
Destructor.
hitfit::JetTranslatorBase::CheckEta
bool CheckEta(const AJet &jet) const
Check if a jet has value which is within the valid range of the resolution.
METTranslatorBase.h
Template class of function object to translate missing transverse energy object to HitFit's Fourvec o...
hitfit::METTranslatorBase::METResolution
Resolution METResolution(const AMet &met, bool useObjEmbRes=false) const
Alias for KtResolution(AMet& met)
LeptonTranslatorBase.h
Template class of function object to translate lepton physics object to HitFit's Lepjets_Event_Lep ob...
hitfit::Lepjets_Event_Jet
A class to represent a jet in an instance of Lepjets_Event class. The class is derived from the Lepje...
Definition: Lepjets_Event_Jet.h:76
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
hitfit::Defaults_Text
A lightweight implementation of the Defaults interface that uses simple ASCII text files.
Definition: Defaults_Text.h:117
compare_using_db.ifile
ifile
Definition: compare_using_db.py:251
hitfit::METTranslatorBase::operator()
Fourvec operator()(const AMet &met, bool useObjEmbRes=false)
Convert a missing transverse energy object of type AMet into HitFit four-momentum object of type Four...
JetTranslatorBase.h
Template class of function object to translate jet physics object to HitFit's Lepjets_Event_Jet objec...
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
hitfit::METTranslatorBase::METTranslatorBase
METTranslatorBase()
Default constructor.
Resolution
Definition: trackSplitPlot.h:33
hitfit::JetTranslatorBase::JetTranslatorBase
JetTranslatorBase()
Default constructor.
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
hitfit::LeptonTranslatorBase::~LeptonTranslatorBase
~LeptonTranslatorBase()
Destructor.
hitfit::JetTranslatorBase::udscResolution
const EtaDepResolution & udscResolution() const
Return the dependent resolution for jets.
hitfit::LeptonTranslatorBase::CheckEta
bool CheckEta(const ALepton &lepton) const
Check if a lepton has value which is within the valid range of the resolution.
hitfit::JetTranslatorBase::bResolution
const EtaDepResolution & bResolution() const
Return the dependent resolution for jets.
hitfit::Resolution
Definition: Resolution.h:98
hitfit::METTranslatorBase::~METTranslatorBase
~METTranslatorBase()
Destructor.
hitfit::higgs_label
Definition: Lepjets_Event_Jet.h:60
hitfit::METTranslatorBase::KtResolution
Resolution KtResolution(const AMet &met, bool useObjEmbRes=false) const
Return the resolution corresponding to an instance of missing transverse energy object.
metsig::jet
Definition: SignAlgoResolutions.h:47
hitfit::JetTranslatorBase::operator()
Lepjets_Event_Jet operator()(const AJet &jet, int type=hitfit::unknown_label, bool useObjEmbRes=false)
Convert a jet physics object of type AJet into HitFit jet physics object of type Lepjets_Event_Jet....
hitfit::Lepjets_Event_Lep
Represent a lepton in an instance of Lepjets_Event class. This class hold the following information:
Definition: Lepjets_Event_Lep.h:64