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

constructor

Definition at line 5 of file MEzCalculator.cc.

References isComplex_, and isMuon_.

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

destructor

Definition at line 11 of file MEzCalculator.cc.

11 {}

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

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

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 }
type
Definition: HCALResponse.h:21
double px() const final
x coordinate of momentum vector
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
pat::Particle lepton_
Definition: MEzCalculator.h:60
double py() const final
y coordinate of momentum vector
double a
Definition: hdecay.h:119
pat::MET MET_
Definition: MEzCalculator.h:61
bool MEzCalculator::IsComplex ( ) const
inline

check for complex root

Definition at line 51 of file MEzCalculator.h.

References isComplex_.

51 { return isComplex_; };
void MEzCalculator::Print ( void  )
inline

verbose

Definition at line 53 of file MEzCalculator.h.

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

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  }
double px() const final
x coordinate of momentum vector
double pz() const final
z coordinate of momentum vector
pat::Particle lepton_
Definition: MEzCalculator.h:60
double py() const final
y coordinate of momentum vector
pat::MET MET_
Definition: MEzCalculator.h:61
void MEzCalculator::SetLepton ( const pat::Particle lepton,
bool  isMuon = true 
)
inline

Set lepton.

Definition at line 31 of file MEzCalculator.h.

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

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

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

Definition at line 35 of file MEzCalculator.h.

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

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

Definition at line 26 of file MEzCalculator.h.

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

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

Member Data Documentation

bool MEzCalculator::isComplex_
private

Definition at line 59 of file MEzCalculator.h.

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

bool MEzCalculator::isMuon_
private

Definition at line 62 of file MEzCalculator.h.

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

pat::Particle MEzCalculator::lepton_
private

Definition at line 60 of file MEzCalculator.h.

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

pat::MET MEzCalculator::MET_
private

Definition at line 61 of file MEzCalculator.h.

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