CMS 3D CMS Logo

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)
 
template<>
Lepjets_Event_Jet operator() (const pat::Jet &jet, int type, bool useObjEmbRes)
 
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 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 44 of file JetTranslatorBase.h.

Constructor & Destructor Documentation

◆ JetTranslatorBase() [1/8]

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

Default constructor.

◆ JetTranslatorBase() [2/8]

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.

◆ JetTranslatorBase() [3/8]

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.

◆ ~JetTranslatorBase() [1/3]

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

Destructor.

◆ JetTranslatorBase() [4/8]

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

Definition at line 83 of file CLHEPHitFitTranslator.cc.

83  {
84  [[clang::suppress]]
85  std::string CMSSW_BASE(std::getenv("CMSSW_BASE"));
86  std::string udsc_resolution_filename =
87  CMSSW_BASE + std::string("/src/TopQuarkAnalysis/TopHitFit/data/exampleJetResolution.txt");
88  const std::string& b_resolution_filename = udsc_resolution_filename;
89 
90  udscResolution_ = EtaDepResolution(udsc_resolution_filename);
91  bResolution_ = EtaDepResolution(b_resolution_filename);
92 
93  } // JetTranslatorBase<CLHEP::HepLorentzVector>::JetTranslatorBase()
EtaDepResolution udscResolution_
The dependent resolution for $udsc$ jets.
EtaDepResolution bResolution_
The dependent resolution for $b$ jets.

◆ JetTranslatorBase() [5/8]

template<>
hitfit::JetTranslatorBase< CLHEP::HepLorentzVector >::JetTranslatorBase ( const std::string &  udscFile,
const std::string &  bFile 
)

Definition at line 96 of file CLHEPHitFitTranslator.cc.

96  {
97  [[clang::suppress]]
98  std::string CMSSW_BASE(std::getenv("CMSSW_BASE"));
99  std::string udsc_resolution_filename;
100  std::string b_resolution_filename;
101 
102  if (udscFile.empty()) {
103  udsc_resolution_filename =
104  CMSSW_BASE + std::string("/src/TopQuarkAnalysis/TopHitFit/data/exampleJetResolution.txt");
105  } else {
106  udsc_resolution_filename = udscFile;
107  }
108 
109  if (bFile.empty()) {
110  b_resolution_filename = CMSSW_BASE + std::string("/src/TopQuarkAnalysis/TopHitFit/data/exampleJetResolution.txt");
111  } else {
112  b_resolution_filename = bFile;
113  }
114 
115  udscResolution_ = EtaDepResolution(udsc_resolution_filename);
116  bResolution_ = EtaDepResolution(b_resolution_filename);
117 
118  } // 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.

◆ ~JetTranslatorBase() [2/3]

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

Definition at line 121 of file CLHEPHitFitTranslator.cc.

121  {
122  } // JetTranslatorBase<CLHEP::HepLorentzVector>::~JetTranslatorBase()

◆ JetTranslatorBase() [6/8]

Definition at line 21 of file PatJetHitFitTranslator.cc.

21  {
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()
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.

◆ JetTranslatorBase() [7/8]

template<>
hitfit::JetTranslatorBase< pat::Jet >::JetTranslatorBase ( const std::string &  udscFile,
const std::string &  bFile 
)

Definition at line 35 of file PatJetHitFitTranslator.cc.

35  {
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)
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.

◆ JetTranslatorBase() [8/8]

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 63 of file PatJetHitFitTranslator.cc.

67  {
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);
90  jes_ = jes;
91  jesB_ = jesB;
92 
93  } // 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.

◆ ~JetTranslatorBase() [3/3]

Definition at line 96 of file PatJetHitFitTranslator.cc.

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

Member Function Documentation

◆ bResolution() [1/3]

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

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

◆ bResolution() [2/3]

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

Definition at line 139 of file PatJetHitFitTranslator.cc.

139  {
140  return bResolution_;
141  }
EtaDepResolution bResolution_
The dependent resolution for $b$ jets.

◆ bResolution() [3/3]

template<>
const EtaDepResolution & hitfit::JetTranslatorBase< CLHEP::HepLorentzVector >::bResolution ( ) const

Definition at line 150 of file CLHEPHitFitTranslator.cc.

150  {
151  return bResolution_;
152  }
EtaDepResolution bResolution_
The dependent resolution for $b$ jets.

◆ CheckEta() [1/3]

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.

◆ CheckEta() [2/3]

template<>
bool hitfit::JetTranslatorBase< pat::Jet >::CheckEta ( const pat::Jet jet) const

Definition at line 144 of file PatJetHitFitTranslator.cc.

144  {
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  }
Jets made from CaloTowers.
Definition: CaloJet.h:27
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.
double eta() const final
momentum pseudorapidity

◆ CheckEta() [3/3]

template<>
bool hitfit::JetTranslatorBase< CLHEP::HepLorentzVector >::CheckEta ( const CLHEP::HepLorentzVector &  jet) const

Definition at line 155 of file CLHEPHitFitTranslator.cc.

155  {
156  return udscResolution_.CheckEta(jet.eta()) && bResolution_.CheckEta(jet.eta());
157  }
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.

◆ operator()() [1/3]

template<>
Lepjets_Event_Jet hitfit::JetTranslatorBase< pat::Jet >::operator() ( const pat::Jet jet,
int  type,
bool  useObjEmbRes 
)

Definition at line 99 of file PatJetHitFitTranslator.cc.

101  {
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)
Vector_Resolution GetResolution(double &eta) const
Return the corresponding resolution for a value of .
Jets made from CaloTowers.
Definition: CaloJet.h:27
double jes_
The jet energy scale.
EtaDepResolution udscResolution_
The dependent resolution for $udsc$ jets.
void scaleEnergy(double fScale) override
Scale energy and correspondingly adjust raw jec factors.
Definition: Jet.h:177
CLHEP::HepLorentzVector Fourvec
Typedef for a HepLorentzVector.
Definition: fourvec.h:55
std::string jetCorrectionLevel_
The jet correction level.
EtaDepResolution bResolution_
The dependent resolution for $b$ jets.
Analysis-level calorimeter jet class.
Definition: Jet.h:77
double jesB_
The b-jet energy scale.
double eta() const final
momentum pseudorapidity

◆ operator()() [2/3]

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.

◆ operator()() [3/3]

template<>
Lepjets_Event_Jet hitfit::JetTranslatorBase< CLHEP::HepLorentzVector >::operator() ( const CLHEP::HepLorentzVector &  jet,
int  type,
bool  useObjEmbRes 
)

Definition at line 125 of file CLHEPHitFitTranslator.cc.

127  {
128  Fourvec p(jet.px(), jet.py(), jet.pz(), jet.e());
129 
130  double jet_eta = jet.eta();
131  Vector_Resolution jet_resolution;
132 
134  jet_resolution = bResolution_.GetResolution(jet_eta);
135  } else {
136  jet_resolution = udscResolution_.GetResolution(jet_eta);
137  }
138 
139  Lepjets_Event_Jet retjet(p, type, jet_resolution);
140  return retjet;
141 
142  } // Lepjets_Event_Jet JetTranslatorBase<CLHEP::HepLorentzVector>::operator()(const CLHEP::HepLorentzVector& j,int type)
Vector_Resolution GetResolution(double &eta) const
Return the corresponding resolution for a value of .
EtaDepResolution udscResolution_
The dependent resolution for $udsc$ jets.
CLHEP::HepLorentzVector Fourvec
Typedef for a HepLorentzVector.
Definition: fourvec.h:55
EtaDepResolution bResolution_
The dependent resolution for $b$ jets.

◆ udscResolution() [1/3]

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

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

◆ udscResolution() [2/3]

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

Definition at line 134 of file PatJetHitFitTranslator.cc.

134  {
135  return udscResolution_;
136  }
EtaDepResolution udscResolution_
The dependent resolution for $udsc$ jets.

◆ udscResolution() [3/3]

template<>
const EtaDepResolution & hitfit::JetTranslatorBase< CLHEP::HepLorentzVector >::udscResolution ( ) const

Definition at line 145 of file CLHEPHitFitTranslator.cc.

145  {
146  return udscResolution_;
147  }
EtaDepResolution udscResolution_
The dependent resolution for $udsc$ jets.

Member Data Documentation

◆ bResolution_

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

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

Definition at line 138 of file JetTranslatorBase.h.

◆ jes_

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

The jet energy scale.

Definition at line 148 of file JetTranslatorBase.h.

◆ jesB_

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

The b-jet energy scale.

Definition at line 153 of file JetTranslatorBase.h.

◆ jetCorrectionLevel_

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

The jet correction level.

Definition at line 143 of file JetTranslatorBase.h.

◆ udscResolution_

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

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

Definition at line 133 of file JetTranslatorBase.h.