Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef TopTools_MEzCalculator_h
0002 #define TopTools_MEzCalculator_h
0003 
0004 /**_________________________________________________________________
0005    class:   MEzCalculator.h
0006 
0007  author: Francisco Yumiceva, Fermilab (yumiceva@fnal.gov)
0008 
0009  version $Id: MEzCalculator.h,v 1.4 2009/02/18 21:31:15 yumiceva Exp $
0010 
0011 ________________________________________________________________**/
0012 
0013 #include "DataFormats/PatCandidates/interface/Particle.h"
0014 #include "DataFormats/PatCandidates/interface/MET.h"
0015 
0016 #include "TLorentzVector.h"
0017 
0018 class MEzCalculator {
0019 public:
0020   /// constructor
0021   MEzCalculator();
0022   /// destructor
0023   ~MEzCalculator();
0024   /// Set MET
0025   void SetMET(const pat::MET& MET) { MET_ = MET; };
0026   void SetMET(const TLorentzVector& MET) {
0027     pat::Particle::LorentzVector p(MET.Px(), MET.Py(), MET.Pz(), MET.E());
0028     MET_.setP4(p);
0029   }
0030   /// Set lepton
0031   void SetLepton(const pat::Particle& lepton, bool isMuon = true) {
0032     lepton_ = lepton;
0033     isMuon_ = isMuon;
0034   };
0035   void SetLepton(const TLorentzVector& lepton) {
0036     pat::Particle::LorentzVector p(lepton.Px(), lepton.Py(), lepton.Pz(), lepton.E());
0037     lepton_.setP4(p);
0038   }
0039   /// Calculate MEz
0040   /// options to choose roots from quadratic equation:
0041   /// type = 0 : if real roots, pick the one nearest to
0042   ///                     the lepton Pz except when the Pz so chosen
0043   ///                     is greater than 300 GeV in which case pick
0044   ///                     the most central root.
0045   /// type = 1 (default): if real roots, choose the one closest to the lepton Pz
0046   ///           if complex roots, use only the real part.
0047   /// type = 2: if real roots, choose the most central solution.
0048   ///           if complex roots, use only the real part.
0049   double Calculate(int type = 1);
0050   /// check for complex root
0051   bool IsComplex() const { return isComplex_; };
0052   /// verbose
0053   void Print() {
0054     std::cout << " METzCalculator: pxmu = " << lepton_.px() << " pzmu= " << lepton_.pz() << std::endl;
0055     std::cout << " METzCalculator: pxnu = " << MET_.px() << " pynu= " << MET_.py() << std::endl;
0056   }
0057 
0058 private:
0059   bool isComplex_;
0060   pat::Particle lepton_;
0061   pat::MET MET_;
0062   bool isMuon_;
0063 };
0064 
0065 #endif