CMS 3D CMS Logo

Public Member Functions | Private Attributes

METzCalculator Class Reference

#include <METzCalculator.h>

List of all members.

Public Member Functions

double Calculate (int type=0)
 member functions
bool IsComplex () const
 check for complex root
 METzCalculator ()
 constructor
void Print ()
void SetMET (TLorentzVector MET)
void SetMET (const pat::MET &MET)
 Set MET.
void SetMuon (TLorentzVector lepton)
void SetMuon (const pat::Particle &lepton)
 Set Muon.
virtual ~METzCalculator ()
 destructor

Private Attributes

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

Detailed Description

_________________________________________________________________ class: METzCalculator.h

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

version

Id:
METzCalculator.h,v 1.1 2012/10/11 14:26:45 eulisse Exp

________________________________________________________________

Definition at line 21 of file METzCalculator.h.


Constructor & Destructor Documentation

METzCalculator::METzCalculator ( )

constructor

Definition at line 6 of file METzCalculator.cc.

References isComplex_.

                               {
        isComplex_ = false;
}
METzCalculator::~METzCalculator ( ) [virtual]

destructor

Definition at line 11 of file METzCalculator.cc.

                                {
}

Member Function Documentation

double METzCalculator::Calculate ( int  type = 0)

member functions

Calculate MEz options to choose roots from quadratic equation: type = 0 (defalut): 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: 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. type = 3: if real roots, pick the largest value of the cosine*

Definition at line 16 of file METzCalculator.cc.

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

Referenced by BoostedTopProducer::produce().

                                  {

        double M_W  = 80.4;
        double M_mu =  0.10566;
        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.;

                
        double a = M_W*M_W - M_mu*M_mu + 2.0*pxmu*pxnu + 2.0*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

                //std::cout << " Neutrino Solutions: complex, real part " << pznu << std::endl;
                }
        else {
                        isComplex_ = false;
                        double tmpsol1 = (-B + TMath::Sqrt(tmproot))/(2.0*A);
                        double tmpsol2 = (-B - TMath::Sqrt(tmproot))/(2.0*A);

                        //std::cout << " Neutrino Solutions: " << tmpsol1 << ", " << tmpsol2 << std::endl;
                        
                        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 METzCalculator::IsComplex ( ) const [inline]

check for complex root

Definition at line 54 of file METzCalculator.h.

References isComplex_.

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

Definition at line 56 of file METzCalculator.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 METzCalculator::SetMET ( TLorentzVector  MET) [inline]

Definition at line 31 of file METzCalculator.h.

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

                                        {
                pat::Particle::LorentzVector p(MET.Px(),MET.Py(),MET.Pz(),MET.E());
                MET_.setP4(p);
        }
void METzCalculator::SetMET ( const pat::MET MET) [inline]

Set MET.

Definition at line 30 of file METzCalculator.h.

References MET_.

Referenced by BoostedTopProducer::produce().

{ MET_ = MET; } ;
void METzCalculator::SetMuon ( const pat::Particle lepton) [inline]

Set Muon.

Definition at line 36 of file METzCalculator.h.

References lepton_.

Referenced by BoostedTopProducer::produce().

{ lepton_ = lepton; };
void METzCalculator::SetMuon ( TLorentzVector  lepton) [inline]

Definition at line 37 of file METzCalculator.h.

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

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

Member Data Documentation

Definition at line 63 of file METzCalculator.h.

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

Definition at line 64 of file METzCalculator.h.

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

Definition at line 65 of file METzCalculator.h.

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