MINT2
Public Member Functions | Private Attributes | List of all members
Chi2BoxSet Class Reference

#include <Chi2BoxSet.h>

Inheritance diagram for Chi2BoxSet:
MINT::PolymorphVector< Chi2Box >

Public Member Functions

 Chi2BoxSet ()
 
 Chi2BoxSet (const DalitzEventPattern &pat, const MINT::counted_ptr< IIntegrationCalculator > &integPtr=(MINT::counted_ptr< IIntegrationCalculator >) 0)
 
 Chi2BoxSet (const DalitzArea &area, const MINT::counted_ptr< IIntegrationCalculator > &integPtr=(MINT::counted_ptr< IIntegrationCalculator >) 0)
 
 Chi2BoxSet (const MINT::PolymorphVector< Chi2Box > &other)
 
 Chi2BoxSet (const Chi2BoxSet &other)
 
virtual ~Chi2BoxSet ()
 
void setIIntegrationCalculator (MINT::counted_ptr< IIntegrationCalculator > fap)
 
void add (const Chi2Box &box)
 
void add (const Chi2BoxSet &boxSet)
 
void resetEventCounts ()
 
bool addData (const IDalitzEvent &evt)
 
bool addData (const IDalitzEvent *evt)
 
bool addMC (IDalitzEvent &evt, double weight)
 
bool addMC (IDalitzEvent *evt, double weight)
 
void printBoxInfo (std::ostream &os=std::cout) const
 
void print (std::ostream &os=std::cout) const
 
int nData () const
 
int nMC () const
 
double weightedMC () const
 
double weightedMC2 () const
 
double rmsMC (int Ntotal) const
 
void setNormFactor (double nf)
 
double normFactor () const
 
void setHistoColour (Color_t fcolor)
 
void setFillColour (Color_t fcolor)
 
void setLineColour (Color_t fcolor)
 
DalitzHistoSethistoData ()
 
const DalitzHistoSethistoData () const
 
DalitzHistoSethistoMC ()
 
const DalitzHistoSethistoMC () const
 
double chi2 (double normFactorPassed=-1) const
 
- Public Member Functions inherited from MINT::PolymorphVector< Chi2Box >
 PolymorphVector ()
 
 PolymorphVector (unsigned int N)
 
 PolymorphVector (unsigned int N, const Chi2Box &c)
 
 PolymorphVector (const PolymorphVector &other)
 
 PolymorphVector (const typename std::vector< Chi2Box > &other)
 
virtual ~PolymorphVector ()
 
std::vector< Chi2Box > & theVector ()
 
const std::vector< Chi2Box > & theVector () const
 
Chi2Boxoperator[] (unsigned int i)
 
const Chi2Boxoperator[] (unsigned int i) const
 
Chi2Boxat (unsigned int i)
 
const Chi2Boxat (unsigned int i) const
 
std::vector< Chi2Box >::iterator begin ()
 
std::vector< Chi2Box >::const_iterator begin () const
 
std::vector< Chi2Box >::iterator end ()
 
std::vector< Chi2Box >::const_iterator end () const
 
std::vector< Chi2Box >::iterator find (const Chi2Box &c)
 
std::vector< Chi2Box >::const_iterator find (const Chi2Box &c) const
 
Chi2Boxfront ()
 
const Chi2Boxfront () const
 
Chi2Boxback ()
 
const Chi2Boxback () const
 
unsigned int size () const
 
bool empty () const
 
void push_back (const Chi2Box &c)
 
void pop_back ()
 
void erase (typename std::vector< Chi2Box >::iterator pos)
 
void erase (typename std::vector< Chi2Box >::iterator first, typename std::vector< Chi2Box >::iterator last)
 
PolymorphVector< Chi2Box > & operator= (const PolymorphVector< Chi2Box > &other)
 
void clear ()
 
void resize (unsigned int N)
 
void resize (unsigned int N, const Chi2Box &c)
 
 operator const typename std::vector< Chi2Box > & () const
 
 operator typename std::vector< Chi2Box > & ()
 
bool operator== (const MINT::PolymorphVector< Chi2Box > &v2) const
 
bool operator!= (const MINT::PolymorphVector< Chi2Box > &v2) const
 
bool operator< (const MINT::PolymorphVector< Chi2Box > &v2) const
 
bool operator> (const MINT::PolymorphVector< Chi2Box > &v2) const
 

Private Attributes

MINT::counted_ptr< IIntegrationCalculator_integCalc
 
DalitzHistoSet _histoData
 
DalitzHistoSet _histoMC
 
double _normFactor
 

Additional Inherited Members

- Protected Attributes inherited from MINT::PolymorphVector< Chi2Box >
std::vector< Chi2Box_vec
 

Detailed Description

Definition at line 19 of file Chi2BoxSet.h.

Constructor & Destructor Documentation

◆ Chi2BoxSet() [1/5]

Chi2BoxSet::Chi2BoxSet ( )

Definition at line 10 of file Chi2BoxSet.cpp.

12  , _integCalc(0)
13  , _normFactor(1)
14 {
15 }
MINT::counted_ptr< IIntegrationCalculator > _integCalc
Definition: Chi2BoxSet.h:20
double _normFactor
Definition: Chi2BoxSet.h:24

◆ Chi2BoxSet() [2/5]

Chi2BoxSet::Chi2BoxSet ( const DalitzEventPattern pat,
const MINT::counted_ptr< IIntegrationCalculator > &  integPtr = (MINT::counted_ptr<IIntegrationCalculator>)0 
)

Definition at line 16 of file Chi2BoxSet.cpp.

19  , _integCalc(integPtr)
20  , _normFactor(1)
21 {
22  Chi2Box b(pat);
23  add(b);
24 }
void add(const Chi2Box &box)
Definition: Chi2BoxSet.cpp:53
MINT::counted_ptr< IIntegrationCalculator > _integCalc
Definition: Chi2BoxSet.h:20
double _normFactor
Definition: Chi2BoxSet.h:24

◆ Chi2BoxSet() [3/5]

Chi2BoxSet::Chi2BoxSet ( const DalitzArea area,
const MINT::counted_ptr< IIntegrationCalculator > &  integPtr = (MINT::counted_ptr<IIntegrationCalculator>)0 
)

Definition at line 25 of file Chi2BoxSet.cpp.

28  , _integCalc(integPtr)
29  , _normFactor(1)
30 {
31  Chi2Box b(area);
32  add(b);
33 }
void add(const Chi2Box &box)
Definition: Chi2BoxSet.cpp:53
MINT::counted_ptr< IIntegrationCalculator > _integCalc
Definition: Chi2BoxSet.h:20
double _normFactor
Definition: Chi2BoxSet.h:24

◆ Chi2BoxSet() [4/5]

Chi2BoxSet::Chi2BoxSet ( const MINT::PolymorphVector< Chi2Box > &  other)

Definition at line 34 of file Chi2BoxSet.cpp.

36  , _integCalc(0)
37  , _normFactor(1)
38 {
39 }
MINT::counted_ptr< IIntegrationCalculator > _integCalc
Definition: Chi2BoxSet.h:20
double _normFactor
Definition: Chi2BoxSet.h:24

◆ Chi2BoxSet() [5/5]

Chi2BoxSet::Chi2BoxSet ( const Chi2BoxSet other)

Definition at line 40 of file Chi2BoxSet.cpp.

42  , _integCalc(0)
43  , _histoData(other._histoData)
44  , _histoMC(other._histoMC)
45  , _normFactor(other._normFactor)
46 {
47  if(0 != other._integCalc){
49  _integCalc = newCP;
50  }
51 }
MINT::counted_ptr< IIntegrationCalculator > _integCalc
Definition: Chi2BoxSet.h:20
virtual MINT::counted_ptr< IIntegrationCalculator > clone_IIntegrationCalculator() const =0
DalitzHistoSet _histoData
Definition: Chi2BoxSet.h:22
DalitzHistoSet _histoMC
Definition: Chi2BoxSet.h:22
double _normFactor
Definition: Chi2BoxSet.h:24

◆ ~Chi2BoxSet()

virtual Chi2BoxSet::~Chi2BoxSet ( )
inlinevirtual

Definition at line 36 of file Chi2BoxSet.h.

36 {}

Member Function Documentation

◆ add() [1/2]

void Chi2BoxSet::add ( const Chi2Box box)

Definition at line 53 of file Chi2BoxSet.cpp.

53  {
54  this->push_back(box);
55 }
void push_back(const Chi2Box &c)

◆ add() [2/2]

void Chi2BoxSet::add ( const Chi2BoxSet boxSet)

Definition at line 57 of file Chi2BoxSet.cpp.

57  {
58  for(unsigned int i=0; i<boxSet.size(); i++){
59  this->add(boxSet[i]);
60  }
61 }
void add(const Chi2Box &box)
Definition: Chi2BoxSet.cpp:53
unsigned int size() const

◆ addData() [1/2]

bool Chi2BoxSet::addData ( const IDalitzEvent evt)

Definition at line 68 of file Chi2BoxSet.cpp.

68  {
69  for(unsigned int i=0; i < this->size(); i++){
70  if ((*this)[i].addData(evt)){
71  _histoData.addEvent(evt);
72  return true;
73  }
74  }
75  return false;
76 }
void addEvent(const IDalitzEvent &evt, double weight=1)
DalitzHistoSet _histoData
Definition: Chi2BoxSet.h:22

◆ addData() [2/2]

bool Chi2BoxSet::addData ( const IDalitzEvent evt)

Definition at line 77 of file Chi2BoxSet.cpp.

77  {
78  for(unsigned int i=0; i < this->size(); i++){
79  if ((*this)[i].addData(evt)){
80  _histoData.addEvent(*evt);
81  return true;
82  }
83  }
84  return false;
85 }
void addEvent(const IDalitzEvent &evt, double weight=1)
DalitzHistoSet _histoData
Definition: Chi2BoxSet.h:22

◆ addMC() [1/2]

bool Chi2BoxSet::addMC ( IDalitzEvent evt,
double  weight 
)

Definition at line 86 of file Chi2BoxSet.cpp.

86  {
87  for(unsigned int i=0; i < this->size(); i++){
88  if((*this)[i].addMC(evt, weight)){
89  _histoMC.addEvent(evt, weight);
90  if(0 != _integCalc)_integCalc->addEvent(&evt);
91  return true;
92  }
93  }
94  return false;
95 }
MINT::counted_ptr< IIntegrationCalculator > _integCalc
Definition: Chi2BoxSet.h:20
void addEvent(const IDalitzEvent &evt, double weight=1)
virtual void addEvent(IDalitzEvent *evtPtr, double weight=1)=0
DalitzHistoSet _histoMC
Definition: Chi2BoxSet.h:22

◆ addMC() [2/2]

bool Chi2BoxSet::addMC ( IDalitzEvent evt,
double  weight 
)

Definition at line 96 of file Chi2BoxSet.cpp.

96  {
97  bool dbThis=false;
98  if(dbThis) {
99  cout << "Chi2BoxSet::addMC for pointers called with evt = "
100  << evt << endl;
101  }
102  for(unsigned int i=0; i < this->size(); i++){
103  if((*this)[i].addMC(evt, weight)){
104  _histoMC.addEvent(*evt, weight);
105  if(0 != _integCalc)_integCalc->addEvent(evt);
106  return true;
107  }
108  }
109  return false;
110 }
MINT::counted_ptr< IIntegrationCalculator > _integCalc
Definition: Chi2BoxSet.h:20
void addEvent(const IDalitzEvent &evt, double weight=1)
virtual void addEvent(IDalitzEvent *evtPtr, double weight=1)=0
DalitzHistoSet _histoMC
Definition: Chi2BoxSet.h:22

◆ chi2()

double Chi2BoxSet::chi2 ( double  normFactorPassed = -1) const

Definition at line 209 of file Chi2BoxSet.cpp.

209  {
210  double nf=normFactorPassed;
211  if(nf < 0){
212  nf = normFactor();
213  }
214 
215  int n_data = this->nData();
216  double weight_mc = this->weightedMC() * nf;
217 
218  double var_mc = this->weightedMC2() * nf*nf;
219  double varData_expected = weight_mc;
220 
221  double varData;
222  if(0 != varData_expected) varData = varData_expected;
223  else varData = n_data;
224 
225  double var = varData + var_mc;
226 
227  double delta_N = n_data - weight_mc;
228  double dNSq = delta_N * delta_N;
229  double chi2;
230  if( dNSq < var * 1.e-20) chi2=0; // catches legit. 0-entry cases
231  else chi2 = dNSq / var;
232 
233  return chi2;
234 }
double chi2(double normFactorPassed=-1) const
Definition: Chi2BoxSet.cpp:209
double weightedMC2() const
Definition: Chi2BoxSet.cpp:148
double weightedMC() const
Definition: Chi2BoxSet.cpp:141
double normFactor() const
Definition: Chi2BoxSet.h:64
int nData() const
Definition: Chi2BoxSet.cpp:127

◆ histoData() [1/2]

DalitzHistoSet & Chi2BoxSet::histoData ( )

Definition at line 196 of file Chi2BoxSet.cpp.

196  {
197  return _histoData;
198 }
DalitzHistoSet _histoData
Definition: Chi2BoxSet.h:22

◆ histoData() [2/2]

const DalitzHistoSet & Chi2BoxSet::histoData ( ) const

Definition at line 199 of file Chi2BoxSet.cpp.

199  {
200  return _histoData;
201 }
DalitzHistoSet _histoData
Definition: Chi2BoxSet.h:22

◆ histoMC() [1/2]

DalitzHistoSet & Chi2BoxSet::histoMC ( )

Definition at line 202 of file Chi2BoxSet.cpp.

202  {
203  return _histoMC;
204 }
DalitzHistoSet _histoMC
Definition: Chi2BoxSet.h:22

◆ histoMC() [2/2]

const DalitzHistoSet & Chi2BoxSet::histoMC ( ) const

Definition at line 205 of file Chi2BoxSet.cpp.

205  {
206  return _histoMC;
207 }
DalitzHistoSet _histoMC
Definition: Chi2BoxSet.h:22

◆ nData()

int Chi2BoxSet::nData ( ) const

Definition at line 127 of file Chi2BoxSet.cpp.

127  {
128  int sum=0;
129  for(unsigned int i=0; i < this->size(); i++){
130  sum += (*this)[i].nData();
131  }
132  return sum;
133 }

◆ nMC()

int Chi2BoxSet::nMC ( ) const

Definition at line 134 of file Chi2BoxSet.cpp.

134  {
135  int sum=0;
136  for(unsigned int i=0; i < this->size(); i++){
137  sum += (*this)[i].nMC();
138  }
139  return sum;
140 }

◆ normFactor()

double Chi2BoxSet::normFactor ( ) const
inline

Definition at line 64 of file Chi2BoxSet.h.

64 {return _normFactor;}
double _normFactor
Definition: Chi2BoxSet.h:24

◆ print()

void Chi2BoxSet::print ( std::ostream &  os = std::cout) const
inline

Definition at line 53 of file Chi2BoxSet.h.

53 { printBoxInfo(os); }
void printBoxInfo(std::ostream &os=std::cout) const
Definition: Chi2BoxSet.cpp:111

◆ printBoxInfo()

void Chi2BoxSet::printBoxInfo ( std::ostream &  os = std::cout) const

Definition at line 111 of file Chi2BoxSet.cpp.

111  {
112  os << "Chi2BoxSet with " << this->size() << " sub-box";
113  if(this->size() > 1) os << "es";
114  os << ": ";
115  for(unsigned int i=0; i < this->size(); i++){
116  os << "\n " << i << ") " << (*this)[i];
117  }
118  if(0 != _integCalc){
121  os << "\n sorted fractions in this box\n"
122  << f << endl;
123  }
124  os << "\n--------------------------------------------------------\n" << endl;
125 
126 }
MINT::counted_ptr< IIntegrationCalculator > _integCalc
Definition: Chi2BoxSet.h:20
virtual FitFractionList getFractions() const =0
void sortByMagnitudeDecending()

◆ resetEventCounts()

void Chi2BoxSet::resetEventCounts ( )

Definition at line 63 of file Chi2BoxSet.cpp.

63  {
64  for(unsigned int i=0; i < this->size(); i++){
65  (*this)[i].resetEventCounts();
66  }
67 }

◆ rmsMC()

double Chi2BoxSet::rmsMC ( int  Ntotal) const

Definition at line 157 of file Chi2BoxSet.cpp.

157  {
158  return weightedMC2();
159 }
double weightedMC2() const
Definition: Chi2BoxSet.cpp:148

◆ setFillColour()

void Chi2BoxSet::setFillColour ( Color_t  fcolor)

Definition at line 187 of file Chi2BoxSet.cpp.

187  {
188  histoData().setFillColour(fcolor);
189  histoMC().setFillColour(fcolor);
190 }
void setFillColour(Color_t fcolor)
DalitzHistoSet & histoMC()
Definition: Chi2BoxSet.cpp:202
DalitzHistoSet & histoData()
Definition: Chi2BoxSet.cpp:196

◆ setHistoColour()

void Chi2BoxSet::setHistoColour ( Color_t  fcolor)

Definition at line 183 of file Chi2BoxSet.cpp.

183  {
184  setFillColour(fcolor);
185  setLineColour(fcolor);
186 }
void setLineColour(Color_t fcolor)
Definition: Chi2BoxSet.cpp:191
void setFillColour(Color_t fcolor)
Definition: Chi2BoxSet.cpp:187

◆ setIIntegrationCalculator()

void Chi2BoxSet::setIIntegrationCalculator ( MINT::counted_ptr< IIntegrationCalculator fap)
inline

Definition at line 38 of file Chi2BoxSet.h.

38  {
39  _integCalc=fap;
40  }
MINT::counted_ptr< IIntegrationCalculator > _integCalc
Definition: Chi2BoxSet.h:20

◆ setLineColour()

void Chi2BoxSet::setLineColour ( Color_t  fcolor)

Definition at line 191 of file Chi2BoxSet.cpp.

191  {
192  histoData().setLineColour(fcolor);
193  histoMC().setLineColour(fcolor);
194 }
void setLineColour(Color_t fcolor)
DalitzHistoSet & histoMC()
Definition: Chi2BoxSet.cpp:202
DalitzHistoSet & histoData()
Definition: Chi2BoxSet.cpp:196

◆ setNormFactor()

void Chi2BoxSet::setNormFactor ( double  nf)
inline

Definition at line 63 of file Chi2BoxSet.h.

63 {_normFactor = nf;}
double _normFactor
Definition: Chi2BoxSet.h:24

◆ weightedMC()

double Chi2BoxSet::weightedMC ( ) const

Definition at line 141 of file Chi2BoxSet.cpp.

141  {
142  double sum=0;
143  for(unsigned int i=0; i < this->size(); i++){
144  sum += (*this)[i].weightedMC();
145  }
146  return sum;
147 }

◆ weightedMC2()

double Chi2BoxSet::weightedMC2 ( ) const

Definition at line 148 of file Chi2BoxSet.cpp.

148  {
149  double sum=0;
150  for(unsigned int i=0; i < this->size(); i++){
151  sum += (*this)[i].weightedMC2();
152  }
153  return sum;
154 }

Member Data Documentation

◆ _histoData

DalitzHistoSet Chi2BoxSet::_histoData
private

Definition at line 22 of file Chi2BoxSet.h.

◆ _histoMC

DalitzHistoSet Chi2BoxSet::_histoMC
private

Definition at line 22 of file Chi2BoxSet.h.

◆ _integCalc

MINT::counted_ptr<IIntegrationCalculator> Chi2BoxSet::_integCalc
private

Definition at line 20 of file Chi2BoxSet.h.

◆ _normFactor

double Chi2BoxSet::_normFactor
private

Definition at line 24 of file Chi2BoxSet.h.


The documentation for this class was generated from the following files: