76 fInterpolMethod(
PDF::kSpline2 ),
83 fHistAvgEvtPerBin ( 0 ),
84 fHistDefinedNBins ( 0 ),
87 fBorderMethodString( 0 ),
88 fInterpolateString ( 0 ),
94 fCheckHist ( kFALSE ),
100 GetThisPdfThreadLocal() =
this;
116 fMinNsmooth ( minnsmooth ),
117 fMaxNsmooth ( maxnsmooth ),
119 fInterpolMethod( method ),
126 fHistAvgEvtPerBin ( 0 ),
127 fHistDefinedNBins ( 0 ),
128 fKDEtypeString ( 0 ),
129 fKDEiterString ( 0 ),
130 fBorderMethodString( 0 ),
131 fInterpolateString ( 0 ),
136 fReadingVersion( 0 ),
137 fCheckHist ( checkHist ),
163 fInterpolMethod(
PDF::kKDE ),
170 fHistAvgEvtPerBin ( 0 ),
171 fHistDefinedNBins ( 0 ),
172 fKDEtypeString ( 0 ),
173 fKDEiterString ( 0 ),
174 fBorderMethodString( 0 ),
175 fInterpolateString ( 0 ),
178 fKDEborder ( kborder ),
179 fFineFactor ( FineFactor),
180 fReadingVersion( 0 ),
204 fInterpolMethod(
PDF::kSpline0 ),
211 fHistAvgEvtPerBin ( 50 ),
212 fHistDefinedNBins ( 0 ),
213 fKDEtypeString (
"Gauss" ),
214 fKDEiterString (
"Nonadaptive" ),
215 fBorderMethodString(
"None" ),
216 fInterpolateString (
"Spline2" ),
221 fReadingVersion( 0 ),
228 if (defaultPDF != 0) {
248 if (fSpline !=
NULL)
delete fSpline;
249 if (fHist !=
NULL)
delete fHist;
250 if (fPDFHist !=
NULL)
delete fPDFHist;
251 if (fHistOriginal !=
NULL)
delete fHistOriginal;
252 if (fIGetVal !=
NULL)
delete fIGetVal;
253 if (fGraph !=
NULL)
delete fGraph;
261 GetThisPdfThreadLocal() =
this;
263 if (hist ==
NULL)
Log() << kFATAL <<
"Called without valid histogram pointer!" <<
Endl;
270 Log()<< kDEBUG <<
"Create "
274 <<
"type KDE kernel for histogram: \"" << hist->
GetName() <<
"\""
280 Log() << kFATAL <<
"PDF construction called with minnsmooth<0" <<
Endl;
281 else if (fMaxNsmooth<=0)
282 fMaxNsmooth = fMinNsmooth;
283 else if (fMaxNsmooth<fMinNsmooth)
284 Log() << kFATAL <<
"PDF construction called with maxnsmooth<minnsmooth" <<
Endl;
289 fHistOriginal->SetTitle( fHistOriginal->GetName() );
290 fHist ->SetTitle( fHist->GetName() );
293 fHistOriginal->SetDirectory(0);
294 fHist ->SetDirectory(0);
297 if (fInterpolMethod ==
PDF::kKDE) BuildKDEPDF();
298 else BuildSplinePDF();
306 if (evtNum == 0 && fHistDefinedNBins == 0)
307 Log() << kFATAL <<
"No number of bins set for PDF" <<
Endl;
308 else if (fHistDefinedNBins > 0)
309 return fHistDefinedNBins * ResolutionFactor;
310 else if ( evtNum > 0 && fHistAvgEvtPerBin > 0 )
311 return evtNum / fHistAvgEvtPerBin * ResolutionFactor;
313 Log() << kFATAL <<
"No number of bins or average event per bin set for PDF" << fHistAvgEvtPerBin <<
Endl;
323 if (fInterpolMethod !=
PDF::kSpline0 && fCheckHist) CheckHist();
326 if (fMaxNsmooth > 0 && fMinNsmooth >=0 ) SmoothHistogram();
332 switch (fInterpolMethod) {
337 fUseHistogram =
kTRUE;
357 Log() << kWARNING <<
"No valid interpolation method given! Use Spline2" <<
Endl;
359 Log() << kFATAL <<
" Well.. .thinking about it, I better quit so you notice you are forced to fix the mistake " <<
Endl;
365 if (!UseHistogram()) {
366 fSpline->SetTitle( (
TString)fHist->GetTitle() + fSpline->GetTitle() );
367 fSpline->SetName ( (
TString)fHist->GetName() + fSpline->GetName() );
373 if (integral < 0)
Log() << kFATAL <<
"Integral: " << integral <<
" <= 0" <<
Endl;
377 if (integral>0) fPDFHist->Scale( 1.0/integral );
379 fPDFHist->SetDirectory(0);
388 fPDFHist =
new TH1F(
"",
"", fgNbin_PdfHist, GetXmin(), GetXmax() );
389 fPDFHist->SetTitle( (
TString)fHist->GetTitle() +
"_hist from_KDE" );
390 fPDFHist->SetName ( (
TString)fHist->GetName() +
"_hist_from_KDE" );
393 Float_t histoLowEdge = fHist->GetBinLowEdge(1);
394 Float_t histoUpperEdge = fPDFHist->GetBinLowEdge(fPDFHist->GetNbinsX()) + fPDFHist->GetBinWidth(fPDFHist->GetNbinsX());
396 fHist, histoLowEdge, histoUpperEdge,
397 fKDEborder, fFineFactor );
400 for (
Int_t i=1;i<fHist->GetNbinsX();i++) {
402 for (
Int_t j=1;j<fPDFHist->GetNbinsX();j++) {
404 fPDFHist->AddBinContent(j,fHist->GetBinContent(i)*
406 fPDFHist->GetBinLowEdge(j+1),
407 fHist->GetBinCenter(i),
411 if (fKDEborder == 3) {
415 if (i < fHist->GetNbinsX()/5 ) {
416 for (
Int_t j=1;j<fPDFHist->GetNbinsX();j++) {
418 fPDFHist->AddBinContent(j,fHist->GetBinContent(i)*
420 fPDFHist->GetBinLowEdge(j+1),
421 2*histoLowEdge-fHist->GetBinCenter(i),
426 if (i > 4*fHist->GetNbinsX()/5) {
427 for (
Int_t j=1;j<fPDFHist->GetNbinsX();j++) {
429 fPDFHist->AddBinContent( j,fHist->GetBinContent(i)*
431 fPDFHist->GetBinLowEdge(j+1),
432 2*histoUpperEdge-fHist->GetBinCenter(i), i) );
438 fPDFHist->SetEntries(fHist->GetEntries());
444 if (integral < 0)
Log() << kFATAL <<
"Integral: " << integral <<
" <= 0" <<
Endl;
448 if (integral>0) fPDFHist->Scale( 1.0/integral );
449 fPDFHist->SetDirectory(0);
456 if(fHist->GetNbinsX()==1)
return;
457 if (fMaxNsmooth == fMinNsmooth) {
458 fHist->Smooth( fMinNsmooth );
465 for (
Int_t bin=0; bin<fHist->GetNbinsX(); bin++) {
466 if (fHist->GetBinContent(bin+1) <= fHist->GetBinError(bin+1))
continue;
467 Err = fHist->GetBinError(bin+1) / fHist->GetBinContent(bin+1);
468 ErrAvg +=
Err; ErrRMS += Err*
Err; num++;
474 Float_t MaxErr=ErrAvg+ErrRMS, MinErr=ErrAvg-ErrRMS;
475 fNSmoothHist =
new TH1I(
"",
"",fHist->GetNbinsX(),0,fHist->GetNbinsX());
476 fNSmoothHist->SetTitle( (
TString)fHist->GetTitle() +
"_Nsmooth" );
477 fNSmoothHist->SetName ( (
TString)fHist->GetName() +
"_Nsmooth" );
478 for (
Int_t bin=0; bin<fHist->GetNbinsX(); bin++) {
479 if (fHist->GetBinContent(bin+1) <= fHist->GetBinError(bin+1))
482 Err = fHist->GetBinError(bin+1) / fHist->GetBinContent(bin+1);
483 smooth=(
Int_t)((Err-MinErr) /(MaxErr-MinErr) * (fMaxNsmooth-fMinNsmooth)) + fMinNsmooth;
486 fNSmoothHist->SetBinContent(bin+1,smooth);
491 for (
Int_t n=fMaxNsmooth;
n>=0;
n--) {
493 if (
n <= fMinNsmooth) { fHist->Smooth();
continue; }
494 Int_t MinBin=-1,MaxBin =-1;
495 for (
Int_t bin=0; bin < fHist->GetNbinsX(); bin++) {
496 if (fNSmoothHist->GetBinContent(bin+1) >=
n) {
497 if (MinBin==-1) MinBin = bin;
500 else if (MaxBin >= 0) {
501 #if ROOT_VERSION_CODE > ROOT_VERSION(5,19,2)
502 fHist->Smooth(1,
"R");
504 fHist->Smooth(1,MinBin+1,MaxBin+1);
528 if (UseHistogram()) {
530 fPDFHist = (
TH1*)fHist->Clone();
531 fPDFHist->SetTitle( (
TString)fHist->GetTitle() +
"_hist from_spline0" );
532 fPDFHist->SetName ( (
TString)fHist->GetName() +
"_hist_from_spline0" );
536 fPDFHist =
new TH1F(
"",
"", fgNbin_PdfHist, GetXmin(), GetXmax() );
537 fPDFHist->SetTitle( (
TString)fHist->GetTitle() +
"_hist from_" + fSpline->GetTitle() );
538 fPDFHist->SetName ( (
TString)fHist->GetName() +
"_hist_from_" + fSpline->GetTitle() );
540 for (
Int_t bin=1; bin <= fgNbin_PdfHist; bin++) {
541 Double_t x = fPDFHist->GetBinCenter( bin );
546 if (y <= fgEpsilon) y = fHist->GetBinContent( fHist->FindBin( x ) );
547 fPDFHist->SetBinContent( bin,
TMath::Max(y, fgEpsilon) );
550 fPDFHist->SetDirectory(0);
559 Log() << kFATAL <<
"<CheckHist> Called without valid histogram pointer!" <<
Endl;
567 if (fHist->GetBinContent(bin) == 0) emptyBins++;
571 <<
"%) of the bins in hist '"
572 << fHist->GetName() <<
"' are empty!" <<
Endl;
573 Log() << kWARNING <<
"X_min=" << GetXmin()
574 <<
" mean=" << fHist->GetMean() <<
" X_max= " << GetXmax() <<
Endl;
584 if (!originalHist) originalHist = fHistOriginal;
604 Int_t binPdfHist = fPDFHist->FindBin( x );
605 if (binPdfHist<0)
continue;
609 originalHist->
GetBinWidth( bin )/fPDFHist->GetBinWidth( binPdfHist ) );
617 if (d > 1) { nc1++;
if (d > 2) { nc2++;
if (d > 3) { nc3++;
if (d > 6) nc6++; } } }
621 Log() << kDEBUG <<
"Validation result for PDF \"" << originalHist->
GetTitle() <<
"\"" <<
": " <<
Endl;
622 Log() << kDEBUG <<
Form(
" chi2/ndof(!=0) = %.1f/%i = %.2f (Prob = %.2f)",
624 if ((1.0 -
TMath::Prob( chi2, ndof )) > 0.9999994) {
625 Log() << kDEBUG <<
"Comparison of the original histogram \"" << originalHist->
GetTitle() <<
"\"" <<
Endl;
626 Log() << kDEBUG <<
"with the corresponding PDF gave a chi2/ndof of " << chi2/ndof <<
"," <<
Endl;
627 Log() << kDEBUG <<
"which corresponds to a deviation of more than 5 sigma! Please check!" <<
Endl;
629 Log() << kDEBUG <<
Form(
" #bins-found(#expected-bins) deviating > [1,2,3,6] sigmas: " \
630 "[%i(%i),%i(%i),%i(%i),%i(%i)]",
640 Double_t integral = fPDFHist->GetSumOfWeights();
641 integral *= GetPdfHistBinWidth();
651 return ThisPDF()->GetVal( x[0] );
661 if (fgManualIntegration) {
664 Int_t imin = fPDFHist->FindBin(xmin);
665 Int_t imax = fPDFHist->FindBin(xmax);
666 if (imin < 1) imin = 1;
667 if (imax > fPDFHist->GetNbinsX()) imax = fPDFHist->GetNbinsX();
669 for (
Int_t bini = imin; bini <= imax; bini++) {
670 Float_t dx = fPDFHist->GetBinWidth(bini);
672 if (bini == imin) dx = fPDFHist->GetBinLowEdge(bini+1) -
xmin;
673 else if (bini == imax) dx = xmax - fPDFHist->GetBinLowEdge(bini);
674 if (dx < 0 && dx > -1.0
e-8) dx = 0;
677 <<
"dx = " << dx << std::endl
678 <<
"bini = " << bini << std::endl
679 <<
"xmin = " << xmin << std::endl
680 <<
"xmax = " << xmax << std::endl
681 <<
"imin = " << imin << std::endl
682 <<
"imax = " << imax << std::endl
683 <<
"low edge of imin" << fPDFHist->GetBinLowEdge(imin) << std::endl
684 <<
"low edge of imin+1" << fPDFHist->GetBinLowEdge(imin+1) <<
Endl;
685 Log() << kFATAL <<
"<GetIntegral> dx = " << dx <<
" < 0" <<
Endl;
687 integral += fPDFHist->GetBinContent(bini)*dx;
694 if (fIGetVal == 0) fIGetVal =
new TF1(
"IGetVal",
PDF::IGetVal, GetXmin(), GetXmax(), 0 );
695 integral = fIGetVal->Integral( xmin, xmax );
707 Int_t bin = fPDFHist->FindBin(x);
713 if (UseHistogram()) {
715 retval = fPDFHist->GetBinContent( bin );
720 if ((x > fPDFHist->GetBinCenter(bin) && bin != fPDFHist->GetNbinsX()) || bin == 1)
726 Double_t dx = fPDFHist->GetBinCenter( bin ) - fPDFHist->GetBinCenter( nextbin );
727 Double_t dy = fPDFHist->GetBinContent( bin ) - fPDFHist->GetBinContent( nextbin );
728 retval = fPDFHist->GetBinContent( bin ) + (x - fPDFHist->GetBinCenter( bin ))*dy/dx;
739 Int_t lowerBin=0, higherBin=0;
740 Double_t lowerBinValue=0, higherBinValue=0;
741 FindBinInverse(fPDFHist,lowerBin,higherBin,lowerBinValue,higherBinValue,y,isMonotonouslyIncreasingFunction);
743 Double_t xValueLowerBin =fPDFHist->GetBinCenter (lowerBin);
744 Double_t xValueHigherBin=fPDFHist->GetBinCenter (higherBin);
746 Double_t length =(higherBinValue-lowerBinValue);
749 fraction=(y-lowerBinValue)/length;
751 Double_t lengthX =xValueHigherBin-xValueLowerBin;
752 Double_t x =xValueLowerBin+lengthX*fraction;
767 if (isMonotonouslyIncreasingFunction) {
771 Int_t bin=higherBin/2;
773 while (bin>lowerBin && bin<higherBin) {
778 higherBinValue=binContent;
780 else if (y>=binContent){
782 lowerBinValue =binContent;
784 bin=lowerBin+(higherBin-lowerBin)/2;
789 for (
Int_t bin=0, binEnd=histogram->
GetNbinsX(); bin<binEnd; ++bin) {
794 lowerBinValue =binContent;
795 higherBinValue=binContent;
799 higherBinValue=binContent;
825 DeclareOptionRef( fNsmooth,
Form(
"NSmooth%s",fSuffix.Data()),
826 "Number of smoothing iterations for the input histograms" );
827 DeclareOptionRef( fMinNsmooth,
Form(
"MinNSmooth%s",fSuffix.Data()),
828 "Min number of smoothing iterations, for bins with most data" );
830 DeclareOptionRef( fMaxNsmooth,
Form(
"MaxNSmooth%s",fSuffix.Data()),
831 "Max number of smoothing iterations, for bins with least data" );
833 DeclareOptionRef( fHistAvgEvtPerBin,
Form(
"NAvEvtPerBin%s",fSuffix.Data()),
834 "Average number of events per PDF bin" );
836 DeclareOptionRef( fHistDefinedNBins,
Form(
"Nbins%s",fSuffix.Data()),
837 "Defined number of bins for the histogram from which the PDF is created" );
839 DeclareOptionRef( fCheckHist,
Form(
"CheckHist%s",fSuffix.Data()),
840 "Whether or not to check the source histogram of the PDF" );
842 DeclareOptionRef( fInterpolateString,
Form(
"PDFInterpol%s",fSuffix.Data()),
843 "Interpolation method for reference histograms (e.g. Spline2 or KDE)" );
844 AddPreDefVal(
TString(
"Spline0"));
845 AddPreDefVal(
TString(
"Spline1"));
846 AddPreDefVal(
TString(
"Spline2"));
847 AddPreDefVal(
TString(
"Spline3"));
848 AddPreDefVal(
TString(
"Spline5"));
851 DeclareOptionRef( fKDEtypeString,
Form(
"KDEtype%s",fSuffix.Data()),
"KDE kernel type (1=Gauss)" );
852 AddPreDefVal(
TString(
"Gauss"));
854 DeclareOptionRef( fKDEiterString,
Form(
"KDEiter%s",fSuffix.Data()),
"Number of iterations (1=non-adaptive, 2=adaptive)" );
855 AddPreDefVal(
TString(
"Nonadaptive"));
856 AddPreDefVal(
TString(
"Adaptive"));
858 DeclareOptionRef( fFineFactor ,
Form(
"KDEFineFactor%s",fSuffix.Data()),
859 "Fine tuning factor for Adaptive KDE: Factor to multiply the width of the kernel");
861 DeclareOptionRef( fBorderMethodString,
Form(
"KDEborder%s",fSuffix.Data()),
862 "Border effects treatment (1=no treatment , 2=kernel renormalization, 3=sample mirroring)" );
864 AddPreDefVal(
TString(
"Renorm"));
865 AddPreDefVal(
TString(
"Mirror"));
868 SetConfigDescription(
"Configuration options for the PDF class" );
875 if (fNsmooth < 0) fNsmooth = 0;
877 if (fMaxNsmooth < 0 || fMinNsmooth < 0) {
878 fMinNsmooth = fMaxNsmooth = fNsmooth;
881 if (fMaxNsmooth < fMinNsmooth && fMinNsmooth >= 0) {
882 Log() << kFATAL <<
"ERROR: MaxNsmooth = "
883 << fMaxNsmooth <<
" < MinNsmooth = " << fMinNsmooth <<
Endl;
886 if (fMaxNsmooth < 0 || fMinNsmooth < 0) {
887 Log() << kFATAL <<
"ERROR: MaxNsmooth = "
888 << fMaxNsmooth <<
" or MinNsmooth = " << fMinNsmooth <<
" smaller than zero" <<
Endl;
897 else if (fInterpolateString ==
"KDE" ) fInterpolMethod =
TMVA::PDF::kKDE;
898 else if (fInterpolateString !=
"" ) {
899 Log() << kFATAL <<
"unknown setting for option 'InterpolateMethod': " << fKDEtypeString << ((fSuffix==
"")?
"":
Form(
" for pdf with suffix %s",fSuffix.Data())) <<
Endl;
904 else if (fKDEtypeString !=
"" )
905 Log() << kFATAL <<
"unknown setting for option 'KDEtype': " << fKDEtypeString << ((fSuffix==
"")?
"":
Form(
" for pdf with suffix %s",fSuffix.Data())) <<
Endl;
908 else if (fKDEiterString !=
"" )
909 Log() << kFATAL <<
"unknown setting for option 'KDEiter': " << fKDEtypeString << ((fSuffix==
"")?
"":
Form(
" for pdf with suffix %s",fSuffix.Data())) <<
Endl;
914 else if ( fKDEiterString !=
"" ) {
915 Log() << kFATAL <<
"unknown setting for option 'KDEBorder': " << fKDEtypeString << ((fSuffix==
"")?
"":
Form(
" for pdf with suffix %s",fSuffix.Data())) <<
Endl;
928 gTools().
AddAttr(pdfxml,
"InterpolMethod", fInterpolMethod );
934 TH1* histToWrite = GetOriginalHist();
940 gTools().
AddAttr(pdfhist,
"HasEquidistantBins", hasEquidistantBinning );
949 if (!hasEquidistantBinning) {
950 void* pdfhistbins =
gTools().
AddChild(pdfxml,
"HistogramBinning" );
979 Bool_t hasEquidistantBinning;
986 gTools().
ReadAttr( histch,
"HasEquidistantBins", hasEquidistantBinning );
990 if (hasEquidistantBinning) {
991 newhist =
new TH1F( hname, hname, nbins, xmin, xmax );
994 std::stringstream s(content);
1003 std::stringstream s(content);
1009 if (nbinning != nbins) {
1010 Log() << kFATAL <<
"Number of bins in content and binning array differs"<<
Endl;
1013 std::stringstream sb(binString);
1014 for (
UInt_t i=0; i<=nbins; i++) sb >> binns[i];
1015 newhist =
new TH1F( hname, hname, nbins, binns.GetMatrixArray() );
1024 hnameSmooth.
ReplaceAll(
"_original",
"_smoothed" );
1026 if (fHistOriginal != 0)
delete fHistOriginal;
1027 fHistOriginal = newhist;
1028 fHist = (
TH1F*)fHistOriginal->
Clone( hnameSmooth );
1029 fHist->SetTitle( hnameSmooth );
1030 fHist->SetDirectory(0);
1032 if (fInterpolMethod ==
PDF::kKDE) BuildKDEPDF();
1033 else BuildSplinePDF();
1041 Int_t dp = os.precision();
1042 os <<
"MinNSmooth " << pdf.
fMinNsmooth << std::endl;
1043 os <<
"MaxNSmooth " << pdf.
fMaxNsmooth << std::endl;
1045 os <<
"KDE_type " << pdf.
fKDEtype << std::endl;
1046 os <<
"KDE_iter " << pdf.
fKDEiter << std::endl;
1047 os <<
"KDE_border " << pdf.
fKDEborder << std::endl;
1048 os <<
"KDE_finefactor " << pdf.
fFineFactor << std::endl;
1063 os <<
"Weights " << std::endl;
1064 os << std::setprecision(8);
1065 for (
Int_t i=0; i<nBins; i++) {
1066 os << std::setw(15) << std::left << histToWrite->
GetBinContent(i+1) << std::right <<
" ";
1067 if ((i+1)%5==0) os << std::endl;
1070 os << std::setprecision(dp);
1085 while (!doneReading) {
1087 if (devnullS==
"NSmooth")
1088 {istr >> pdf.fMinNsmooth; pdf.fMaxNsmooth=pdf.fMinNsmooth;}
1089 else if (devnullS==
"MinNSmooth") istr >> pdf.fMinNsmooth;
1090 else if (devnullS==
"MaxNSmooth") istr >> pdf.fMaxNsmooth;
1096 else if (devnullS ==
"KDE_finefactor") {
1097 istr >> pdf.fFineFactor;
1098 if (pdf.GetReadingVersion() != 0 && pdf.GetReadingVersion() <
TMVA_VERSION(3,7,3)) {
1100 istr >> nbins >> xmin >>
xmax;
1101 doneReading =
kTRUE;
1104 else if (devnullS ==
"Histogram") { istr >> hname >> nbins >> xmin >>
xmax; }
1105 else if (devnullS ==
"Weights") { doneReading =
kTRUE; }
1109 hnameSmooth.
ReplaceAll(
"_original",
"_smoothed" );
1113 std::cout <<
"PDF, trying to create a histogram without defined binning"<< std::endl;
1116 TH1* newhist =
new TH1F( hname,hname, nbins, xmin,
xmax );
1124 if (pdf.fHistOriginal != 0)
delete pdf.fHistOriginal;
1125 pdf.fHistOriginal = newhist;
1126 pdf.fHist = (
TH1F*)pdf.fHistOriginal->
Clone( hnameSmooth );
1127 pdf.fHist->SetTitle( hnameSmooth );
1128 pdf.fHist->SetDirectory(0);
1130 if (pdf.fMinNsmooth>=0) pdf.BuildSplinePDF();
1142 return GetThisPdfThreadLocal();
virtual const char * GetTitle() const
Returns title of object.
std::string GetName(const std::string &scope_name)
TString fBorderMethodString
THist< 1, int, THistStatContent > TH1I
MsgLogger & Endl(MsgLogger &ml)
void ReadXML(void *pdfnode)
XML file reading.
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
static const Double_t fgEpsilon
virtual void SetDirectory(TDirectory *dir)
By default when an histogram is created, it is added to the list of histogram objects in the current ...
TString & ReplaceAll(const TString &s1, const TString &s2)
void BuildPDF(const TH1 *theHist)
THist< 1, float, THistStatContent, THistStatUncertainty > TH1F
Double_t GetIntegral() const
computes normalisation
void FindBinInverse(const TH1 *histogram, Int_t &lowerBin, Int_t &higherBin, Double_t &lowerBinValue, Double_t &higherBinValue, Double_t y, Bool_t isMonotonouslyIncreasingFunction=kFALSE) const
find bin from value on ordinate
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
static const Int_t fgNbin_PdfHist
tomato 1-D histogram with a float per channel (see TH1 documentation)}
Short_t Min(Short_t a, Short_t b)
PDF(const TString &name, Bool_t norm=kTRUE)
default constructor needed for ROOT I/O
virtual Int_t GetNbinsX() const
virtual Double_t GetEntries() const
Return the current number of entries.
Double_t Prob(Double_t chi2, Int_t ndf)
Computation of the probability for a certain Chi-squared (chi2) and number of degrees of freedom (ndf...
Class to create third splines to interpolate knots Arbitrary conditions can be introduced for first a...
TObject * Clone(const char *newname=0) const
Make a complete copy of the underlying object.
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width for 1D histogram.
TMVA::PDF::EInterpolateMethod fInterpolMethod
KDE Kernel for "smoothing" the PDFs.
static PDF * ThisPDF(void)
virtual TArrayD * GetSumw2()
PDF wrapper for histograms; uses user-defined spline interpolation.
static const Bool_t fgManualIntegration
void ValidatePDF(TH1 *original=0) const
comparison of original histogram with reference PDF
void BuildSplinePDF()
build the PDF from the original histograms
Int_t GetHistNBins(Int_t evtNum=0)
virtual Double_t GetBinCenter(Int_t bin) const
Return bin center for 1D histogram.
TH1 * GetOriginalHist() const
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
std::ostream & operator<<(std::ostream &os, const BinaryTree &tree)
char * Form(const char *fmt,...)
virtual Double_t GetSumOfWeights() const
Return the sum of weights excluding under/overflows.
virtual const char * GetName() const
Returns name of object.
Double_t GetValInverse(Double_t y, Bool_t isMonotonouslyIncreasingFunction=kFALSE) const
returns value
Linear interpolation of TGraph.
MsgLogger * fLogger
the suffix for options
void DeclareOptions()
define the options (their key words) that can be set in the option string
#define TMVA_VERSION(a, b, c)
void CheckHist() const
sanity check: compare PDF with original histogram
void BuildKDEPDF()
creates high-binned reference histogram to be used instead of the PDF for speed reasons ...
Float_t GetBinKernelIntegral(Float_t lowr, Float_t highr, Float_t mean, Int_t binnum)
calculates the integral of the Kernel
Double_t GetVal(Double_t x) const
returns value PDF(x)
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
void AddXMLTo(void *parent)
XML file writing.
ostringstream derivative to redirect and format output
void Err(int level, const char *msg, int size)
Short_t Max(Short_t a, Short_t b)
virtual void Sumw2(Bool_t flag=kTRUE)
Create structure to store sum of squares of weights.
A Graph is a graphics object made of two arrays X and Y with npoints each.
static Double_t IGetVal(Double_t *, Double_t *)
static external auxiliary function (integrand)
Quadratic interpolation of TGraph.
Class to create quintic natural splines to interpolate knots Arbitrary conditions can be introduced f...
std::istream & operator>>(std::istream &istr, BinaryTree &tree)
KDEKernel::EKernelIter fKDEiter
TString()
TString default ctor.
void SetKernelType(EKernelType ktype=kGauss)
fIter == 1 —> nonadaptive KDE fIter == 2 —> adaptive KDE
TString fInterpolateString
Double_t Sqrt(Double_t x)
virtual Double_t GetBinError(Int_t bin) const
Return value of error associated to bin number bin.
void FillSplineToHist()
creates high-binned reference histogram to be used instead of the PDF for speed reasons ...
double norm(double *x, double *p)
KDEKernel::EKernelBorder fKDEborder
KDEKernel::EKernelType fKDEtype
void FillHistToGraph()
Simple conversion.