ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
MVAUtils::NodeTMVA Class Reference

Node for TMVA implementation. More...

#include <NodeImpl.h>

Collaboration diagram for MVAUtils::NodeTMVA:

Public Member Functions

 NodeTMVA (const int ivar, const float val, const index_t right)
 The constructor gets the index of the variable to cut on (-1 if leaf), the index of the right child (value not used if a leaf), and the value to cut on (if not leaf) or the respons (if leaf). More...
 
void Print (index_t index) const
 For debugging only: print the node values. More...
 
index_t GetNext (const float value, index_t index) const
 Based on the value of the variable that's passed in, return the index of the appropriate child. More...
 
bool IsLeaf () const
 is the current node a leaf node More...
 
var_t GetVar () const
 The variable index to cut on (or -1 if leaf, but use IsLeaf instead if checking for leaf) More...
 
float GetVal () const
 The value to cut on (if not leaf), or the response (if leaf). More...
 
index_t GetLeft (index_t index) const
 For debugging: returns the index of the left node; is passed the current node index. More...
 
index_t GetRight (index_t index) const
 For debugging: returns the index of the right node; is passed the current node index. More...
 

Private Attributes

float m_cut
 cut value for internal nodes or response for leaf nodes More...
 
int16_t m_right
 right relative index (to be added to current) (left is always current + 1) More...
 
var_t m_var
 index of the variable to cut for internal nodes, -1 for leaf nodes More...
 

Detailed Description

Node for TMVA implementation.

This follows the implementation in TMVA. next = value >= cut ? left : right

Definition at line 35 of file NodeImpl.h.

Constructor & Destructor Documentation

◆ NodeTMVA()

MVAUtils::NodeTMVA::NodeTMVA ( const int  ivar,
const float  val,
const index_t  right 
)
inline

The constructor gets the index of the variable to cut on (-1 if leaf), the index of the right child (value not used if a leaf), and the value to cut on (if not leaf) or the respons (if leaf).

Definition at line 42 of file NodeImpl.h.

42  :
43  m_cut(val), m_right(right), m_var(ivar) { }

Member Function Documentation

◆ GetLeft()

index_t MVAUtils::NodeTMVA::GetLeft ( index_t  index) const
inline

For debugging: returns the index of the left node; is passed the current node index.

Definition at line 64 of file NodeImpl.h.

64 { return index + 1; }

◆ GetNext()

index_t MVAUtils::NodeTMVA::GetNext ( const float  value,
index_t  index 
) const
inline

Based on the value of the variable that's passed in, return the index of the appropriate child.

Assumes the node is not a leaf (i.e., there is no check). Must also pass the current node index.

Definition at line 78 of file NodeImpl.h.

78  {
79  return (value >= m_cut) ? GetLeft(index) : GetRight(index);
80  }

◆ GetRight()

index_t MVAUtils::NodeTMVA::GetRight ( index_t  index) const
inline

For debugging: returns the index of the right node; is passed the current node index.

Definition at line 68 of file NodeImpl.h.

68 { return index + m_right; }

◆ GetVal()

float MVAUtils::NodeTMVA::GetVal ( ) const
inline

The value to cut on (if not leaf), or the response (if leaf).

Definition at line 60 of file NodeImpl.h.

60 { return m_cut; }

◆ GetVar()

var_t MVAUtils::NodeTMVA::GetVar ( ) const
inline

The variable index to cut on (or -1 if leaf, but use IsLeaf instead if checking for leaf)

Definition at line 57 of file NodeImpl.h.

57 { return m_var; }

◆ IsLeaf()

bool MVAUtils::NodeTMVA::IsLeaf ( ) const
inline

is the current node a leaf node

Definition at line 54 of file NodeImpl.h.

◆ Print()

void NodeTMVA::Print ( index_t  index) const

For debugging only: print the node values.

Definition at line 11 of file NodeImpl.cxx.

12 {
13  std::cout << " Variable: " << int(m_var) << ", Cut: " << m_cut
14  << " (index = " << index << ")" << std::endl;
15 }

Member Data Documentation

◆ m_cut

float MVAUtils::NodeTMVA::m_cut
private

cut value for internal nodes or response for leaf nodes

Definition at line 72 of file NodeImpl.h.

◆ m_right

int16_t MVAUtils::NodeTMVA::m_right
private

right relative index (to be added to current) (left is always current + 1)

Definition at line 73 of file NodeImpl.h.

◆ m_var

var_t MVAUtils::NodeTMVA::m_var
private

index of the variable to cut for internal nodes, -1 for leaf nodes

Definition at line 74 of file NodeImpl.h.


The documentation for this class was generated from the following files:
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
index
Definition: index.py:1
athena.value
value
Definition: athena.py:122
MVAUtils::NodeTMVA::GetLeft
index_t GetLeft(index_t index) const
For debugging: returns the index of the left node; is passed the current node index.
Definition: NodeImpl.h:64
MVAUtils::NodeTMVA::m_cut
float m_cut
cut value for internal nodes or response for leaf nodes
Definition: NodeImpl.h:72
MVAUtils::NodeTMVA::GetRight
index_t GetRight(index_t index) const
For debugging: returns the index of the right node; is passed the current node index.
Definition: NodeImpl.h:68
plotBeamSpotCompare.ivar
int ivar
Definition: plotBeamSpotCompare.py:383
MVAUtils::NodeTMVA::m_right
int16_t m_right
right relative index (to be added to current) (left is always current + 1)
Definition: NodeImpl.h:73
MVAUtils::NodeTMVA::m_var
var_t m_var
index of the variable to cut for internal nodes, -1 for leaf nodes
Definition: NodeImpl.h:74
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14