#include <Chi2Binning.h>
Definition at line 21 of file Chi2Binning.h.
◆ Chi2Binning()
Chi2Binning::Chi2Binning |
( |
| ) |
|
◆ chi2_ofBin()
double Chi2Binning::chi2_ofBin |
( |
unsigned int |
i | ) |
const |
Definition at line 358 of file Chi2Binning.cpp.
359 if(i >
_boxSets.size())
return -9999;
std::vector< Chi2BoxSet > _boxSets
double normFactor() const
◆ createBinning()
Definition at line 87 of file Chi2Binning.cpp.
92 if(0 == events)
return 0;
93 if(0 == events->
size())
return 0;
Chi2BoxSet splitBoxes(MINT::IMinimalEventList< DalitzEvent > *events, int maxPerBin) const
virtual unsigned int size() const =0
int mergeBoxes(Chi2BoxSet &boxes, int minPerBin)
◆ drawChi2Distribution()
void Chi2Binning::drawChi2Distribution |
( |
const std::string & |
fname = "chi2Distribution.eps" | ) |
const |
Definition at line 450 of file Chi2Binning.cpp.
455 can.Print(fname.c_str());
MINT::counted_ptr< TH1D > getChi2Distribution() const
◆ fillData() [1/2]
Definition at line 191 of file Chi2Binning.cpp.
192 for(
unsigned int k=0; k < data.
size(); k++){
195 for(
unsigned int i=0; i <
_boxSets.size(); i++){
203 cout <<
"WARNING in Chi2Binning::fillData:" 204 <<
"\n\t didn't find box for event " 207 cout <<
"compare to first event: " << endl;
210 Chi2Box box(evt.eventPattern());
211 cout <<
"would have fit into large? "
bool addData(const IDalitzEvent &evt)
virtual EVENT_TYPE getEvent(unsigned int i) const =0
std::vector< Chi2BoxSet > _boxSets
void print(std::ostream &os=std::cout) const
virtual unsigned int size() const =0
◆ fillData() [2/2]
Definition at line 47 of file Chi2Binning.h.
void fillData(MINT::IMinimalEventList< DalitzEvent > &data)
◆ fillMC() [1/2]
Definition at line 216 of file Chi2Binning.cpp.
220 cout <<
"Chi2Binning::fillMC called with " 221 << &mc <<
", " << pdf << endl;
223 int printevery=10000;
224 for(
unsigned int k=0; k < mc.
size(); k++){
225 bool printit = (0 == k%printevery);
226 if(printit) cout <<
"...fillMC filling event number " << k;
228 double weight = pdf->
getVal_noPs(evt) * evt.getWeight() /
229 evt.getGeneratorPdfRelativeToPhaseSpace();
231 if(printit) cout <<
", with weight " << weight << endl;
233 for(
unsigned int i=0; i <
_boxSets.size(); i++){
242 cout <<
"event " << k <<
" in " << n <<
" out of " <<
numBins()
243 <<
" box sets" << endl;
244 if(0 == n) evt.print();
virtual EVENT_TYPE getEvent(unsigned int i) const =0
std::vector< Chi2BoxSet > _boxSets
virtual unsigned int size() const =0
virtual double getVal_noPs(IDalitzEvent &evt)=0
◆ fillMC() [2/2]
Definition at line 52 of file Chi2Binning.h.
53 if(0 != mcPtr)
fillMC(*mcPtr, pdf);
void fillMC(MINT::IMinimalEventList< DalitzEvent > &mc, IDalitzPdf *pdf)
◆ getChi2_perBin()
double Chi2Binning::getChi2_perBin |
( |
| ) |
const |
Definition at line 362 of file Chi2Binning.cpp.
363 if(
_nMC <= 0)
return -9999;
364 if(
_nData <=0 )
return -9999;
368 for(
unsigned int i=0; i <
_boxSets.size(); i++){
double chi2_ofBin(unsigned int i) const
std::vector< Chi2BoxSet > _boxSets
◆ getChi2Distribution()
counted_ptr< TH1D > Chi2Binning::getChi2Distribution |
( |
| ) |
const |
Definition at line 437 of file Chi2Binning.cpp.
440 cout <<
"from " << from <<
" to " << to << endl;
444 for(
unsigned int i=0; i <
_boxSets.size(); i++){
double getMaxChi2() const
std::vector< Chi2BoxSet > _boxSets
◆ getColourPalette()
int * Chi2Binning::getColourPalette |
( |
| ) |
|
|
staticprivate |
Definition at line 76 of file Chi2Binning.cpp.
static int * __colourPalette
static void makeColourPalette()
◆ getDataHistoStack()
Definition at line 407 of file Chi2Binning.cpp.
411 for(
unsigned int i=0; i <
_boxSets.size(); i++){
double getMaxChi2() const
static int * __colourPalette
virtual void add(const DalitzCoordSet &coord, const MINT::counted_ptr< TH1 > &histo)
std::vector< Chi2BoxSet > _boxSets
void setColourPalette(int nCol, int *pal, double max, double min=0.000001)
◆ getMaxChi2()
double Chi2Binning::getMaxChi2 |
( |
| ) |
const |
Definition at line 375 of file Chi2Binning.cpp.
377 for(
unsigned int i=0; i <
_boxSets.size(); i++){
379 if(chi2 > max) max=chi2;
double chi2_ofBin(unsigned int i) const
std::vector< Chi2BoxSet > _boxSets
◆ getMCHistoStack()
Definition at line 421 of file Chi2Binning.cpp.
425 for(
unsigned int i=0; i <
_boxSets.size(); i++){
double getMaxChi2() const
static int * __colourPalette
virtual void add(const DalitzCoordSet &coord, const MINT::counted_ptr< TH1 > &histo)
std::vector< Chi2BoxSet > _boxSets
void setColourPalette(int nCol, int *pal, double max, double min=0.000001)
◆ makeColourPalette()
void Chi2Binning::makeColourPalette |
( |
| ) |
|
|
staticprivate |
Definition at line 70 of file Chi2Binning.cpp.
static void makeColourPaletteBlueGrey()
◆ makeColourPaletteBlueGrey()
void Chi2Binning::makeColourPaletteBlueGrey |
( |
| ) |
|
|
staticprivate |
Definition at line 21 of file Chi2Binning.cpp.
22 static const int NRGBs = 7;
26 Double_t stops[NRGBs] = { 0.00, 0.10, 0.25, 0.45, 0.60, 0.75, 1.00 };
27 Double_t red[NRGBs] = { 0.85, 0.00, 0.00, 0.00, 0.80, 0.80, 0.99 };
28 Double_t green[NRGBs] = { 0.85, 0.80, 0.40, 0.40, 0.80, 0.00, 0.00 };
29 Double_t blue[NRGBs] = { 0.85, 0.85, 0.80, 0.00, 0.00, 0.00, 0.00 };
30 Int_t Fi = TColor::CreateGradientColorTable(NRGBs
static int * __colourPalette
◆ makeColourPaletteBlueWhite()
void Chi2Binning::makeColourPaletteBlueWhite |
( |
| ) |
|
|
staticprivate |
Definition at line 37 of file Chi2Binning.cpp.
38 static const int NRGBs = 7;
42 Double_t stops[NRGBs] = { 0.00, 0.10, 0.25, 0.45, 0.60, 0.75, 1.00 };
43 Double_t red[NRGBs] = { 1.00, 0.00, 0.00, 0.00, 0.97, 0.97, 0.10 };
44 Double_t green[NRGBs] = { 1.00, 0.97, 0.30, 0.40, 0.97, 0.00, 0.00 };
45 Double_t blue[NRGBs] = { 1.00, 0.97, 0.97, 0.00, 0.00, 0.00, 0.00 };
46 Int_t Fi = TColor::CreateGradientColorTable(NRGBs
static int * __colourPalette
◆ makeColourPaletteRGB()
void Chi2Binning::makeColourPaletteRGB |
( |
| ) |
|
|
staticprivate |
Definition at line 53 of file Chi2Binning.cpp.
54 static const int NRGBs = 5;
59 Double_t red[NRGBs] = {0., 0.0, 1.0, 1.0, 1.0};
60 Double_t green[NRGBs] = {0., 0.0, 0.0, 1.0, 1.0};
61 Double_t blue[NRGBs] = {0., 1.0, 0.0, 0.0, 1.0};
62 Double_t stops[NRGBs] = {0., .25, .50, .75, 1.0};
63 Int_t Fi = TColor::CreateGradientColorTable(NRGBs
static int * __colourPalette
◆ mergeBoxes()
int Chi2Binning::mergeBoxes |
( |
Chi2BoxSet & |
boxes, |
|
|
int |
minPerBin |
|
) |
| |
|
private |
Definition at line 102 of file Chi2Binning.cpp.
104 sort(boxes.
begin(), boxes.
end(), sorter);
109 for(
unsigned int i=0; i < boxes.
size(); i++){
110 boxSet.
add(boxes[i]);
111 if(boxSet.nData() >= minPerBin){
void add(const Chi2Box &box)
std::vector< T >::iterator end()
std::vector< T >::iterator begin()
unsigned int size() const
std::vector< Chi2BoxSet > _boxSets
◆ normFactor()
double Chi2Binning::normFactor |
( |
| ) |
const |
|
private |
◆ numBins()
int Chi2Binning::numBins |
( |
| ) |
const |
◆ print()
void Chi2Binning::print |
( |
std::ostream & |
os = std::cout | ) |
const |
Definition at line 301 of file Chi2Binning.cpp.
306 double sumVarData =0;
308 for(
unsigned int i=0; i <
_boxSets.size(); i++){
310 nDataCheck += n_data;
312 nMCCheck += weight_mc;
316 double varData_expected = weight_mc;
317 sumVarData += varData_expected;
323 os <<
" data " <<
_boxSets[i].nData();
325 os <<
", (nMC " <<
_boxSets[i].nMC() <<
")";
326 os <<
", chi2 " << chi2 << endl;
329 os <<
"\n=========================================================="<< endl;
330 os <<
"chi2 / nbins = " << chi2sum <<
" / " <<
numBins()
331 <<
" = " << chi2sum/
numBins() << endl;
332 os <<
"===========================================================" << endl;
333 os <<
" total data weight: " << nDataCheck
334 <<
" .. _nData = " <<
_nData 335 <<
" should be same as normalised total MC weight = " << nMCCheck
338 if(sumVarMC > sumVarData){
339 os <<
"Severe WARNING in Chi2Binning::getChi2_perBin()" 340 <<
"\n error on difference between data and MC dominated by MC" 341 <<
"\n mean data variance: " << sumVarData/
numBins()
342 <<
", ... mc: " << sumVarMC/
numBins()
343 <<
".\n Get more MC!"
double chi2_ofBin(unsigned int i) const
std::vector< Chi2BoxSet > _boxSets
double normFactor() const
◆ resetEventCounts()
void Chi2Binning::resetEventCounts |
( |
| ) |
|
|
private |
Definition at line 183 of file Chi2Binning.cpp.
187 for(
unsigned int i=0; i <
_boxSets.size(); i++){
std::vector< Chi2BoxSet > _boxSets
◆ setBoxesNormFactors()
void Chi2Binning::setBoxesNormFactors |
( |
| ) |
|
|
private |
Definition at line 352 of file Chi2Binning.cpp.
353 for(
unsigned int i=0; i <
_boxSets.size(); i++){
std::vector< Chi2BoxSet > _boxSets
double normFactor() const
◆ setEventsAndPdf()
Definition at line 255 of file Chi2Binning.cpp.
261 if(dbThis) cout <<
"Chi2Binning::setEventsAndPdf" << endl;
262 if(0 == data)
return -9999;
263 if(0 == mc)
return -9999;
264 if(0 == pdf)
return -9999;
270 if(dbThis) cout <<
"...number of chi2 bins = " <<
numBins() << endl;
272 if(dbThis) cout <<
"...about to fill in the data " << endl;
274 if(dbThis) cout <<
"...done that - now the MC" << endl;
276 if(dbThis) cout <<
"... fillMC done, now setting norm factors" << endl;
278 if(dbThis) cout <<
" done the norm factors, now sorting by chi2" << endl;
280 if(dbThis) cout <<
" Chi2Binning::setEventsAndPdf done" << endl;
void fillMC(MINT::IMinimalEventList< DalitzEvent > &mc, IDalitzPdf *pdf)
int createBinning(MINT::IMinimalEventList< DalitzEvent > *events, int minPerBin=10, int maxPerBin=100)
void setBoxesNormFactors()
void fillData(MINT::IMinimalEventList< DalitzEvent > &data)
void setFas(IFastAmplitudeIntegrable *fas)
◆ setFas()
Definition at line 284 of file Chi2Binning.cpp.
291 cout <<
"Chi2Binning::setFas: this is the fas:" << endl;
295 for(
unsigned int i=0; i <
_boxSets.size(); i++){
297 _boxSets[i].setIIntegrationCalculator(fap);
virtual MINT::counted_ptr< IIntegrationCalculator > clone_IIntegrationCalculator() const =0
virtual MINT::counted_ptr< IIntegrationCalculator > makeIntegrationCalculator()=0
virtual void print(std::ostream &os=std::cout) const =0
std::vector< Chi2BoxSet > _boxSets
◆ setHistoColours()
void Chi2Binning::setHistoColours |
( |
| ) |
|
|
private |
Definition at line 398 of file Chi2Binning.cpp.
400 for(
unsigned int i=0; i <
_boxSets.size(); i++){
402 int colIndex = (chi2/maxChi2)*(
__Ncol-1);
double getMaxChi2() const
double chi2_ofBin(unsigned int i) const
static int * getColourPalette()
std::vector< Chi2BoxSet > _boxSets
◆ sortByChi2()
void Chi2Binning::sortByChi2 |
( |
| ) |
|
|
private |
◆ splitBoxes() [1/2]
Definition at line 121 of file Chi2Binning.cpp.
126 cout <<
"Chi2Binning::splitBoxes(MINT::IEventList<DalitzEvent>* events , int maxPerBin = " 127 << maxPerBin <<
") called" << endl;
131 if(0 == events)
return dummy;
Chi2BoxSet splitBoxes(MINT::IMinimalEventList< DalitzEvent > *events, int maxPerBin) const
◆ splitBoxes() [2/2]
Definition at line 135 of file Chi2Binning.cpp.
140 if(0 == events.
size())
return dummy;
146 bool needToSplitMore=
false;
151 int failedSet=0, failedBox=0;
153 for(
unsigned int i=0; i < events.
size(); i++){
154 bool added = boxes.addData(events.
getEvent(i));
155 if(! added) failedSet++;
156 if(! box.addData(events.
getEvent(i))){
160 if(failedSet > 0 || dbThis){
161 cout <<
" Chi2Binning::splitBoxes: ERROR split level " << counter
162 <<
", num boxes: " << boxes.size()
163 <<
", failedSet: " << failedSet
164 <<
", failedBox: " << failedBox << endl;
168 needToSplitMore=
false;
169 for(
unsigned int i=0; i < boxes.size(); i++){
170 if( boxes[i].nData() > maxPerBin ){
171 needToSplitMore=
true;
172 newBoxes.
add(boxes[i].split());
174 newBoxes.
add(boxes[i]);
178 }
while(needToSplitMore);
void add(const Chi2Box &box)
virtual EVENT_TYPE getEvent(unsigned int i) const =0
virtual const DalitzEventPattern & eventPattern() const =0
virtual unsigned int size() const =0
◆ __colourPalette
int * Chi2Binning::__colourPalette =0 |
|
staticprivate |
◆ __Ncol
int Chi2Binning::__Ncol =256 |
|
staticprivate |
◆ _boxSets
◆ _nData
◆ _nMC
◆ _totalMCWeight
double Chi2Binning::_totalMCWeight |
|
private |
The documentation for this class was generated from the following files: