CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10/src/TopQuarkAnalysis/TopHitFit/src/PatElectronHitFitTranslator.cc

Go to the documentation of this file.
00001  //
00002 // $Id: PatElectronHitFitTranslator.cc,v 1.1 2011/05/26 09:47:00 mseidel Exp $
00003 //
00004 
00020 #include "TopQuarkAnalysis/TopHitFit/interface/LeptonTranslatorBase.h"
00021 #include "DataFormats/PatCandidates/interface/Electron.h"
00022 
00023 namespace hitfit {
00024 
00025 template<>
00026 LeptonTranslatorBase<pat::Electron>::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/exampleElectronResolution.txt");
00032     resolution_ = EtaDepResolution(resolution_filename);
00033 
00034 } // LeptonTranslatorBase<pat::Electron>::LeptonTranslatorBase()
00035 
00036 
00037 template<>
00038 LeptonTranslatorBase<pat::Electron>::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/exampleElectronResolution.txt");
00047     } else {
00048         resolution_filename = ifile ;
00049     }
00050 
00051     resolution_ = EtaDepResolution(resolution_filename);
00052 
00053 } // LeptonTranslatorBase<pat::Electron>::LeptonTranslatorBase(const std::string& ifile)
00054 
00055 
00056 template<>
00057 LeptonTranslatorBase<pat::Electron>::~LeptonTranslatorBase()
00058 {
00059 }
00060 
00061 
00062 template<>
00063 Lepjets_Event_Lep
00064 LeptonTranslatorBase<pat::Electron>::operator()(const pat::Electron& 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            electron_eta        = lepton.superCluster()->eta();
00072     Vector_Resolution electron_resolution = resolution_.GetResolution(electron_eta);
00073 
00074     Lepjets_Event_Lep electron(p,
00075                                electron_label,
00076                                electron_resolution);
00077     return electron;
00078 
00079 } // Lepjets_Event_Lep LeptonTranslatorBase<pat::Electron>::operator()
00080 
00081 
00082 template<>
00083 const EtaDepResolution&
00084 LeptonTranslatorBase<pat::Electron>::resolution() const
00085 {
00086     return resolution_;
00087 }
00088 
00089 
00090 template<>
00091 bool
00092 LeptonTranslatorBase<pat::Electron>::CheckEta(const pat::Electron& lepton) const
00093 {
00094     double            electron_eta        = lepton.superCluster()->eta();
00095     return resolution_.CheckEta(electron_eta);
00096 }
00097 
00098 
00099 } // namespace hitfit