CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
hitfit::LeptonTranslatorBase< ALepton > Class Template Reference

Template class of function object to translate lepton physics object to HitFit's Lepjets_Event_Lep object. Users need to write an implementation of a template specialization of this class for their lepton 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 lepton physics object class in different experiments. More...

#include <LeptonTranslatorBase.h>

Public Member Functions

template<>
bool CheckEta (const pat::Muon &lepton) const
 
template<>
bool CheckEta (const pat::Electron &lepton) const
 
template<>
bool CheckEta (const CLHEP::HepLorentzVector &lepton) const
 
bool CheckEta (const ALepton &lepton) const
 Check if a lepton has $ \eta $ value which is within the valid $ \eta $ range of the resolution. More...
 
template<>
 LeptonTranslatorBase ()
 
template<>
 LeptonTranslatorBase ()
 
template<>
 LeptonTranslatorBase ()
 
template<>
 LeptonTranslatorBase (const std::string &ifile)
 
template<>
 LeptonTranslatorBase (const std::string &ifile)
 
template<>
 LeptonTranslatorBase (const std::string &ifile)
 
 LeptonTranslatorBase ()
 Default constructor. More...
 
 LeptonTranslatorBase (const std::string &ifile)
 Constructor, instantiate a LeptonTranslatorBase object using the name of and input file in std::string format. More...
 
template<>
Lepjets_Event_Lep operator() (const pat::Muon &lepton, int type, bool useObjEmbRes)
 
template<>
Lepjets_Event_Lep operator() (const pat::Electron &lepton, int type, bool useObjEmbRes)
 
template<>
Lepjets_Event_Lep operator() (const CLHEP::HepLorentzVector &lepton, int type, bool useObjEmbRes)
 
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_Event_Lep. More...
 
template<>
const EtaDepResolutionresolution () const
 
template<>
const EtaDepResolutionresolution () const
 
template<>
const EtaDepResolutionresolution () const
 
const EtaDepResolutionresolution () const
 Return the $ \eta- $ dependent resolution of the lepton. More...
 
template<>
 ~LeptonTranslatorBase ()
 
template<>
 ~LeptonTranslatorBase ()
 
template<>
 ~LeptonTranslatorBase ()
 
 ~LeptonTranslatorBase ()
 Destructor. More...
 

Private Attributes

EtaDepResolution resolution_
 The $ \eta- $ dependent resolution. More...
 

Detailed Description

template<class ALepton>
class hitfit::LeptonTranslatorBase< ALepton >

Template class of function object to translate lepton physics object to HitFit's Lepjets_Event_Lep object. Users need to write an implementation of a template specialization of this class for their lepton 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 lepton physics object class in different experiments.

Parameters
ALeptonThe typename of the lepton physics object class to be translated into HitFit's Lepjets_Event_Lep.

Definition at line 44 of file LeptonTranslatorBase.h.

Constructor & Destructor Documentation

template<class ALepton>
hitfit::LeptonTranslatorBase< ALepton >::LeptonTranslatorBase ( )

Default constructor.

template<class ALepton>
hitfit::LeptonTranslatorBase< ALepton >::LeptonTranslatorBase ( const std::string &  ifile)

Constructor, instantiate a LeptonTranslatorBase object using the name of and input file in std::string format.

Parameters
ifileThe path of the input file.
template<class ALepton>
hitfit::LeptonTranslatorBase< ALepton >::~LeptonTranslatorBase ( )

Destructor.

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

Definition at line 30 of file CLHEPHitFitTranslator.cc.

References TkMap_script_phase1::CMSSW_BASE, and AlCaHLTBitMon_QueryRunRegistry::string.

30  {
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()
EtaDepResolution resolution_
The dependent resolution.
template<>
hitfit::LeptonTranslatorBase< CLHEP::HepLorentzVector >::LeptonTranslatorBase ( const std::string &  ifile)

Definition at line 39 of file CLHEPHitFitTranslator.cc.

References TkMap_script_phase1::CMSSW_BASE, compare_using_db::ifile, and AlCaHLTBitMon_QueryRunRegistry::string.

39  {
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)
EtaDepResolution resolution_
The dependent resolution.
template<>
hitfit::LeptonTranslatorBase< CLHEP::HepLorentzVector >::~LeptonTranslatorBase ( )

Definition at line 55 of file CLHEPHitFitTranslator.cc.

55 {}

Definition at line 24 of file PatElectronHitFitTranslator.cc.

References TkMap_script_phase1::CMSSW_BASE, and AlCaHLTBitMon_QueryRunRegistry::string.

24  {
25  std::string CMSSW_BASE(std::getenv("CMSSW_BASE"));
26  std::string resolution_filename =
27  CMSSW_BASE + std::string("/src/TopQuarkAnalysis/PatHitFit/data/exampleElectronResolution.txt");
28  resolution_ = EtaDepResolution(resolution_filename);
29 
30  } // LeptonTranslatorBase<pat::Electron>::LeptonTranslatorBase()
EtaDepResolution resolution_
The dependent resolution.
template<>
hitfit::LeptonTranslatorBase< pat::Electron >::LeptonTranslatorBase ( const std::string &  ifile)

Definition at line 33 of file PatElectronHitFitTranslator.cc.

References TkMap_script_phase1::CMSSW_BASE, compare_using_db::ifile, and AlCaHLTBitMon_QueryRunRegistry::string.

33  {
34  std::string CMSSW_BASE(std::getenv("CMSSW_BASE"));
35  std::string resolution_filename;
36 
37  if (ifile.empty()) {
38  resolution_filename =
39  CMSSW_BASE + std::string("/src/TopQuarkAnalysis/PatHitFit/data/exampleElectronResolution.txt");
40  } else {
41  resolution_filename = ifile;
42  }
43 
44  resolution_ = EtaDepResolution(resolution_filename);
45 
46  } // LeptonTranslatorBase<pat::Electron>::LeptonTranslatorBase(const std::string& ifile)
EtaDepResolution resolution_
The dependent resolution.

Definition at line 49 of file PatElectronHitFitTranslator.cc.

49 {}

Definition at line 23 of file PatMuonHitFitTranslator.cc.

References TkMap_script_phase1::CMSSW_BASE, and AlCaHLTBitMon_QueryRunRegistry::string.

23  {
24  std::string CMSSW_BASE(std::getenv("CMSSW_BASE"));
25  std::string resolution_filename =
26  CMSSW_BASE + std::string("/src/TopQuarkAnalysis/PatHitFit/data/exampleMuonResolution.txt");
27  resolution_ = EtaDepResolution(resolution_filename);
28 
29  } // LeptonTranslatorBase<pat::Muon>::LeptonTranslatorBase()
EtaDepResolution resolution_
The dependent resolution.
template<>
hitfit::LeptonTranslatorBase< pat::Muon >::LeptonTranslatorBase ( const std::string &  ifile)

Definition at line 32 of file PatMuonHitFitTranslator.cc.

References TkMap_script_phase1::CMSSW_BASE, compare_using_db::ifile, and AlCaHLTBitMon_QueryRunRegistry::string.

32  {
33  std::string CMSSW_BASE(std::getenv("CMSSW_BASE"));
34  std::string resolution_filename;
35 
36  if (ifile.empty()) {
37  resolution_filename = CMSSW_BASE + std::string("/src/TopQuarkAnalysis/PatHitFit/data/exampleMuonResolution.txt");
38  } else {
39  resolution_filename = ifile;
40  }
41 
42  resolution_ = EtaDepResolution(resolution_filename);
43 
44  } // LeptonTranslatorBase<pat::Muon>::LeptonTranslatorBase(const std::string& s)
EtaDepResolution resolution_
The dependent resolution.

Definition at line 47 of file PatMuonHitFitTranslator.cc.

47  {
48  } // LeptonTranslatorBase<pat::Muon>::~LeptonTranslatorBase()

Member Function Documentation

template<>
bool hitfit::LeptonTranslatorBase< pat::Muon >::CheckEta ( const pat::Muon lepton) const

Definition at line 70 of file PatMuonHitFitTranslator.cc.

References hitfit::LeptonTranslatorBase< ALepton >::CheckEta(), and reco::LeafCandidate::eta().

70  {
71  return resolution_.CheckEta(lepton.eta());
72  }
double eta() const final
momentum pseudorapidity
EtaDepResolution resolution_
The dependent resolution.
const bool CheckEta(double eta) const
Check is an input value is within the valid -range of this instance.
template<>
bool hitfit::LeptonTranslatorBase< pat::Electron >::CheckEta ( const pat::Electron lepton) const

Definition at line 71 of file PatElectronHitFitTranslator.cc.

References pat::Electron::superCluster().

71  {
72  double electron_eta = lepton.superCluster()->eta();
73  return resolution_.CheckEta(electron_eta);
74  }
EtaDepResolution resolution_
The dependent resolution.
const bool CheckEta(double eta) const
Check is an input value is within the valid -range of this instance.
reco::SuperClusterRef superCluster() const override
override the reco::GsfElectron::superCluster method, to access the internal storage of the superclust...
template<>
bool hitfit::LeptonTranslatorBase< CLHEP::HepLorentzVector >::CheckEta ( const CLHEP::HepLorentzVector &  lepton) const

Definition at line 76 of file CLHEPHitFitTranslator.cc.

76  {
77  return resolution_.CheckEta(lepton.eta());
78  }
EtaDepResolution resolution_
The dependent resolution.
const bool CheckEta(double eta) const
Check is an input value is within the valid -range of this instance.
template<class ALepton>
bool hitfit::LeptonTranslatorBase< ALepton >::CheckEta ( const ALepton &  lepton) const

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

Parameters
leptonThe lepton whose $ \eta $ value is to be checked.

Referenced by hitfit::LeptonTranslatorBase< ALepton >::CheckEta().

template<>
Lepjets_Event_Lep hitfit::LeptonTranslatorBase< pat::Muon >::operator() ( const pat::Muon lepton,
int  type,
bool  useObjEmbRes 
)

Definition at line 51 of file PatMuonHitFitTranslator.cc.

References reco::LeafCandidate::energy(), reco::LeafCandidate::eta(), HLT_2018_cff::muon, hitfit::muon_label, AlCaHLTBitMon_ParallelJobs::p, reco::LeafCandidate::px(), reco::LeafCandidate::py(), and reco::LeafCandidate::pz().

53  {
54  Fourvec p(lepton.px(), lepton.py(), lepton.pz(), lepton.energy());
55 
56  double muon_eta = lepton.eta();
57  Vector_Resolution muon_resolution = resolution_.GetResolution(muon_eta);
58 
59  Lepjets_Event_Lep muon(p, muon_label, muon_resolution);
60  return muon;
61 
62  } // Lepjets_Event_Lep LeptonTranslatorBase<pat::Muon>::operator()
double eta() const final
momentum pseudorapidity
double px() const final
x coordinate of momentum vector
Vector_Resolution GetResolution(double &eta) const
Return the corresponding resolution for a value of .
double pz() const final
z coordinate of momentum vector
double energy() const final
energy
CLHEP::HepLorentzVector Fourvec
Typedef for a HepLorentzVector.
Definition: fourvec.h:55
EtaDepResolution resolution_
The dependent resolution.
double py() const final
y coordinate of momentum vector
template<>
Lepjets_Event_Lep hitfit::LeptonTranslatorBase< pat::Electron >::operator() ( const pat::Electron lepton,
int  type,
bool  useObjEmbRes 
)

Definition at line 52 of file PatElectronHitFitTranslator.cc.

References metsig::electron, hitfit::electron_label, reco::LeafCandidate::energy(), AlCaHLTBitMon_ParallelJobs::p, reco::LeafCandidate::px(), reco::LeafCandidate::py(), reco::LeafCandidate::pz(), and pat::Electron::superCluster().

54  {
55  Fourvec p(lepton.px(), lepton.py(), lepton.pz(), lepton.energy());
56 
57  double electron_eta = lepton.superCluster()->eta();
58  Vector_Resolution electron_resolution = resolution_.GetResolution(electron_eta);
59 
60  Lepjets_Event_Lep electron(p, electron_label, electron_resolution);
61  return electron;
62 
63  } // Lepjets_Event_Lep LeptonTranslatorBase<pat::Electron>::operator()
double px() const final
x coordinate of momentum vector
Vector_Resolution GetResolution(double &eta) const
Return the corresponding resolution for a value of .
double pz() const final
z coordinate of momentum vector
double energy() const final
energy
CLHEP::HepLorentzVector Fourvec
Typedef for a HepLorentzVector.
Definition: fourvec.h:55
EtaDepResolution resolution_
The dependent resolution.
double py() const final
y coordinate of momentum vector
reco::SuperClusterRef superCluster() const override
override the reco::GsfElectron::superCluster method, to access the internal storage of the superclust...
template<>
Lepjets_Event_Lep hitfit::LeptonTranslatorBase< CLHEP::HepLorentzVector >::operator() ( const CLHEP::HepLorentzVector &  lepton,
int  type,
bool  useObjEmbRes 
)

Definition at line 58 of file CLHEPHitFitTranslator.cc.

References AlCaHLTBitMon_ParallelJobs::p.

60  {
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)
type
Definition: HCALResponse.h:21
Vector_Resolution GetResolution(double &eta) const
Return the corresponding resolution for a value of .
CLHEP::HepLorentzVector Fourvec
Typedef for a HepLorentzVector.
Definition: fourvec.h:55
EtaDepResolution resolution_
The dependent resolution.
template<class ALepton>
Lepjets_Event_Lep hitfit::LeptonTranslatorBase< ALepton >::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_Event_Lep.

Parameters
leptonThe lepton physics object to be translated.
typeThe typecode of the lepton to be translated.
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<>
const EtaDepResolution & hitfit::LeptonTranslatorBase< pat::Muon >::resolution ( ) const

Definition at line 65 of file PatMuonHitFitTranslator.cc.

65  {
66  return resolution_;
67  }
EtaDepResolution resolution_
The dependent resolution.
template<>
const EtaDepResolution & hitfit::LeptonTranslatorBase< pat::Electron >::resolution ( ) const

Definition at line 66 of file PatElectronHitFitTranslator.cc.

66  {
67  return resolution_;
68  }
EtaDepResolution resolution_
The dependent resolution.
template<>
const EtaDepResolution & hitfit::LeptonTranslatorBase< CLHEP::HepLorentzVector >::resolution ( ) const

Definition at line 71 of file CLHEPHitFitTranslator.cc.

71  {
72  return resolution_;
73  }
EtaDepResolution resolution_
The dependent resolution.
template<class ALepton>
const EtaDepResolution& hitfit::LeptonTranslatorBase< ALepton >::resolution ( ) const

Return the $ \eta- $ dependent resolution of the lepton.

Member Data Documentation

template<class ALepton>
EtaDepResolution hitfit::LeptonTranslatorBase< ALepton >::resolution_
private

The $ \eta- $ dependent resolution.

Definition at line 95 of file LeptonTranslatorBase.h.