CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
hitfit::JetTranslatorBase< AJet > Class Template Reference

Template class of function object to translate jet physics object to HitFit's Lepjets_Event_Jet object. Users need to write an implementation of a template specialization of this class for their jet physics object class. Then users combine this header file and their implementation for their analysis code. With this approach, it is possible to use HitFit for different jet physics object class in different experiments. More...

#include <JetTranslatorBase.h>

Public Member Functions

const EtaDepResolutionbResolution () const
 Return the $ \eta- $ dependent resolution for $b$ jets. More...
 
template<>
const EtaDepResolutionbResolution () const
 
template<>
const EtaDepResolutionbResolution () const
 
bool CheckEta (const AJet &jet) const
 Check if a jet has $ \eta $ value which is within the valid $ \eta $ range of the resolution. More...
 
template<>
bool CheckEta (const pat::Jet &jet) const
 
template<>
bool CheckEta (const CLHEP::HepLorentzVector &jet) const
 
template<>
 JetTranslatorBase ()
 
template<>
 JetTranslatorBase (const std::string &udscFile, const std::string &bFile)
 
 JetTranslatorBase ()
 Default constructor. More...
 
 JetTranslatorBase (const std::string &udscFile, const std::string &bFile)
 Constructor, instantiate a JetTranslatorBase object using the names of input files in std::string format. More...
 
template<>
 JetTranslatorBase (const std::string &udscFile, const std::string &bFile, const std::string &jetCorrectionLevel, double jes, double jesB)
 
 JetTranslatorBase (const std::string &udscFile, const std::string &bFile, const std::string &jetCorrectionLevel, double jes, double jesB)
 Constructor, instantiate a JetTranslatorBase object using the names of input files in std::string format. More...
 
template<>
 JetTranslatorBase ()
 
template<>
 JetTranslatorBase (const std::string &udscFile, const std::string &bFile)
 
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. This operator must be able to apply the appropriate jet energy correction in accord with the type of the jet. More...
 
template<>
Lepjets_Event_Jet operator() (const pat::Jet &jet, int type, bool useObjEmbRes)
 
template<>
Lepjets_Event_Jet operator() (const CLHEP::HepLorentzVector &jet, int type, bool useObjEmbRes)
 
const EtaDepResolutionudscResolution () const
 Return the $ \eta- $ dependent resolution for $udsc$ jets. More...
 
template<>
const EtaDepResolutionudscResolution () const
 
template<>
const EtaDepResolutionudscResolution () const
 
 ~JetTranslatorBase ()
 Destructor. More...
 
template<>
 ~JetTranslatorBase ()
 
template<>
 ~JetTranslatorBase ()
 

Private Attributes

EtaDepResolution bResolution_
 The $ \eta- $ dependent resolution for $b$ jets. More...
 
double jes_
 The jet energy scale. More...
 
double jesB_
 The b-jet energy scale. More...
 
std::string jetCorrectionLevel_
 The jet correction level. More...
 
EtaDepResolution udscResolution_
 The $ \eta- $ dependent resolution for $udsc$ jets. More...
 

Detailed Description

template<class AJet>
class hitfit::JetTranslatorBase< AJet >

Template class of function object to translate jet physics object to HitFit's Lepjets_Event_Jet object. Users need to write an implementation of a template specialization of this class for their jet physics object class. Then users combine this header file and their implementation for their analysis code. With this approach, it is possible to use HitFit for different jet physics object class in different experiments.

Parameters
AJetThe typename of the jet physics object class to be translated into HitFit's Lepjets_Event_Jet.

Definition at line 45 of file JetTranslatorBase.h.

Constructor & Destructor Documentation

template<class AJet>
hitfit::JetTranslatorBase< AJet >::JetTranslatorBase ( )

Default constructor.

template<class AJet>
hitfit::JetTranslatorBase< AJet >::JetTranslatorBase ( const std::string &  udscFile,
const std::string &  bFile 
)

Constructor, instantiate a JetTranslatorBase object using the names of input files in std::string format.

Parameters
udscFileThe path of the input file containing resolution for $udsc$ jets.
bFileThe path of the input file containing resolution for $b$ jets.
template<class AJet>
hitfit::JetTranslatorBase< AJet >::JetTranslatorBase ( const std::string &  udscFile,
const std::string &  bFile,
const std::string &  jetCorrectionLevel,
double  jes,
double  jesB 
)

Constructor, instantiate a JetTranslatorBase object using the names of input files in std::string format.

Parameters
udscFileThe path of the input file containing resolution for $udsc$ jets.
bFileThe path of the input file containing resolution for $b$ jets.
jetCorrectionLevelThe jet correction level.
jesThe jet energy scale.
jesBThe b-jet energy scale.
template<class AJet>
hitfit::JetTranslatorBase< AJet >::~JetTranslatorBase ( )

Destructor.

template<>
hitfit::JetTranslatorBase< CLHEP::HepLorentzVector >::JetTranslatorBase ( )

Definition at line 102 of file CLHEPHitFitTranslator.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

103 {
104 
105  std::string CMSSW_BASE(getenv("CMSSW_BASE"));
106  std::string udsc_resolution_filename = CMSSW_BASE +
107  std::string("/src/TopQuarkAnalysis/TopHitFit/data/exampleJetResolution.txt");
108  std::string b_resolution_filename = udsc_resolution_filename;
109 
110  udscResolution_ = EtaDepResolution(udsc_resolution_filename);
111  bResolution_ = EtaDepResolution(b_resolution_filename);
112 
113 } // JetTranslatorBase<CLHEP::HepLorentzVector>::JetTranslatorBase()
EtaDepResolution udscResolution_
The dependent resolution for $udsc$ jets.
EtaDepResolution bResolution_
The dependent resolution for $b$ jets.
template<>
hitfit::JetTranslatorBase< CLHEP::HepLorentzVector >::JetTranslatorBase ( const std::string &  udscFile,
const std::string &  bFile 
)

Definition at line 117 of file CLHEPHitFitTranslator.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

119 {
120 
121  std::string CMSSW_BASE(getenv("CMSSW_BASE"));
122  std::string udsc_resolution_filename;
123  std::string b_resolution_filename;
124 
125  if (udscFile.empty()) {
126  udsc_resolution_filename = CMSSW_BASE +
127  std::string("/src/TopQuarkAnalysis/TopHitFit/data/exampleJetResolution.txt");
128  } else {
129  udsc_resolution_filename = udscFile;
130  }
131 
132  if (bFile.empty()) {
133  b_resolution_filename = CMSSW_BASE +
134  std::string("/src/TopQuarkAnalysis/TopHitFit/data/exampleJetResolution.txt");
135  } else {
136  b_resolution_filename = bFile;
137  }
138 
139  udscResolution_ = EtaDepResolution(udsc_resolution_filename);
140  bResolution_ = EtaDepResolution(b_resolution_filename);
141 
142 } // JetTranslatorBase<CLHEP::HepLorentzVector>::JetTranslatorBase(const std::string& udscFile,const std::string& bFile)
EtaDepResolution udscResolution_
The dependent resolution for $udsc$ jets.
EtaDepResolution bResolution_
The dependent resolution for $b$ jets.
template<>
hitfit::JetTranslatorBase< CLHEP::HepLorentzVector >::~JetTranslatorBase ( )

Definition at line 146 of file CLHEPHitFitTranslator.cc.

147 {
148 } // JetTranslatorBase<CLHEP::HepLorentzVector>::~JetTranslatorBase()

Definition at line 23 of file PatJetHitFitTranslator.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

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()
double jes_
The jet energy scale.
EtaDepResolution udscResolution_
The dependent resolution for $udsc$ jets.
std::string jetCorrectionLevel_
The jet correction level.
EtaDepResolution bResolution_
The dependent resolution for $b$ jets.
double jesB_
The b-jet energy scale.
template<>
hitfit::JetTranslatorBase< pat::Jet >::JetTranslatorBase ( const std::string &  udscFile,
const std::string &  bFile 
)

Definition at line 39 of file PatJetHitFitTranslator.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

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)
double jes_
The jet energy scale.
EtaDepResolution udscResolution_
The dependent resolution for $udsc$ jets.
std::string jetCorrectionLevel_
The jet correction level.
EtaDepResolution bResolution_
The dependent resolution for $b$ jets.
double jesB_
The b-jet energy scale.
template<>
hitfit::JetTranslatorBase< pat::Jet >::JetTranslatorBase ( const std::string &  udscFile,
const std::string &  bFile,
const std::string &  jetCorrectionLevel,
double  jes,
double  jesB 
)

Definition at line 71 of file PatJetHitFitTranslator.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

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)
double jes_
The jet energy scale.
EtaDepResolution udscResolution_
The dependent resolution for $udsc$ jets.
std::string jetCorrectionLevel_
The jet correction level.
EtaDepResolution bResolution_
The dependent resolution for $b$ jets.
double jesB_
The b-jet energy scale.

Definition at line 106 of file PatJetHitFitTranslator.cc.

107 {
108 } // JetTranslatorBase<pat::Jet>::~JetTranslatorBase()

Member Function Documentation

template<class AJet>
const EtaDepResolution& hitfit::JetTranslatorBase< AJet >::bResolution ( ) const

Return the $ \eta- $ dependent resolution for $b$ jets.

template<>
const EtaDepResolution & hitfit::JetTranslatorBase< pat::Jet >::bResolution ( ) const

Definition at line 164 of file PatJetHitFitTranslator.cc.

165 {
166  return bResolution_;
167 }
EtaDepResolution bResolution_
The dependent resolution for $b$ jets.
template<>
const EtaDepResolution & hitfit::JetTranslatorBase< CLHEP::HepLorentzVector >::bResolution ( ) const

Definition at line 187 of file CLHEPHitFitTranslator.cc.

188 {
189  return bResolution_;
190 }
EtaDepResolution bResolution_
The dependent resolution for $b$ jets.
template<class AJet>
bool hitfit::JetTranslatorBase< AJet >::CheckEta ( const AJet &  jet) const

Check if a jet has $ \eta $ value which is within the valid $ \eta $ range of the resolution.

Parameters
jetThe jet whose $ \eta $ value is to be checked.
template<>
bool hitfit::JetTranslatorBase< pat::Jet >::CheckEta ( const pat::Jet jet) const

Definition at line 172 of file PatJetHitFitTranslator.cc.

References reco::LeafCandidate::eta(), pat::Jet::isCaloJet(), pat::Jet::isPFJet(), and pat::PATObject< ObjectType >::originalObject().

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 }
Jets made from CaloTowers.
Definition: CaloJet.h:29
EtaDepResolution udscResolution_
The dependent resolution for $udsc$ jets.
bool isCaloJet() const
check to see if the jet is a reco::CaloJet
Definition: Jet.h:247
bool isPFJet() const
check to see if the jet is a reco::PFJet
Definition: Jet.h:251
EtaDepResolution bResolution_
The dependent resolution for $b$ jets.
const bool CheckEta(double eta) const
Check is an input value is within the valid -range of this instance.
const reco::Candidate * originalObject() const
access to the original object; returns zero for null Ref and throws for unavailable collection ...
Definition: PATObject.h:487
virtual double eta() const final
momentum pseudorapidity
template<>
bool hitfit::JetTranslatorBase< CLHEP::HepLorentzVector >::CheckEta ( const CLHEP::HepLorentzVector &  jet) const

Definition at line 195 of file CLHEPHitFitTranslator.cc.

196 {
197  return udscResolution_.CheckEta(jet.eta()) && bResolution_.CheckEta(jet.eta());
198 }
EtaDepResolution udscResolution_
The dependent resolution for $udsc$ jets.
EtaDepResolution bResolution_
The dependent resolution for $b$ jets.
const bool CheckEta(double eta) const
Check is an input value is within the valid -range of this instance.
template<class AJet>
Lepjets_Event_Jet hitfit::JetTranslatorBase< AJet >::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. This operator must be able to apply the appropriate jet energy correction in accord with the type of the jet.

Parameters
jetThe jet physics object to be translated.
typeThe typecode of the jet to be translated (leptonic b, hadronic b, or hadronic W).
useObjEmbResBoolean parameter to indicate if the user would like to use the resolution embedded in the object, and not the resolution read when instantiating the class.
template<>
Lepjets_Event_Jet hitfit::JetTranslatorBase< pat::Jet >::operator() ( const pat::Jet jet,
int  type,
bool  useObjEmbRes 
)

Definition at line 113 of file PatJetHitFitTranslator.cc.

References pat::Jet::correctedJet(), reco::LeafCandidate::eta(), hitfit::hadb_label, hitfit::higgs_label, pat::Jet::isCaloJet(), pat::Jet::isPFJet(), hitfit::lepb_label, pat::PATObject< ObjectType >::originalObject(), AlCaHLTBitMon_ParallelJobs::p, and reco::Jet::scaleEnergy().

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 
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)
type
Definition: HCALResponse.h:21
Jets made from CaloTowers.
Definition: CaloJet.h:29
virtual void scaleEnergy(double fScale)
scale energy of the jet
double jes_
The jet energy scale.
EtaDepResolution udscResolution_
The dependent resolution for $udsc$ jets.
Vector_Resolution GetResolution(double &eta) const
Return the corresponding resolution for a value of .
bool isCaloJet() const
check to see if the jet is a reco::CaloJet
Definition: Jet.h:247
CLHEP::HepLorentzVector Fourvec
Typedef for a HepLorentzVector.
Definition: fourvec.h:57
std::string jetCorrectionLevel_
The jet correction level.
bool isPFJet() const
check to see if the jet is a reco::PFJet
Definition: Jet.h:251
EtaDepResolution bResolution_
The dependent resolution for $b$ jets.
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:487
virtual double eta() const final
momentum pseudorapidity
Jet correctedJet(const std::string &level, const std::string &flavor="none", const std::string &set="") const
double jesB_
The b-jet energy scale.
template<>
Lepjets_Event_Jet hitfit::JetTranslatorBase< CLHEP::HepLorentzVector >::operator() ( const CLHEP::HepLorentzVector &  jet,
int  type,
bool  useObjEmbRes 
)

Definition at line 153 of file CLHEPHitFitTranslator.cc.

References hitfit::hadb_label, hitfit::higgs_label, hitfit::lepb_label, and AlCaHLTBitMon_ParallelJobs::p.

156 {
157 
158  Fourvec p(jet.px(),jet.py(),jet.pz(),jet.e());
159 
160  double jet_eta = jet.eta();
161  Vector_Resolution jet_resolution;
162 
164  jet_resolution = bResolution_.GetResolution(jet_eta);
165  } else {
166  jet_resolution = udscResolution_.GetResolution(jet_eta);
167  }
168 
169  Lepjets_Event_Jet retjet(p,
170  type,
171  jet_resolution);
172  return retjet;
173 
174 } // Lepjets_Event_Jet JetTranslatorBase<CLHEP::HepLorentzVector>::operator()(const CLHEP::HepLorentzVector& j,int type)
type
Definition: HCALResponse.h:21
EtaDepResolution udscResolution_
The dependent resolution for $udsc$ jets.
Vector_Resolution GetResolution(double &eta) const
Return the corresponding resolution for a value of .
CLHEP::HepLorentzVector Fourvec
Typedef for a HepLorentzVector.
Definition: fourvec.h:57
EtaDepResolution bResolution_
The dependent resolution for $b$ jets.
template<class AJet>
const EtaDepResolution& hitfit::JetTranslatorBase< AJet >::udscResolution ( ) const

Return the $ \eta- $ dependent resolution for $udsc$ jets.

template<>
const EtaDepResolution & hitfit::JetTranslatorBase< pat::Jet >::udscResolution ( ) const

Definition at line 156 of file PatJetHitFitTranslator.cc.

157 {
158  return udscResolution_;
159 }
EtaDepResolution udscResolution_
The dependent resolution for $udsc$ jets.
template<>
const EtaDepResolution & hitfit::JetTranslatorBase< CLHEP::HepLorentzVector >::udscResolution ( ) const

Definition at line 179 of file CLHEPHitFitTranslator.cc.

180 {
181  return udscResolution_;
182 }
EtaDepResolution udscResolution_
The dependent resolution for $udsc$ jets.

Member Data Documentation

template<class AJet>
EtaDepResolution hitfit::JetTranslatorBase< AJet >::bResolution_
private

The $ \eta- $ dependent resolution for $b$ jets.

Definition at line 146 of file JetTranslatorBase.h.

template<class AJet>
double hitfit::JetTranslatorBase< AJet >::jes_
private

The jet energy scale.

Definition at line 156 of file JetTranslatorBase.h.

template<class AJet>
double hitfit::JetTranslatorBase< AJet >::jesB_
private

The b-jet energy scale.

Definition at line 161 of file JetTranslatorBase.h.

template<class AJet>
std::string hitfit::JetTranslatorBase< AJet >::jetCorrectionLevel_
private

The jet correction level.

Definition at line 151 of file JetTranslatorBase.h.

template<class AJet>
EtaDepResolution hitfit::JetTranslatorBase< AJet >::udscResolution_
private

The $ \eta- $ dependent resolution for $udsc$ jets.

Definition at line 141 of file JetTranslatorBase.h.