CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/TopQuarkAnalysis/TopHitFit/src/PatMuonHitFitTranslator.cc

Go to the documentation of this file.
00001 //
00002 //     $Id: PatMuonHitFitTranslator.cc,v 1.1 2011/05/26 09:47:00 mseidel Exp $
00003 //
00019 #include "TopQuarkAnalysis/TopHitFit/interface/LeptonTranslatorBase.h"
00020 #include "DataFormats/PatCandidates/interface/Muon.h"
00021 
00022 namespace hitfit {
00023 
00024 
00025 template<>
00026 LeptonTranslatorBase<pat::Muon>::LeptonTranslatorBase()
00027 {
00028 
00029     std::string CMSSW_BASE(getenv("CMSSW_BASE"));
00030     std::string resolution_filename = CMSSW_BASE +
00031         std::string("/src/TopQuarkAnalysis/PatHitFit/data/exampleMuonResolution.txt");
00032     resolution_ = EtaDepResolution(resolution_filename);
00033 
00034 } // LeptonTranslatorBase<pat::Muon>::LeptonTranslatorBase()
00035 
00036 
00037 template<>
00038 LeptonTranslatorBase<pat::Muon>::LeptonTranslatorBase(const std::string& ifile)
00039 {
00040 
00041     std::string CMSSW_BASE(getenv("CMSSW_BASE"));
00042     std::string resolution_filename;
00043 
00044     if (ifile.empty()) {
00045         resolution_filename = CMSSW_BASE +
00046         std::string("/src/TopQuarkAnalysis/PatHitFit/data/exampleMuonResolution.txt");
00047     } else {
00048         resolution_filename = ifile ;
00049     }
00050 
00051     resolution_ = EtaDepResolution(resolution_filename);
00052 
00053 } // LeptonTranslatorBase<pat::Muon>::LeptonTranslatorBase(const std::string& s)
00054 
00055 
00056 template<>
00057 LeptonTranslatorBase<pat::Muon>::~LeptonTranslatorBase()
00058 {
00059 } // LeptonTranslatorBase<pat::Muon>::~LeptonTranslatorBase()
00060 
00061 
00062 template<>
00063 Lepjets_Event_Lep
00064 LeptonTranslatorBase<pat::Muon>::operator()(const pat::Muon& lepton,
00065                                             int type /*= hitfit::lepton_label */,
00066                                             bool useObjEmbRes /* = false */)
00067 {
00068 
00069     Fourvec p(lepton.px(),lepton.py(),lepton.pz(),lepton.energy());
00070 
00071     double            muon_eta        = lepton.eta();
00072     Vector_Resolution muon_resolution = resolution_.GetResolution(muon_eta);
00073 
00074     Lepjets_Event_Lep muon(p,
00075                            muon_label,
00076                            muon_resolution);
00077     return muon;
00078 
00079 } // Lepjets_Event_Lep LeptonTranslatorBase<pat::Muon>::operator()
00080 
00081 
00082 template<>
00083 const EtaDepResolution&
00084 LeptonTranslatorBase<pat::Muon>::resolution() const
00085 {
00086     return resolution_;
00087 }
00088 
00089 
00090 template<>
00091 bool
00092 LeptonTranslatorBase<pat::Muon>::CheckEta(const pat::Muon& lepton) const
00093 {
00094     return resolution_.CheckEta(lepton.eta());
00095 }
00096 
00097 
00098 } // namespace hitfit