CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MET.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 // Package: METReco
4 // Class: MET
5 //
6 // Original authors: Michael Schmitt, Richard Cavanaugh The University of Florida
7 // changes by: Freya Blekman, Cornell University
8 //
9 
10 //____________________________________________________________________________||
12 #include "TVector.h"
13 
14 //____________________________________________________________________________||
15 using namespace std;
16 using namespace reco;
17 
18 //____________________________________________________________________________||
20 {
21  sumet = 0.0;
22  elongit = 0.0;
23  signif_dxx=signif_dyy=signif_dyx=signif_dxy=0.;
24 }
25 
26 // Constructer for the case when only p4_ = (mEx, mEy, 0, mEt) is known.
27 // The vertex information is currently not used (but may be in the future)
28 // and is required by the RecoCandidate constructer.
29 //____________________________________________________________________________||
30 MET::MET( const LorentzVector& p4_, const Point& vtx_ ) :
31  RecoCandidate( 0, p4_, vtx_ )
32 {
33  sumet = 0.0;
34  elongit = 0.0;
36 }
37 
38 // Constructer for the case when the SumET is known in addition to
39 // p4_ = (mEx, mEy, 0, mEt). The vertex information is currently not used
40 // (but see above).
41 //____________________________________________________________________________||
42 MET::MET( double sumet_, const LorentzVector& p4_, const Point& vtx_ ) :
43  RecoCandidate( 0, p4_, vtx_ )
44 {
45  sumet = sumet_;
46  elongit = 0.0;
48 }
49 
50 // Constructor for the case when the SumET, the corrections which
51 // were applied to the MET, as well the MET itself p4_ = (mEx, mEy, 0, mEt)
52 // are all known. See above concerning the vertex information.
53 //____________________________________________________________________________||
54 MET::MET( double sumet_, const std::vector<CorrMETData>& corr_,
55  const LorentzVector& p4_, const Point& vtx_ ) :
56  RecoCandidate( 0, p4_, vtx_ )
57 {
58  sumet = sumet_;
59  elongit = 0.0;
61  //-----------------------------------
62  // Fill the vector containing the corrections (corr) with vector of
63  // known corrections (corr_) passed in via the constructor.
64  std::vector<CorrMETData>::const_iterator i;
65  for( i = corr_.begin(); i != corr_.end(); i++ )
66  {
67  corr.push_back( *i );
68  }
69 }
70 
71 //____________________________________________________________________________||
72 MET * MET::clone() const {
73  return new MET( * this );
74 }
75 
76 // function that calculates the MET significance from the vector information.
77 //____________________________________________________________________________||
78 double MET::significance() const {
79  if(signif_dxx==0 && signif_dyy==0 && signif_dxy==0 && signif_dyx==0)
80  return -1;
82  ROOT::Math::SVector<double,2> metvec;
83  metvec(0)=this->px();
84  metvec(1)=this->py();
85  double signif = -1;
86  double det=0;
87  metmat.Det2(det);
88  if(std::abs(det)>0.000001){
89  metmat.Invert();
90  signif = ROOT::Math::Dot(metvec, (metmat * metvec) );
91  }
92  return signif;
93 }
94 
95 // Returns the vector of all corrections applied to the x component of the
96 // missing transverse momentum, mEx
97 //____________________________________________________________________________||
98 std::vector<double> MET::dmEx() const
99 {
100  std::vector<double> deltas;
101  std::vector<CorrMETData>::const_iterator i;
102  for( i = corr.begin(); i != corr.end(); i++ )
103  {
104  deltas.push_back( i->mex );
105  }
106  return deltas;
107 }
108 
109 // Returns the vector of all corrections applied to the y component of the
110 // missing transverse momentum, mEy
111 //____________________________________________________________________________||
112 std::vector<double> MET::dmEy() const
113 {
114  std::vector<double> deltas;
115  std::vector<CorrMETData>::const_iterator i;
116  for( i = corr.begin(); i != corr.end(); i++ )
117  {
118  deltas.push_back( i->mey );
119  }
120  return deltas;
121 }
122 
123 // Returns the vector of all corrections applied to the scalar sum of the
124 // transverse energy (over all objects)
125 //____________________________________________________________________________||
126 std::vector<double> MET::dsumEt() const
127 {
128  std::vector<double> deltas;
129  std::vector<CorrMETData>::const_iterator i;
130  for( i = corr.begin(); i != corr.end(); i++ )
131  {
132  deltas.push_back( i->sumet );
133  }
134  return deltas;
135 }
136 
137 // returns the significance matrix
138 //____________________________________________________________________________||
140 {
142  result(0,0)=signif_dxx;
143  result(0,1)=signif_dxy;
144  result(1,0)=signif_dyx;
145  result(1,1)=signif_dyy;
146  return result;
147 }
148 
149 // Required RecoCandidate polymorphism
150 //____________________________________________________________________________||
151 bool MET::overlap( const Candidate & ) const
152 {
153  return false;
154 }
155 
156 //____________________________________________________________________________||
158 {
159  signif_dxx=inmatrix(0,0);
160  signif_dxy=inmatrix(0,1);
161  signif_dyx=inmatrix(1,0);
162  signif_dyy=inmatrix(1,1);
163  return;
164 }
165 
166 //____________________________________________________________________________||
std::vector< double > dsumEt() const
Definition: MET.cc:126
int i
Definition: DBlmapReader.cc:9
double signif_dyx
Definition: MET.h:83
MET * clone() const
returns a clone of the Candidate object
Definition: MET.cc:72
double signif_dxy
Definition: MET.h:84
void setSignificanceMatrix(const reco::METCovMatrix &matrix)
Definition: MET.cc:157
double signif_dxx
Definition: MET.h:81
ROOT::Math::SMatrix< double, 2 > METCovMatrix
Definition: MET.h:40
std::vector< double > dmEx() const
Definition: MET.cc:98
MET()
Definition: MET.cc:19
Definition: MET.h:42
tuple result
Definition: query.py:137
std::vector< CorrMETData > corr
Definition: MET.h:85
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< double > dmEy() const
Definition: MET.cc:112
double signif_dyy
Definition: MET.h:82
virtual double px() const
x coordinate of momentum vector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
virtual bool overlap(const Candidate &) const
check overlap with another candidate
Definition: MET.cc:151
math::XYZPoint Point
point in the space
Definition: Candidate.h:41
double elongit
Definition: MET.h:79
double significance() const
Definition: MET.cc:78
double sumet
Definition: MET.h:78
virtual double py() const
y coordinate of momentum vector
reco::METCovMatrix getSignificanceMatrix(void) const
Definition: MET.cc:139