Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:31:19

0001 //
0002 //
0003 
0004 /**
0005     @file PatMETHitFitTranslator.cc
0006 
0007     @brief Specialization of template class METTranslatorBase in the
0008     package HitFit for pat::MET
0009 
0010     @author Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
0011 
0012     @par Created
0013     Sat Jun 27 17:49:32 2009 UTC
0014 
0015     @version $Id: PatMETHitFitTranslator.cc,v 1.7 2011/01/29 22:21:38 haryo Exp $
0016  */
0017 
0018 #include "TopQuarkAnalysis/TopHitFit/interface/METTranslatorBase.h"
0019 #include "DataFormats/PatCandidates/interface/MET.h"
0020 
0021 #include <cmath>
0022 
0023 namespace hitfit {
0024 
0025   template <>
0026   METTranslatorBase<pat::MET>::METTranslatorBase() {
0027     resolution_ = Resolution(std::string("0,0,12"));
0028   }  // METTranslatorBase<pat::MET>::METTranslatorBase()
0029 
0030   template <>
0031   METTranslatorBase<pat::MET>::METTranslatorBase(const std::string& ifile) {
0032     const Defaults_Text defs(ifile);
0033     std::string resolution_string(defs.get_string("met_resolution"));
0034     resolution_ = Resolution(resolution_string);
0035 
0036   }  // METTranslatorBase<pat::MET>::METTranslatorBase(const std::string& ifile)
0037 
0038   template <>
0039   METTranslatorBase<pat::MET>::~METTranslatorBase() {}  // METTranslatorBase<pat::MET>::~METTranslatorBase()
0040 
0041   template <>
0042   Fourvec METTranslatorBase<pat::MET>::operator()(const pat::MET& m, bool useObjEmbRes /* = false */) {
0043     double px = m.px();
0044     double py = m.py();
0045 
0046     return Fourvec(px, py, 0.0, sqrt(px * px + py * py));
0047 
0048   }  // Fourvec METTranslatorBase<pat::MET>::operator()(const pat::MET& m)
0049 
0050   template <>
0051   Resolution METTranslatorBase<pat::MET>::KtResolution(const pat::MET& m, bool useObjEmbRes /* = false */) const {
0052     return resolution_;
0053   }  // Resolution METTranslatorBase<pat::MET>::KtResolution(const pat::MET& m)
0054 
0055   template <>
0056   Resolution METTranslatorBase<pat::MET>::METResolution(const pat::MET& m, bool useObjEmbRes /* = false */) const {
0057     return KtResolution(m, useObjEmbRes);
0058   }  // Resolution METTranslatorBase<pat::MET>::METResolution(const pat::MET& m)
0059 
0060 }  // namespace hitfit