CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 int &ptCut) const
 
long int sum () const
 
long double sumR () const
 
long double sumR (const int &ptCut) const
 
std::string toString ()
 
void update (PTStatistics &otherPtStats)
 

Static Public Attributes

static std::vector< long double > m_rates = std::vector<long double>(RPCpg::ptBins_s,0)
 
static bool rateInitilized = false
 

Detailed Description

Definition at line 12 of file PTStatistics.h.

Constructor & Destructor Documentation

PTStatistics::PTStatistics ( )

Definition at line 12 of file PTStatistics.cc.

References assign(), i, m_rates, RPCpg::ptBins_s, RPCpg::pts, RPCpg::rate(), and rateInitilized.

12  {
13  this->assign(RPCpg::ptBins_s,0);
14 
15  if(!rateInitilized){
16  //std::cout << "Initilizing rates" << std::endl;
17  rateInitilized = true;
18  m_rates.assign(RPCpg::ptBins_s,0);
19 
20  // Note bin=0 is empty during generation
21  // bin=0 is used only when calculating efficiencies (for storing muons,that werent found)
22  for (unsigned int i = 1;i < this->m_rates.size(); ++i ){
23 
24  long double low = RPCpg::pts[i];
25  long double high = RPCpg::pts[i+1];
26  long double rt = RPCpg::rate(low)-RPCpg::rate(high);
27 
28  /* std::cout << "PtCode " << i
29  << " " << low
30  << " " << high
31  << " " << rt
32  << std::endl;*/
33  this->m_rates.at(i) = rt;
34  }
35 
36  }
37 
38 }
int i
Definition: DBlmapReader.cc:9
static std::vector< long double > m_rates
Definition: PTStatistics.h:26
static const double pts[33]
Definition: Constants.h:30
void assign(const std::vector< float > &vec, float &a, float &b, float &c, float &d)
static bool rateInitilized
Definition: PTStatistics.h:25
const unsigned int ptBins_s
Definition: Constants.h:28
double rate(double x)
Definition: Constants.cc:3

Member Function Documentation

long double PTStatistics::eff ( int  ptCut)

Definition at line 60 of file PTStatistics.cc.

References sum().

60  { // ptCut=0 -> total rate
61  //int eqOrAbovePtCut = 0;
62  //for(unsigned int i=ptCut;i<this->size();++i) eqOrAbovePtCut += this->at(i);
63  // return double(eqOrAbovePtCut)/this->sum();
64  return double(sum(ptCut))/this->sum();
65 }
long int sum() const
Definition: PTStatistics.cc:79
long int PTStatistics::sum ( const int &  ptCut) const

Definition at line 68 of file PTStatistics.cc.

References i, and findQualityFiles::size.

68  {
69 //inline int PTStatistics::sum(const int & ptCut) const{
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  return eqOrAbovePtCut;
76 }
int i
Definition: DBlmapReader.cc:9
tuple size
Write out results.
long int PTStatistics::sum ( ) const

Definition at line 79 of file PTStatistics.cc.

References begin, and end.

Referenced by eff().

79  {
80  //return std::accumulate(this->begin(),this->end(),0);
81  long int eqOrAbovePtCut = 0;
82  //unsigned int size = this->size();
83  //for(unsigned int i=ptCut;i<size;++i) eqOrAbovePtCut += this->at(i);
84  //for(unsigned int i=ptCut;i<size;++i) eqOrAbovePtCut += (*this)[i];
85  PTStatistics::const_iterator it = this->begin();
86  PTStatistics::const_iterator itend = this->end();
87  for(;it!=itend;++it) eqOrAbovePtCut += *it;
88 
89  return eqOrAbovePtCut;
90 }
#define end
Definition: vmac.h:37
#define begin
Definition: vmac.h:30
long double PTStatistics::sumR ( ) const

Definition at line 101 of file PTStatistics.cc.

References i, m_rates, and findQualityFiles::size.

101  {
102  //return std::accumulate(this->begin(),this->end(),0);
103  long double eqOrAbovePtCut = 0;
104  //unsigned int size = this->size();
105  //for(unsigned int i=ptCut;i<size;++i) eqOrAbovePtCut += this->at(i);
106  //for(unsigned int i=ptCut;i<size;++i) eqOrAbovePtCut += (*this)[i];
107  //PTStatistics::const_iterator it = this->begin();
108  //PTStatistics::const_iterator itend = this->end();
109  //PtCode 0 - muons not found
110  unsigned int size = this->size();
111  for(unsigned int i=1;i<size;++i) eqOrAbovePtCut += (*this)[i]*m_rates[i];
112  //for(;it!=itend;++it) eqOrAbovePtCut += *it*m_rates[i];
113 
114  return eqOrAbovePtCut;
115 }
int i
Definition: DBlmapReader.cc:9
static std::vector< long double > m_rates
Definition: PTStatistics.h:26
tuple size
Write out results.
long double PTStatistics::sumR ( const int &  ptCut) const

Definition at line 92 of file PTStatistics.cc.

References i, m_rates, and findQualityFiles::size.

92  {
93  //return std::accumulate(this->begin(),this->end(),0);
94  long double eqOrAbovePtCut = 0;
95  unsigned int size = this->size();
96  //for(unsigned int i=ptCut;i<size;++i) eqOrAbovePtCut += this->at(i);
97  for(unsigned int i=ptCut;i<size;++i) eqOrAbovePtCut += (*this)[i]*m_rates[i];
98  return eqOrAbovePtCut;
99 }
int i
Definition: DBlmapReader.cc:9
static std::vector< long double > m_rates
Definition: PTStatistics.h:26
tuple size
Write out results.
std::string PTStatistics::toString ( )

Definition at line 49 of file PTStatistics.cc.

References asciidump::at, i, and findQualityFiles::size.

49  {
50 
51  std::stringstream ss;
52  ss << "PTStats:";
53  for (unsigned int i=0; i<this->size();++i){
54  ss << " " << this->at(i);
55  }
56 
57  return ss.str();
58 }
int i
Definition: DBlmapReader.cc:9
tuple size
Write out results.
list at
Definition: asciidump.py:428
void PTStatistics::update ( PTStatistics otherPtStats)

Definition at line 40 of file PTStatistics.cc.

References i, and findQualityFiles::size.

Referenced by relval_steps.Matrix::__setitem__(), relval_steps.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), relval_steps.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

40  {
41 
42  for (unsigned int i=0; i<this->size();++i){
43  //this->at(i)+=otherPtStats.at(i);
44  (*this)[i]+=otherPtStats[i];
45  }
46 
47 
48 }
int i
Definition: DBlmapReader.cc:9
tuple size
Write out results.

Member Data Documentation

std::vector< long double > PTStatistics::m_rates = std::vector<long double>(RPCpg::ptBins_s,0)
static

Definition at line 26 of file PTStatistics.h.

Referenced by PTStatistics(), and sumR().

bool PTStatistics::rateInitilized = false
static

Definition at line 25 of file PTStatistics.h.

Referenced by PTStatistics().