CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/TopQuarkAnalysis/TopPairBSM/src/METzCalculator.cc

Go to the documentation of this file.
00001 
00002 #include "METzCalculator.h"
00003 #include "TMath.h"
00004 
00006 METzCalculator::METzCalculator() {
00007         isComplex_ = false;
00008 }
00009 
00011 METzCalculator::~METzCalculator() {
00012 }
00013 
00015 double
00016 METzCalculator::Calculate(int type) {
00017 
00018         double M_W  = 80.4;
00019         double M_mu =  0.10566;
00020         double emu = lepton_.energy();
00021         double pxmu = lepton_.px();
00022         double pymu = lepton_.py();
00023         double pzmu = lepton_.pz();
00024         double pxnu = MET_.px();
00025         double pynu = MET_.py();
00026         double pznu = 0.;
00027 
00028                 
00029         double a = M_W*M_W - M_mu*M_mu + 2.0*pxmu*pxnu + 2.0*pymu*pynu;
00030         double A = 4.0*(emu*emu - pzmu*pzmu);
00031         double B = -4.0*a*pzmu;
00032         double C = 4.0*emu*emu*(pxnu*pxnu + pynu*pynu) - a*a;
00033 
00034         double tmproot = B*B - 4.0*A*C;
00035 
00036         if (tmproot<0) {
00037                 isComplex_= true;
00038                 pznu = - B/(2*A); // take real part of complex roots
00039 
00040                 //std::cout << " Neutrino Solutions: complex, real part " << pznu << std::endl;
00041                 }
00042         else {
00043                         isComplex_ = false;
00044                         double tmpsol1 = (-B + TMath::Sqrt(tmproot))/(2.0*A);
00045                         double tmpsol2 = (-B - TMath::Sqrt(tmproot))/(2.0*A);
00046 
00047                         //std::cout << " Neutrino Solutions: " << tmpsol1 << ", " << tmpsol2 << std::endl;
00048                         
00049                         if (type == 0 ) {
00050                                 // two real roots, pick the one closest to pz of muon
00051                                 if (TMath::Abs(tmpsol2-pzmu) < TMath::Abs(tmpsol1-pzmu)) { pznu = tmpsol2;}
00052                                 else pznu = tmpsol1;
00053                                 // if pznu is > 300 pick the most central root
00054                                 if ( pznu > 300. ) {
00055                                         if (TMath::Abs(tmpsol1)<TMath::Abs(tmpsol2) ) pznu = tmpsol1;
00056                                         else pznu = tmpsol2;
00057                                 }
00058                         }
00059                         if (type == 1 ) {
00060                                 // two real roots, pick the one closest to pz of muon
00061                                 if (TMath::Abs(tmpsol2-pzmu) < TMath::Abs(tmpsol1-pzmu)) { pznu = tmpsol2;}
00062                                 else pznu = tmpsol1;
00063                         }
00064                         if (type == 2 ) {
00065                                 // pick the most central root.
00066                                 if (TMath::Abs(tmpsol1)<TMath::Abs(tmpsol2) ) pznu = tmpsol1;
00067                                 else pznu = tmpsol2;
00068                         }
00069                         if (type == 3 ) {
00070                                 // pick the largest value of the cosine
00071                                 TVector3 p3w, p3mu;
00072                                 p3w.SetXYZ(pxmu+pxnu, pymu+pynu, pzmu+ tmpsol1);
00073                                 p3mu.SetXYZ(pxmu, pymu, pzmu );
00074                                 
00075                                 double sinthcm1 = 2.*(p3mu.Perp(p3w))/M_W;
00076                                 p3w.SetXYZ(pxmu+pxnu, pymu+pynu, pzmu+ tmpsol2);
00077                                 double sinthcm2 = 2.*(p3mu.Perp(p3w))/M_W;
00078 
00079                                 double costhcm1 = TMath::Sqrt(1. - sinthcm1*sinthcm1);
00080                                 double costhcm2 = TMath::Sqrt(1. - sinthcm2*sinthcm2);
00081 
00082                                 if ( costhcm1 > costhcm2 ) pznu = tmpsol1;
00083                                 else pznu = tmpsol2;
00084                         }
00085                 
00086         }
00087 
00088         //Particle neutrino;
00089         //neutrino.setP4( LorentzVector(pxnu, pynu, pznu, TMath::Sqrt(pxnu*pxnu + pynu*pynu + pznu*pznu ))) ;
00090 
00091         return pznu;
00092 }