MINT2
Chi2Box.cpp
Go to the documentation of this file.
1 
2 #include "Mint/IDalitzEvent.h"
3 #include "Mint/Chi2Box.h"
4 
5 using namespace std;
6 
8  : _area()
9  , _nData(0)
10  , _nMC(0)
11  , _nWeightedMC(0.0)
12  , _weightMC_Squared(0.0)
13 {}
15  : _area(pat)
16  , _nData(0)
17  , _nMC(0)
18  , _nWeightedMC(0.0)
19  , _weightMC_Squared(0.0)
20 {
22 }
24  : _area(area)
25  , _nData(0)
26  , _nMC(0)
27  , _nWeightedMC(0.0)
28  , _weightMC_Squared(0.0)
29 {}
30 Chi2Box::Chi2Box(const Chi2Box& other)
31  : _area(other._area)
32  , _nData(other._nData)
33  , _nMC(other._nMC)
34  , _nWeightedMC(other._nWeightedMC)
35  , _weightMC_Squared(other._weightMC_Squared)
36 {}
37 
38 void Chi2Box::enclosePhaseSpace(double safetyFactor){
39  bool dbThis=true;
40  if(dbThis) cout << "box: setting limits to phase space area" << endl;
41  _area.setAllLimitsToPhaseSpaceArea(safetyFactor);
42  if(dbThis) cout << "result: " << _area << endl;
43 }
44 
46 
49 
50  for(unsigned int i=0; i < va.size(); i++){
51  Chi2Box b(va[i]);
52  vb[i]=b;
53  }
54  return vb;
55 }
56 
58  _nData = 0;
59  _nMC = 0;
60  _nWeightedMC=0.0;
61  _weightMC_Squared = 0.0;
62 }
66 }
67 
68 bool Chi2Box::addData(const IDalitzEvent& evt){
69  if(! _area.isInside(evt)) return false;
70  _nData++;
71  return true;
72 }
73 bool Chi2Box::addData(const IDalitzEvent* evt){
74  bool dbThis=false;
75  if(0 == evt) return false;
76  if(dbThis) cout << "Chi2Box::addData for pointers called" << endl;
77  if(! _area.isInside(*evt)) return false;
78  if(dbThis){
79  cout << "found data event inside area. This is the event:" << endl;
80  evt->print();
81  }
82 
83  _nData++;
84  return true;
85 }
86 bool Chi2Box::addMC(const IDalitzEvent& evt, double weight){
87  if(! _area.isInside(evt)) return false;
88  _nMC++;
89  _nWeightedMC += weight;
90  return true;
91 }
92 bool Chi2Box::addMC(const IDalitzEvent* evt, double weight){
93  bool dbThis=false;
94  if(dbThis) cout << "Chi2Box::addMC for pointers called" << endl;
95  if(0 == evt) return false;
96  if(dbThis){
97  cout << "...area inside for this event:" << endl;
98  evt->print();
99  }
100  if(! _area.isInside(*evt)) return false;
101  _nMC++;
102  _nWeightedMC += weight;
103  _weightMC_Squared += weight*weight;
104 
105  if(dbThis) cout << "Chi2Box::addMC returning; have nMC = "<< _nMC << endl;
106  return true;
107 }
108 
109 int Chi2Box::nData() const{
110  return _nData;
111 }
112 int Chi2Box::nMC() const{
113  return _nMC;
114 }
115 double Chi2Box::weightedMC() const{
116  return _nWeightedMC;
117 }
118 double Chi2Box::weightedMC2() const{
119  return _weightMC_Squared;
120 }
121 double Chi2Box::rmsMC(int Ntotal) const{
122  bool dbThis=false;
123  if(dbThis){
124  cout << Ntotal
125  << endl;
126  }
127  return weightedMC2();
128  /*
129  bool dbThis=false;
130  double dN = (double) Ntotal;
131  double msq = weightedMC2() /(dN);
132  double m = weightedMC() /(dN);
133  if(dbThis){
134  cout << "Chi2BoxSet::rmsMC() "
135  << " msq " << msq << " m " << m << " m*m " << m*m
136  << " rms " << msq - m*m
137  << endl;
138  }
139  return (msq - m*m) * dN;
140  */
141 }
142 void Chi2Box::print(std::ostream& os) const{
143  os << "box: with area " << _area;
144 }
145 
146 std::ostream& operator<<(std::ostream& os, const Chi2Box& box){
147  box.print(os);
148  return os;
149 }
150 //
151 
std::vector< DalitzArea > split_in_all_dimensions(int n=2) const
Definition: DalitzArea.cpp:371
double weightedMC() const
Definition: Chi2Box.cpp:115
void enclosePhaseSpace(double safetyFactor=1.2)
Definition: Chi2Box.cpp:38
void setAllLimitsToPhaseSpaceArea(double safetyFactor=1.0)
Definition: DalitzArea.cpp:165
bool isInside(const IDalitzEvent &evt) const
Definition: DalitzArea.cpp:214
int nMC() const
Definition: Chi2Box.cpp:112
int _nData
Definition: Chi2Box.h:14
DalitzArea _area
Definition: Chi2Box.h:12
virtual void print(std::ostream &os=std::cout) const =0
Chi2Box()
Definition: Chi2Box.cpp:7
bool addData(const IDalitzEvent &evt)
Definition: Chi2Box.cpp:68
void print(std::ostream &os=std::cout) const
Definition: Chi2Box.cpp:142
bool addMC(const IDalitzEvent &evt, double weight)
Definition: Chi2Box.cpp:86
void resetAll()
Definition: Chi2Box.cpp:63
double rmsMC(int Ntotal) const
Definition: Chi2Box.cpp:121
double weightedMC2() const
Definition: Chi2Box.cpp:118
unsigned int size() const
double _nWeightedMC
Definition: Chi2Box.h:16
void resetEventCounts()
Definition: Chi2Box.cpp:57
double _weightMC_Squared
Definition: Chi2Box.h:18
int nData() const
Definition: Chi2Box.cpp:109
MINT::PolymorphVector< Chi2Box > split(int n=2)
Definition: Chi2Box.cpp:45
int _nMC
Definition: Chi2Box.h:15
std::ostream & operator<<(std::ostream &os, const Chi2Box &box)
Definition: Chi2Box.cpp:146