138 const
Double_t TMVA::MethodCuts::fgMaxAbsCutVal = 1.0e30;
148 fFitMethod ( kUseGeneticAlgorithm ),
149 fEffMethod ( kUseEventSelection ),
174 fVarHistS_smooth( 0 ),
175 fVarHistB_smooth( 0 ),
186 const TString& theWeightFile) :
188 fFitMethod ( kUseGeneticAlgorithm ),
189 fEffMethod ( kUseEventSelection ),
214 fVarHistS_smooth( 0 ),
215 fVarHistB_smooth( 0 ),
236 fVarHistS = fVarHistB = 0;
237 fVarHistS_smooth = fVarHistB_smooth = 0;
238 fVarPdfS = fVarPdfB = 0;
240 fBinaryTreeS = fBinaryTreeB = 0;
246 fRangeSign =
new std::vector<Int_t> ( GetNvar() );
247 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) (*fRangeSign)[ivar] = +1;
249 fMeanS =
new std::vector<Double_t>( GetNvar() );
250 fMeanB =
new std::vector<Double_t>( GetNvar() );
251 fRmsS =
new std::vector<Double_t>( GetNvar() );
252 fRmsB =
new std::vector<Double_t>( GetNvar() );
255 fFitParams =
new std::vector<EFitParameters>( GetNvar() );
256 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) (*fFitParams)[ivar] = kNotEnforced;
258 fFitMethod = kUseMonteCarlo;
264 for (
UInt_t i=0; i<GetNvar(); i++) {
270 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
271 for (
Int_t ibin=0; ibin<fNbins; ibin++) {
272 fCutMin[ivar][ibin] = 0;
273 fCutMax[ivar][ibin] = 0;
277 fTmpCutMin =
new Double_t[GetNvar()];
278 fTmpCutMax =
new Double_t[GetNvar()];
292 delete fEffBvsSLocal;
294 if (
NULL != fCutRangeMin)
delete [] fCutRangeMin;
295 if (
NULL != fCutRangeMax)
delete [] fCutRangeMax;
296 if (
NULL != fAllVarsI)
delete [] fAllVarsI;
298 for (
UInt_t i=0;i<GetNvar();i++) {
299 if (
NULL != fCutMin[i] )
delete [] fCutMin[i];
300 if (
NULL != fCutMax[i] )
delete [] fCutMax[i];
301 if (
NULL != fCutRange[i])
delete fCutRange[i];
304 if (
NULL != fCutMin)
delete [] fCutMin;
305 if (
NULL != fCutMax)
delete [] fCutMax;
307 if (
NULL != fTmpCutMin)
delete [] fTmpCutMin;
308 if (
NULL != fTmpCutMax)
delete [] fTmpCutMax;
310 if (
NULL != fBinaryTreeS)
delete fBinaryTreeS;
311 if (
NULL != fBinaryTreeB)
delete fBinaryTreeB;
334 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)");
338 AddPreDefVal(
TString(
"MCEvents"));
339 AddPreDefVal(
TString(
"MINUIT"));
340 AddPreDefVal(
TString(
"EventScan"));
343 DeclareOptionRef(fEffMethodS =
"EffSel",
"EffMethod",
"Selection Method");
344 AddPreDefVal(
TString(
"EffSel"));
345 AddPreDefVal(
TString(
"EffPDF"));
348 fCutRange.resize(GetNvar());
349 fCutRangeMin =
new Double_t[GetNvar()];
350 fCutRangeMax =
new Double_t[GetNvar()];
351 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
353 fCutRangeMin[ivar] = fCutRangeMax[ivar] = -1;
356 DeclareOptionRef( fCutRangeMin, GetNvar(),
"CutRangeMin",
"Minimum of allowed cut range (set per variable)" );
357 DeclareOptionRef( fCutRangeMax, GetNvar(),
"CutRangeMax",
"Maximum of allowed cut range (set per variable)" );
359 fAllVarsI =
new TString[GetNvar()];
361 for (
UInt_t i=0; i<GetNvar(); i++) fAllVarsI[i] =
"NotEnforced";
363 DeclareOptionRef(fAllVarsI, GetNvar(),
"VarProp",
"Categorisation of cuts");
364 AddPreDefVal(
TString(
"NotEnforced"));
367 AddPreDefVal(
TString(
"FSmart"));
377 if (IsNormalised()) {
378 Log() <<
kWARNING <<
"Normalisation of the input variables for cut optimisation is not" <<
Endl;
379 Log() <<
kWARNING <<
"supported because this provides intransparent cut values, and no" <<
Endl;
380 Log() <<
kWARNING <<
"improvement in the performance of the algorithm." <<
Endl;
381 Log() <<
kWARNING <<
"Please remove \"Normalise\" option from booking option string" <<
Endl;
382 Log() <<
kWARNING <<
"==> Will reset normalisation flag to \"False\"" <<
Endl;
386 if (IgnoreEventsWithNegWeightsInTraining()) {
387 Log() <<
kFATAL <<
"Mechanism to ignore events with negative weights in training not yet available for method: "
388 << GetMethodTypeName()
389 <<
" --> Please remove \"IgnoreNegWeightsInTraining\" option from booking string."
393 if (fFitMethodS ==
"MC" ) fFitMethod = kUseMonteCarlo;
394 else if (fFitMethodS ==
"MCEvents") fFitMethod = kUseMonteCarloEvents;
395 else if (fFitMethodS ==
"GA" ) fFitMethod = kUseGeneticAlgorithm;
396 else if (fFitMethodS ==
"SA" ) fFitMethod = kUseSimulatedAnnealing;
397 else if (fFitMethodS ==
"MINUIT" ) {
398 fFitMethod = kUseMinuit;
399 Log() <<
kWARNING <<
"poor performance of MINUIT in MethodCuts; preferred fit method: GA" <<
Endl;
401 else if (fFitMethodS ==
"EventScan" ) fFitMethod = kUseEventScan;
402 else Log() <<
kFATAL <<
"unknown minimisation method: " << fFitMethodS <<
Endl;
404 if (fEffMethodS ==
"EFFSEL" ) fEffMethod = kUseEventSelection;
405 else if (fEffMethodS ==
"EFFPDF" ) fEffMethod = kUsePDFs;
406 else fEffMethod = kUseEventSelection;
409 Log() <<
kINFO <<
Form(
"Use optimization method: \"%s\"",
410 (fFitMethod == kUseMonteCarlo) ?
"Monte Carlo" :
411 (fFitMethod == kUseMonteCarlo) ?
"Monte-Carlo-Event sampling" :
412 (fFitMethod == kUseEventScan) ?
"Full Event Scan (slow)" :
413 (fFitMethod == kUseMinuit) ?
"MINUIT" :
"Genetic Algorithm" ) <<
Endl;
414 Log() <<
kINFO <<
Form(
"Use efficiency computation method: \"%s\"",
415 (fEffMethod == kUseEventSelection) ?
"Event Selection" :
"PDF" ) <<
Endl;
418 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
419 fCutRange[ivar] =
new Interval( fCutRangeMin[ivar], fCutRangeMax[ivar] );
423 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
425 if (fAllVarsI[ivar] ==
"" || fAllVarsI[ivar] ==
"NotEnforced") theFitP = kNotEnforced;
426 else if (fAllVarsI[ivar] ==
"FMax" ) theFitP = kForceMax;
427 else if (fAllVarsI[ivar] ==
"FMin" ) theFitP = kForceMin;
428 else if (fAllVarsI[ivar] ==
"FSmart" ) theFitP = kForceSmart;
430 Log() <<
kFATAL <<
"unknown value \'" << fAllVarsI[ivar]
431 <<
"\' for fit parameter option " <<
Form(
"VarProp[%i]",ivar) <<
Endl;
433 (*fFitParams)[ivar] = theFitP;
435 if (theFitP != kNotEnforced)
436 Log() <<
kINFO <<
"Use \"" << fAllVarsI[ivar]
437 <<
"\" cuts for variable: " <<
"'" << (*fInputVars)[ivar] <<
"'" <<
Endl;
447 NoErrorCalc(err, errUpper);
450 if (fCutMin ==
NULL || fCutMax ==
NULL || fNbins == 0) {
451 Log() <<
kFATAL <<
"<Eval_Cuts> fCutMin/Max have zero pointer. "
452 <<
"Did you book Cuts ?" <<
Endl;
455 const Event* ev = GetEvent();
458 if (fTestSignalEff > 0) {
460 Int_t ibin = fEffBvsSLocal->FindBin( fTestSignalEff );
461 if (ibin < 0 ) ibin = 0;
462 else if (ibin >= fNbins) ibin = fNbins - 1;
465 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++)
466 passed &= ( (ev->
GetValue(ivar) > fCutMin[ivar][ibin]) &&
467 (ev->
GetValue(ivar) <= fCutMax[ivar][ibin]) );
469 return passed ? 1. : 0. ;
479 std::vector<Double_t> cutsMin;
480 std::vector<Double_t> cutsMax;
481 Int_t ibin = fEffBvsSLocal->FindBin( effS );
483 Double_t trueEffS = GetCuts( effS, cutsMin, cutsMax );
486 std::vector<TString>* varVec = 0;
487 if (GetTransformationHandler().GetNumOfTransformations() == 0) {
489 varVec =
new std::vector<TString>;
490 for (
UInt_t ivar=0; ivar<cutsMin.size(); ivar++) {
491 varVec->push_back( DataInfo().GetVariableInfo(ivar).GetLabel() );
494 else if (GetTransformationHandler().GetNumOfTransformations() == 1) {
496 varVec = GetTransformationHandler().GetTransformationStringsOfLastTransform();
500 varVec =
new std::vector<TString>;
501 for (
UInt_t ivar=0; ivar<cutsMin.size(); ivar++) {
502 varVec->push_back( DataInfo().GetVariableInfo(ivar).GetLabel() +
" [transformed]" );
507 for (
UInt_t ivar=0; ivar<cutsMin.size(); ivar++) {
508 if ((
UInt_t)(*varVec)[ivar].Length() > maxL) maxL = (*varVec)[ivar].Length();
510 UInt_t maxLine = 20+maxL+16;
512 for (
UInt_t i=0; i<maxLine; i++)
Log() <<
"-";
514 Log() <<
kHEADER <<
"Cut values for requested signal efficiency: " << trueEffS <<
Endl;
515 Log() <<
kINFO <<
"Corresponding background efficiency : " << fEffBvsSLocal->GetBinContent( ibin ) <<
Endl;
516 if (GetTransformationHandler().GetNumOfTransformations() == 1) {
517 Log() <<
kINFO <<
"Transformation applied to input variables : \""
518 << GetTransformationHandler().GetNameOfLastTransform() <<
"\"" <<
Endl;
520 else if (GetTransformationHandler().GetNumOfTransformations() > 1) {
521 Log() <<
kINFO <<
"[ More than one (=" << GetTransformationHandler().GetNumOfTransformations() <<
") "
522 <<
" transformations applied in transformation chain; cuts applied on transformed quantities ] " <<
Endl;
525 Log() <<
kINFO <<
"Transformation applied to input variables : None" <<
Endl;
527 for (
UInt_t i=0; i<maxLine; i++)
Log() <<
"-";
529 for (
UInt_t ivar=0; ivar<cutsMin.size(); ivar++) {
531 <<
"Cut[" << std::setw(2) << ivar <<
"]: "
532 << std::setw(10) << cutsMin[ivar]
534 << std::setw(maxL) << (*varVec)[ivar]
536 << std::setw(10) << cutsMax[ivar] <<
Endl;
538 for (
UInt_t i=0; i<maxLine; i++)
Log() <<
"-";
550 std::vector<Double_t> cMin( GetNvar() );
551 std::vector<Double_t> cMax( GetNvar() );
552 Double_t trueEffS = GetCuts( effS, cMin, cMax );
553 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
554 cutMin[ivar] = cMin[ivar];
555 cutMax[ivar] = cMax[ivar];
564 std::vector<Double_t>& cutMin,
565 std::vector<Double_t>& cutMax )
const
568 Int_t ibin = fEffBvsSLocal->FindBin( effS );
571 Double_t trueEffS = fEffBvsSLocal->GetBinLowEdge( ibin );
574 if (ibin < 0 ) ibin = 0;
575 else if (ibin >= fNbins) ibin = fNbins - 1;
579 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
580 cutMin.push_back( fCutMin[ivar][ibin] );
581 cutMax.push_back( fCutMax[ivar][ibin] );
592 if (fEffMethod == kUsePDFs) CreateVariablePDFs();
595 if (fBinaryTreeS != 0) {
delete fBinaryTreeS; fBinaryTreeS = 0; }
596 if (fBinaryTreeB != 0) {
delete fBinaryTreeB; fBinaryTreeB = 0; }
605 fBinaryTreeB->Fill( GetEventCollection(
Types::kTraining), fBackgroundClass );
607 for (
UInt_t ivar =0; ivar <
Data()->GetNVariables(); ivar++) {
624 if (
TMath::Abs(fCutRange[ivar]->GetMin() - fCutRange[ivar]->GetMax()) < 1.0
e-300 ) {
625 fCutRange[ivar]->SetMin( xmin );
626 fCutRange[ivar]->SetMax( xmax );
628 else if (xmin > fCutRange[ivar]->GetMin()) fCutRange[ivar]->SetMin( xmin );
629 else if (xmax < fCutRange[ivar]->GetMax()) fCutRange[ivar]->SetMax( xmax );
632 std::vector<TH1F*> signalDist, bkgDist;
635 delete fEffBvsSLocal;
636 fEffBvsSLocal =
new TH1F( GetTestvarName() +
"_effBvsSLocal",
638 fEffBvsSLocal->SetDirectory(0);
641 for (
Int_t ibin=1; ibin<=fNbins; ibin++) fEffBvsSLocal->SetBinContent( ibin, -0.1 );
644 if (fFitMethod == kUseGeneticAlgorithm ||
645 fFitMethod == kUseMonteCarlo ||
646 fFitMethod == kUseMinuit ||
647 fFitMethod == kUseSimulatedAnnealing) {
650 std::vector<Interval*> ranges;
652 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
655 if (DataInfo().GetVariableInfo(ivar).GetVarType() ==
'I') {
656 nbins =
Int_t(fCutRange[ivar]->GetMax() - fCutRange[ivar]->GetMin()) + 1;
659 if ((*fFitParams)[ivar] == kForceSmart) {
660 if ((*fMeanS)[ivar] > (*fMeanB)[ivar]) (*fFitParams)[ivar] = kForceMax;
661 else (*fFitParams)[ivar] = kForceMin;
664 if ((*fFitParams)[ivar] == kForceMin) {
665 ranges.push_back(
new Interval( fCutRange[ivar]->GetMin(), fCutRange[ivar]->GetMin(), nbins ) );
666 ranges.push_back(
new Interval( 0, fCutRange[ivar]->GetMax() - fCutRange[ivar]->GetMin(), nbins ) );
668 else if ((*fFitParams)[ivar] == kForceMax) {
669 ranges.push_back(
new Interval( fCutRange[ivar]->GetMin(), fCutRange[ivar]->GetMax(), nbins ) );
670 ranges.push_back(
new Interval( fCutRange[ivar]->GetMax() - fCutRange[ivar]->GetMin(),
671 fCutRange[ivar]->GetMax() - fCutRange[ivar]->GetMin(), nbins ) );
674 ranges.push_back(
new Interval( fCutRange[ivar]->GetMin(), fCutRange[ivar]->GetMax(), nbins ) );
675 ranges.push_back(
new Interval( 0, fCutRange[ivar]->GetMax() - fCutRange[ivar]->GetMin(), nbins ) );
682 switch (fFitMethod) {
683 case kUseGeneticAlgorithm:
692 case kUseSimulatedAnnealing:
696 Log() <<
kFATAL <<
"Wrong fit method: " << fFitMethod <<
Endl;
707 for (
UInt_t ivar=0; ivar<ranges.size(); ivar++)
delete ranges[ivar];
712 else if (fFitMethod == kUseEventScan) {
718 Int_t nsamples =
Int_t(0.5*nevents*(nevents - 1));
720 fIPyMaxIter = nsamples;
723 for (
Int_t ievt1=0; ievt1<nevents; ievt1++) {
724 for (
Int_t ievt2=ievt1+1; ievt2<nevents; ievt2++) {
726 fIPyCurrentIter = ic;
727 if (fExitFromTraining)
break;
728 EstimatorFunction( ievt1, ievt2 );
737 else if (fFitMethod == kUseMonteCarloEvents) {
739 Int_t nsamples = 200000;
741 DeclareOptionRef( nsamples,
"SampleSize",
"Number of Monte-Carlo-Event samples" );
742 DeclareOptionRef( seed,
"Seed",
"Seed for the random generator (0 takes random seeds)" );
750 fIPyMaxIter = nsamples;
755 Log() <<
kINFO <<
"Running Monte-Carlo-Event sampling over " << nsamples <<
" events" <<
Endl;
756 std::vector<Double_t> pars( 2*GetNvar() );
758 for (
Int_t itoy=0; itoy<nsamples; itoy++) {
759 fIPyCurrentIter = ic;
760 if (fExitFromTraining)
break;
762 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
775 const Event *ev1 = GetEvent(ievt1);
776 isSignal = DataInfo().IsSignal(ev1);
777 evt1 = ev1->GetValue( ivar );
779 const Event *ev2 = GetEvent(ievt2);
780 isSignal &= DataInfo().IsSignal(ev2);
783 if (nbreak++ > 10000)
Log() <<
kFATAL <<
"<MCEvents>: could not find signal events"
784 <<
" after 10000 trials - do you have signal events in your sample ?"
790 if (evt1 > evt2) {
Double_t z = evt1; evt1 = evt2; evt2 =
z; }
792 pars[2*ivar+1] = evt2 - evt1;
796 EstimatorFunction( pars );
806 else Log() <<
kFATAL <<
"Unknown minimisation method: " << fFitMethod <<
Endl;
808 if (fBinaryTreeS != 0) {
delete fBinaryTreeS; fBinaryTreeS = 0; }
809 if (fBinaryTreeB != 0) {
delete fBinaryTreeB; fBinaryTreeB = 0; }
812 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
813 for (
Int_t ibin=0; ibin<fNbins; ibin++) {
815 if ((*fFitParams)[ivar] == kForceMin && fCutMin[ivar][ibin] > -fgMaxAbsCutVal) {
816 fCutMin[ivar][ibin] = -fgMaxAbsCutVal;
818 if ((*fFitParams)[ivar] == kForceMax && fCutMax[ivar][ibin] < fgMaxAbsCutVal) {
819 fCutMax[ivar][ibin] = fgMaxAbsCutVal;
828 for (
Double_t eff=0.1; eff<0.95; eff += 0.1) PrintCuts( eff+epsilon );
830 if (!fExitFromTraining) fIPyMaxIter = fIPyCurrentIter;
846 const Event *ev1 = GetEvent(ievt1);
847 if (!DataInfo().IsSignal(ev1))
return -1;
849 const Event *ev2 = GetEvent(ievt2);
850 if (!DataInfo().IsSignal(ev2))
return -1;
852 const Int_t nvar = GetNvar();
856 for (
Int_t ivar=0; ivar<nvar; ivar++) {
862 std::vector<Double_t> pars;
863 for (
Int_t ivar=0; ivar<nvar; ivar++) {
866 if (evt1[ivar] < evt2[ivar]) {
875 pars.push_back( cutMin );
876 pars.push_back( cutMax - cutMin );
882 return ComputeEstimator( pars );
890 return ComputeEstimator( pars );
908 this->MatchParsToCuts( pars, &fTmpCutMin[0], &fTmpCutMax[0] );
911 switch (fEffMethod) {
913 this->GetEffsfromPDFs (&fTmpCutMin[0], &fTmpCutMax[0], effS, effB);
915 case kUseEventSelection:
916 this->GetEffsfromSelection (&fTmpCutMin[0], &fTmpCutMax[0], effS, effB);
919 this->GetEffsfromSelection (&fTmpCutMin[0], &fTmpCutMax[0], effS, effB);
930 Int_t ibinS = fEffBvsSLocal->FindBin( effS );
932 Double_t effBH = fEffBvsSLocal->GetBinContent( ibinS );
933 Double_t effBH_left = (ibinS > 1 ) ? fEffBvsSLocal->GetBinContent( ibinS-1 ) : effBH;
934 Double_t effBH_right = (ibinS < fNbins) ? fEffBvsSLocal->GetBinContent( ibinS+1 ) : effBH;
936 Double_t average = 0.5*(effBH_left + effBH_right);
937 if (effBH < effB) average = effBH;
941 eta = ( -
TMath::Abs(effBH-average) + (1.0 - (effBH - effB))) / (1.0 + effS);
948 if (effBH < 0 || effBH > effB) {
949 fEffBvsSLocal->SetBinContent( ibinS, effB );
950 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
951 fCutMin[ivar][ibinS-1] = fTmpCutMin[ivar];
952 fCutMax[ivar][ibinS-1] = fTmpCutMax[ivar];
966 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
967 diff=(fCutRange[ivar]->GetMax()-fTmpCutMax[ivar])/(fCutRange[ivar]->GetMax()-fCutRange[ivar]->GetMin());
969 diff=(fCutRange[ivar]->GetMin()-fTmpCutMin[ivar])/(fCutRange[ivar]->GetMax()-fCutRange[ivar]->GetMin());
970 penalty+=4.*diff*diff;
973 if (effS<1.
e-4)
return 10.0+penalty;
974 else return 10.*(1.-10.*effS);
985 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
987 cutMin[ivar] = ((*fRangeSign)[ivar] > 0) ? pars[ipar] : pars[ipar] - pars[ipar+1];
988 cutMax[ivar] = ((*fRangeSign)[ivar] > 0) ? pars[ipar] + pars[ipar+1] : pars[ipar];
998 if (ibin < 1 || ibin > fNbins)
Log() <<
kFATAL <<
"::MatchCutsToPars: bin error: "
1001 const UInt_t nvar = GetNvar();
1004 for (
UInt_t ivar=0; ivar<nvar; ivar++) {
1005 cutMin[ivar] = cutMinAll[ivar][ibin-1];
1006 cutMax[ivar] = cutMaxAll[ivar][ibin-1];
1009 MatchCutsToPars( pars, cutMin, cutMax );
1020 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
1021 Int_t ipar = 2*ivar;
1022 pars[ipar] = ((*fRangeSign)[ivar] > 0) ? cutMin[ivar] : cutMax[ivar];
1023 pars[ipar+1] = cutMax[ivar] - cutMin[ivar];
1036 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
1037 effS *= (*fVarPdfS)[ivar]->GetIntegral( cutMin[ivar], cutMax[ivar] );
1038 effB *= (*fVarPdfB)[ivar]->GetIntegral( cutMin[ivar], cutMax[ivar] );
1044 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;
1045 fNegEffWarning =
kTRUE;
1049 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;
1050 fNegEffWarning =
kTRUE;
1064 Volume* volume =
new Volume( cutMin, cutMax, GetNvar() );
1067 nSelS = fBinaryTreeS->SearchVolume( volume );
1068 nSelB = fBinaryTreeB->SearchVolume( volume );
1073 nTotS = fBinaryTreeS->GetSumOfWeights();
1074 nTotB = fBinaryTreeB->GetSumOfWeights();
1077 if (nTotS == 0 && nTotB == 0) {
1078 Log() <<
kFATAL <<
"<GetEffsfromSelection> fatal error in zero total number of events:"
1079 <<
" nTotS, nTotB: " << nTotS <<
" " << nTotB <<
" ***" <<
Endl;
1086 Log() <<
kWARNING <<
"<ComputeEstimator> zero number of signal events" <<
Endl;
1088 else if (nTotB == 0) {
1091 Log() <<
kWARNING <<
"<ComputeEstimator> zero number of background events" <<
Endl;
1101 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;
1102 fNegEffWarning =
kTRUE;
1106 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;
1107 fNegEffWarning =
kTRUE;
1117 fVarHistS =
new std::vector<TH1*>( GetNvar() );
1118 fVarHistB =
new std::vector<TH1*>( GetNvar() );
1119 fVarHistS_smooth =
new std::vector<TH1*>( GetNvar() );
1120 fVarHistB_smooth =
new std::vector<TH1*>( GetNvar() );
1121 fVarPdfS =
new std::vector<PDF*>( GetNvar() );
1122 fVarPdfB =
new std::vector<PDF*>( GetNvar() );
1129 for(
UInt_t ievt=0; ievt<
Data()->GetNEvents(); ievt++ ){
1130 const Event *ev = GetEvent(ievt);
1132 if( val > minVal ) minVal = val;
1133 if( val < maxVal ) maxVal = val;
1136 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
1139 TString histTitle = (*fInputVars)[ivar] +
" signal training";
1140 TString histName = (*fInputVars)[ivar] +
"_sig";
1151 (*fVarHistS)[ivar] =
new TH1F(histName.
Data(), histTitle.
Data(), fNbins, minVal, maxVal );
1154 histTitle = (*fInputVars)[ivar] +
" background training";
1155 histName = (*fInputVars)[ivar] +
"_bgd";
1166 (*fVarHistB)[ivar] =
new TH1F(histName.
Data(), histTitle.Data(), fNbins, minVal, maxVal );
1168 for(
UInt_t ievt=0; ievt<
Data()->GetNEvents(); ievt++ ){
1169 const Event *ev = GetEvent(ievt);
1171 if( DataInfo().IsSignal(ev) ){
1172 (*fVarHistS)[ivar]->Fill( val );
1174 (*fVarHistB)[ivar]->Fill( val );
1181 (*fVarHistS_smooth)[ivar] = (
TH1F*)(*fVarHistS)[ivar]->Clone();
1182 histTitle = (*fInputVars)[ivar] +
" signal training smoothed ";
1183 histTitle += nsmooth;
1184 histTitle +=
" times";
1185 histName = (*fInputVars)[ivar] +
"_sig_smooth";
1186 (*fVarHistS_smooth)[ivar]->SetName(histName);
1187 (*fVarHistS_smooth)[ivar]->SetTitle(histTitle);
1190 (*fVarHistS_smooth)[ivar]->Smooth(nsmooth);
1205 (*fVarHistB_smooth)[ivar] = (
TH1F*)(*fVarHistB)[ivar]->
Clone();
1206 histTitle = (*fInputVars)[ivar]+
" background training smoothed ";
1207 histTitle += nsmooth;
1208 histTitle +=
" times";
1209 histName = (*fInputVars)[ivar]+
"_bgd_smooth";
1210 (*fVarHistB_smooth)[ivar]->SetName(histName);
1211 (*fVarHistB_smooth)[ivar]->SetTitle(histTitle);
1214 (*fVarHistB_smooth)[ivar]->Smooth(nsmooth);
1231 istr >> dummy >>
dummy;
1233 istr >> dummy >> fNbins;
1236 istr >> dummy >> dummy >> dummy >> dummy >> dummy >> dummy >> dummyInt >>
dummy ;
1239 if (dummyInt !=
Data()->GetNVariables()) {
1240 Log() <<
kFATAL <<
"<ReadWeightsFromStream> fatal error: mismatch "
1241 <<
"in number of variables: " << dummyInt <<
" != " <<
Data()->GetNVariables() <<
Endl;
1246 if (fFitMethod == kUseMonteCarlo) {
1247 Log() <<
kWARNING <<
"Read cuts optimised using sample of MC events" <<
Endl;
1249 else if (fFitMethod == kUseMonteCarloEvents) {
1250 Log() <<
kWARNING <<
"Read cuts optimised using sample of MC events" <<
Endl;
1252 else if (fFitMethod == kUseGeneticAlgorithm) {
1253 Log() <<
kINFO <<
"Read cuts optimised using Genetic Algorithm" <<
Endl;
1255 else if (fFitMethod == kUseSimulatedAnnealing) {
1256 Log() <<
kINFO <<
"Read cuts optimised using Simulated Annealing algorithm" <<
Endl;
1258 else if (fFitMethod == kUseEventScan) {
1259 Log() <<
kINFO <<
"Read cuts optimised using Full Event Scan" <<
Endl;
1264 Log() <<
kINFO <<
"in " << fNbins <<
" signal efficiency bins and for " << GetNvar() <<
" variables" <<
Endl;
1268 istr.getline(buffer,200);
1269 istr.getline(buffer,200);
1273 if (fEffBvsSLocal != 0)
delete fEffBvsSLocal;
1274 fEffBvsSLocal =
new TH1F( GetTestvarName() +
"_effBvsSLocal",
1275 TString(
GetName()) +
" efficiency of B vs S", fNbins, 0.0, 1.0 );
1276 fEffBvsSLocal->SetDirectory(0);
1278 for (
Int_t ibin=0; ibin<fNbins; ibin++) {
1279 istr >> tmpbin >> tmpeffS >> tmpeffB;
1280 fEffBvsSLocal->SetBinContent( ibin+1, tmpeffB );
1282 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
1283 istr >> fCutMin[ivar][ibin] >> fCutMax[ivar][ibin];
1287 fEffSMin = fEffBvsSLocal->GetBinCenter(1);
1288 fEffSMax = fEffBvsSLocal->GetBinCenter(fNbins);
1298 std::vector<Double_t> cutsMin;
1299 std::vector<Double_t> cutsMax;
1305 gTools().
AddComment( wght,
Form(
"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() ) );
1315 for (
Int_t ibin=0; ibin<fNbins; ibin++) {
1316 Double_t effS = fEffBvsSLocal->GetBinCenter ( ibin + 1 );
1317 Double_t trueEffS = GetCuts( effS, cutsMin, cutsMax );
1323 gTools().
AddAttr( binxml,
"effB", fEffBvsSLocal->GetBinContent( ibin + 1 ) );
1325 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
1338 for (
UInt_t i=0; i<GetNvar(); i++) {
1339 if (fCutMin[i] != 0)
delete [] fCutMin[i];
1340 if (fCutMax[i] != 0)
delete [] fCutMax[i];
1342 if (fCutMin != 0)
delete [] fCutMin;
1343 if (fCutMax != 0)
delete [] fCutMax;
1345 Int_t tmpEffMethod, tmpFitMethod;
1346 gTools().
ReadAttr( wghtnode,
"OptimisationMethod", tmpEffMethod );
1354 if (fFitMethod == kUseMonteCarlo) {
1355 Log() <<
kINFO <<
"Read cuts optimised using sample of MC events" <<
Endl;
1357 else if (fFitMethod == kUseMonteCarloEvents) {
1358 Log() <<
kINFO <<
"Read cuts optimised using sample of MC-Event events" <<
Endl;
1360 else if (fFitMethod == kUseGeneticAlgorithm) {
1361 Log() <<
kINFO <<
"Read cuts optimised using Genetic Algorithm" <<
Endl;
1363 else if (fFitMethod == kUseSimulatedAnnealing) {
1364 Log() <<
kINFO <<
"Read cuts optimised using Simulated Annealing algorithm" <<
Endl;
1366 else if (fFitMethod == kUseEventScan) {
1367 Log() <<
kINFO <<
"Read cuts optimised using Full Event Scan" <<
Endl;
1372 Log() <<
kINFO <<
"Reading " << fNbins <<
" signal efficiency bins for " << GetNvar() <<
" variables" <<
Endl;
1374 delete fEffBvsSLocal;
1375 fEffBvsSLocal =
new TH1F( GetTestvarName() +
"_effBvsSLocal",
1376 TString(
GetName()) +
" efficiency of B vs S", fNbins, 0.0, 1.0 );
1377 fEffBvsSLocal->SetDirectory(0);
1378 for (
Int_t ibin=1; ibin<=fNbins; ibin++) fEffBvsSLocal->SetBinContent( ibin, -0.1 );
1380 fCutMin =
new Double_t*[GetNvar()];
1381 fCutMax =
new Double_t*[GetNvar()];
1382 for (
UInt_t i=0;i<GetNvar();i++) {
1402 if (tmpbin-1 >= fNbins || tmpbin-1 < 0) {
1403 Log() <<
kFATAL <<
"Mismatch in bins: " << tmpbin-1 <<
" >= " << fNbins <<
Endl;
1406 fEffBvsSLocal->SetBinContent( tmpbin, tmpeffB );
1408 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
1421 Log() <<
kINFO <<
"Write monitoring histograms to file: " << BaseDir()->GetPath() <<
Endl;
1423 fEffBvsSLocal->
Write();
1426 if (fEffMethod == kUsePDFs) {
1427 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
1428 (*fVarHistS)[ivar]->Write();
1429 (*fVarHistB)[ivar]->Write();
1430 (*fVarHistS_smooth)[ivar]->Write();
1431 (*fVarHistB_smooth)[ivar]->Write();
1432 (*fVarPdfS)[ivar]->GetPDFHist()->Write();
1433 (*fVarPdfB)[ivar]->GetPDFHist()->Write();
1455 Log() <<
kFATAL <<
"<GetTrainingEfficiency> wrong number of arguments"
1456 <<
" in string: " << theString
1457 <<
" | required format, e.g., Efficiency:0.05" <<
Endl;
1470 if (results->
GetHist(
"EFF_BVSS_TR")==0) {
1472 if (fBinaryTreeS != 0) {
delete fBinaryTreeS; fBinaryTreeS = 0; }
1473 if (fBinaryTreeB != 0) {
delete fBinaryTreeB; fBinaryTreeB = 0; }
1478 fBinaryTreeB->Fill( GetEventCollection(
Types::kTraining), fBackgroundClass );
1486 TH1* eff_bvss_tr =
new TH1F( GetTestvarName() +
"_trainingEffBvsS", GetTestvarName() +
"", fNbins, 0, 1 );
1488 TH1* rej_bvss_tr =
new TH1F( GetTestvarName() +
"_trainingRejBvsS", GetTestvarName() +
"", fNbins, 0, 1 );
1490 results->
Store(eff_bvss_tr,
"EFF_BVSS_TR");
1491 results->
Store(rej_bvss_tr,
"REJ_BVSS_TR");
1498 Int_t nFailedBins=0;
1499 for (
Int_t bini=1; bini<=fNbins; bini++) {
1500 for (
UInt_t ivar=0; ivar <GetNvar(); ivar++){
1501 tmpCutMin[ivar] = fCutMin[ivar][bini-1];
1502 tmpCutMax[ivar] = fCutMax[ivar][bini-1];
1506 this->GetEffsfromSelection( &tmpCutMin[0], &tmpCutMax[0], effS, effB);
1509 if (effBin != bini){
1510 Log()<<
kVERBOSE <<
"unable to fill efficiency bin " << bini<<
" " << effBin <<
Endl;
1519 if (nFailedBins>0)
Log()<<
kWARNING <<
" unable to fill "<< nFailedBins <<
" efficiency bins " <<
Endl;
1521 delete [] tmpCutMin;
1522 delete [] tmpCutMax;
1525 fSplTrainEffBvsS =
new TSpline1(
"trainEffBvsS",
new TGraph( eff_bvss_tr ) );
1529 if (
NULL == fSplTrainEffBvsS)
return 0.0;
1532 Double_t effS = 0., effB, effS_ = 0., effB_ = 0.;
1533 Int_t nbins_ = 1000;
1536 for (
Int_t bini=1; bini<=nbins_; bini++) {
1538 effS = (bini - 0.5)/
Float_t(nbins_);
1539 effB = fSplTrainEffBvsS->Eval( effS );
1542 if ((effB - effBref)*(effB_ - effBref) < 0)
break;
1547 return 0.5*(effS + effS_);
1563 Data()->SetCurrentType(type);
1572 Log() <<
kFATAL <<
"<GetEfficiency> wrong number of arguments"
1573 <<
" in string: " << theString
1574 <<
" | required format, e.g., Efficiency:0.05, or empty string" <<
Endl;
1589 if (results->
GetHist(
"MVA_EFF_BvsS")==0) {
1591 if (fBinaryTreeS!=0) {
delete fBinaryTreeS; fBinaryTreeS = 0; }
1592 if (fBinaryTreeB!=0) {
delete fBinaryTreeB; fBinaryTreeB = 0; }
1598 fBinaryTreeS->Fill( GetEventCollection(
Types::kTesting), fSignalClass );
1600 fBinaryTreeB->Fill( GetEventCollection(
Types::kTesting), fBackgroundClass );
1609 TH1* eff_BvsS =
new TH1F( GetTestvarName() +
"_effBvsS", GetTestvarName() +
"", fNbins, 0, 1 );
1611 TH1* rej_BvsS =
new TH1F( GetTestvarName() +
"_rejBvsS", GetTestvarName() +
"", fNbins, 0, 1 );
1613 results->
Store(eff_BvsS,
"MVA_EFF_BvsS");
1614 results->
Store(rej_BvsS);
1619 TH1* eff_s =
new TH1F( GetTestvarName() +
"_effS", GetTestvarName() +
" (signal)", fNbins, xmin, xmax);
1621 TH1* eff_b =
new TH1F( GetTestvarName() +
"_effB", GetTestvarName() +
" (background)", fNbins, xmin, xmax);
1623 results->
Store(eff_s,
"MVA_S");
1624 results->
Store(eff_b,
"MVA_B");
1634 for (
Int_t bini=1; bini<=fNbins; bini++) {
1635 for (
UInt_t ivar=0; ivar <GetNvar(); ivar++) {
1636 tmpCutMin[ivar] = fCutMin[ivar][bini-1];
1637 tmpCutMax[ivar] = fCutMax[ivar][bini-1];
1641 this->GetEffsfromSelection( &tmpCutMin[0], &tmpCutMax[0], effS, effB);
1642 tmpBvsS->
SetPoint(bini, effS, effB);
1647 tmpBvsS->
SetPoint(fNbins+1, 1., 1.);
1649 delete [] tmpCutMin;
1650 delete [] tmpCutMax;
1653 fSpleffBvsS =
new TSpline1(
"effBvsS", tmpBvsS );
1654 for (
Int_t bini=1; bini<=fNbins; bini++) {
1656 Double_t effB = fSpleffBvsS->Eval( effS );
1663 if (
NULL == fSpleffBvsS)
return 0.0;
1666 Double_t effS = 0, effB = 0, effS_ = 0, effB_ = 0;
1667 Int_t nbins_ = 1000;
1673 for (
Int_t bini=1; bini<=nbins_; bini++) {
1676 effS = (bini - 0.5)/
Float_t(nbins_);
1677 effB = fSpleffBvsS->Eval( effS );
1678 integral += (1.0 - effB);
1687 for (
Int_t bini=1; bini<=nbins_; bini++) {
1689 effS = (bini - 0.5)/
Float_t(nbins_);
1690 effB = fSpleffBvsS->Eval( effS );
1693 if ((effB - effBref)*(effB_ - effBref) < 0)
break;
1698 effS = 0.5*(effS + effS_);
1700 if (
Data()->GetNEvtSigTest() > 0)
1715 fout <<
" // not implemented for class: \"" << className <<
"\"" << std::endl;
1716 fout <<
"};" << std::endl;
1734 Log() <<
"The optimisation of rectangular cuts performed by TMVA maximises " <<
Endl;
1735 Log() <<
"the background rejection at given signal efficiency, and scans " <<
Endl;
1736 Log() <<
"over the full range of the latter quantity. Three optimisation" <<
Endl;
1737 Log() <<
"methods are optional: Monte Carlo sampling (MC), a Genetics" <<
Endl;
1738 Log() <<
"Algorithm (GA), and Simulated Annealing (SA). GA and SA are" <<
Endl;
1739 Log() <<
"expected to perform best." <<
Endl;
1741 Log() <<
"The difficulty to find the optimal cuts strongly increases with" <<
Endl;
1742 Log() <<
"the dimensionality (number of input variables) of the problem." <<
Endl;
1743 Log() <<
"This behavior is due to the non-uniqueness of the solution space."<<
Endl;
1747 Log() <<
"If the dimensionality exceeds, say, 4 input variables, it is " <<
Endl;
1748 Log() <<
"advisable to scrutinize the separation power of the variables," <<
Endl;
1749 Log() <<
"and to remove the weakest ones. If some among the input variables" <<
Endl;
1750 Log() <<
"can be described by a single cut (e.g., because signal tends to be" <<
Endl;
1751 Log() <<
"larger than background), this can be indicated to MethodCuts via" <<
Endl;
1752 Log() <<
"the \"Fsmart\" options (see option string). Choosing this option" <<
Endl;
1753 Log() <<
"reduces the number of requirements for the variable from 2 (min/max)" <<
Endl;
1754 Log() <<
"to a single one (TMVA finds out whether it is to be interpreted as" <<
Endl;
1755 Log() <<
"min or max)." <<
Endl;
1759 Log() << bold <<
"Monte Carlo sampling:" << resbold <<
Endl;
1761 Log() <<
"Apart form the \"Fsmart\" option for the variables, the only way" <<
Endl;
1762 Log() <<
"to improve the MC sampling is to increase the sampling rate. This" <<
Endl;
1763 Log() <<
"is done via the configuration option \"MC_NRandCuts\". The execution" <<
Endl;
1764 Log() <<
"time scales linearly with the sampling rate." <<
Endl;
1766 Log() << bold <<
"Genetic Algorithm:" << resbold <<
Endl;
1768 Log() <<
"The algorithm terminates if no significant fitness increase has" <<
Endl;
1769 Log() <<
"been achieved within the last \"nsteps\" steps of the calculation." <<
Endl;
1770 Log() <<
"Wiggles in the ROC curve or constant background rejection of 1" <<
Endl;
1771 Log() <<
"indicate that the GA failed to always converge at the true maximum" <<
Endl;
1772 Log() <<
"fitness. In such a case, it is recommended to broaden the search " <<
Endl;
1773 Log() <<
"by increasing the population size (\"popSize\") and to give the GA " <<
Endl;
1774 Log() <<
"more time to find improvements by increasing the number of steps" <<
Endl;
1775 Log() <<
"(\"nsteps\")" <<
Endl;
1776 Log() <<
" -> increase \"popSize\" (at least >10 * number of variables)" <<
Endl;
1777 Log() <<
" -> increase \"nsteps\"" <<
Endl;
1779 Log() << bold <<
"Simulated Annealing (SA) algorithm:" << resbold <<
Endl;
1781 Log() <<
"\"Increasing Adaptive\" approach:" <<
Endl;
1783 Log() <<
"The algorithm seeks local minima and explores their neighborhood, while" <<
Endl;
1784 Log() <<
"changing the ambient temperature depending on the number of failures" <<
Endl;
1785 Log() <<
"in the previous steps. The performance can be improved by increasing" <<
Endl;
1786 Log() <<
"the number of iteration steps (\"MaxCalls\"), or by adjusting the" <<
Endl;
1787 Log() <<
"minimal temperature (\"MinTemperature\"). Manual adjustments of the" <<
Endl;
1788 Log() <<
"speed of the temperature increase (\"TemperatureScale\" and \"AdaptiveSpeed\")" <<
Endl;
1789 Log() <<
"to individual data sets should also help. Summary:" << brk <<
Endl;
1790 Log() <<
" -> increase \"MaxCalls\"" << brk <<
Endl;
1791 Log() <<
" -> adjust \"MinTemperature\"" << brk <<
Endl;
1792 Log() <<
" -> adjust \"TemperatureScale\"" << brk <<
Endl;
1793 Log() <<
" -> adjust \"AdaptiveSpeed\"" <<
Endl;
1795 Log() <<
"\"Decreasing Adaptive\" approach:" <<
Endl;
1797 Log() <<
"The algorithm calculates the initial temperature (based on the effect-" <<
Endl;
1798 Log() <<
"iveness of large steps) and the multiplier that ensures to reach the" <<
Endl;
1799 Log() <<
"minimal temperature with the requested number of iteration steps." <<
Endl;
1800 Log() <<
"The performance can be improved by adjusting the minimal temperature" <<
Endl;
1801 Log() <<
" (\"MinTemperature\") and by increasing number of steps (\"MaxCalls\"):" << brk <<
Endl;
1802 Log() <<
" -> increase \"MaxCalls\"" << brk <<
Endl;
1803 Log() <<
" -> adjust \"MinTemperature\"" <<
Endl;
1805 Log() <<
"Other kernels:" <<
Endl;
1807 Log() <<
"Alternative ways of counting the temperature change are implemented. " <<
Endl;
1808 Log() <<
"Each of them starts with the maximum temperature (\"MaxTemperature\")" <<
Endl;
1809 Log() <<
"and descreases while changing the temperature according to a given" <<
Endl;
1810 Log() <<
"prescription:" << brk <<
Endl;
1811 Log() <<
"CurrentTemperature =" << brk <<
Endl;
1812 Log() <<
" - Sqrt: InitialTemperature / Sqrt(StepNumber+2) * TemperatureScale" << brk <<
Endl;
1813 Log() <<
" - Log: InitialTemperature / Log(StepNumber+2) * TemperatureScale" << brk <<
Endl;
1814 Log() <<
" - Homo: InitialTemperature / (StepNumber+2) * TemperatureScale" << brk <<
Endl;
1815 Log() <<
" - Sin: (Sin(StepNumber / TemperatureScale) + 1) / (StepNumber + 1)*InitialTemperature + Eps" << brk <<
Endl;
1816 Log() <<
" - Geo: CurrentTemperature * TemperatureScale" <<
Endl;
1818 Log() <<
"Their performance can be improved by adjusting initial temperature" <<
Endl;
1819 Log() <<
"(\"InitialTemperature\"), the number of iteration steps (\"MaxCalls\")," <<
Endl;
1820 Log() <<
"and the multiplier that scales the termperature descrease" <<
Endl;
1821 Log() <<
"(\"TemperatureScale\")" << brk <<
Endl;
1822 Log() <<
" -> increase \"MaxCalls\"" << brk <<
Endl;
1823 Log() <<
" -> adjust \"InitialTemperature\"" << brk <<
Endl;
1824 Log() <<
" -> adjust \"TemperatureScale\"" << brk <<
Endl;
1825 Log() <<
" -> adjust \"KernelTemperature\"" <<
Endl;
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
Double_t GetMvaValue(Double_t *err=0, Double_t *errUpper=0)
cut evaluation: returns 1.0 if event passed, 0.0 otherwise
std::string GetName(const std::string &scope_name)
Random number generator class based on M.
MsgLogger & Endl(MsgLogger &ml)
TH1 * GetHist(const TString &alias) const
Double_t ComputeEstimator(std::vector< Double_t > &)
returns estimator for "cut fitness" used by GA there are two requirements: 1) the signal efficiency m...
void TestClassification()
nothing to test
Collectable string class.
MethodCuts(const TString &jobName, const TString &methodTitle, DataSetInfo &theData, const TString &theOption="MC:150:10000:")
standard constructor
void CheckForUnusedOptions() const
checks for unused options in option string
THist< 1, float, THistStatContent, THistStatUncertainty > TH1F
void MatchParsToCuts(const std::vector< Double_t > &, Double_t *, Double_t *)
translates parameters into cuts
void Clone(Ssiz_t nc)
Make self a distinct copy with capacity of at least tot, where tot cannot be smaller than the current...
void DrawProgressBar(Int_t, const TString &comment="")
draws progress bar in color or B&W caution:
tomato 1-D histogram with a float per channel (see TH1 documentation)}
Short_t Min(Short_t a, Short_t b)
void AddWeightsXMLTo(void *parent) const
create XML description for LD classification and regression (for arbitrary number of output classes/t...
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
Float_t GetValue(UInt_t ivar) const
return value of i'th variable
const char * Data() const
Double_t EstimatorFunction(std::vector< Double_t > &)
returns estimator for "cut fitness" used by GA
Double_t Run()
estimator function interface for fitting
void SetIPythonInteractive(bool *ExitFromTraining, UInt_t *fIPyMaxIter_, UInt_t *fIPyCurrentIter_)
void Init(void)
default initialisation called by all constructors
void CreateVariablePDFs(void)
for PDF method: create efficiency reference histograms and PDFs
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 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 ...
std::vector< std::vector< double > > Data
void MatchCutsToPars(std::vector< Double_t > &, Double_t *, Double_t *)
translates cuts into parameters
void Train(void)
training method: here the cuts are optimised for the training sample
std::string GetMethodName(TCppMethod_t)
void PrintCuts(Double_t effS) const
print cuts
void MakeClassSpecific(std::ostream &, const TString &) const
write specific classifier response
void ReadWeightsFromXML(void *wghtnode)
read coefficients from xml weight file
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...
char * Form(const char *fmt,...)
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
void DeclareOptions()
define the options (their key words) that can be set in the option string know options: Method <strin...
virtual Int_t FindBin(Double_t x)
Find bin number corresponding to abscissa x.
virtual Int_t GetSize() const
void WriteMonitoringHistosToFile(void) const
write histograms and PDFs to file for monitoring purposes
void ReadWeightsFromStream(std::istream &i)
read the cuts from stream
static RooMathCoreReg dummy
Double_t GetEfficiency(const TString &, Types::ETreeType, Double_t &)
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
virtual Double_t Uniform(Double_t x1=1)
Returns a uniform deviate on the interval (0, x1).
void GetHelpMessage() const
get help message text
you should not use this method at all Int_t Int_t z
#define REGISTER_METHOD(CLASS)
for example
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
virtual ~MethodCuts(void)
destructor
Short_t Max(Short_t a, Short_t b)
A Graph is a graphics object made of two arrays X and Y with npoints each.
void ProcessOptions()
process user options sanity check, do not allow the input variables to be normalised, because this only creates problems when interpreting the cuts
Bool_t WriteOptionsReference() const
void Store(TObject *obj, const char *alias=0)
Double_t Sqrt(Double_t x)
Double_t GetTrainingEfficiency(const TString &)
virtual Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets)
Cuts can only handle classification with 2 classes.