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
MEzCalculator Class Reference

#include <MEzCalculator.h>

Public Member Functions

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

Private Attributes

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

Detailed Description


class: MEzCalculator.h

author: Francisco Yumiceva, Fermilab (yumic.nosp@m.eva@.nosp@m.fnal..nosp@m.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_.

6 {
7  isComplex_ = false;
8  isMuon_ = true;
9 }
MEzCalculator::~MEzCalculator ( )

destructor

Definition at line 12 of file MEzCalculator.cc.

13 {
14 }

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

Referenced by TtSemiLRSignalSelObservables::operator()(), and TtSemiLepJetCombWMassDeltaTopMass::produce().

19 {
20  if(type<0 || type>3)
21  throw cms::Exception("UnimplementedFeature") << "Type " << type << " not supported in MEzCalculator.\n";
22 
23  double M_W = 80.4;
24  double M_mu = 0.10566;
25  double M_e = 0.511e-3;
26  double M_lepton = M_mu;
27  if (! isMuon_ ) M_lepton = M_e;
28 
29  double emu = lepton_.energy();
30  double pxmu = lepton_.px();
31  double pymu = lepton_.py();
32  double pzmu = lepton_.pz();
33  double pxnu = MET_.px();
34  double pynu = MET_.py();
35  double pznu = 0.;
36 
37  // use pznu = - B/2*A +/- sqrt(B*B-4*A*C)/(2*A)
38 
39  double a = M_W*M_W - M_lepton*M_lepton + 2.0*(pxmu*pxnu + pymu*pynu);
40  double A = 4.0*(emu*emu - pzmu*pzmu);
41  double B = -4.0*a*pzmu;
42  double C = 4.0*emu*emu*(pxnu*pxnu + pynu*pynu) - a*a;
43 
44  double tmproot = B*B - 4.0*A*C;
45 
46  if (tmproot<0) {
47  isComplex_= true;
48  pznu = - B/(2*A); // take real part of complex roots
49  }
50  else {
51  isComplex_ = false;
52  double tmpsol1 = (-B + TMath::Sqrt(tmproot))/(2.0*A);
53  double tmpsol2 = (-B - TMath::Sqrt(tmproot))/(2.0*A);
54 
55  if (type == 0 ) {
56  // two real roots, pick the one closest to pz of muon
57  if (TMath::Abs(tmpsol2-pzmu) < TMath::Abs(tmpsol1-pzmu)) { pznu = tmpsol2;}
58  else pznu = tmpsol1;
59  // if pznu is > 300 pick the most central root
60  if ( pznu > 300. ) {
61  if (TMath::Abs(tmpsol1)<TMath::Abs(tmpsol2) ) pznu = tmpsol1;
62  else pznu = tmpsol2;
63  }
64  }
65  if (type == 1 ) {
66  // two real roots, pick the one closest to pz of muon
67  if (TMath::Abs(tmpsol2-pzmu) < TMath::Abs(tmpsol1-pzmu)) { pznu = tmpsol2;}
68  else pznu = tmpsol1;
69  }
70  if (type == 2 ) {
71  // pick the most central root.
72  if (TMath::Abs(tmpsol1)<TMath::Abs(tmpsol2) ) pznu = tmpsol1;
73  else pznu = tmpsol2;
74  }
75  if (type == 3 ) {
76  // pick the largest value of the cosine
77  TVector3 p3w, p3mu;
78  p3w.SetXYZ(pxmu+pxnu, pymu+pynu, pzmu+ tmpsol1);
79  p3mu.SetXYZ(pxmu, pymu, pzmu );
80 
81  double sinthcm1 = 2.*(p3mu.Perp(p3w))/M_W;
82  p3w.SetXYZ(pxmu+pxnu, pymu+pynu, pzmu+ tmpsol2);
83  double sinthcm2 = 2.*(p3mu.Perp(p3w))/M_W;
84 
85  double costhcm1 = TMath::Sqrt(1. - sinthcm1*sinthcm1);
86  double costhcm2 = TMath::Sqrt(1. - sinthcm2*sinthcm2);
87 
88  if ( costhcm1 > costhcm2 ) pznu = tmpsol1;
89  else pznu = tmpsol2;
90  }
91 
92  }
93 
94  //Particle neutrino;
95  //neutrino.setP4( LorentzVector(pxnu, pynu, pznu, TMath::Sqrt(pxnu*pxnu + pynu*pynu + pznu*pznu ))) ;
96 
97  return pznu;
98 }
type
Definition: HCALResponse.h:21
virtual double energy() const
energy
T Abs(T a)
Definition: MathUtil.h:49
pat::Particle lepton_
Definition: MEzCalculator.h:62
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
pat::MET MET_
Definition: MEzCalculator.h:63
bool MEzCalculator::IsComplex ( ) const
inline

check for complex root

Definition at line 52 of file MEzCalculator.h.

References isComplex_.

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

54  {
55  std::cout << " METzCalculator: pxmu = " << lepton_.px() << " pzmu= " << lepton_.pz() << std::endl;
56  std::cout << " METzCalculator: pxnu = " << MET_.px() << " pynu= " << MET_.py() << std::endl;
57  }
pat::Particle lepton_
Definition: MEzCalculator.h:62
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
pat::MET MET_
Definition: MEzCalculator.h:63
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()(), and TtSemiLepJetCombWMassDeltaTopMass::produce().

32  {
33  lepton_ = lepton;
34  isMuon_ = isMuon;
35  };
bool isMuon(const Candidate &part)
Definition: pdgIdUtils.h:11
pat::Particle lepton_
Definition: MEzCalculator.h:62
void MEzCalculator::SetLepton ( const TLorentzVector &  lepton)
inline

Definition at line 36 of file MEzCalculator.h.

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

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

Definition at line 27 of file MEzCalculator.h.

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

27  {
28  pat::Particle::LorentzVector p(MET.Px(),MET.Py(),MET.Pz(),MET.E());
29  MET_.setP4(p);
30  }
virtual void setP4(const LorentzVector &p4)
set 4-momentum
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
pat::MET MET_
Definition: MEzCalculator.h:63

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

pat::Particle MEzCalculator::lepton_
private

Definition at line 62 of file MEzCalculator.h.

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

pat::MET MEzCalculator::MET_
private

Definition at line 63 of file MEzCalculator.h.

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