CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Attributes
PTStatistics Class Reference

#include <PTStatistics.h>

Inheritance diagram for PTStatistics:

Public Member Functions

long double eff (int ptCut)
 
 PTStatistics ()
 
long int sum () const
 
long int sum (const int &ptCut) const
 
long double sumR () const
 
long double sumR (const int &ptCut) const
 
std::string toString ()
 
void update (PTStatistics &otherPtStats)
 

Static Public Attributes

static const std::vector< long double > m_rates = initializeRates()
 

Detailed Description

Definition at line 10 of file PTStatistics.h.

Constructor & Destructor Documentation

◆ PTStatistics()

PTStatistics::PTStatistics ( )

Definition at line 32 of file PTStatistics.cc.

32 { this->assign(RPCpg::ptBins_s, 0); }

References assign(), and RPCpg::ptBins_s.

Member Function Documentation

◆ eff()

long double PTStatistics::eff ( int  ptCut)

Definition at line 50 of file PTStatistics.cc.

50  { // ptCut=0 -> total rate
51  //int eqOrAbovePtCut = 0;
52  //for(unsigned int i=ptCut;i<this->size();++i) eqOrAbovePtCut += this->at(i);
53  // return double(eqOrAbovePtCut)/this->sum();
54  return double(sum(ptCut)) / this->sum();
55 }

References jetfilter_cfi::ptCut, and sum().

◆ sum() [1/2]

long int PTStatistics::sum ( ) const

Definition at line 69 of file PTStatistics.cc.

69  {
70  //return std::accumulate(this->begin(),this->end(),0);
71  long int eqOrAbovePtCut = 0;
72  //unsigned int size = this->size();
73  //for(unsigned int i=ptCut;i<size;++i) eqOrAbovePtCut += this->at(i);
74  //for(unsigned int i=ptCut;i<size;++i) eqOrAbovePtCut += (*this)[i];
75  PTStatistics::const_iterator it = this->begin();
76  PTStatistics::const_iterator itend = this->end();
77  for (; it != itend; ++it)
78  eqOrAbovePtCut += *it;
79 
80  return eqOrAbovePtCut;
81 }

References mps_fire::end.

Referenced by eff().

◆ sum() [2/2]

long int PTStatistics::sum ( const int &  ptCut) const

Definition at line 57 of file PTStatistics.cc.

57  {
58  //inline int PTStatistics::sum(const int & ptCut) const{
59  //return std::accumulate(this->begin(),this->end(),0);
60  long int eqOrAbovePtCut = 0;
61  unsigned int size = this->size();
62  //for(unsigned int i=ptCut;i<size;++i) eqOrAbovePtCut += this->at(i);
63  for (unsigned int i = ptCut; i < size; ++i)
64  eqOrAbovePtCut += (*this)[i];
65  return eqOrAbovePtCut;
66 }

References mps_fire::i, and findQualityFiles::size.

◆ sumR() [1/2]

long double PTStatistics::sumR ( ) const

Definition at line 93 of file PTStatistics.cc.

93  {
94  //return std::accumulate(this->begin(),this->end(),0);
95  long double eqOrAbovePtCut = 0;
96  //unsigned int size = this->size();
97  //for(unsigned int i=ptCut;i<size;++i) eqOrAbovePtCut += this->at(i);
98  //for(unsigned int i=ptCut;i<size;++i) eqOrAbovePtCut += (*this)[i];
99  //PTStatistics::const_iterator it = this->begin();
100  //PTStatistics::const_iterator itend = this->end();
101  //PtCode 0 - muons not found
102  unsigned int size = this->size();
103  for (unsigned int i = 1; i < size; ++i)
104  eqOrAbovePtCut += (*this)[i] * m_rates[i];
105  //for(;it!=itend;++it) eqOrAbovePtCut += *it*m_rates[i];
106 
107  return eqOrAbovePtCut;
108 }

References mps_fire::i, m_rates, and findQualityFiles::size.

◆ sumR() [2/2]

long double PTStatistics::sumR ( const int &  ptCut) const

Definition at line 83 of file PTStatistics.cc.

83  {
84  //return std::accumulate(this->begin(),this->end(),0);
85  long double eqOrAbovePtCut = 0;
86  unsigned int size = this->size();
87  //for(unsigned int i=ptCut;i<size;++i) eqOrAbovePtCut += this->at(i);
88  for (unsigned int i = ptCut; i < size; ++i)
89  eqOrAbovePtCut += (*this)[i] * m_rates[i];
90  return eqOrAbovePtCut;
91 }

References mps_fire::i, m_rates, and findQualityFiles::size.

◆ toString()

std::string PTStatistics::toString ( )

Definition at line 40 of file PTStatistics.cc.

40  {
41  std::stringstream ss;
42  ss << "PTStats:";
43  for (unsigned int i = 0; i < this->size(); ++i) {
44  ss << " " << (*this)[i];
45  }
46 
47  return ss.str();
48 }

References mps_fire::i, findQualityFiles::size, and contentValuesCheck::ss.

◆ update()

void PTStatistics::update ( PTStatistics otherPtStats)

Definition at line 34 of file PTStatistics.cc.

34  {
35  for (unsigned int i = 0; i < this->size(); ++i) {
36  //this->at(i)+=otherPtStats.at(i);
37  (*this)[i] += otherPtStats[i];
38  }
39 }

References mps_fire::i, and findQualityFiles::size.

Referenced by MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), and MatrixUtil.Steps::overwrite().

Member Data Documentation

◆ m_rates

const std::vector< long double > PTStatistics::m_rates = initializeRates()
static

Definition at line 22 of file PTStatistics.h.

Referenced by sumR().

mps_fire.i
i
Definition: mps_fire.py:428
PTStatistics::m_rates
static const std::vector< long double > m_rates
Definition: PTStatistics.h:22
assign
void assign(const std::vector< float > &vec, float &a, float &b, float &c, float &d)
Definition: PileupJetIdAlgo.cc:139
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
mps_fire.end
end
Definition: mps_fire.py:242
jetfilter_cfi.ptCut
ptCut
Definition: jetfilter_cfi.py:6
PTStatistics::sum
long int sum() const
Definition: PTStatistics.cc:69
RPCpg::ptBins_s
const unsigned int ptBins_s
Definition: Constants.h:28
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443