77 fInterpolMethod(
PDF::kSpline2 ),
84 fHistAvgEvtPerBin ( 0 ),
85 fHistDefinedNBins ( 0 ),
88 fBorderMethodString( 0 ),
89 fInterpolateString ( 0 ),
117 fMinNsmooth ( minnsmooth ),
118 fMaxNsmooth ( maxnsmooth ),
120 fInterpolMethod( method ),
127 fHistAvgEvtPerBin ( 0 ),
128 fHistDefinedNBins ( 0 ),
129 fKDEtypeString ( 0 ),
130 fKDEiterString ( 0 ),
131 fBorderMethodString( 0 ),
132 fInterpolateString ( 0 ),
137 fReadingVersion( 0 ),
138 fCheckHist ( checkHist ),
164 fInterpolMethod(
PDF::kKDE ),
171 fHistAvgEvtPerBin ( 0 ),
172 fHistDefinedNBins ( 0 ),
173 fKDEtypeString ( 0 ),
174 fKDEiterString ( 0 ),
175 fBorderMethodString( 0 ),
176 fInterpolateString ( 0 ),
179 fKDEborder ( kborder ),
180 fFineFactor ( FineFactor),
181 fReadingVersion( 0 ),
205 fInterpolMethod(
PDF::kSpline0 ),
212 fHistAvgEvtPerBin ( 50 ),
213 fHistDefinedNBins ( 0 ),
214 fKDEtypeString (
"Gauss" ),
215 fKDEiterString (
"Nonadaptive" ),
216 fBorderMethodString(
"None" ),
217 fInterpolateString (
"Spline2" ),
222 fReadingVersion( 0 ),
229 if (defaultPDF != 0) {
249 if (fSpline != NULL)
delete fSpline;
250 if (fHist != NULL)
delete fHist;
251 if (fPDFHist != NULL)
delete fPDFHist;
252 if (fHistOriginal != NULL)
delete fHistOriginal;
253 if (fIGetVal != NULL)
delete fIGetVal;
254 if (fGraph != NULL)
delete fGraph;
262 GetThisPdfThreadLocal() =
this;
264 if (hist == NULL) Log() << kFATAL <<
"Called without valid histogram pointer!" <<
Endl;
268 Log() << kFATAL <<
"Number of entries <= 0 (" << hist->
GetEntries() <<
" in histogram: " << hist->
GetTitle() <<
")" <<
Endl;
271 Log()<< kDEBUG <<
"Create "
275 <<
"type KDE kernel for histogram: \"" << hist->
GetName() <<
"\""
281 Log() << kFATAL <<
"PDF construction called with minnsmooth<0" <<
Endl;
282 else if (fMaxNsmooth<=0)
283 fMaxNsmooth = fMinNsmooth;
284 else if (fMaxNsmooth<fMinNsmooth)
285 Log() << kFATAL <<
"PDF construction called with maxnsmooth<minnsmooth" <<
Endl;
290 fHistOriginal->SetTitle( fHistOriginal->GetName() );
291 fHist ->SetTitle( fHist->GetName() );
294 fHistOriginal->SetDirectory(
nullptr);
295 fHist ->SetDirectory(
nullptr);
298 if (fInterpolMethod ==
PDF::kKDE) BuildKDEPDF();
299 else BuildSplinePDF();
307 if (evtNum == 0 && fHistDefinedNBins == 0)
308 Log() << kFATAL <<
"No number of bins set for PDF" <<
Endl;
309 else if (fHistDefinedNBins > 0)
310 return fHistDefinedNBins * ResolutionFactor;
311 else if ( evtNum > 0 && fHistAvgEvtPerBin > 0 )
312 return evtNum / fHistAvgEvtPerBin * ResolutionFactor;
314 Log() << kFATAL <<
"No number of bins or average event per bin set for PDF" << fHistAvgEvtPerBin <<
Endl;
324 if (fInterpolMethod !=
PDF::kSpline0 && fCheckHist) CheckHist();
327 if (fMaxNsmooth > 0 && fMinNsmooth >=0 ) SmoothHistogram();
333 switch (fInterpolMethod) {
338 fUseHistogram =
kTRUE;
358 Log() << kWARNING <<
"No valid interpolation method given! Use Spline2" <<
Endl;
360 Log() << kFATAL <<
" Well.. .thinking about it, I better quit so you notice you are forced to fix the mistake " <<
Endl;
366 if (!UseHistogram()) {
367 fSpline->SetTitle( (
TString)fHist->GetTitle() + fSpline->GetTitle() );
368 fSpline->SetName ( (
TString)fHist->GetName() + fSpline->GetName() );
374 if (integral < 0) Log() << kFATAL <<
"Integral: " << integral <<
" <= 0" <<
Endl;
378 if (integral>0) fPDFHist->Scale( 1.0/integral );
380 fPDFHist->SetDirectory(
nullptr);
389 fPDFHist =
new TH1F(
"",
"", fgNbin_PdfHist, GetXmin(), GetXmax() );
390 fPDFHist->SetTitle( (
TString)fHist->GetTitle() +
"_hist from_KDE" );
391 fPDFHist->SetName ( (
TString)fHist->GetName() +
"_hist_from_KDE" );
394 Float_t histoLowEdge = fHist->GetBinLowEdge(1);
395 Float_t histoUpperEdge = fPDFHist->GetBinLowEdge(fPDFHist->GetNbinsX()) + fPDFHist->GetBinWidth(fPDFHist->GetNbinsX());
397 fHist, histoLowEdge, histoUpperEdge,
398 fKDEborder, fFineFactor );
401 for (
Int_t i=1;i<fHist->GetNbinsX();i++) {
403 for (
Int_t j=1;j<fPDFHist->GetNbinsX();j++) {
405 fPDFHist->AddBinContent(j,fHist->GetBinContent(i)*
407 fPDFHist->GetBinLowEdge(j+1),
408 fHist->GetBinCenter(i),
412 if (fKDEborder == 3) {
416 if (i < fHist->GetNbinsX()/5 ) {
417 for (
Int_t j=1;j<fPDFHist->GetNbinsX();j++) {
419 fPDFHist->AddBinContent(j,fHist->GetBinContent(i)*
421 fPDFHist->GetBinLowEdge(j+1),
422 2*histoLowEdge-fHist->GetBinCenter(i),
427 if (i > 4*fHist->GetNbinsX()/5) {
428 for (
Int_t j=1;j<fPDFHist->GetNbinsX();j++) {
430 fPDFHist->AddBinContent( j,fHist->GetBinContent(i)*
432 fPDFHist->GetBinLowEdge(j+1),
433 2*histoUpperEdge-fHist->GetBinCenter(i), i) );
439 fPDFHist->SetEntries(fHist->GetEntries());
445 if (integral < 0) Log() << kFATAL <<
"Integral: " << integral <<
" <= 0" <<
Endl;
449 if (integral>0) fPDFHist->Scale( 1.0/integral );
450 fPDFHist->SetDirectory(
nullptr);
457 if(fHist->GetNbinsX()==1)
return;
458 if (fMaxNsmooth == fMinNsmooth) {
459 fHist->Smooth( fMinNsmooth );
465 Float_t Err=0, ErrAvg=0, ErrRMS=0 ;
Int_t num=0, smooth;
466 for (
Int_t bin=0; bin<fHist->GetNbinsX(); bin++) {
467 if (fHist->GetBinContent(bin+1) <= fHist->GetBinError(bin+1))
continue;
468 Err = fHist->GetBinError(bin+1) / fHist->GetBinContent(bin+1);
469 ErrAvg += Err; ErrRMS += Err*Err; num++;
475 Float_t MaxErr=ErrAvg+ErrRMS, MinErr=ErrAvg-ErrRMS;
476 fNSmoothHist =
new TH1I(
"",
"",fHist->GetNbinsX(),0,fHist->GetNbinsX());
477 fNSmoothHist->SetTitle( (
TString)fHist->GetTitle() +
"_Nsmooth" );
478 fNSmoothHist->SetName ( (
TString)fHist->GetName() +
"_Nsmooth" );
479 for (
Int_t bin=0; bin<fHist->GetNbinsX(); bin++) {
480 if (fHist->GetBinContent(bin+1) <= fHist->GetBinError(bin+1))
483 Err = fHist->GetBinError(bin+1) / fHist->GetBinContent(bin+1);
484 smooth=(
Int_t)((Err-MinErr) /(MaxErr-MinErr) * (fMaxNsmooth-fMinNsmooth)) + fMinNsmooth;
487 fNSmoothHist->SetBinContent(bin+1,smooth);
492 for (
Int_t n=fMaxNsmooth;
n>=0;
n--) {
494 if (
n <= fMinNsmooth) { fHist->Smooth();
continue; }
495 Int_t MinBin=-1,MaxBin =-1;
496 for (
Int_t bin=0; bin < fHist->GetNbinsX(); bin++) {
497 if (fNSmoothHist->GetBinContent(bin+1) >=
n) {
498 if (MinBin==-1) MinBin = bin;
501 else if (MaxBin >= 0) {
502 fHist->Smooth(1,
"R");
525 if (UseHistogram()) {
527 fPDFHist = (
TH1*)fHist->Clone();
528 fPDFHist->SetTitle( (
TString)fHist->GetTitle() +
"_hist from_spline0" );
529 fPDFHist->SetName ( (
TString)fHist->GetName() +
"_hist_from_spline0" );
533 fPDFHist =
new TH1F(
"",
"", fgNbin_PdfHist, GetXmin(), GetXmax() );
534 fPDFHist->SetTitle( (
TString)fHist->GetTitle() +
"_hist from_" + fSpline->GetTitle() );
535 fPDFHist->SetName ( (
TString)fHist->GetName() +
"_hist_from_" + fSpline->GetTitle() );
537 for (
Int_t bin=1; bin <= fgNbin_PdfHist; bin++) {
538 Double_t x = fPDFHist->GetBinCenter( bin );
543 if (
y <= fgEpsilon)
y = fHist->GetBinContent( fHist->FindBin(
x ) );
544 fPDFHist->SetBinContent( bin,
TMath::Max(
y, fgEpsilon) );
547 fPDFHist->SetDirectory(
nullptr);
556 Log() << kFATAL <<
"<CheckHist> Called without valid histogram pointer!" <<
Endl;
559 Int_t nbins = fHist->GetNbinsX();
563 for (
Int_t bin=1; bin<=nbins; bin++)
564 if (fHist->GetBinContent(bin) == 0) emptyBins++;
567 Log() << kWARNING <<
"More than 50% (" << (((
Float_t)emptyBins/(
Float_t)nbins)*100)
568 <<
"%) of the bins in hist '"
569 << fHist->GetName() <<
"' are empty!" <<
Endl;
570 Log() << kWARNING <<
"X_min=" << GetXmin()
571 <<
" mean=" << fHist->GetMean() <<
" X_max= " << GetXmax() <<
Endl;
581 if (!originalHist) originalHist = fHistOriginal;
596 for (
Int_t bin=1; bin<=nbins; bin++) {
601 Int_t binPdfHist = fPDFHist->FindBin(
x );
602 if (binPdfHist<0)
continue;
606 originalHist->
GetBinWidth( bin )/fPDFHist->GetBinWidth( binPdfHist ) );
614 if (
d > 1) { nc1++;
if (
d > 2) { nc2++;
if (
d > 3) { nc3++;
if (
d > 6) nc6++; } } }
618 Log() << kDEBUG <<
"Validation result for PDF \"" << originalHist->
GetTitle() <<
"\"" <<
": " <<
Endl;
619 Log() << kDEBUG <<
TString::Format(
" chi2/ndof(!=0) = %.1f/%i = %.2f (Prob = %.2f)",
621 if ((1.0 -
TMath::Prob( chi2, ndof )) > 0.9999994) {
622 Log() << kDEBUG <<
"Comparison of the original histogram \"" << originalHist->
GetTitle() <<
"\"" <<
Endl;
623 Log() << kDEBUG <<
"with the corresponding PDF gave a chi2/ndof of " << chi2/ndof <<
"," <<
Endl;
624 Log() << kDEBUG <<
"which corresponds to a deviation of more than 5 sigma! Please check!" <<
Endl;
626 Log() << kDEBUG <<
TString::Format(
" #bins-found(#expected-bins) deviating > [1,2,3,6] sigmas: " \
627 "[%i(%i),%i(%i),%i(%i),%i(%i)]",
637 Double_t integral = fPDFHist->GetSumOfWeights();
638 integral *= GetPdfHistBinWidth();
648 return ThisPDF()->GetVal(
x[0] );
658 if (fgManualIntegration) {
663 if (imin < 1) imin = 1;
664 if (imax > fPDFHist->GetNbinsX()) imax = fPDFHist->GetNbinsX();
666 for (
Int_t bini = imin; bini <= imax; bini++) {
667 Float_t dx = fPDFHist->GetBinWidth(bini);
669 if (bini == imin) dx = fPDFHist->GetBinLowEdge(bini+1) -
xmin;
670 else if (bini == imax) dx =
xmax - fPDFHist->GetBinLowEdge(bini);
671 if (dx < 0 && dx > -1.0e-8) dx = 0;
674 <<
"dx = " << dx << std::endl
675 <<
"bini = " << bini << std::endl
676 <<
"xmin = " <<
xmin << std::endl
677 <<
"xmax = " <<
xmax << std::endl
678 <<
"imin = " << imin << std::endl
679 <<
"imax = " << imax << std::endl
680 <<
"low edge of imin" << fPDFHist->GetBinLowEdge(imin) << std::endl
681 <<
"low edge of imin+1" << fPDFHist->GetBinLowEdge(imin+1) <<
Endl;
682 Log() << kFATAL <<
"<GetIntegral> dx = " << dx <<
" < 0" <<
Endl;
684 integral += fPDFHist->GetBinContent(bini)*dx;
691 if (fIGetVal == 0) fIGetVal =
new TF1(
"IGetVal",
PDF::IGetVal, GetXmin(), GetXmax(), 0 );
692 integral = fIGetVal->Integral(
xmin,
xmax );
704 Int_t bin = fPDFHist->FindBin(
x);
710 if (UseHistogram()) {
712 retval = fPDFHist->GetBinContent( bin );
717 if ((
x > fPDFHist->GetBinCenter(bin) && bin != fPDFHist->GetNbinsX()) || bin == 1)
723 Double_t dx = fPDFHist->GetBinCenter( bin ) - fPDFHist->GetBinCenter( nextbin );
724 Double_t dy = fPDFHist->GetBinContent( bin ) - fPDFHist->GetBinContent( nextbin );
725 retval = fPDFHist->GetBinContent( bin ) + (
x - fPDFHist->GetBinCenter( bin ))*dy/dx;
736 Int_t lowerBin=0, higherBin=0;
737 Double_t lowerBinValue=0, higherBinValue=0;
738 FindBinInverse(fPDFHist,lowerBin,higherBin,lowerBinValue,higherBinValue,
y,isMonotonouslyIncreasingFunction);
740 Double_t xValueLowerBin =fPDFHist->GetBinCenter (lowerBin);
741 Double_t xValueHigherBin=fPDFHist->GetBinCenter (higherBin);
746 fraction=(
y-lowerBinValue)/
length;
748 Double_t lengthX =xValueHigherBin-xValueLowerBin;
749 Double_t x =xValueLowerBin+lengthX*fraction;
764 if (isMonotonouslyIncreasingFunction) {
768 Int_t bin=higherBin/2;
770 while (bin>lowerBin && bin<higherBin) {
775 higherBinValue=binContent;
777 else if (
y>=binContent){
779 lowerBinValue =binContent;
781 bin=lowerBin+(higherBin-lowerBin)/2;
786 for (
Int_t bin=0, binEnd=histogram->
GetNbinsX(); bin<binEnd; ++bin) {
791 lowerBinValue =binContent;
792 higherBinValue=binContent;
796 higherBinValue=binContent;
822 DeclareOptionRef( fNsmooth,
TString::Format(
"NSmooth%s",fSuffix.Data()),
823 "Number of smoothing iterations for the input histograms" );
824 DeclareOptionRef( fMinNsmooth,
TString::Format(
"MinNSmooth%s",fSuffix.Data()),
825 "Min number of smoothing iterations, for bins with most data" );
827 DeclareOptionRef( fMaxNsmooth,
TString::Format(
"MaxNSmooth%s",fSuffix.Data()),
828 "Max number of smoothing iterations, for bins with least data" );
830 DeclareOptionRef( fHistAvgEvtPerBin,
TString::Format(
"NAvEvtPerBin%s",fSuffix.Data()),
831 "Average number of events per PDF bin" );
833 DeclareOptionRef( fHistDefinedNBins,
TString::Format(
"Nbins%s",fSuffix.Data()),
834 "Defined number of bins for the histogram from which the PDF is created" );
836 DeclareOptionRef( fCheckHist,
TString::Format(
"CheckHist%s",fSuffix.Data()),
837 "Whether or not to check the source histogram of the PDF" );
839 DeclareOptionRef( fInterpolateString,
TString::Format(
"PDFInterpol%s",fSuffix.Data()),
840 "Interpolation method for reference histograms (e.g. Spline2 or KDE)" );
841 AddPreDefVal(
TString(
"Spline0"));
842 AddPreDefVal(
TString(
"Spline1"));
843 AddPreDefVal(
TString(
"Spline2"));
844 AddPreDefVal(
TString(
"Spline3"));
845 AddPreDefVal(
TString(
"Spline5"));
848 DeclareOptionRef( fKDEtypeString,
TString::Format(
"KDEtype%s",fSuffix.Data()),
"KDE kernel type (1=Gauss)" );
849 AddPreDefVal(
TString(
"Gauss"));
851 DeclareOptionRef( fKDEiterString,
TString::Format(
"KDEiter%s",fSuffix.Data()),
"Number of iterations (1=non-adaptive, 2=adaptive)" );
852 AddPreDefVal(
TString(
"Nonadaptive"));
853 AddPreDefVal(
TString(
"Adaptive"));
855 DeclareOptionRef( fFineFactor ,
TString::Format(
"KDEFineFactor%s",fSuffix.Data()),
856 "Fine tuning factor for Adaptive KDE: Factor to multiply the width of the kernel");
858 DeclareOptionRef( fBorderMethodString,
TString::Format(
"KDEborder%s",fSuffix.Data()),
859 "Border effects treatment (1=no treatment , 2=kernel renormalization, 3=sample mirroring)" );
861 AddPreDefVal(
TString(
"Renorm"));
862 AddPreDefVal(
TString(
"Mirror"));
864 SetConfigName( GetName() );
865 SetConfigDescription(
"Configuration options for the PDF class" );
872 if (fNsmooth < 0) fNsmooth = 0;
874 if (fMaxNsmooth < 0 || fMinNsmooth < 0) {
875 fMinNsmooth = fMaxNsmooth = fNsmooth;
878 if (fMaxNsmooth < fMinNsmooth && fMinNsmooth >= 0) {
879 Log() << kFATAL <<
"ERROR: MaxNsmooth = "
880 << fMaxNsmooth <<
" < MinNsmooth = " << fMinNsmooth <<
Endl;
883 if (fMaxNsmooth < 0 || fMinNsmooth < 0) {
884 Log() << kFATAL <<
"ERROR: MaxNsmooth = "
885 << fMaxNsmooth <<
" or MinNsmooth = " << fMinNsmooth <<
" smaller than zero" <<
Endl;
894 else if (fInterpolateString ==
"KDE" ) fInterpolMethod =
TMVA::PDF::kKDE;
895 else if (fInterpolateString !=
"" ) {
896 Log() << kFATAL <<
"unknown setting for option 'InterpolateMethod': " << fKDEtypeString << ((fSuffix==
"")?
"":
Form(
" for pdf with suffix %s",fSuffix.Data())) <<
Endl;
901 else if (fKDEtypeString !=
"" )
902 Log() << kFATAL <<
"unknown setting for option 'KDEtype': " << fKDEtypeString << ((fSuffix==
"")?
"":
Form(
" for pdf with suffix %s",fSuffix.Data())) <<
Endl;
905 else if (fKDEiterString !=
"" )
906 Log() << kFATAL <<
"unknown setting for option 'KDEiter': " << fKDEtypeString << ((fSuffix==
"")?
"":
Form(
" for pdf with suffix %s",fSuffix.Data())) <<
Endl;
911 else if ( fKDEiterString !=
"" ) {
912 Log() << kFATAL <<
"unknown setting for option 'KDEBorder': " << fKDEtypeString << ((fSuffix==
"")?
"":
Form(
" for pdf with suffix %s",fSuffix.Data())) <<
Endl;
925 gTools().
AddAttr(pdfxml,
"InterpolMethod", fInterpolMethod );
931 TH1* histToWrite = GetOriginalHist();
937 gTools().
AddAttr(pdfhist,
"HasEquidistantBins", hasEquidistantBinning );
946 if (!hasEquidistantBinning) {
947 void* pdfhistbins =
gTools().
AddChild(pdfxml,
"HistogramBinning" );
976 Bool_t hasEquidistantBinning;
983 gTools().
ReadAttr( histch,
"HasEquidistantBins", hasEquidistantBinning );
987 if (hasEquidistantBinning) {
991 std::stringstream s(content);
993 for (
UInt_t i=0; i<nbins; i++) {
1000 std::stringstream s(content);
1006 if (nbinning != nbins) {
1007 Log() << kFATAL <<
"Number of bins in content and binning array differs"<<
Endl;
1010 std::stringstream sb(binString);
1011 for (
UInt_t i=0; i<=nbins; i++) sb >> binns[i];
1014 for (
UInt_t i=0; i<nbins; i++) {
1021 hnameSmooth.
ReplaceAll(
"_original",
"_smoothed" );
1023 if (fHistOriginal != 0)
delete fHistOriginal;
1024 fHistOriginal = newhist;
1025 fHist = (
TH1F*)fHistOriginal->
Clone( hnameSmooth );
1026 fHist->SetTitle( hnameSmooth );
1027 fHist->SetDirectory(
nullptr);
1029 if (fInterpolMethod ==
PDF::kKDE) BuildKDEPDF();
1030 else BuildSplinePDF();
1038 Int_t dp = os.precision();
1039 os <<
"MinNSmooth " << pdf.
fMinNsmooth << std::endl;
1040 os <<
"MaxNSmooth " << pdf.
fMaxNsmooth << std::endl;
1042 os <<
"KDE_type " << pdf.
fKDEtype << std::endl;
1043 os <<
"KDE_iter " << pdf.
fKDEiter << std::endl;
1044 os <<
"KDE_border " << pdf.
fKDEborder << std::endl;
1045 os <<
"KDE_finefactor " << pdf.
fFineFactor << std::endl;
1060 os <<
"Weights " << std::endl;
1061 os << std::setprecision(8);
1062 for (
Int_t i=0; i<nBins; i++) {
1063 os << std::setw(15) << std::left << histToWrite->
GetBinContent(i+1) << std::right <<
" ";
1064 if ((i+1)%5==0) os << std::endl;
1067 os << std::setprecision(dp);
1082 while (!doneReading) {
1084 if (devnullS==
"NSmooth")
1085 {istr >> pdf.fMinNsmooth; pdf.fMaxNsmooth=pdf.fMinNsmooth;}
1086 else if (devnullS==
"MinNSmooth") istr >> pdf.fMinNsmooth;
1087 else if (devnullS==
"MaxNSmooth") istr >> pdf.fMaxNsmooth;
1093 else if (devnullS ==
"KDE_finefactor") {
1094 istr >> pdf.fFineFactor;
1095 if (pdf.GetReadingVersion() != 0 && pdf.GetReadingVersion() <
TMVA_VERSION(3,7,3)) {
1098 doneReading =
kTRUE;
1101 else if (devnullS ==
"Histogram") { istr >> hname >> nbins >>
xmin >>
xmax; }
1102 else if (devnullS ==
"Weights") { doneReading =
kTRUE; }
1106 hnameSmooth.
ReplaceAll(
"_original",
"_smoothed" );
1110 std::cout <<
"PDF, trying to create a histogram without defined binning"<< std::endl;
1116 for (
Int_t i=0; i<nbins; i++) {
1121 if (pdf.fHistOriginal != 0)
delete pdf.fHistOriginal;
1122 pdf.fHistOriginal = newhist;
1123 pdf.fHist = (
TH1F*)pdf.fHistOriginal->
Clone( hnameSmooth );
1124 pdf.fHist->SetTitle( hnameSmooth );
1125 pdf.fHist->SetDirectory(
nullptr);
1127 if (pdf.fMinNsmooth>=0) pdf.BuildSplinePDF();
1139 return GetThisPdfThreadLocal();
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h length
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
#define TMVA_VERSION(a, b, c)
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
A TGraph is an object made of two arrays X and Y with npoints each.
1-D histogram with a float per channel (see TH1 documentation)}
1-D histogram with an int per channel (see TH1 documentation)}
TH1 is the base class of all histogram classes in ROOT.
virtual void SetDirectory(TDirectory *dir)
By default, when a histogram is created, it is added to the list of histogram objects in the current ...
virtual Double_t GetBinCenter(Int_t bin) const
Return bin center for 1D histogram.
virtual Double_t GetBinError(Int_t bin) const
Return value of error associated to bin number bin.
virtual Int_t GetNbinsX() 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...
virtual Double_t GetEntries() const
Return the current number of entries.
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
virtual TArrayD * GetSumw2()
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width for 1D histogram.
TObject * Clone(const char *newname="") const override
Make a complete copy of the underlying object.
virtual Double_t GetSumOfWeights() const
Return the sum of weights excluding under/overflows.
virtual void Sumw2(Bool_t flag=kTRUE)
Create structure to store sum of squares of weights.
KDE Kernel for "smoothing" the PDFs.
void SetKernelType(EKernelType ktype=kGauss)
fIter == 1 —> nonadaptive KDE fIter == 2 —> adaptive KDE
Float_t GetBinKernelIntegral(Float_t lowr, Float_t highr, Float_t mean, Int_t binnum)
calculates the integral of the Kernel
ostringstream derivative to redirect and format output
PDF wrapper for histograms; uses user-defined spline interpolation.
static const Bool_t fgManualIntegration
manual integration (sum over bins) or DGAUSS
KDEKernel::EKernelType fKDEtype
Kernel type to use for KDE.
void FillHistToGraph()
Simple conversion.
void BuildPDF(const TH1 *theHist)
KDEKernel::EKernelBorder fKDEborder
The method to take care about "border" effects (string)
static Double_t IGetVal(Double_t *, Double_t *)
static external auxiliary function (integrand)
TString fBorderMethodString
Int_t fMaxNsmooth
Max number of smoothing iterations.
void ValidatePDF(TH1 *original=nullptr) const
comparison of original histogram with reference PDF
TMVA::PDF::EInterpolateMethod fInterpolMethod
interpolation method
Double_t GetValInverse(Double_t y, Bool_t isMonotonouslyIncreasingFunction=kFALSE) const
returns value
void CheckHist() const
sanity check: compare PDF with original histogram
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
Int_t fHistDefinedNBins
source hist bin num set by user
void ReadXML(void *pdfnode)
XML file reading.
TString fInterpolateString
Int_t fNsmooth
Min number of smoothing iterations.
void DeclareOptions()
define the options (their key words) that can be set in the option string
void AddXMLTo(void *parent)
XML file writing.
void BuildSplinePDF()
build the PDF from the original histograms
void FillSplineToHist()
creates high-binned reference histogram to be used instead of the PDF for speed reasons
void BuildKDEPDF()
creates high-binned reference histogram to be used instead of the PDF for speed reasons
Int_t fMinNsmooth
Min number of smoothing iterations.
Int_t GetHistNBins(Int_t evtNum=0)
static const Double_t fgEpsilon
minimum PDF return
TH1 * GetOriginalHist() const
Float_t fFineFactor
fine tuning factor for Adaptive KDE
static PDF *& GetThisPdfThreadLocal()
Double_t GetVal(Double_t x) const
returns value PDF(x)
Int_t fHistAvgEvtPerBin
avg event per source hist bin
Double_t GetIntegral() const
computes normalisation
Bool_t fCheckHist
check of source histogram
MsgLogger * fLogger
! message logger
TString fKDEtypeString
strings used to read definitions
static const Int_t fgNbin_PdfHist
number of bins in high-binned reference histogram
PDF(const TString &name, Bool_t norm=kTRUE)
default constructor needed for ROOT I/O
KDEKernel::EKernelIter fKDEiter
Number of iterations (adaptive or not)
static PDF * ThisPDF(void)
Linear interpolation of TGraph.
Quadratic interpolation of TGraph.
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
Class to create third splines to interpolate knots Arbitrary conditions can be introduced for first a...
Class to create quintic natural splines to interpolate knots Arbitrary conditions can be introduced f...
TString & ReplaceAll(const TString &s1, const TString &s2)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Element * GetMatrixArray()
std::istream & operator>>(std::istream &istr, BinaryTree &tree)
std::ostream & operator<<(std::ostream &os, const BinaryTree &tree)
MsgLogger & Endl(MsgLogger &ml)
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
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...
Double_t Sqrt(Double_t x)
Returns the square root of x.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.