CMS 3D CMS Logo

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

constructor

Definition at line 5 of file MEzCalculator.cc.

5  {
6  isComplex_ = false;
7  isMuon_ = true;
8 }

References isComplex_, and isMuon_.

◆ ~MEzCalculator()

MEzCalculator::~MEzCalculator ( )

destructor

Definition at line 11 of file MEzCalculator.cc.

11 {}

Member Function Documentation

◆ Calculate()

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 14 of file MEzCalculator.cc.

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

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

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

◆ IsComplex()

bool MEzCalculator::IsComplex ( ) const
inline

check for complex root

Definition at line 51 of file MEzCalculator.h.

51 { return isComplex_; };

References isComplex_.

Referenced by TtSemiLepHypothesis::setNeutrino().

◆ Print()

void MEzCalculator::Print ( void  )
inline

verbose

Definition at line 53 of file MEzCalculator.h.

53  {
54  std::cout << " METzCalculator: pxmu = " << lepton_.px() << " pzmu= " << lepton_.pz() << std::endl;
55  std::cout << " METzCalculator: pxnu = " << MET_.px() << " pynu= " << MET_.py() << std::endl;
56  }

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

◆ SetLepton() [1/2]

void MEzCalculator::SetLepton ( const pat::Particle lepton,
bool  isMuon = true 
)
inline

Set lepton.

Definition at line 31 of file MEzCalculator.h.

31  {
32  lepton_ = lepton;
33  isMuon_ = isMuon;
34  };

References reco::isMuon(), isMuon_, and lepton_.

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

◆ SetLepton() [2/2]

void MEzCalculator::SetLepton ( const TLorentzVector &  lepton)
inline

Definition at line 35 of file MEzCalculator.h.

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

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

◆ SetMET() [1/2]

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

◆ SetMET() [2/2]

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

Definition at line 26 of file MEzCalculator.h.

26  {
27  pat::Particle::LorentzVector p(MET.Px(), MET.Py(), MET.Pz(), MET.E());
28  MET_.setP4(p);
29  }

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

Member Data Documentation

◆ isComplex_

bool MEzCalculator::isComplex_
private

Definition at line 59 of file MEzCalculator.h.

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

◆ isMuon_

bool MEzCalculator::isMuon_
private

Definition at line 62 of file MEzCalculator.h.

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

◆ lepton_

pat::Particle MEzCalculator::lepton_
private

Definition at line 60 of file MEzCalculator.h.

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

◆ MET_

pat::MET MEzCalculator::MET_
private

Definition at line 61 of file MEzCalculator.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
MEzCalculator::isMuon_
bool isMuon_
Definition: MEzCalculator.h:62
MEzCalculator::lepton_
pat::Particle lepton_
Definition: MEzCalculator.h:60
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
MEzCalculator::MET_
pat::MET MET_
Definition: MEzCalculator.h:61
type
type
Definition: HCALResponse.h:21
gen::C
C
Definition: PomwigHadronizer.cc:76
Exception
Definition: hltDiff.cc:246
MET
reco::LeafCandidate::energy
double energy() const final
energy
Definition: LeafCandidate.h:125
reco::Candidate::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
MEzCalculator::isComplex_
bool isComplex_
Definition: MEzCalculator.h:59
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
reco::isMuon
bool isMuon(const Candidate &part)
Definition: pdgIdUtils.h:9