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...
 
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)
 Constructor, instantiate a JetTranslatorBase object using the names of input files in std::string format. More...
 
template<>
 JetTranslatorBase ()
 
 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 (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 81 of file CLHEPHitFitTranslator.cc.

81  {
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()
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 93 of file CLHEPHitFitTranslator.cc.

93  {
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)
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 117 of file CLHEPHitFitTranslator.cc.

117  {
118  } // JetTranslatorBase<CLHEP::HepLorentzVector>::~JetTranslatorBase()

◆ JetTranslatorBase() [6/8]

Definition at line 21 of file PatJetHitFitTranslator.cc.

21  {
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()
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 34 of file PatJetHitFitTranslator.cc.

34  {
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)
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 61 of file PatJetHitFitTranslator.cc.

65  {
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);
87  jes_ = jes;
88  jesB_ = jesB;
89 
90  } // 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 93 of file PatJetHitFitTranslator.cc.

93 {} // 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 136 of file PatJetHitFitTranslator.cc.

136  {
137  return bResolution_;
138  }
EtaDepResolution bResolution_
The dependent resolution for $b$ jets.

◆ bResolution() [3/3]

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

Definition at line 146 of file CLHEPHitFitTranslator.cc.

146  {
147  return bResolution_;
148  }
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 141 of file PatJetHitFitTranslator.cc.

141  {
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  }
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 151 of file CLHEPHitFitTranslator.cc.

151  {
152  return udscResolution_.CheckEta(jet.eta()) && bResolution_.CheckEta(jet.eta());
153  }
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 96 of file PatJetHitFitTranslator.cc.

98  {
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 
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)
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 121 of file CLHEPHitFitTranslator.cc.

123  {
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)
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 131 of file PatJetHitFitTranslator.cc.

131  {
132  return udscResolution_;
133  }
EtaDepResolution udscResolution_
The dependent resolution for $udsc$ jets.

◆ udscResolution() [3/3]

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

Definition at line 141 of file CLHEPHitFitTranslator.cc.

141  {
142  return udscResolution_;
143  }
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.