CMS 3D CMS Logo

WMuNuCandidatePtr.cc
Go to the documentation of this file.
5 
6 using namespace edm;
7 using namespace std;
8 using namespace reco;
9 
10 WMuNuCandidatePtr::WMuNuCandidatePtr() {}
11 
12 WMuNuCandidatePtr::WMuNuCandidatePtr(const reco::CandidatePtr muon, const reco::CandidatePtr met)
13  : muon_(muon), neutrino_(met) {
16  AddFourMomenta addP4;
17  addP4.set(*this);
18  cout << "WCandidatePtr Created Wpx=" << muon_->px() << " + " << neutrino_->px() << " ?= " << this->px() << endl;
19  //WARNING: W CandidatePtrs combine the information from a Muon with the (px,py) information of the MET as the Neutrino
20  // --> There is no Pz information!!!!
21  // Be very careful when using the default CandidatePtr functions (.mass, .mt, .et, etc). They may not be what you are looking for :-).
22 }
23 
25 
26 double WMuNuCandidatePtr::eT() const {
27  double e_t = 0;
28  e_t = muon_->pt() + neutrino_->pt();
29  return e_t;
30 }
31 
32 double WMuNuCandidatePtr::massT() const {
33  // CandidatePtrs have a mt() function which computes the tranverse mass from E & pz.
34  // As MET does not have pz information... WMuNuCandidatePtrs have an alternative function to compute the mt quantity
35  // used in the WMuNu Inclusive analysis just from px, py
36  double wpx = muon_->px() + neutrino_->px();
37  double wpy = muon_->py() + neutrino_->py();
38  double mt = eT() * eT() - wpx * wpx - wpy * wpy;
39  mt = (mt > 0) ? sqrt(mt) : 0;
40  return mt;
41 }
42 
43 double WMuNuCandidatePtr::acop() const {
44  // Acoplanarity between the muon and the MET
45  Geom::Phi<double> deltaphi(muon_->phi() - neutrino_->phi());
46  double acop = deltaphi.value();
47  if (acop < 0)
48  acop = -acop;
49  acop = M_PI - acop;
50  return acop;
51 }
void set(reco::Candidate &c) const
set up a candidate
double mt() const final
transverse mass
double px() const final
x coordinate of momentum vector
T sqrt(T t)
Definition: SSEVec.h:19
#define M_PI
fixed size matrix
HLT enums.
void addDaughter(const CandidatePtr &)
add a daughter via a reference
Definition: Phi.h:52