NTagTMVA

class NTagTMVA

Public Functions

NTagTMVA(Verbosity verbose = pDEFAULT)

Constructor of NTagTMVA.

Calls NTagTMVA::Constructor.

Parameters

verbose – #Verbosity.

NTagTMVA(const char *inFileName, const char *outFileName, Verbosity verbose = pDEFAULT)

Constructor of NTagTMVA.

Calls NTagTMVA::Constructor.

Parameters
  • inFileName – Input file name.

  • outFileName – Output file name.

  • verbose – #Verbosity.

void Constructor()

Constructor function for NTagTMVA.

Sets up member NTagMessage and NTagTMVAVariables. Sets MVA methods to use using NTagTMVA::SetMethods. Sets default fSigCut and fBkgCut as “CaptureType > 0” and “CaptureType == 0”.

void SetMethods(bool turnOn)

Specifies which MVA method to use in generating weights.

See the source code to which MVA method can be turned on or off.

void UseMethod(const char *methodName, bool turnOn = true)

Turns on/off an MVA method in generating weights.

Parameters

methodName – MVA method name to turn on or off.

void MakeWeights(bool isMultiClass = false)

Generates weights with MVA methods specified with NTagTMVA::SetMethods and NTagTMVA::UseMethod.

The default path for the generated weights is weights/new.

void SetReader(TString methodName, TString weightFileName)

Sets MVA method name and weight file path to apply. Also sets cuts for TMVA variables.

The default cuts for TMVA variables are specified in the source code.

Parameters
  • methodName – MVA method name to apply.

  • weightFileName – Path of the weight file to apply.

void InstantiateReader()

Instantiate the TMVA reader fReader and add variables to it. Also books the specified MVA method.

inline void SetReaderCutRange(const char *key, float low, float up)

Sets cut range for the TMVA variables input to the reader fReader.

Add key and the specified #Range (low, up) to the private member #RangeMap fRangeMap.

See also

NTagTMVAVariables::Clear for the available keys.

Parameters
  • key – A name of the variable.

  • low – Lower limit for the variable key.

  • up – Upper limit for the variable key.

void DumpReaderCutRange()

Prints out all specified cuts to the output stream.

bool IsInRange(const char *key)

Checks if the variable key is within the cut range specified by NTagTMVA::SetReaderCutRange.

Returns

true if the variable key passes the cut, otherwise false.

bool CandidateCut()

Checks if the capture candidate passes all cuts specified by NTagTMVA::SetReaderCutRange.

Returns

The result of the && operator applied to each return value of NTagTMVA::IsInRange with each variable.

float GetOutputFromCandidate(int iCandidate)

If the capture candidate passes variable cuts specified by NTagTMVA::SetReaderCutRange, return classifier output of the capture candidate.

Parameters

iCandidate – The index of the input neutron capture candidate. (0 < iCandidate < NTagEventInfo::nCandidates)

Returns

The return value of fReader->EvaluateMVA.

void ApplyWeight(TString methodName, TString weightFileName)

Applies MVA weight and method to an NTag output with ntvar tree.

Creates the branch “TMVAOutput” and fills the branch with classifier outputs evaluated with the specified MVA method and weight. Replaces the branch if the branch name exists. The default output name for an input name example_input.root is example_input_(methodName).root.

Parameters
  • methodName – MVA method name to apply.

  • weightFileName – Path of the weight file to apply.

Private Members

TCut fSigCut

Signal cut.

TCut fBkgCut

Background cut.

TMVA::Reader *fReader

TMVA reader.

RangeMap fRangeMap

A map of variable names to cuts (#Range).