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::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::Electron &lepton) const
 
template<>
bool CheckEta (const pat::Muon &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<>
bool CheckEta (const CLHEP::HepLorentzVector &lepton) const
 
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::Electron &lepton, int type, bool useObjEmbRes)
 
template<>
Lepjets_Event_Lep operator() (const pat::Muon &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 46 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 31 of file CLHEPHitFitTranslator.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

32 {
33 
34  std::string CMSSW_BASE(getenv("CMSSW_BASE"));
35  std::string resolution_filename = CMSSW_BASE +
36  std::string("/src/TopQuarkAnalysis/TopHitFit/data/exampleElectronResolution.txt");
37  resolution_ = EtaDepResolution(resolution_filename);
38 
39 } // LeptonTranslatorBase<CLHEP::HepLorentzVector>::LeptonTranslatorBase()
EtaDepResolution resolution_
The dependent resolution.
template<>
hitfit::LeptonTranslatorBase< CLHEP::HepLorentzVector >::LeptonTranslatorBase ( const std::string &  ifile)

Definition at line 43 of file CLHEPHitFitTranslator.cc.

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

44 {
45 
46  std::string CMSSW_BASE(getenv("CMSSW_BASE"));
47  std::string resolution_filename;
48 
49  if (ifile.empty()) {
50  resolution_filename = CMSSW_BASE +
51  std::string("/src/TopQuarkAnalysis/TopHitFit/data/exampleElectronResolution.txt");
52  } else {
53  resolution_filename = ifile ;
54  }
55 
56  resolution_ = EtaDepResolution(resolution_filename);
57 
58 } // LeptonTranslatorBase<CLHEP::HepLorentzVector>::LeptonTranslatorBase(const std::string& ifile)
EtaDepResolution resolution_
The dependent resolution.
template<>
hitfit::LeptonTranslatorBase< CLHEP::HepLorentzVector >::~LeptonTranslatorBase ( )

Definition at line 62 of file CLHEPHitFitTranslator.cc.

63 {
64 }

Definition at line 26 of file PatElectronHitFitTranslator.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

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

Definition at line 38 of file PatElectronHitFitTranslator.cc.

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

39 {
40 
41  std::string CMSSW_BASE(getenv("CMSSW_BASE"));
42  std::string resolution_filename;
43 
44  if (ifile.empty()) {
45  resolution_filename = CMSSW_BASE +
46  std::string("/src/TopQuarkAnalysis/PatHitFit/data/exampleElectronResolution.txt");
47  } else {
48  resolution_filename = ifile ;
49  }
50 
51  resolution_ = EtaDepResolution(resolution_filename);
52 
53 } // LeptonTranslatorBase<pat::Electron>::LeptonTranslatorBase(const std::string& ifile)
EtaDepResolution resolution_
The dependent resolution.

Definition at line 57 of file PatElectronHitFitTranslator.cc.

58 {
59 }

Definition at line 26 of file PatMuonHitFitTranslator.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

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

Definition at line 38 of file PatMuonHitFitTranslator.cc.

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

39 {
40 
41  std::string CMSSW_BASE(getenv("CMSSW_BASE"));
42  std::string resolution_filename;
43 
44  if (ifile.empty()) {
45  resolution_filename = CMSSW_BASE +
46  std::string("/src/TopQuarkAnalysis/PatHitFit/data/exampleMuonResolution.txt");
47  } else {
48  resolution_filename = ifile ;
49  }
50 
51  resolution_ = EtaDepResolution(resolution_filename);
52 
53 } // LeptonTranslatorBase<pat::Muon>::LeptonTranslatorBase(const std::string& s)
EtaDepResolution resolution_
The dependent resolution.

Definition at line 57 of file PatMuonHitFitTranslator.cc.

58 {
59 } // LeptonTranslatorBase<pat::Muon>::~LeptonTranslatorBase()

Member Function Documentation

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

Definition at line 92 of file PatElectronHitFitTranslator.cc.

References pat::Electron::superCluster().

93 {
94  double electron_eta = lepton.superCluster()->eta();
95  return resolution_.CheckEta(electron_eta);
96 }
reco::SuperClusterRef superCluster() const
override the reco::GsfElectron::superCluster method, to access the internal storage of the superclust...
Definition: Electron.cc:150
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::Muon >::CheckEta ( const pat::Muon lepton) const

Definition at line 92 of file PatMuonHitFitTranslator.cc.

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

93 {
94  return resolution_.CheckEta(lepton.eta());
95 }
EtaDepResolution resolution_
The dependent resolution.
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
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<>
bool hitfit::LeptonTranslatorBase< CLHEP::HepLorentzVector >::CheckEta ( const CLHEP::HepLorentzVector &  lepton) const

Definition at line 96 of file CLHEPHitFitTranslator.cc.

97 {
98  return resolution_.CheckEta(lepton.eta());
99 }
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<>
Lepjets_Event_Lep hitfit::LeptonTranslatorBase< pat::Muon >::operator() ( const pat::Muon lepton,
int  type,
bool  useObjEmbRes 
)

Definition at line 64 of file PatMuonHitFitTranslator.cc.

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

67 {
68 
69  Fourvec p(lepton.px(),lepton.py(),lepton.pz(),lepton.energy());
70 
71  double muon_eta = lepton.eta();
72  Vector_Resolution muon_resolution = resolution_.GetResolution(muon_eta);
73 
74  Lepjets_Event_Lep muon(p,
75  muon_label,
76  muon_resolution);
77  return muon;
78 
79 } // Lepjets_Event_Lep LeptonTranslatorBase<pat::Muon>::operator()
virtual double energy() const GCC11_FINAL
energy
virtual double pz() const GCC11_FINAL
z coordinate of momentum vector
virtual double py() const GCC11_FINAL
y coordinate of momentum vector
Vector_Resolution GetResolution(double &eta) const
Return the corresponding resolution for a value of .
virtual double px() const GCC11_FINAL
x coordinate of momentum vector
CLHEP::HepLorentzVector Fourvec
Typedef for a HepLorentzVector.
Definition: fourvec.h:58
EtaDepResolution resolution_
The dependent resolution.
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
template<>
Lepjets_Event_Lep hitfit::LeptonTranslatorBase< pat::Electron >::operator() ( const pat::Electron lepton,
int  type,
bool  useObjEmbRes 
)

Definition at line 64 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().

67 {
68 
69  Fourvec p(lepton.px(),lepton.py(),lepton.pz(),lepton.energy());
70 
71  double electron_eta = lepton.superCluster()->eta();
72  Vector_Resolution electron_resolution = resolution_.GetResolution(electron_eta);
73 
74  Lepjets_Event_Lep electron(p,
76  electron_resolution);
77  return electron;
78 
79 } // Lepjets_Event_Lep LeptonTranslatorBase<pat::Electron>::operator()
virtual double energy() const GCC11_FINAL
energy
reco::SuperClusterRef superCluster() const
override the reco::GsfElectron::superCluster method, to access the internal storage of the superclust...
Definition: Electron.cc:150
virtual double pz() const GCC11_FINAL
z coordinate of momentum vector
virtual double py() const GCC11_FINAL
y coordinate of momentum vector
Vector_Resolution GetResolution(double &eta) const
Return the corresponding resolution for a value of .
virtual double px() const GCC11_FINAL
x coordinate of momentum vector
CLHEP::HepLorentzVector Fourvec
Typedef for a HepLorentzVector.
Definition: fourvec.h:58
EtaDepResolution resolution_
The dependent resolution.
template<>
Lepjets_Event_Lep hitfit::LeptonTranslatorBase< CLHEP::HepLorentzVector >::operator() ( const CLHEP::HepLorentzVector &  lepton,
int  type,
bool  useObjEmbRes 
)

Definition at line 69 of file CLHEPHitFitTranslator.cc.

References AlCaHLTBitMon_ParallelJobs::p.

72 {
73 
74  Fourvec p(lepton.px(),lepton.py(),lepton.pz(),lepton.e());
75 
76  double lepton_eta(lepton.eta());
77  Vector_Resolution lepton_resolution = resolution_.GetResolution(lepton_eta);
78  Lepjets_Event_Lep retlep(p,
79  type,
80  lepton_resolution);
81  return retlep;
82 
83 } // 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:58
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 84 of file PatMuonHitFitTranslator.cc.

85 {
86  return resolution_;
87 }
EtaDepResolution resolution_
The dependent resolution.
template<>
const EtaDepResolution & hitfit::LeptonTranslatorBase< pat::Electron >::resolution ( ) const

Definition at line 84 of file PatElectronHitFitTranslator.cc.

85 {
86  return resolution_;
87 }
EtaDepResolution resolution_
The dependent resolution.
template<class ALepton>
const EtaDepResolution& hitfit::LeptonTranslatorBase< ALepton >::resolution ( ) const

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

template<>
const EtaDepResolution & hitfit::LeptonTranslatorBase< CLHEP::HepLorentzVector >::resolution ( ) const

Definition at line 88 of file CLHEPHitFitTranslator.cc.

89 {
90  return resolution_;
91 }
EtaDepResolution resolution_
The dependent resolution.

Member Data Documentation

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

The $ \eta- $ dependent resolution.

Definition at line 104 of file LeptonTranslatorBase.h.