test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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): muon_(muon), neutrino_(met)
13 {
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 }
27 
28 double WMuNuCandidatePtr::eT() const{
29  double e_t=0;
30  e_t=muon_->pt()+neutrino_->pt();
31  return e_t;
32 }
33 
34 double WMuNuCandidatePtr::massT() const{
35  // CandidatePtrs have a mt() function which computes the tranverse mass from E & pz.
36  // As MET does not have pz information... WMuNuCandidatePtrs have an alternative function to compute the mt quantity
37  // used in the WMuNu Inclusive analysis just from px, py
38  double wpx=muon_->px()+neutrino_->px(); double wpy=muon_->py()+neutrino_->py();
39  double mt = eT()*eT() - wpx*wpx - wpy*wpy;
40  mt = (mt>0) ? sqrt(mt) : 0;
41  return mt;
42 }
43 
44 double WMuNuCandidatePtr::acop() const{
45  // Acoplanarity between the muon and the MET
46  Geom::Phi<double> deltaphi(muon_->phi()-neutrino_->phi());
47  double acop = deltaphi.value();
48  if (acop<0) acop = - acop;
49  acop = M_PI - acop;
50  return acop;
51 }
virtual double mt() const final
transverse mass
T sqrt(T t)
Definition: SSEVec.h:18
#define M_PI
void addDaughter(const CandidatePtr &)
add a daughter via a reference
virtual double px() const final
x coordinate of momentum vector
tuple cout
Definition: gather_cfg.py:145
void set(reco::Candidate &c) const
set up a candidate