133 fFitMethod ( kUseGeneticAlgorithm ),
134 fEffMethod ( kUseEventSelection ),
159 fVarHistS_smooth( 0 ),
160 fVarHistB_smooth( 0 ),
171 const TString& theWeightFile) :
173 fFitMethod ( kUseGeneticAlgorithm ),
174 fEffMethod ( kUseEventSelection ),
199 fVarHistS_smooth( 0 ),
200 fVarHistB_smooth( 0 ),
221 fVarHistS = fVarHistB = 0;
222 fVarHistS_smooth = fVarHistB_smooth = 0;
223 fVarPdfS = fVarPdfB = 0;
225 fBinaryTreeS = fBinaryTreeB = 0;
231 fRangeSign =
new std::vector<Int_t> ( GetNvar() );
232 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) (*fRangeSign)[ivar] = +1;
234 fMeanS =
new std::vector<Double_t>( GetNvar() );
235 fMeanB =
new std::vector<Double_t>( GetNvar() );
236 fRmsS =
new std::vector<Double_t>( GetNvar() );
237 fRmsB =
new std::vector<Double_t>( GetNvar() );
240 fFitParams =
new std::vector<EFitParameters>( GetNvar() );
241 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) (*fFitParams)[ivar] = kNotEnforced;
243 fFitMethod = kUseMonteCarlo;
249 for (
UInt_t i=0; i<GetNvar(); i++) {
255 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
256 for (
Int_t ibin=0; ibin<fNbins; ibin++) {
257 fCutMin[ivar][ibin] = 0;
258 fCutMax[ivar][ibin] = 0;
262 fTmpCutMin =
new Double_t[GetNvar()];
263 fTmpCutMax =
new Double_t[GetNvar()];
277 delete fEffBvsSLocal;
279 if (NULL != fCutRangeMin)
delete [] fCutRangeMin;
280 if (NULL != fCutRangeMax)
delete [] fCutRangeMax;
281 if (NULL != fAllVarsI)
delete [] fAllVarsI;
283 for (
UInt_t i=0;i<GetNvar();i++) {
284 if (NULL != fCutMin[i] )
delete [] fCutMin[i];
285 if (NULL != fCutMax[i] )
delete [] fCutMax[i];
286 if (NULL != fCutRange[i])
delete fCutRange[i];
289 if (NULL != fCutMin)
delete [] fCutMin;
290 if (NULL != fCutMax)
delete [] fCutMax;
292 if (NULL != fTmpCutMin)
delete [] fTmpCutMin;
293 if (NULL != fTmpCutMax)
delete [] fTmpCutMax;
295 if (NULL != fBinaryTreeS)
delete fBinaryTreeS;
296 if (NULL != fBinaryTreeB)
delete fBinaryTreeB;
320 DeclareOptionRef(fFitMethodS =
"GA",
"FitMethod",
"Minimisation Method (GA, SA, and MC are the primary methods to be used; the others have been introduced for testing purposes and are depreciated)");
324 AddPreDefVal(
TString(
"MCEvents"));
325 AddPreDefVal(
TString(
"MINUIT"));
326 AddPreDefVal(
TString(
"EventScan"));
329 DeclareOptionRef(fEffMethodS =
"EffSel",
"EffMethod",
"Selection Method");
330 AddPreDefVal(
TString(
"EffSel"));
331 AddPreDefVal(
TString(
"EffPDF"));
334 fCutRange.resize(GetNvar());
335 fCutRangeMin =
new Double_t[GetNvar()];
336 fCutRangeMax =
new Double_t[GetNvar()];
337 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
339 fCutRangeMin[ivar] = fCutRangeMax[ivar] = -1;
342 DeclareOptionRef( fCutRangeMin, GetNvar(),
"CutRangeMin",
"Minimum of allowed cut range (set per variable)" );
343 DeclareOptionRef( fCutRangeMax, GetNvar(),
"CutRangeMax",
"Maximum of allowed cut range (set per variable)" );
345 fAllVarsI =
new TString[GetNvar()];
347 for (
UInt_t i=0; i<GetNvar(); i++) fAllVarsI[i] =
"NotEnforced";
349 DeclareOptionRef(fAllVarsI, GetNvar(),
"VarProp",
"Categorisation of cuts");
350 AddPreDefVal(
TString(
"NotEnforced"));
353 AddPreDefVal(
TString(
"FSmart"));
364 if (IsNormalised()) {
365 Log() << kWARNING <<
"Normalisation of the input variables for cut optimisation is not" <<
Endl;
366 Log() << kWARNING <<
"supported because this provides intransparent cut values, and no" <<
Endl;
367 Log() << kWARNING <<
"improvement in the performance of the algorithm." <<
Endl;
368 Log() << kWARNING <<
"Please remove \"Normalise\" option from booking option string" <<
Endl;
369 Log() << kWARNING <<
"==> Will reset normalisation flag to \"False\"" <<
Endl;
373 if (IgnoreEventsWithNegWeightsInTraining()) {
374 Log() << kFATAL <<
"Mechanism to ignore events with negative weights in training not yet available for method: "
375 << GetMethodTypeName()
376 <<
" --> Please remove \"IgnoreNegWeightsInTraining\" option from booking string."
380 if (fFitMethodS ==
"MC" ) fFitMethod = kUseMonteCarlo;
381 else if (fFitMethodS ==
"MCEvents") fFitMethod = kUseMonteCarloEvents;
382 else if (fFitMethodS ==
"GA" ) fFitMethod = kUseGeneticAlgorithm;
383 else if (fFitMethodS ==
"SA" ) fFitMethod = kUseSimulatedAnnealing;
384 else if (fFitMethodS ==
"MINUIT" ) {
385 fFitMethod = kUseMinuit;
386 Log() << kWARNING <<
"poor performance of MINUIT in MethodCuts; preferred fit method: GA" <<
Endl;
388 else if (fFitMethodS ==
"EventScan" ) fFitMethod = kUseEventScan;
389 else Log() << kFATAL <<
"unknown minimisation method: " << fFitMethodS <<
Endl;
391 if (fEffMethodS ==
"EFFSEL" ) fEffMethod = kUseEventSelection;
392 else if (fEffMethodS ==
"EFFPDF" ) fEffMethod = kUsePDFs;
393 else fEffMethod = kUseEventSelection;
396 Log() << kINFO <<
Form(
"Use optimization method: \"%s\"",
397 (fFitMethod == kUseMonteCarlo) ?
"Monte Carlo" :
398 (fFitMethod == kUseMonteCarlo) ?
"Monte-Carlo-Event sampling" :
399 (fFitMethod == kUseEventScan) ?
"Full Event Scan (slow)" :
400 (fFitMethod == kUseMinuit) ?
"MINUIT" :
"Genetic Algorithm" ) <<
Endl;
401 Log() << kINFO <<
Form(
"Use efficiency computation method: \"%s\"",
402 (fEffMethod == kUseEventSelection) ?
"Event Selection" :
"PDF" ) <<
Endl;
405 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
406 fCutRange[ivar] =
new Interval( fCutRangeMin[ivar], fCutRangeMax[ivar] );
410 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
412 if (fAllVarsI[ivar] ==
"" || fAllVarsI[ivar] ==
"NotEnforced") theFitP = kNotEnforced;
413 else if (fAllVarsI[ivar] ==
"FMax" ) theFitP = kForceMax;
414 else if (fAllVarsI[ivar] ==
"FMin" ) theFitP = kForceMin;
415 else if (fAllVarsI[ivar] ==
"FSmart" ) theFitP = kForceSmart;
417 Log() << kFATAL <<
"unknown value \'" << fAllVarsI[ivar]
418 <<
"\' for fit parameter option " <<
Form(
"VarProp[%i]",ivar) <<
Endl;
420 (*fFitParams)[ivar] = theFitP;
422 if (theFitP != kNotEnforced)
423 Log() << kINFO <<
"Use \"" << fAllVarsI[ivar]
424 <<
"\" cuts for variable: " <<
"'" << (*fInputVars)[ivar] <<
"'" <<
Endl;
434 NoErrorCalc(err, errUpper);
437 if (fCutMin == NULL || fCutMax == NULL || fNbins == 0) {
438 Log() << kFATAL <<
"<Eval_Cuts> fCutMin/Max have zero pointer. "
439 <<
"Did you book Cuts ?" <<
Endl;
442 const Event* ev = GetEvent();
445 if (fTestSignalEff > 0) {
447 Int_t ibin = fEffBvsSLocal->FindBin( fTestSignalEff );
448 if (ibin < 0 ) ibin = 0;
449 else if (ibin >= fNbins) ibin = fNbins - 1;
452 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++)
453 passed &= ( (ev->
GetValue(ivar) > fCutMin[ivar][ibin]) &&
454 (ev->
GetValue(ivar) <= fCutMax[ivar][ibin]) );
456 return passed ? 1. : 0. ;
466 std::vector<Double_t> cutsMin;
467 std::vector<Double_t> cutsMax;
468 Int_t ibin = fEffBvsSLocal->FindBin( effS );
470 Double_t trueEffS = GetCuts( effS, cutsMin, cutsMax );
473 std::vector<TString>* varVec = 0;
474 if (GetTransformationHandler().GetNumOfTransformations() == 0) {
476 varVec =
new std::vector<TString>;
477 for (
UInt_t ivar=0; ivar<cutsMin.size(); ivar++) {
478 varVec->push_back( DataInfo().GetVariableInfo(ivar).GetLabel() );
481 else if (GetTransformationHandler().GetNumOfTransformations() == 1) {
483 varVec = GetTransformationHandler().GetTransformationStringsOfLastTransform();
487 varVec =
new std::vector<TString>;
488 for (
UInt_t ivar=0; ivar<cutsMin.size(); ivar++) {
489 varVec->push_back( DataInfo().GetVariableInfo(ivar).GetLabel() +
" [transformed]" );
494 for (
UInt_t ivar=0; ivar<cutsMin.size(); ivar++) {
495 if ((
UInt_t)(*varVec)[ivar].Length() > maxL) maxL = (*varVec)[ivar].Length();
497 UInt_t maxLine = 20+maxL+16;
499 for (
UInt_t i=0; i<maxLine; i++) Log() <<
"-";
501 Log() << kHEADER <<
"Cut values for requested signal efficiency: " << trueEffS <<
Endl;
502 Log() << kINFO <<
"Corresponding background efficiency : " << fEffBvsSLocal->GetBinContent( ibin ) <<
Endl;
503 if (GetTransformationHandler().GetNumOfTransformations() == 1) {
504 Log() << kINFO <<
"Transformation applied to input variables : \""
505 << GetTransformationHandler().GetNameOfLastTransform() <<
"\"" <<
Endl;
507 else if (GetTransformationHandler().GetNumOfTransformations() > 1) {
508 Log() << kINFO <<
"[ More than one (=" << GetTransformationHandler().GetNumOfTransformations() <<
") "
509 <<
" transformations applied in transformation chain; cuts applied on transformed quantities ] " <<
Endl;
512 Log() << kINFO <<
"Transformation applied to input variables : None" <<
Endl;
514 for (
UInt_t i=0; i<maxLine; i++) Log() <<
"-";
516 for (
UInt_t ivar=0; ivar<cutsMin.size(); ivar++) {
518 <<
"Cut[" << std::setw(2) << ivar <<
"]: "
519 << std::setw(10) << cutsMin[ivar]
521 << std::setw(maxL) << (*varVec)[ivar]
523 << std::setw(10) << cutsMax[ivar] <<
Endl;
525 for (
UInt_t i=0; i<maxLine; i++) Log() <<
"-";
537 std::vector<Double_t> cMin( GetNvar() );
538 std::vector<Double_t> cMax( GetNvar() );
539 Double_t trueEffS = GetCuts( effS, cMin, cMax );
540 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
541 cutMin[ivar] = cMin[ivar];
542 cutMax[ivar] = cMax[ivar];
551 std::vector<Double_t>& cutMin,
552 std::vector<Double_t>& cutMax )
const
555 Int_t ibin = fEffBvsSLocal->FindBin( effS );
558 Double_t trueEffS = fEffBvsSLocal->GetBinLowEdge( ibin );
561 if (ibin < 0 ) ibin = 0;
562 else if (ibin >= fNbins) ibin = fNbins - 1;
566 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
567 cutMin.push_back( fCutMin[ivar][ibin] );
568 cutMax.push_back( fCutMax[ivar][ibin] );
579 if (fEffMethod == kUsePDFs) CreateVariablePDFs();
582 if (fBinaryTreeS != 0) {
delete fBinaryTreeS; fBinaryTreeS = 0; }
583 if (fBinaryTreeB != 0) {
delete fBinaryTreeB; fBinaryTreeB = 0; }
592 fBinaryTreeB->Fill( GetEventCollection(
Types::kTraining), fBackgroundClass );
594 for (
UInt_t ivar =0; ivar < Data()->GetNVariables(); ivar++) {
611 if (
TMath::Abs(fCutRange[ivar]->GetMin() - fCutRange[ivar]->GetMax()) < 1.0e-300 ) {
612 fCutRange[ivar]->SetMin(
xmin );
613 fCutRange[ivar]->SetMax(
xmax );
615 else if (
xmin > fCutRange[ivar]->GetMin()) fCutRange[ivar]->SetMin(
xmin );
616 else if (
xmax < fCutRange[ivar]->GetMax()) fCutRange[ivar]->SetMax(
xmax );
619 std::vector<TH1F*> signalDist, bkgDist;
622 delete fEffBvsSLocal;
623 fEffBvsSLocal =
new TH1F( GetTestvarName() +
"_effBvsSLocal",
624 TString(GetName()) +
" efficiency of B vs S", fNbins, 0.0, 1.0 );
625 fEffBvsSLocal->SetDirectory(
nullptr);
628 for (
Int_t ibin=1; ibin<=fNbins; ibin++) fEffBvsSLocal->SetBinContent( ibin, -0.1 );
631 if (fFitMethod == kUseGeneticAlgorithm ||
632 fFitMethod == kUseMonteCarlo ||
633 fFitMethod == kUseMinuit ||
634 fFitMethod == kUseSimulatedAnnealing) {
637 std::vector<Interval*> ranges;
639 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
642 if (DataInfo().GetVariableInfo(ivar).GetVarType() ==
'I') {
643 nbins =
Int_t(fCutRange[ivar]->GetMax() - fCutRange[ivar]->GetMin()) + 1;
646 if ((*fFitParams)[ivar] == kForceSmart) {
647 if ((*fMeanS)[ivar] > (*fMeanB)[ivar]) (*fFitParams)[ivar] = kForceMax;
648 else (*fFitParams)[ivar] = kForceMin;
651 if ((*fFitParams)[ivar] == kForceMin) {
652 ranges.push_back(
new Interval( fCutRange[ivar]->GetMin(), fCutRange[ivar]->GetMin(), nbins ) );
653 ranges.push_back(
new Interval( 0, fCutRange[ivar]->GetMax() - fCutRange[ivar]->GetMin(), nbins ) );
655 else if ((*fFitParams)[ivar] == kForceMax) {
656 ranges.push_back(
new Interval( fCutRange[ivar]->GetMin(), fCutRange[ivar]->GetMax(), nbins ) );
657 ranges.push_back(
new Interval( fCutRange[ivar]->GetMax() - fCutRange[ivar]->GetMin(),
658 fCutRange[ivar]->GetMax() - fCutRange[ivar]->GetMin(), nbins ) );
661 ranges.push_back(
new Interval( fCutRange[ivar]->GetMin(), fCutRange[ivar]->GetMax(), nbins ) );
662 ranges.push_back(
new Interval( 0, fCutRange[ivar]->GetMax() - fCutRange[ivar]->GetMin(), nbins ) );
669 switch (fFitMethod) {
670 case kUseGeneticAlgorithm:
679 case kUseSimulatedAnnealing:
683 Log() << kFATAL <<
"Wrong fit method: " << fFitMethod <<
Endl;
692 for (
UInt_t ivar=0; ivar<ranges.size(); ivar++)
delete ranges[ivar];
697 else if (fFitMethod == kUseEventScan) {
699 Int_t nevents = Data()->GetNEvents();
703 Int_t nsamples =
Int_t(0.5*nevents*(nevents - 1));
704 Timer timer( nsamples, GetName() );
706 Log() << kINFO <<
"Running full event scan: " <<
Endl;
707 for (
Int_t ievt1=0; ievt1<nevents; ievt1++) {
708 for (
Int_t ievt2=ievt1+1; ievt2<nevents; ievt2++) {
710 EstimatorFunction( ievt1, ievt2 );
719 else if (fFitMethod == kUseMonteCarloEvents) {
721 Int_t nsamples = 200000;
723 DeclareOptionRef( nsamples,
"SampleSize",
"Number of Monte-Carlo-Event samples" );
724 DeclareOptionRef( seed,
"Seed",
"Seed for the random generator (0 takes random seeds)" );
727 Int_t nevents = Data()->GetNEvents();
731 Timer timer( nsamples, GetName() );
736 Log() << kINFO <<
"Running Monte-Carlo-Event sampling over " << nsamples <<
" events" <<
Endl;
737 std::vector<Double_t> pars( 2*GetNvar() );
739 for (
Int_t itoy=0; itoy<nsamples; itoy++) {
741 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
754 const Event *ev1 = GetEvent(ievt1);
755 isSignal = DataInfo().IsSignal(ev1);
758 const Event *ev2 = GetEvent(ievt2);
759 isSignal &= DataInfo().IsSignal(ev2);
762 if (nbreak++ > 10000) {
763 Log() << kFATAL <<
"<MCEvents>: could not find signal events"
764 <<
" after 10000 trials - do you have signal events in your sample ?"
771 if (evt1 > evt2) {
Double_t z = evt1; evt1 = evt2; evt2 = z; }
773 pars[2*ivar+1] = evt2 - evt1;
777 EstimatorFunction( pars );
787 else Log() << kFATAL <<
"Unknown minimisation method: " << fFitMethod <<
Endl;
789 if (fBinaryTreeS != 0) {
delete fBinaryTreeS; fBinaryTreeS = 0; }
790 if (fBinaryTreeB != 0) {
delete fBinaryTreeB; fBinaryTreeB = 0; }
793 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
794 for (
Int_t ibin=0; ibin<fNbins; ibin++) {
796 if ((*fFitParams)[ivar] == kForceMin && fCutMin[ivar][ibin] > -fgMaxAbsCutVal) {
797 fCutMin[ivar][ibin] = -fgMaxAbsCutVal;
799 if ((*fFitParams)[ivar] == kForceMax && fCutMax[ivar][ibin] < fgMaxAbsCutVal) {
800 fCutMax[ivar][ibin] = fgMaxAbsCutVal;
809 for (
Double_t eff=0.1; eff<0.95; eff += 0.1) PrintCuts( eff+epsilon );
825 const Event *ev1 = GetEvent(ievt1);
826 if (!DataInfo().IsSignal(ev1))
return -1;
828 const Event *ev2 = GetEvent(ievt2);
829 if (!DataInfo().IsSignal(ev2))
return -1;
831 const Int_t nvar = GetNvar();
835 for (
Int_t ivar=0; ivar<nvar; ivar++) {
841 std::vector<Double_t> pars;
842 for (
Int_t ivar=0; ivar<nvar; ivar++) {
845 if (evt1[ivar] < evt2[ivar]) {
854 pars.push_back( cutMin );
855 pars.push_back( cutMax - cutMin );
861 return ComputeEstimator( pars );
869 return ComputeEstimator( pars );
889 this->MatchParsToCuts( pars, &fTmpCutMin[0], &fTmpCutMax[0] );
892 switch (fEffMethod) {
894 this->GetEffsfromPDFs (&fTmpCutMin[0], &fTmpCutMax[0], effS, effB);
896 case kUseEventSelection:
897 this->GetEffsfromSelection (&fTmpCutMin[0], &fTmpCutMax[0], effS, effB);
900 this->GetEffsfromSelection (&fTmpCutMin[0], &fTmpCutMax[0], effS, effB);
911 Int_t ibinS = fEffBvsSLocal->FindBin( effS );
913 Double_t effBH = fEffBvsSLocal->GetBinContent( ibinS );
914 Double_t effBH_left = (ibinS > 1 ) ? fEffBvsSLocal->GetBinContent( ibinS-1 ) : effBH;
915 Double_t effBH_right = (ibinS < fNbins) ? fEffBvsSLocal->GetBinContent( ibinS+1 ) : effBH;
917 Double_t average = 0.5*(effBH_left + effBH_right);
918 if (effBH < effB) average = effBH;
922 eta = ( -
TMath::Abs(effBH-average) + (1.0 - (effBH - effB))) / (1.0 + effS);
929 if (effBH < 0 || effBH > effB) {
930 fEffBvsSLocal->SetBinContent( ibinS, effB );
931 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
932 fCutMin[ivar][ibinS-1] = fTmpCutMin[ivar];
933 fCutMax[ivar][ibinS-1] = fTmpCutMax[ivar];
947 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
948 diff=(fCutRange[ivar]->GetMax()-fTmpCutMax[ivar])/(fCutRange[ivar]->GetMax()-fCutRange[ivar]->GetMin());
950 diff=(fCutRange[ivar]->GetMin()-fTmpCutMin[ivar])/(fCutRange[ivar]->GetMax()-fCutRange[ivar]->GetMin());
951 penalty+=4.*diff*diff;
954 if (effS<1.e-4)
return 10.0+penalty;
955 else return 10.*(1.-10.*effS);
966 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
968 cutMin[ivar] = ((*fRangeSign)[ivar] > 0) ? pars[ipar] : pars[ipar] - pars[ipar+1];
969 cutMax[ivar] = ((*fRangeSign)[ivar] > 0) ? pars[ipar] + pars[ipar+1] : pars[ipar];
979 if (ibin < 1 || ibin > fNbins) Log() << kFATAL <<
"::MatchCutsToPars: bin error: "
982 const UInt_t nvar = GetNvar();
985 for (
UInt_t ivar=0; ivar<nvar; ivar++) {
986 cutMin[ivar] = cutMinAll[ivar][ibin-1];
987 cutMax[ivar] = cutMaxAll[ivar][ibin-1];
990 MatchCutsToPars( pars, cutMin, cutMax );
1001 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
1002 Int_t ipar = 2*ivar;
1003 pars[ipar] = ((*fRangeSign)[ivar] > 0) ? cutMin[ivar] : cutMax[ivar];
1004 pars[ipar+1] = cutMax[ivar] - cutMin[ivar];
1017 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
1018 effS *= (*fVarPdfS)[ivar]->GetIntegral( cutMin[ivar], cutMax[ivar] );
1019 effB *= (*fVarPdfB)[ivar]->GetIntegral( cutMin[ivar], cutMax[ivar] );
1025 if( !fNegEffWarning ) Log() << kWARNING <<
"Negative signal efficiency found and set to 0. This is probably due to many events with negative weights in a certain cut-region." <<
Endl;
1026 fNegEffWarning =
kTRUE;
1030 if( !fNegEffWarning ) Log() << kWARNING <<
"Negative background efficiency found and set to 0. This is probably due to many events with negative weights in a certain cut-region." <<
Endl;
1031 fNegEffWarning =
kTRUE;
1045 Volume* volume =
new Volume( cutMin, cutMax, GetNvar() );
1048 nSelS = fBinaryTreeS->SearchVolume( volume );
1049 nSelB = fBinaryTreeB->SearchVolume( volume );
1054 nTotS = fBinaryTreeS->GetSumOfWeights();
1055 nTotB = fBinaryTreeB->GetSumOfWeights();
1058 if (nTotS == 0 && nTotB == 0) {
1059 Log() << kFATAL <<
"<GetEffsfromSelection> fatal error in zero total number of events:"
1060 <<
" nTotS, nTotB: " << nTotS <<
" " << nTotB <<
" ***" <<
Endl;
1067 Log() << kWARNING <<
"<ComputeEstimator> zero number of signal events" <<
Endl;
1069 else if (nTotB == 0) {
1072 Log() << kWARNING <<
"<ComputeEstimator> zero number of background events" <<
Endl;
1082 if( !fNegEffWarning ) Log() << kWARNING <<
"Negative signal efficiency found and set to 0. This is probably due to many events with negative weights in a certain cut-region." <<
Endl;
1083 fNegEffWarning =
kTRUE;
1087 if( !fNegEffWarning ) Log() << kWARNING <<
"Negative background efficiency found and set to 0. This is probably due to many events with negative weights in a certain cut-region." <<
Endl;
1088 fNegEffWarning =
kTRUE;
1098 fVarHistS =
new std::vector<TH1*>( GetNvar() );
1099 fVarHistB =
new std::vector<TH1*>( GetNvar() );
1100 fVarHistS_smooth =
new std::vector<TH1*>( GetNvar() );
1101 fVarHistB_smooth =
new std::vector<TH1*>( GetNvar() );
1102 fVarPdfS =
new std::vector<PDF*>( GetNvar() );
1103 fVarPdfB =
new std::vector<PDF*>( GetNvar() );
1110 for(
UInt_t ievt=0; ievt<Data()->GetNEvents(); ievt++ ){
1111 const Event *ev = GetEvent(ievt);
1113 if( val > minVal ) minVal = val;
1114 if( val < maxVal ) maxVal = val;
1117 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
1120 TString histTitle = (*fInputVars)[ivar] +
" signal training";
1121 TString histName = (*fInputVars)[ivar] +
"_sig";
1132 (*fVarHistS)[ivar] =
new TH1F(histName.
Data(), histTitle.
Data(), fNbins, minVal, maxVal );
1135 histTitle = (*fInputVars)[ivar] +
" background training";
1136 histName = (*fInputVars)[ivar] +
"_bgd";
1147 (*fVarHistB)[ivar] =
new TH1F(histName.
Data(), histTitle.
Data(), fNbins, minVal, maxVal );
1149 for(
UInt_t ievt=0; ievt<Data()->GetNEvents(); ievt++ ){
1150 const Event *ev = GetEvent(ievt);
1152 if( DataInfo().IsSignal(ev) ){
1153 (*fVarHistS)[ivar]->Fill( val );
1155 (*fVarHistB)[ivar]->Fill( val );
1162 (*fVarHistS_smooth)[ivar] = (
TH1F*)(*fVarHistS)[ivar]->Clone();
1163 histTitle = (*fInputVars)[ivar] +
" signal training smoothed ";
1164 histTitle += nsmooth;
1165 histTitle +=
" times";
1166 histName = (*fInputVars)[ivar] +
"_sig_smooth";
1167 (*fVarHistS_smooth)[ivar]->SetName(histName);
1168 (*fVarHistS_smooth)[ivar]->SetTitle(histTitle);
1171 (*fVarHistS_smooth)[ivar]->Smooth(nsmooth);
1186 (*fVarHistB_smooth)[ivar] = (
TH1F*)(*fVarHistB)[ivar]->
Clone();
1187 histTitle = (*fInputVars)[ivar]+
" background training smoothed ";
1188 histTitle += nsmooth;
1189 histTitle +=
" times";
1190 histName = (*fInputVars)[ivar]+
"_bgd_smooth";
1191 (*fVarHistB_smooth)[ivar]->SetName(histName);
1192 (*fVarHistB_smooth)[ivar]->SetTitle(histTitle);
1195 (*fVarHistB_smooth)[ivar]->Smooth(nsmooth);
1198 (*fVarPdfS)[ivar] =
new PDF(
TString(GetName()) +
" PDF Var Sig " + GetInputVar( ivar ), (*fVarHistS_smooth)[ivar],
PDF::kSpline2 );
1199 (*fVarPdfB)[ivar] =
new PDF(
TString(GetName()) +
" PDF Var Bkg " + GetInputVar( ivar ), (*fVarHistB_smooth)[ivar],
PDF::kSpline2 );
1212 istr >> dummy >> dummy;
1214 istr >> dummy >> fNbins;
1217 istr >> dummy >> dummy >> dummy >> dummy >> dummy >> dummy >> dummyInt >> dummy ;
1220 if (dummyInt != Data()->GetNVariables()) {
1221 Log() << kFATAL <<
"<ReadWeightsFromStream> fatal error: mismatch "
1222 <<
"in number of variables: " << dummyInt <<
" != " << Data()->GetNVariables() <<
Endl;
1227 if (fFitMethod == kUseMonteCarlo) {
1228 Log() << kWARNING <<
"Read cuts optimised using sample of MC events" <<
Endl;
1230 else if (fFitMethod == kUseMonteCarloEvents) {
1231 Log() << kWARNING <<
"Read cuts optimised using sample of MC events" <<
Endl;
1233 else if (fFitMethod == kUseGeneticAlgorithm) {
1234 Log() << kINFO <<
"Read cuts optimised using Genetic Algorithm" <<
Endl;
1236 else if (fFitMethod == kUseSimulatedAnnealing) {
1237 Log() << kINFO <<
"Read cuts optimised using Simulated Annealing algorithm" <<
Endl;
1239 else if (fFitMethod == kUseEventScan) {
1240 Log() << kINFO <<
"Read cuts optimised using Full Event Scan" <<
Endl;
1243 Log() << kWARNING <<
"unknown method: " << fFitMethod <<
Endl;
1245 Log() << kINFO <<
"in " << fNbins <<
" signal efficiency bins and for " << GetNvar() <<
" variables" <<
Endl;
1249 istr.getline(buffer,200);
1250 istr.getline(buffer,200);
1254 if (fEffBvsSLocal != 0)
delete fEffBvsSLocal;
1255 fEffBvsSLocal =
new TH1F( GetTestvarName() +
"_effBvsSLocal",
1256 TString(GetName()) +
" efficiency of B vs S", fNbins, 0.0, 1.0 );
1257 fEffBvsSLocal->SetDirectory(
nullptr);
1259 for (
Int_t ibin=0; ibin<fNbins; ibin++) {
1260 istr >> tmpbin >> tmpeffS >> tmpeffB;
1261 fEffBvsSLocal->SetBinContent( ibin+1, tmpeffB );
1263 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
1264 istr >> fCutMin[ivar][ibin] >> fCutMax[ivar][ibin];
1268 fEffSMin = fEffBvsSLocal->GetBinCenter(1);
1269 fEffSMax = fEffBvsSLocal->GetBinCenter(fNbins);
1279 std::vector<Double_t> cutsMin;
1280 std::vector<Double_t> cutsMax;
1286 gTools().
AddComment( wght,
TString::Format(
"Below are the optimised cuts for %i variables: Format: ibin(hist) effS effB cutMin[ivar=0] cutMax[ivar=0] ... cutMin[ivar=n-1] cutMax[ivar=n-1]", GetNvar() ) );
1296 for (
Int_t ibin=0; ibin<fNbins; ibin++) {
1297 Double_t effS = fEffBvsSLocal->GetBinCenter ( ibin + 1 );
1298 Double_t trueEffS = GetCuts( effS, cutsMin, cutsMax );
1304 gTools().
AddAttr( binxml,
"effB", fEffBvsSLocal->GetBinContent( ibin + 1 ) );
1306 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
1319 for (
UInt_t i=0; i<GetNvar(); i++) {
1320 if (fCutMin[i] != 0)
delete [] fCutMin[i];
1321 if (fCutMax[i] != 0)
delete [] fCutMax[i];
1323 if (fCutMin != 0)
delete [] fCutMin;
1324 if (fCutMax != 0)
delete [] fCutMax;
1326 Int_t tmpEffMethod, tmpFitMethod;
1327 gTools().
ReadAttr( wghtnode,
"OptimisationMethod", tmpEffMethod );
1335 if (fFitMethod == kUseMonteCarlo) {
1336 Log() << kINFO <<
"Read cuts optimised using sample of MC events" <<
Endl;
1338 else if (fFitMethod == kUseMonteCarloEvents) {
1339 Log() << kINFO <<
"Read cuts optimised using sample of MC-Event events" <<
Endl;
1341 else if (fFitMethod == kUseGeneticAlgorithm) {
1342 Log() << kINFO <<
"Read cuts optimised using Genetic Algorithm" <<
Endl;
1344 else if (fFitMethod == kUseSimulatedAnnealing) {
1345 Log() << kINFO <<
"Read cuts optimised using Simulated Annealing algorithm" <<
Endl;
1347 else if (fFitMethod == kUseEventScan) {
1348 Log() << kINFO <<
"Read cuts optimised using Full Event Scan" <<
Endl;
1351 Log() << kWARNING <<
"unknown method: " << fFitMethod <<
Endl;
1353 Log() << kINFO <<
"Reading " << fNbins <<
" signal efficiency bins for " << GetNvar() <<
" variables" <<
Endl;
1355 delete fEffBvsSLocal;
1356 fEffBvsSLocal =
new TH1F( GetTestvarName() +
"_effBvsSLocal",
1357 TString(GetName()) +
" efficiency of B vs S", fNbins, 0.0, 1.0 );
1358 fEffBvsSLocal->SetDirectory(
nullptr);
1359 for (
Int_t ibin=1; ibin<=fNbins; ibin++) fEffBvsSLocal->SetBinContent( ibin, -0.1 );
1361 fCutMin =
new Double_t*[GetNvar()];
1362 fCutMax =
new Double_t*[GetNvar()];
1363 for (
UInt_t i=0;i<GetNvar();i++) {
1383 if (tmpbin-1 >= fNbins || tmpbin-1 < 0) {
1384 Log() << kFATAL <<
"Mismatch in bins: " << tmpbin-1 <<
" >= " << fNbins <<
Endl;
1387 fEffBvsSLocal->SetBinContent( tmpbin, tmpeffB );
1389 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
1402 Log() << kINFO <<
"Write monitoring histograms to file: " << BaseDir()->GetPath() <<
Endl;
1404 fEffBvsSLocal->
Write();
1407 if (fEffMethod == kUsePDFs) {
1408 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
1409 (*fVarHistS)[ivar]->Write();
1410 (*fVarHistB)[ivar]->Write();
1411 (*fVarHistS_smooth)[ivar]->Write();
1412 (*fVarHistB_smooth)[ivar]->Write();
1413 (*fVarPdfS)[ivar]->GetPDFHist()->Write();
1414 (*fVarPdfB)[ivar]->GetPDFHist()->Write();
1436 if (list->GetSize() != 2) {
1437 Log() << kFATAL <<
"<GetTrainingEfficiency> wrong number of arguments"
1438 <<
" in string: " << theString
1439 <<
" | required format, e.g., Efficiency:0.05" <<
Endl;
1452 if (results->
GetHist(
"EFF_BVSS_TR")==0) {
1454 if (fBinaryTreeS != 0) {
delete fBinaryTreeS; fBinaryTreeS = 0; }
1455 if (fBinaryTreeB != 0) {
delete fBinaryTreeB; fBinaryTreeB = 0; }
1460 fBinaryTreeB->Fill( GetEventCollection(
Types::kTraining), fBackgroundClass );
1468 TH1* eff_bvss_tr =
new TH1F( GetTestvarName() +
"_trainingEffBvsS", GetTestvarName() +
"", fNbins, 0, 1 );
1470 TH1* rej_bvss_tr =
new TH1F( GetTestvarName() +
"_trainingRejBvsS", GetTestvarName() +
"", fNbins, 0, 1 );
1472 results->
Store(eff_bvss_tr,
"EFF_BVSS_TR");
1473 results->
Store(rej_bvss_tr,
"REJ_BVSS_TR");
1480 Int_t nFailedBins=0;
1481 for (
Int_t bini=1; bini<=fNbins; bini++) {
1482 for (
UInt_t ivar=0; ivar <GetNvar(); ivar++){
1483 tmpCutMin[ivar] = fCutMin[ivar][bini-1];
1484 tmpCutMax[ivar] = fCutMax[ivar][bini-1];
1488 this->GetEffsfromSelection( &tmpCutMin[0], &tmpCutMax[0], effS, effB);
1491 if (effBin != bini){
1492 Log()<< kVERBOSE <<
"unable to fill efficiency bin " << bini<<
" " << effBin <<
Endl;
1501 if (nFailedBins>0) Log()<< kWARNING <<
" unable to fill "<< nFailedBins <<
" efficiency bins " <<
Endl;
1503 delete [] tmpCutMin;
1504 delete [] tmpCutMax;
1507 fSplTrainEffBvsS =
new TSpline1(
"trainEffBvsS",
new TGraph( eff_bvss_tr ) );
1511 if (NULL == fSplTrainEffBvsS)
return 0.0;
1514 Double_t effS = 0., effB, effS_ = 0., effB_ = 0.;
1515 Int_t nbins_ = 1000;
1518 for (
Int_t bini=1; bini<=nbins_; bini++) {
1520 effS = (bini - 0.5)/
Float_t(nbins_);
1521 effB = fSplTrainEffBvsS->Eval( effS );
1524 if ((effB - effBref)*(effB_ - effBref) < 0)
break;
1529 return 0.5*(effS + effS_);
1546 Data()->SetCurrentType(
type);
1553 if (list->GetSize() > 2) {
1555 Log() << kFATAL <<
"<GetEfficiency> wrong number of arguments"
1556 <<
" in string: " << theString
1557 <<
" | required format, e.g., Efficiency:0.05, or empty string" <<
Endl;
1562 Bool_t computeArea = (list->GetSize() < 2);
1566 Float_t effBref = (computeArea?1.:atof( ((
TObjString*)list->At(1))->GetString() ));
1572 if (results->
GetHist(
"MVA_EFF_BvsS")==0) {
1574 if (fBinaryTreeS!=0) {
delete fBinaryTreeS; fBinaryTreeS = 0; }
1575 if (fBinaryTreeB!=0) {
delete fBinaryTreeB; fBinaryTreeB = 0; }
1581 fBinaryTreeS->Fill( GetEventCollection(
Types::kTesting), fSignalClass );
1583 fBinaryTreeB->Fill( GetEventCollection(
Types::kTesting), fBackgroundClass );
1592 TH1* eff_BvsS =
new TH1F( GetTestvarName() +
"_effBvsS", GetTestvarName() +
"", fNbins, 0, 1 );
1594 TH1* rej_BvsS =
new TH1F( GetTestvarName() +
"_rejBvsS", GetTestvarName() +
"", fNbins, 0, 1 );
1596 results->
Store(eff_BvsS,
"MVA_EFF_BvsS");
1597 results->
Store(rej_BvsS);
1602 TH1* eff_s =
new TH1F( GetTestvarName() +
"_effS", GetTestvarName() +
" (signal)", fNbins,
xmin,
xmax);
1604 TH1* eff_b =
new TH1F( GetTestvarName() +
"_effB", GetTestvarName() +
" (background)", fNbins,
xmin,
xmax);
1606 results->
Store(eff_s,
"MVA_S");
1607 results->
Store(eff_b,
"MVA_B");
1617 for (
Int_t bini=1; bini<=fNbins; bini++) {
1618 for (
UInt_t ivar=0; ivar <GetNvar(); ivar++) {
1619 tmpCutMin[ivar] = fCutMin[ivar][bini-1];
1620 tmpCutMax[ivar] = fCutMax[ivar][bini-1];
1624 this->GetEffsfromSelection( &tmpCutMin[0], &tmpCutMax[0], effS, effB);
1625 tmpBvsS->
SetPoint(bini, effS, effB);
1630 tmpBvsS->
SetPoint(fNbins+1, 1., 1.);
1632 delete [] tmpCutMin;
1633 delete [] tmpCutMax;
1636 fSpleffBvsS =
new TSpline1(
"effBvsS", tmpBvsS );
1637 for (
Int_t bini=1; bini<=fNbins; bini++) {
1639 Double_t effB = fSpleffBvsS->Eval( effS );
1646 if (NULL == fSpleffBvsS)
return 0.0;
1649 Double_t effS = 0, effB = 0, effS_ = 0, effB_ = 0;
1650 Int_t nbins_ = 1000;
1656 for (
Int_t bini=1; bini<=nbins_; bini++) {
1659 effS = (bini - 0.5)/
Float_t(nbins_);
1660 effB = fSpleffBvsS->Eval( effS );
1661 integral += (1.0 - effB);
1670 for (
Int_t bini=1; bini<=nbins_; bini++) {
1672 effS = (bini - 0.5)/
Float_t(nbins_);
1673 effB = fSpleffBvsS->Eval( effS );
1676 if ((effB - effBref)*(effB_ - effBref) < 0)
break;
1681 effS = 0.5*(effS + effS_);
1683 if (Data()->GetNEvtSigTest() > 0)
1698 fout <<
" // not implemented for class: \"" << className <<
"\"" << std::endl;
1699 fout <<
"};" << std::endl;
1717 Log() <<
"The optimisation of rectangular cuts performed by TMVA maximises " <<
Endl;
1718 Log() <<
"the background rejection at given signal efficiency, and scans " <<
Endl;
1719 Log() <<
"over the full range of the latter quantity. Three optimisation" <<
Endl;
1720 Log() <<
"methods are optional: Monte Carlo sampling (MC), a Genetics" <<
Endl;
1721 Log() <<
"Algorithm (GA), and Simulated Annealing (SA). GA and SA are" <<
Endl;
1722 Log() <<
"expected to perform best." <<
Endl;
1724 Log() <<
"The difficulty to find the optimal cuts strongly increases with" <<
Endl;
1725 Log() <<
"the dimensionality (number of input variables) of the problem." <<
Endl;
1726 Log() <<
"This behavior is due to the non-uniqueness of the solution space."<<
Endl;
1730 Log() <<
"If the dimensionality exceeds, say, 4 input variables, it is " <<
Endl;
1731 Log() <<
"advisable to scrutinize the separation power of the variables," <<
Endl;
1732 Log() <<
"and to remove the weakest ones. If some among the input variables" <<
Endl;
1733 Log() <<
"can be described by a single cut (e.g., because signal tends to be" <<
Endl;
1734 Log() <<
"larger than background), this can be indicated to MethodCuts via" <<
Endl;
1735 Log() <<
"the \"Fsmart\" options (see option string). Choosing this option" <<
Endl;
1736 Log() <<
"reduces the number of requirements for the variable from 2 (min/max)" <<
Endl;
1737 Log() <<
"to a single one (TMVA finds out whether it is to be interpreted as" <<
Endl;
1738 Log() <<
"min or max)." <<
Endl;
1741 Log() <<
"" <<
Endl;
1742 Log() << bold <<
"Monte Carlo sampling:" << resbold <<
Endl;
1743 Log() <<
"" <<
Endl;
1744 Log() <<
"Apart form the \"Fsmart\" option for the variables, the only way" <<
Endl;
1745 Log() <<
"to improve the MC sampling is to increase the sampling rate. This" <<
Endl;
1746 Log() <<
"is done via the configuration option \"MC_NRandCuts\". The execution" <<
Endl;
1747 Log() <<
"time scales linearly with the sampling rate." <<
Endl;
1748 Log() <<
"" <<
Endl;
1749 Log() << bold <<
"Genetic Algorithm:" << resbold <<
Endl;
1750 Log() <<
"" <<
Endl;
1751 Log() <<
"The algorithm terminates if no significant fitness increase has" <<
Endl;
1752 Log() <<
"been achieved within the last \"nsteps\" steps of the calculation." <<
Endl;
1753 Log() <<
"Wiggles in the ROC curve or constant background rejection of 1" <<
Endl;
1754 Log() <<
"indicate that the GA failed to always converge at the true maximum" <<
Endl;
1755 Log() <<
"fitness. In such a case, it is recommended to broaden the search " <<
Endl;
1756 Log() <<
"by increasing the population size (\"popSize\") and to give the GA " <<
Endl;
1757 Log() <<
"more time to find improvements by increasing the number of steps" <<
Endl;
1758 Log() <<
"(\"nsteps\")" <<
Endl;
1759 Log() <<
" -> increase \"popSize\" (at least >10 * number of variables)" <<
Endl;
1760 Log() <<
" -> increase \"nsteps\"" <<
Endl;
1761 Log() <<
"" <<
Endl;
1762 Log() << bold <<
"Simulated Annealing (SA) algorithm:" << resbold <<
Endl;
1763 Log() <<
"" <<
Endl;
1764 Log() <<
"\"Increasing Adaptive\" approach:" <<
Endl;
1765 Log() <<
"" <<
Endl;
1766 Log() <<
"The algorithm seeks local minima and explores their neighborhoods, while" <<
Endl;
1767 Log() <<
"changing the ambient temperature depending on the number of failures" <<
Endl;
1768 Log() <<
"in the previous steps. The performance can be improved by increasing" <<
Endl;
1769 Log() <<
"the number of iteration steps (\"MaxCalls\"), or by adjusting the" <<
Endl;
1770 Log() <<
"minimal temperature (\"MinTemperature\"). Manual adjustments of the" <<
Endl;
1771 Log() <<
"speed of the temperature increase (\"TemperatureScale\" and \"AdaptiveSpeed\")" <<
Endl;
1772 Log() <<
"to individual data sets should also help. Summary:" << brk <<
Endl;
1773 Log() <<
" -> increase \"MaxCalls\"" << brk <<
Endl;
1774 Log() <<
" -> adjust \"MinTemperature\"" << brk <<
Endl;
1775 Log() <<
" -> adjust \"TemperatureScale\"" << brk <<
Endl;
1776 Log() <<
" -> adjust \"AdaptiveSpeed\"" <<
Endl;
1777 Log() <<
"" <<
Endl;
1778 Log() <<
"\"Decreasing Adaptive\" approach:" <<
Endl;
1779 Log() <<
"" <<
Endl;
1780 Log() <<
"The algorithm calculates the initial temperature (based on the effect-" <<
Endl;
1781 Log() <<
"iveness of large steps) and the multiplier that ensures to reach the" <<
Endl;
1782 Log() <<
"minimal temperature with the requested number of iteration steps." <<
Endl;
1783 Log() <<
"The performance can be improved by adjusting the minimal temperature" <<
Endl;
1784 Log() <<
" (\"MinTemperature\") and by increasing number of steps (\"MaxCalls\"):" << brk <<
Endl;
1785 Log() <<
" -> increase \"MaxCalls\"" << brk <<
Endl;
1786 Log() <<
" -> adjust \"MinTemperature\"" <<
Endl;
1787 Log() <<
" " <<
Endl;
1788 Log() <<
"Other kernels:" <<
Endl;
1789 Log() <<
"" <<
Endl;
1790 Log() <<
"Alternative ways of counting the temperature change are implemented. " <<
Endl;
1791 Log() <<
"Each of them starts with the maximum temperature (\"MaxTemperature\")" <<
Endl;
1792 Log() <<
"and decreases while changing the temperature according to a given" <<
Endl;
1793 Log() <<
"prescription:" << brk <<
Endl;
1794 Log() <<
"CurrentTemperature =" << brk <<
Endl;
1795 Log() <<
" - Sqrt: InitialTemperature / Sqrt(StepNumber+2) * TemperatureScale" << brk <<
Endl;
1796 Log() <<
" - Log: InitialTemperature / Log(StepNumber+2) * TemperatureScale" << brk <<
Endl;
1797 Log() <<
" - Homo: InitialTemperature / (StepNumber+2) * TemperatureScale" << brk <<
Endl;
1798 Log() <<
" - Sin: (Sin(StepNumber / TemperatureScale) + 1) / (StepNumber + 1)*InitialTemperature + Eps" << brk <<
Endl;
1799 Log() <<
" - Geo: CurrentTemperature * TemperatureScale" <<
Endl;
1800 Log() <<
"" <<
Endl;
1801 Log() <<
"Their performance can be improved by adjusting initial temperature" <<
Endl;
1802 Log() <<
"(\"InitialTemperature\"), the number of iteration steps (\"MaxCalls\")," <<
Endl;
1803 Log() <<
"and the multiplier that scales the temperature decrease" <<
Endl;
1804 Log() <<
"(\"TemperatureScale\")" << brk <<
Endl;
1805 Log() <<
" -> increase \"MaxCalls\"" << brk <<
Endl;
1806 Log() <<
" -> adjust \"InitialTemperature\"" << brk <<
Endl;
1807 Log() <<
" -> adjust \"TemperatureScale\"" << brk <<
Endl;
1808 Log() <<
" -> adjust \"KernelTemperature\"" <<
Endl;
#define REGISTER_METHOD(CLASS)
for example
int Int_t
Signed integer 4 bytes (int)
float Float_t
Float 4 bytes (float)
double Double_t
Double 8 bytes.
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 Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
virtual Int_t FindBin(Double_t x)
Find bin number corresponding to abscissa x.
A TGraph is an object made of two arrays X and Y with npoints each.
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
1-D histogram with a float per channel (see TH1 documentation)
TH1 is the base class of all histogram classes in ROOT.
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...
A simple Binary search tree including a volume search method.
Bool_t WriteOptionsReference() const
void CheckForUnusedOptions() const
checks for unused options in option string
Class that contains all the data information.
Float_t GetValue(UInt_t ivar) const
return value of i'th variable
Base class for TMVA fitters.
Double_t Run()
estimator function interface for fitting
Fitter using a Genetic Algorithm.
The TMVA::Interval Class.
Fitter using Monte Carlo sampling of parameters.
Virtual base Class for all MVA method.
Double_t EstimatorFunction(std::vector< Double_t > &) override
returns estimator for "cut fitness" used by GA
Double_t ComputeEstimator(std::vector< Double_t > &)
returns estimator for "cut fitness" used by GA.
void MakeClassSpecific(std::ostream &, const TString &) const override
write specific classifier response
void AddWeightsXMLTo(void *parent) const override
create XML description for LD classification and regression (for arbitrary number of output classes/t...
void DeclareOptions() override
define the options (their key words) that can be set in the option string.
void Train(void) override
training method: here the cuts are optimised for the training sample
void MatchCutsToPars(std::vector< Double_t > &, Double_t *, Double_t *)
translates cuts into parameters
Double_t GetTrainingEfficiency(const TString &) override
Overloaded function to create background efficiency (rejection) versus signal efficiency plot (first ...
void ProcessOptions() override
process user options.
static const Double_t fgMaxAbsCutVal
Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets) override
Cuts can only handle classification with 2 classes.
void CreateVariablePDFs(void)
for PDF method: create efficiency reference histograms and PDFs
void ReadWeightsFromStream(std::istream &i) override
read the cuts from stream
void GetEffsfromSelection(Double_t *cutMin, Double_t *cutMax, Double_t &effS, Double_t &effB)
compute signal and background efficiencies from event counting for given cut sample
void TestClassification() override
nothing to test
void WriteMonitoringHistosToFile(void) const override
write histograms and PDFs to file for monitoring purposes
void MatchParsToCuts(const std::vector< Double_t > &, Double_t *, Double_t *)
translates parameters into cuts
virtual ~MethodCuts(void)
destructor
Double_t GetEfficiency(const TString &, Types::ETreeType, Double_t &) override
Overloaded function to create background efficiency (rejection) versus signal efficiency plot (first ...
void Init(void) override
default initialisation called by all constructors
Double_t GetMvaValue(Double_t *err=nullptr, Double_t *errUpper=nullptr) override
cut evaluation: returns 1.0 if event passed, 0.0 otherwise
void ReadWeightsFromXML(void *wghtnode) override
read coefficients from xml weight file
void GetHelpMessage() const override
get help message text
void GetEffsfromPDFs(Double_t *cutMin, Double_t *cutMax, Double_t &effS, Double_t &effB)
compute signal and background efficiencies from PDFs for given cut sample
Double_t GetCuts(Double_t effS, std::vector< Double_t > &cutMin, std::vector< Double_t > &cutMax) const
retrieve cut values for given signal efficiency
void PrintCuts(Double_t effS) const
print cuts
PDF wrapper for histograms; uses user-defined spline interpolation.
Class that is the base-class for a vector of result.
void Store(TObject *obj, const char *alias=nullptr)
TH1 * GetHist(const TString &alias) const
Fitter using a Simulated Annealing Algorithm.
Linear interpolation of TGraph.
Timing information for training and evaluation of MVA methods.
void DrawProgressBar(Int_t, const TString &comment="")
draws progress bar in color or B&W caution:
Singleton class for Global types used by TMVA.
@ kSignal
Never change this number - it is elsewhere assumed to be zero !
Volume for BinarySearchTree.
Collectable string class.
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
Random number generator class based on M.
virtual Double_t Uniform(Double_t x1=1)
Returns a uniform deviate on the interval (0, x1).
const char * Data() const
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
void Clone(Ssiz_t nc)
Make self a distinct copy with capacity of at least tot, where tot cannot be smaller than the current...
MsgLogger & Endl(MsgLogger &ml)
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
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.