File indexing completed on 2024-04-06 12:31:19
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #include "TopQuarkAnalysis/TopHitFit/interface/LeptonTranslatorBase.h"
0018 #include "DataFormats/PatCandidates/interface/Muon.h"
0019
0020 namespace hitfit {
0021
0022 template <>
0023 LeptonTranslatorBase<pat::Muon>::LeptonTranslatorBase() {
0024 std::string CMSSW_BASE(std::getenv("CMSSW_BASE"));
0025 std::string resolution_filename =
0026 CMSSW_BASE + std::string("/src/TopQuarkAnalysis/PatHitFit/data/exampleMuonResolution.txt");
0027 resolution_ = EtaDepResolution(resolution_filename);
0028
0029 }
0030
0031 template <>
0032 LeptonTranslatorBase<pat::Muon>::LeptonTranslatorBase(const std::string& ifile) {
0033 std::string CMSSW_BASE(std::getenv("CMSSW_BASE"));
0034 std::string resolution_filename;
0035
0036 if (ifile.empty()) {
0037 resolution_filename = CMSSW_BASE + std::string("/src/TopQuarkAnalysis/PatHitFit/data/exampleMuonResolution.txt");
0038 } else {
0039 resolution_filename = ifile;
0040 }
0041
0042 resolution_ = EtaDepResolution(resolution_filename);
0043
0044 }
0045
0046 template <>
0047 LeptonTranslatorBase<pat::Muon>::~LeptonTranslatorBase() {
0048 }
0049
0050 template <>
0051 Lepjets_Event_Lep LeptonTranslatorBase<pat::Muon>::operator()(const pat::Muon& lepton,
0052 int type ,
0053 bool useObjEmbRes ) {
0054 Fourvec p(lepton.px(), lepton.py(), lepton.pz(), lepton.energy());
0055
0056 double muon_eta = lepton.eta();
0057 Vector_Resolution muon_resolution = resolution_.GetResolution(muon_eta);
0058
0059 Lepjets_Event_Lep muon(p, muon_label, muon_resolution);
0060 return muon;
0061
0062 }
0063
0064 template <>
0065 const EtaDepResolution& LeptonTranslatorBase<pat::Muon>::resolution() const {
0066 return resolution_;
0067 }
0068
0069 template <>
0070 bool LeptonTranslatorBase<pat::Muon>::CheckEta(const pat::Muon& lepton) const {
0071 return resolution_.CheckEta(lepton.eta());
0072 }
0073
0074 }