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::METzCalculator ( )

constructor

Definition at line 6 of file METzCalculator.cc.

6 { isComplex_ = false; }

References isComplex_.

◆ ~METzCalculator()

METzCalculator::~METzCalculator ( )
virtual

destructor

Definition at line 9 of file METzCalculator.cc.

9 {}

Member Function Documentation

◆ Calculate()

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.

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 }

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

◆ IsComplex()

bool METzCalculator::IsComplex ( ) const
inline

check for complex root

Definition at line 53 of file METzCalculator.h.

53 { return isComplex_; };

References isComplex_.

◆ Print()

void METzCalculator::Print ( void  )
inline

Definition at line 55 of file METzCalculator.h.

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  }

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

◆ SetMET() [1/2]

void METzCalculator::SetMET ( const pat::MET MET)
inline

Set MET.

Definition at line 29 of file METzCalculator.h.

29 { MET_ = MET; };

References HLTTauDQMOffline_cfi::MET, and MET_.

Referenced by BoostedTopProducer::produce().

◆ SetMET() [2/2]

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

Definition at line 30 of file METzCalculator.h.

30  {
31  pat::Particle::LorentzVector p(MET.Px(), MET.Py(), MET.Pz(), MET.E());
32  MET_.setP4(p);
33  }

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

◆ SetMuon() [1/2]

void METzCalculator::SetMuon ( const pat::Particle lepton)
inline

Set Muon.

Definition at line 35 of file METzCalculator.h.

35 { lepton_ = lepton; };

References lepton_.

Referenced by BoostedTopProducer::produce().

◆ SetMuon() [2/2]

void METzCalculator::SetMuon ( const TLorentzVector &  lepton)
inline

Definition at line 36 of file METzCalculator.h.

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

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

Member Data Documentation

◆ isComplex_

bool METzCalculator::isComplex_
private

Definition at line 61 of file METzCalculator.h.

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

◆ lepton_

pat::Particle METzCalculator::lepton_
private

Definition at line 62 of file METzCalculator.h.

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

◆ MET_

pat::MET METzCalculator::MET_
private

Definition at line 63 of file METzCalculator.h.

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

AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
gather_cfg.cout
cout
Definition: gather_cfg.py:144
METzCalculator::isComplex_
bool isComplex_
Definition: METzCalculator.h:61
METzCalculator::MET_
pat::MET MET_
Definition: METzCalculator.h:63
Abs
T Abs(T a)
Definition: MathUtil.h:49
reco::LeafCandidate::py
double py() const final
y coordinate of momentum vector
Definition: LeafCandidate.h:142
a
double a
Definition: hdecay.h:119
A
TtFullHadDaughter::B
static const std::string B
Definition: TtFullHadronicEvent.h:9
MaterialEffects_cfi.A
A
Definition: MaterialEffects_cfi.py:11
reco::LeafCandidate::setP4
void setP4(const LorentzVector &p4) final
set 4-momentum
Definition: LeafCandidate.h:158
type
type
Definition: HCALResponse.h:21
gen::C
C
Definition: PomwigHadronizer.cc:76
MET
reco::LeafCandidate::energy
double energy() const final
energy
Definition: LeafCandidate.h:125
METzCalculator::lepton_
pat::Particle lepton_
Definition: METzCalculator.h:62
reco::Candidate::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
reco::LeafCandidate::px
double px() const final
x coordinate of momentum vector
Definition: LeafCandidate.h:140
reco::LeafCandidate::pz
double pz() const final
z coordinate of momentum vector
Definition: LeafCandidate.h:144
HLTTauDQMOffline_cfi.MET
MET
Definition: HLTTauDQMOffline_cfi.py:70