CMS 3D CMS Logo

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 { isComplex_ = false; }
METzCalculator::~METzCalculator ( )
virtual

destructor

Definition at line 9 of file METzCalculator.cc.

9 {}

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 12 of file METzCalculator.cc.

References MaterialEffects_cfi::A, a, Abs(), TtFullHadDaughter::B, gen::C, reco::LeafCandidate::energy(), isComplex_, lepton_, MET_, reco::LeafCandidate::px(), reco::LeafCandidate::py(), and reco::LeafCandidate::pz().

Referenced by BoostedTopProducer::produce(), and SetMuon().

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

check for complex root

Definition at line 53 of file METzCalculator.h.

References isComplex_.

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

Definition at line 55 of file METzCalculator.h.

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

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

Set MET.

Definition at line 29 of file METzCalculator.h.

References HLTTauDQMOffline_cfi::MET, and MET_.

Referenced by BoostedTopProducer::produce().

void METzCalculator::SetMET ( const TLorentzVector &  MET)
inline

Definition at line 30 of file METzCalculator.h.

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

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

Set Muon.

Definition at line 35 of file METzCalculator.h.

References lepton_.

Referenced by BoostedTopProducer::produce().

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

Definition at line 36 of file METzCalculator.h.

References Calculate(), 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  }
pat::Particle lepton_
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
void setP4(const LorentzVector &p4) final
set 4-momentum

Member Data Documentation

bool METzCalculator::isComplex_
private

Definition at line 61 of file METzCalculator.h.

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

pat::Particle METzCalculator::lepton_
private

Definition at line 62 of file METzCalculator.h.

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

pat::MET METzCalculator::MET_
private

Definition at line 63 of file METzCalculator.h.

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