CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
metsig::significanceAlgo Class Reference

#include <significanceAlgo.h>

Public Member Functions

const void addObjects (const std::vector< metsig::SigInputObj > &EventVec)
 
const void addSignifMatrix (const reco::METCovMatrix &input)
 
reco::METCovMatrix getSignifMatrix () const
 
const void setSignifMatrix (const reco::METCovMatrix &input, const double &met_r, const double &met_phi, const double &met_set)
 reset the signficance matrix (this is the most likely case), so that the vector sum can be continued More...
 
const double significance (double &met_r, double &met_phi, double &met_set)
 
 significanceAlgo ()
 
const void subtractObjects (const std::vector< metsig::SigInputObj > &EventVec)
 
 ~significanceAlgo ()
 

Private Attributes

double set_worker_
 
reco::METCovMatrix signifmatrix_
 
double xmet_
 
double ymet_
 

Detailed Description

Definition at line 86 of file significanceAlgo.h.

Constructor & Destructor Documentation

◆ significanceAlgo()

metsig::significanceAlgo::significanceAlgo ( )

Definition at line 27 of file significanceAlgo.cc.

28  : // eventVec_(0),
29  set_worker_(0),
30  xmet_(0),
31  ymet_(0)
32 
33 {
34  // std::cout << "in constructor ! " << std::endl;
35  signifmatrix_(0, 0) = signifmatrix_(1, 0) = signifmatrix_(0, 1) = signifmatrix_(1, 1) = 0;
36 }

References signifmatrix_.

◆ ~significanceAlgo()

metsig::significanceAlgo::~significanceAlgo ( )

Definition at line 60 of file significanceAlgo.cc.

60 {}

Member Function Documentation

◆ addObjects()

const void metsig::significanceAlgo::addObjects ( const std::vector< metsig::SigInputObj > &  EventVec)

Definition at line 109 of file significanceAlgo.cc.

109  {
111  //--- Loop over physics objects in the event ---//
112  // for(unsigned int objnum=1; objnum < EventVec.size(); objnum++ ) {
113  for (std::vector<SigInputObj>::const_iterator obj = eventVec.begin(); obj != eventVec.end(); ++obj) {
114  double et_tmp = obj->get_energy();
115  double phi_tmp = obj->get_phi();
116  double sigma_et = obj->get_sigma_e();
117  double sigma_tan = obj->get_sigma_tan();
118 
119  double cosphi = cos(phi_tmp);
120  double sinphi = sin(phi_tmp);
121  double xval = et_tmp * cosphi;
122  double yval = et_tmp * sinphi;
123  xmet_ -= xval;
124  ymet_ -= yval;
125  set_worker_ += et_tmp;
126 
127  double sigma0_2 = sigma_et * sigma_et;
128  double sigma1_2 = sigma_tan * sigma_tan;
129 
130  v_tot(0, 0) += sigma0_2 * cosphi * cosphi + sigma1_2 * sinphi * sinphi;
131  v_tot(0, 1) += cosphi * sinphi * (sigma0_2 - sigma1_2);
132  v_tot(1, 0) += cosphi * sinphi * (sigma0_2 - sigma1_2);
133  v_tot(1, 1) += sigma1_2 * cosphi * cosphi + sigma0_2 * sinphi * sinphi;
134  }
135  signifmatrix_ = v_tot;
136 }

References funct::cos(), getGTfromDQMFile::obj, and funct::sin().

Referenced by SignCaloSpecificAlgo::calculateBaseCaloMET(), computePFMEtSignificance(), PFMEtSignInterfaceBase::operator()(), and pat::PATMHTProducer::produce().

◆ addSignifMatrix()

const void metsig::significanceAlgo::addSignifMatrix ( const reco::METCovMatrix input)

Definition at line 39 of file significanceAlgo.cc.

39  {
41  return;
42 }

References input.

Referenced by SignCaloSpecificAlgo::calculateBaseCaloMET().

◆ getSignifMatrix()

reco::METCovMatrix metsig::significanceAlgo::getSignifMatrix ( ) const
inline

◆ setSignifMatrix()

const void metsig::significanceAlgo::setSignifMatrix ( const reco::METCovMatrix input,
const double &  met_r,
const double &  met_phi,
const double &  met_set 
)

reset the signficance matrix (this is the most likely case), so that the vector sum can be continued

Definition at line 46 of file significanceAlgo.cc.

49  {
51  set_worker_ = met_set;
52  xmet_ = met_r * cos(met_phi);
53  ymet_ = met_r * sin(met_phi);
54 
55  return;
56 }

References funct::cos(), input, and funct::sin().

◆ significance()

const double metsig::significanceAlgo::significance ( double &  met_r,
double &  met_phi,
double &  met_set 
)

Definition at line 139 of file significanceAlgo.cc.

139  {
140  if (signifmatrix_(0, 0) == 0 && signifmatrix_(1, 1) == 0 && signifmatrix_(1, 0) == 0 && signifmatrix_(0, 1) == 0) {
141  //edm::LogWarning("SignCaloSpecificAlgo") << "Event Vector is empty! Return significance -1";
142  return (-1);
143  }
144 
145  //--- Temporary variables ---//
146 
147  reco::METCovMatrix v_tot;
148  ROOT::Math::SVector<double, 2> metvec;
149 
150  //--- Initialize sum of rotated covariance matrices ---//
151  v_tot = signifmatrix_;
152  // std::cout << "INPUT:\n"<< v_tot(0,0) << "," << v_tot(0,1) << "\n" << v_tot(1,0) << "," << v_tot(1,1) << std::endl;
153 
154  //--- Calculate magnitude and angle of MET, store in returned variables ---//
155  met_r = sqrt(xmet_ * xmet_ + ymet_ * ymet_);
156  met_set = set_worker_;
157  met_phi = TMath::ATan2(ymet_, xmet_);
158 
159  // one other option: if particles cancel there could be small numbers.
160  // this check fixes this, added by F.Blekman
161  double det = 0;
162  v_tot.Det(det);
163  if (fabs(det) < 0.000001)
164  return -1;
165 
166  // save matrix into object:
167  // std::cout << "SAVED:\n"<< v_tot(0,0) << "," << v_tot(0,1) << "\n" << v_tot(1,0) << "," << v_tot(1,1) << std::endl;
168  v_tot.Invert();
169  // std::cout << "INVERTED:\n"<< v_tot(0,0) << "," << v_tot(0,1) << "\n" << v_tot(1,0) << "," << v_tot(1,1) << std::endl;
170 
171  metvec(0) = xmet_;
172  metvec(1) = ymet_;
173  double lnSignificance = ROOT::Math::Dot(metvec, (v_tot * metvec));
174 
175  // v_tot.Invert();
176  // std::cout << "INVERTED AGAIN:\n"<< v_tot(0,0) << "," << v_tot(0,1) << "\n" << v_tot(1,0) << "," << v_tot(1,1) << std::endl;
177  return lnSignificance;
178 }

References mathSSE::sqrt().

Referenced by SignCaloSpecificAlgo::calculateBaseCaloMET(), and pat::PATMHTProducer::produce().

◆ subtractObjects()

const void metsig::significanceAlgo::subtractObjects ( const std::vector< metsig::SigInputObj > &  EventVec)

Definition at line 79 of file significanceAlgo.cc.

79  {
81  //--- Loop over physics objects in the event ---//
82  // for(unsigned int objnum=1; objnum < EventVec.size(); objnum++ ) {
83  for (std::vector<SigInputObj>::const_iterator obj = eventVec.begin(); obj != eventVec.end(); ++obj) {
84  double et_tmp = obj->get_energy();
85  double phi_tmp = obj->get_phi();
86  double sigma_et = obj->get_sigma_e();
87  double sigma_tan = obj->get_sigma_tan();
88 
89  double cosphi = cos(phi_tmp);
90  double sinphi = sin(phi_tmp);
91  double xval = et_tmp * cosphi;
92  double yval = et_tmp * sinphi;
93  xmet_ += xval;
94  ymet_ += yval;
95  set_worker_ -= et_tmp;
96 
97  double sigma0_2 = sigma_et * sigma_et;
98  double sigma1_2 = sigma_tan * sigma_tan;
99 
100  v_tot(0, 0) -= sigma0_2 * cosphi * cosphi + sigma1_2 * sinphi * sinphi;
101  v_tot(0, 1) -= cosphi * sinphi * (sigma0_2 - sigma1_2);
102  v_tot(1, 0) -= cosphi * sinphi * (sigma0_2 - sigma1_2);
103  v_tot(1, 1) -= sigma1_2 * cosphi * cosphi + sigma0_2 * sinphi * sinphi;
104  }
105  signifmatrix_ = v_tot;
106 }

References funct::cos(), getGTfromDQMFile::obj, and funct::sin().

Member Data Documentation

◆ set_worker_

double metsig::significanceAlgo::set_worker_
private

Definition at line 107 of file significanceAlgo.h.

◆ signifmatrix_

reco::METCovMatrix metsig::significanceAlgo::signifmatrix_
private

Definition at line 105 of file significanceAlgo.h.

Referenced by getSignifMatrix(), and significanceAlgo().

◆ xmet_

double metsig::significanceAlgo::xmet_
private

Definition at line 108 of file significanceAlgo.h.

◆ ymet_

double metsig::significanceAlgo::ymet_
private

Definition at line 109 of file significanceAlgo.h.

metsig::significanceAlgo::xmet_
double xmet_
Definition: significanceAlgo.h:108
input
static const std::string input
Definition: EdmProvDump.cc:48
metsig::significanceAlgo::set_worker_
double set_worker_
Definition: significanceAlgo.h:107
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
metsig::significanceAlgo::ymet_
double ymet_
Definition: significanceAlgo.h:109
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
metsig::significanceAlgo::signifmatrix_
reco::METCovMatrix signifmatrix_
Definition: significanceAlgo.h:105
reco::METCovMatrix
ROOT::Math::SMatrix< double, 2 > METCovMatrix
Definition: MET.h:39