CMS 3D CMS Logo

Public Member Functions | Private Attributes

MEzCalculator Class Reference

#include <MEzCalculator.h>

List of all members.

Public Member Functions

double Calculate (int type=1)
 member functions
bool IsComplex () const
 check for complex root
 MEzCalculator ()
 constructor
void Print ()
 verbose
void SetLepton (const pat::Particle &lepton, bool isMuon=true)
 Set lepton.
void SetLepton (TLorentzVector lepton)
void SetMET (const pat::MET &MET)
 Set MET.
void SetMET (TLorentzVector MET)
 ~MEzCalculator ()
 destructor

Private Attributes

bool isComplex_
bool isMuon_
pat::Particle lepton_
pat::MET MET_

Detailed Description

_________________________________________________________________ class: MEzCalculator.h

author: Francisco Yumiceva, Fermilab (yumiceva@fnal.gov)

version

Id:
MEzCalculator.h,v 1.4 2009/02/18 21:31:15 yumiceva Exp

________________________________________________________________

Definition at line 18 of file MEzCalculator.h.


Constructor & Destructor Documentation

MEzCalculator::MEzCalculator ( )

constructor

Definition at line 5 of file MEzCalculator.cc.

References isComplex_, and isMuon_.

{
  isComplex_ = false;
  isMuon_ = true;
}
MEzCalculator::~MEzCalculator ( )

destructor

Definition at line 12 of file MEzCalculator.cc.

{
}

Member Function Documentation

double MEzCalculator::Calculate ( int  type = 1)

member functions

Calculate MEz options to choose roots from quadratic equation: type = 0 : if real roots, pick the one nearest to the lepton Pz except when the Pz so chosen is greater than 300 GeV in which case pick the most central root. type = 1 (default): if real roots, choose the one closest to the lepton Pz if complex roots, use only the real part. type = 2: if real roots, choose the most central solution. if complex roots, use only the real part.

Definition at line 18 of file MEzCalculator.cc.

References a, funct::A, funct::C, reco::LeafCandidate::energy(), Exception, isComplex_, isMuon_, lepton_, MET_, reco::LeafCandidate::px(), reco::LeafCandidate::py(), and reco::LeafCandidate::pz().

Referenced by TtSemiLRSignalSelObservables::operator()().

{
  if(type<0 || type>3)
    throw cms::Exception("UnimplementedFeature") << "Type " << type << " not supported in MEzCalculator.\n";

  double M_W  = 80.4;
  double M_mu =  0.10566;
  double M_e = 0.511e-3;
  double M_lepton = M_mu;
  if (! isMuon_ ) M_lepton = M_e;
  
  double emu = lepton_.energy();
  double pxmu = lepton_.px();
  double pymu = lepton_.py();
  double pzmu = lepton_.pz();
  double pxnu = MET_.px();
  double pynu = MET_.py();
  double pznu = 0.;

  // use pznu = - B/2*A +/- sqrt(B*B-4*A*C)/(2*A)
  
  double a = M_W*M_W - M_lepton*M_lepton + 2.0*(pxmu*pxnu + pymu*pynu);
  double A = 4.0*(emu*emu - pzmu*pzmu);
  double B = -4.0*a*pzmu;
  double C = 4.0*emu*emu*(pxnu*pxnu + pynu*pynu) - a*a;
  
  double tmproot = B*B - 4.0*A*C;
  
  if (tmproot<0) {
    isComplex_= true;
    pznu = - B/(2*A); // take real part of complex roots
  }
  else {
    isComplex_ = false;
    double tmpsol1 = (-B + TMath::Sqrt(tmproot))/(2.0*A);
    double tmpsol2 = (-B - TMath::Sqrt(tmproot))/(2.0*A);
    
    if (type == 0 ) {
      // two real roots, pick the one closest to pz of muon
      if (TMath::Abs(tmpsol2-pzmu) < TMath::Abs(tmpsol1-pzmu)) { pznu = tmpsol2;}
      else pznu = tmpsol1;
      // if pznu is > 300 pick the most central root
      if ( pznu > 300. ) {
        if (TMath::Abs(tmpsol1)<TMath::Abs(tmpsol2) ) pznu = tmpsol1;
        else pznu = tmpsol2;
      }
    }
    if (type == 1 ) {
      // two real roots, pick the one closest to pz of muon
      if (TMath::Abs(tmpsol2-pzmu) < TMath::Abs(tmpsol1-pzmu)) { pznu = tmpsol2;}
      else pznu = tmpsol1;
    }
    if (type == 2 ) {
      // pick the most central root.
      if (TMath::Abs(tmpsol1)<TMath::Abs(tmpsol2) ) pznu = tmpsol1;
      else pznu = tmpsol2;
    }
    if (type == 3 ) {
      // pick the largest value of the cosine
      TVector3 p3w, p3mu;
      p3w.SetXYZ(pxmu+pxnu, pymu+pynu, pzmu+ tmpsol1);
      p3mu.SetXYZ(pxmu, pymu, pzmu );
      
      double sinthcm1 = 2.*(p3mu.Perp(p3w))/M_W;
      p3w.SetXYZ(pxmu+pxnu, pymu+pynu, pzmu+ tmpsol2);
      double sinthcm2 = 2.*(p3mu.Perp(p3w))/M_W;
      
      double costhcm1 = TMath::Sqrt(1. - sinthcm1*sinthcm1);
      double costhcm2 = TMath::Sqrt(1. - sinthcm2*sinthcm2);
      
      if ( costhcm1 > costhcm2 ) pznu = tmpsol1;
      else pznu = tmpsol2;
    }   

  }
  
  //Particle neutrino;
  //neutrino.setP4( LorentzVector(pxnu, pynu, pznu, TMath::Sqrt(pxnu*pxnu + pynu*pynu + pznu*pznu ))) ;
  
  return pznu;
}
bool MEzCalculator::IsComplex ( ) const [inline]

check for complex root

Definition at line 52 of file MEzCalculator.h.

References isComplex_.

{ return isComplex_; };
void MEzCalculator::Print ( void  ) [inline]

verbose

Definition at line 54 of file MEzCalculator.h.

References gather_cfg::cout, lepton_, MET_, reco::LeafCandidate::px(), reco::LeafCandidate::py(), and reco::LeafCandidate::pz().

               {
          std::cout << " METzCalculator: pxmu = " << lepton_.px() << " pzmu= " << lepton_.pz() << std::endl;
          std::cout << " METzCalculator: pxnu = " << MET_.px() << " pynu= " << MET_.py() << std::endl;
  }
void MEzCalculator::SetLepton ( TLorentzVector  lepton) [inline]

Definition at line 36 of file MEzCalculator.h.

References lepton_, L1TEmulatorMonitor_cff::p, and reco::LeafCandidate::setP4().

                                        {
          pat::Particle::LorentzVector p(lepton.Px(), lepton.Py(), lepton.Pz(), lepton.E() );
          lepton_.setP4(p);
  }
void MEzCalculator::SetLepton ( const pat::Particle lepton,
bool  isMuon = true 
) [inline]

Set lepton.

Definition at line 32 of file MEzCalculator.h.

References reco::isMuon(), isMuon_, and lepton_.

Referenced by TtSemiLRSignalSelObservables::operator()().

                                                                {
          lepton_ = lepton;
          isMuon_ = isMuon;
  };
void MEzCalculator::SetMET ( const pat::MET MET) [inline]

Set MET.

Definition at line 26 of file MEzCalculator.h.

References MET_.

Referenced by TtSemiLRSignalSelObservables::operator()().

{ MET_ = MET; } ;
void MEzCalculator::SetMET ( TLorentzVector  MET) [inline]

Definition at line 27 of file MEzCalculator.h.

References MET_, L1TEmulatorMonitor_cff::p, and reco::LeafCandidate::setP4().

                                  {
          pat::Particle::LorentzVector p(MET.Px(),MET.Py(),MET.Pz(),MET.E());
          MET_.setP4(p);
  }

Member Data Documentation

bool MEzCalculator::isComplex_ [private]

Definition at line 61 of file MEzCalculator.h.

Referenced by Calculate(), IsComplex(), and MEzCalculator().

bool MEzCalculator::isMuon_ [private]

Definition at line 64 of file MEzCalculator.h.

Referenced by Calculate(), MEzCalculator(), and SetLepton().

Definition at line 62 of file MEzCalculator.h.

Referenced by Calculate(), Print(), and SetLepton().

Definition at line 63 of file MEzCalculator.h.

Referenced by Calculate(), Print(), and SetMET().