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

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<>
bool CheckEta (const pat::Electron &lepton) const
 
template<>
bool CheckEta (const pat::Muon &lepton) const
 
template<>
 LeptonTranslatorBase ()
 
template<>
 LeptonTranslatorBase ()
 
template<>
 LeptonTranslatorBase ()
 
 LeptonTranslatorBase ()
 Default constructor. More...
 
template<>
 LeptonTranslatorBase (const std::string &ifile)
 
template<>
 LeptonTranslatorBase (const std::string &ifile)
 
template<>
 LeptonTranslatorBase (const std::string &ifile)
 
 LeptonTranslatorBase (const std::string &ifile)
 Constructor, instantiate a LeptonTranslatorBase object using the name of and input file in std::string format. More...
 
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<>
Lepjets_Event_Lep operator() (const CLHEP::HepLorentzVector &lepton, int type, bool useObjEmbRes)
 
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<>
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

◆ LeptonTranslatorBase() [1/8]

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

Default constructor.

◆ LeptonTranslatorBase() [2/8]

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.

◆ ~LeptonTranslatorBase() [1/4]

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

Destructor.

◆ LeptonTranslatorBase() [3/8]

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

Definition at line 30 of file CLHEPHitFitTranslator.cc.

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()

◆ LeptonTranslatorBase() [4/8]

template<>
hitfit::LeptonTranslatorBase< CLHEP::HepLorentzVector >::LeptonTranslatorBase ( const std::string &  ifile)

Definition at line 39 of file CLHEPHitFitTranslator.cc.

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)

◆ ~LeptonTranslatorBase() [2/4]

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

Definition at line 55 of file CLHEPHitFitTranslator.cc.

55 {}

◆ LeptonTranslatorBase() [5/8]

Definition at line 24 of file PatElectronHitFitTranslator.cc.

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()

◆ LeptonTranslatorBase() [6/8]

template<>
hitfit::LeptonTranslatorBase< pat::Electron >::LeptonTranslatorBase ( const std::string &  ifile)

Definition at line 33 of file PatElectronHitFitTranslator.cc.

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)

◆ ~LeptonTranslatorBase() [3/4]

Definition at line 49 of file PatElectronHitFitTranslator.cc.

49 {}

◆ LeptonTranslatorBase() [7/8]

Definition at line 23 of file PatMuonHitFitTranslator.cc.

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()

◆ LeptonTranslatorBase() [8/8]

template<>
hitfit::LeptonTranslatorBase< pat::Muon >::LeptonTranslatorBase ( const std::string &  ifile)

Definition at line 32 of file PatMuonHitFitTranslator.cc.

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)

◆ ~LeptonTranslatorBase() [4/4]

Definition at line 47 of file PatMuonHitFitTranslator.cc.

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

Member Function Documentation

◆ CheckEta() [1/4]

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< AElectron >::CheckEta().

◆ CheckEta() [2/4]

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  }

◆ CheckEta() [3/4]

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

Definition at line 71 of file PatElectronHitFitTranslator.cc.

71  {
72  double electron_eta = lepton.superCluster()->eta();
73  return resolution_.CheckEta(electron_eta);
74  }

◆ CheckEta() [4/4]

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

Definition at line 70 of file PatMuonHitFitTranslator.cc.

70  {
71  return resolution_.CheckEta(lepton.eta());
72  }

◆ operator()() [1/4]

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.

◆ operator()() [2/4]

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.

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)

◆ operator()() [3/4]

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.

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()

◆ operator()() [4/4]

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.

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()

◆ resolution() [1/4]

template<>
const EtaDepResolution & hitfit::LeptonTranslatorBase< pat::Muon >::resolution ( ) const

Definition at line 65 of file PatMuonHitFitTranslator.cc.

65  {
66  return resolution_;
67  }

◆ resolution() [2/4]

template<>
const EtaDepResolution & hitfit::LeptonTranslatorBase< pat::Electron >::resolution ( ) const

Definition at line 66 of file PatElectronHitFitTranslator.cc.

66  {
67  return resolution_;
68  }

◆ resolution() [3/4]

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

Definition at line 71 of file CLHEPHitFitTranslator.cc.

71  {
72  return resolution_;
73  }

◆ resolution() [4/4]

template<class ALepton>
const EtaDepResolution& hitfit::LeptonTranslatorBase< ALepton >::resolution ( ) const

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

Member Data Documentation

◆ resolution_

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

The $ \eta- $ dependent resolution.

Definition at line 95 of file LeptonTranslatorBase.h.

hitfit::Fourvec
CLHEP::HepLorentzVector Fourvec
Typedef for a HepLorentzVector.
Definition: fourvec.h:55
hitfit::LeptonTranslatorBase::resolution_
EtaDepResolution resolution_
The dependent resolution.
Definition: LeptonTranslatorBase.h:95
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
TkMap_script_phase1.CMSSW_BASE
CMSSW_BASE
Definition: TkMap_script_phase1.py:158
HLT_2018_cff.muon
muon
Definition: HLT_2018_cff.py:10349
hitfit::EtaDepResolution::CheckEta
const bool CheckEta(double eta) const
Check is an input value is within the valid -range of this instance.
Definition: EtaDepResolution.cc:112
hitfit::EtaDepResolution::GetResolution
Vector_Resolution GetResolution(double &eta) const
Return the corresponding resolution for a value of .
Definition: EtaDepResolution.cc:116
reco::LeafCandidate::py
double py() const final
y coordinate of momentum vector
Definition: LeafCandidate.h:142
compare_using_db.ifile
ifile
Definition: compare_using_db.py:251
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
reco::LeafCandidate::eta
double eta() const final
momentum pseudorapidity
Definition: LeafCandidate.h:152
HPSPFTauProducerPuppi_cfi.electron
electron
Definition: HPSPFTauProducerPuppi_cfi.py:13
type
type
Definition: HCALResponse.h:21
hitfit::electron_label
Definition: Lepjets_Event_Lep.h:53
pat::Electron::superCluster
reco::SuperClusterRef superCluster() const override
override the reco::GsfElectron::superCluster method, to access the internal storage of the superclust...
hitfit::muon_label
Definition: Lepjets_Event_Lep.h:54
reco::LeafCandidate::energy
double energy() const final
energy
Definition: LeafCandidate.h:125
reco::LeafCandidate::px
double px() const final
x coordinate of momentum vector
Definition: LeafCandidate.h:140
reco::LeafCandidate::pz
double pz() const final
z coordinate of momentum vector
Definition: LeafCandidate.h:144