CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
METzCalculator Class Reference

#include <METzCalculator.h>

Public Member Functions

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

Private Attributes

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

Detailed Description


class: METzCalculator.h

author: Francisco Yumiceva, Fermilab (yumic.nosp@m.eva@.nosp@m.fnal..nosp@m.gov)

version

Id:
METzCalculator.h,v 1.3 2009/07/30 06:02:19 jengbou 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_.

6  {
7  isComplex_ = false;
8 }
METzCalculator::~METzCalculator ( )
virtual

destructor

Definition at line 11 of file METzCalculator.cc.

11  {
12 }

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 funct::A, a, Abs(), funct::C, reco::LeafCandidate::energy(), isComplex_, lepton_, MET_, reco::LeafCandidate::px(), reco::LeafCandidate::py(), and reco::LeafCandidate::pz().

Referenced by BoostedTopProducer::produce().

16  {
17 
18  double M_W = 80.4;
19  double M_mu = 0.10566;
20  double emu = lepton_.energy();
21  double pxmu = lepton_.px();
22  double pymu = lepton_.py();
23  double pzmu = lepton_.pz();
24  double pxnu = MET_.px();
25  double pynu = MET_.py();
26  double pznu = 0.;
27 
28 
29  double a = M_W*M_W - M_mu*M_mu + 2.0*pxmu*pxnu + 2.0*pymu*pynu;
30  double A = 4.0*(emu*emu - pzmu*pzmu);
31  double B = -4.0*a*pzmu;
32  double C = 4.0*emu*emu*(pxnu*pxnu + pynu*pynu) - a*a;
33 
34  double tmproot = B*B - 4.0*A*C;
35 
36  if (tmproot<0) {
37  isComplex_= true;
38  pznu = - B/(2*A); // take real part of complex roots
39 
40  //std::cout << " Neutrino Solutions: complex, real part " << pznu << std::endl;
41  }
42  else {
43  isComplex_ = false;
44  double tmpsol1 = (-B + TMath::Sqrt(tmproot))/(2.0*A);
45  double tmpsol2 = (-B - TMath::Sqrt(tmproot))/(2.0*A);
46 
47  //std::cout << " Neutrino Solutions: " << tmpsol1 << ", " << tmpsol2 << std::endl;
48 
49  if (type == 0 ) {
50  // two real roots, pick the one closest to pz of muon
51  if (TMath::Abs(tmpsol2-pzmu) < TMath::Abs(tmpsol1-pzmu)) { pznu = tmpsol2;}
52  else pznu = tmpsol1;
53  // if pznu is > 300 pick the most central root
54  if ( pznu > 300. ) {
55  if (TMath::Abs(tmpsol1)<TMath::Abs(tmpsol2) ) pznu = tmpsol1;
56  else pznu = tmpsol2;
57  }
58  }
59  if (type == 1 ) {
60  // two real roots, pick the one closest to pz of muon
61  if (TMath::Abs(tmpsol2-pzmu) < TMath::Abs(tmpsol1-pzmu)) { pznu = tmpsol2;}
62  else pznu = tmpsol1;
63  }
64  if (type == 2 ) {
65  // pick the most central root.
66  if (TMath::Abs(tmpsol1)<TMath::Abs(tmpsol2) ) pznu = tmpsol1;
67  else pznu = tmpsol2;
68  }
69  if (type == 3 ) {
70  // pick the largest value of the cosine
71  TVector3 p3w, p3mu;
72  p3w.SetXYZ(pxmu+pxnu, pymu+pynu, pzmu+ tmpsol1);
73  p3mu.SetXYZ(pxmu, pymu, pzmu );
74 
75  double sinthcm1 = 2.*(p3mu.Perp(p3w))/M_W;
76  p3w.SetXYZ(pxmu+pxnu, pymu+pynu, pzmu+ tmpsol2);
77  double sinthcm2 = 2.*(p3mu.Perp(p3w))/M_W;
78 
79  double costhcm1 = TMath::Sqrt(1. - sinthcm1*sinthcm1);
80  double costhcm2 = TMath::Sqrt(1. - sinthcm2*sinthcm2);
81 
82  if ( costhcm1 > costhcm2 ) pznu = tmpsol1;
83  else pznu = tmpsol2;
84  }
85 
86  }
87 
88  //Particle neutrino;
89  //neutrino.setP4( LorentzVector(pxnu, pynu, pznu, TMath::Sqrt(pxnu*pxnu + pynu*pynu + pznu*pznu ))) ;
90 
91  return pznu;
92 }
type
Definition: HCALResponse.h:21
pat::Particle lepton_
virtual double energy() const
energy
T Abs(T a)
Definition: MathUtil.h:49
virtual double px() const
x coordinate of momentum vector
virtual double pz() const
z coordinate of momentum vector
double a
Definition: hdecay.h:121
virtual double py() const
y coordinate of momentum vector
bool METzCalculator::IsComplex ( ) const
inline

check for complex root

Definition at line 54 of file METzCalculator.h.

References isComplex_.

54 { 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().

56  {
57  std::cout << " METzCalculator: pxmu = " << lepton_.px() << " pzmu= " << lepton_.pz() << std::endl;
58  std::cout << " METzCalculator: pxnu = " << MET_.px() << " pynu= " << MET_.py() << std::endl;
59  }
pat::Particle lepton_
virtual double px() const
x coordinate of momentum vector
virtual double pz() const
z coordinate of momentum vector
tuple cout
Definition: gather_cfg.py:121
virtual double py() const
y coordinate of momentum vector
void METzCalculator::SetMET ( const pat::MET MET)
inline

Set MET.

Definition at line 30 of file METzCalculator.h.

References MET_.

Referenced by BoostedTopProducer::produce().

30 { MET_ = MET; } ;
void METzCalculator::SetMET ( const TLorentzVector &  MET)
inline

Definition at line 31 of file METzCalculator.h.

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

31  {
32  pat::Particle::LorentzVector p(MET.Px(),MET.Py(),MET.Pz(),MET.E());
33  MET_.setP4(p);
34  }
virtual void setP4(const LorentzVector &p4)
set 4-momentum
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:41
void METzCalculator::SetMuon ( const pat::Particle lepton)
inline

Set Muon.

Definition at line 36 of file METzCalculator.h.

References lepton_.

Referenced by BoostedTopProducer::produce().

36 { lepton_ = lepton; };
pat::Particle lepton_
void METzCalculator::SetMuon ( const TLorentzVector &  lepton)
inline

Definition at line 37 of file METzCalculator.h.

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

37  {
38  pat::Particle::LorentzVector p(lepton.Px(), lepton.Py(), lepton.Pz(), lepton.E() );
39  lepton_.setP4(p);
40  }
virtual void setP4(const LorentzVector &p4)
set 4-momentum
pat::Particle lepton_
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:41

Member Data Documentation

bool METzCalculator::isComplex_
private

Definition at line 63 of file METzCalculator.h.

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

pat::Particle METzCalculator::lepton_
private

Definition at line 64 of file METzCalculator.h.

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

pat::MET METzCalculator::MET_
private

Definition at line 65 of file METzCalculator.h.

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