Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:31:18

0001 //
0002 //
0003 /**
0004     @file PatMuonHitFitTranslator.cc
0005 
0006     @brief Specialization of template class LeptonTranslatorBase in the
0007     package HitFit for pat::Muon.
0008 
0009     @author Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
0010 
0011     @par Created
0012     Sat Jun 27 17:49:15 2009 UTC
0013 
0014     @version $Id: PatMuonHitFitTranslator.cc,v 1.8 2010/08/06 22:03:03 haryo Exp $
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   }  // LeptonTranslatorBase<pat::Muon>::LeptonTranslatorBase()
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   }  // LeptonTranslatorBase<pat::Muon>::LeptonTranslatorBase(const std::string& s)
0045 
0046   template <>
0047   LeptonTranslatorBase<pat::Muon>::~LeptonTranslatorBase() {
0048   }  // LeptonTranslatorBase<pat::Muon>::~LeptonTranslatorBase()
0049 
0050   template <>
0051   Lepjets_Event_Lep LeptonTranslatorBase<pat::Muon>::operator()(const pat::Muon& lepton,
0052                                                                 int type /*= hitfit::lepton_label */,
0053                                                                 bool useObjEmbRes /* = false */) {
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   }  // Lepjets_Event_Lep LeptonTranslatorBase<pat::Muon>::operator()
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 }  // namespace hitfit