Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
lar_content::LArMvaHelper Class Reference

LArMvaHelper class. More...

#include "LArMvaHelper.h"

Public Types

typedef MvaTypes::MvaFeature MvaFeature
 
typedef MvaTypes::MvaFeatureVector MvaFeatureVector
 
typedef std::map< std::string, double > DoubleMap
 
typedef MvaTypes::MvaFeatureMap MvaFeatureMap
 
typedef std::map< std::string, pandora::AlgorithmTool * > AlgorithmToolMap
 

Static Public Member Functions

template<typename TCONTAINER >
static pandora::StatusCode ProduceTrainingExample (const std::string &trainingOutputFile, const bool result, TCONTAINER &&featureContainer)
 Produce a training example with the given features and result.
 
template<typename TCONTAINER >
static pandora::StatusCode ProduceTrainingExample (const std::string &trainingOutputFile, const bool result, const pandora::StringVector &featureOrder, TCONTAINER &&featureContainer)
 Produce a training example with the given features and result - using a map.
 
template<typename TCONTAINER >
static bool Classify (const MvaInterface &classifier, TCONTAINER &&featureContainer)
 Use the trained classifier to predict the boolean class of an example.
 
template<typename TCONTAINER >
static bool Classify (const MvaInterface &classifier, const pandora::StringVector &featureOrder, TCONTAINER &&featureContainer)
 Use the trained classifier to predict the boolean class of an example – using a map.
 
template<typename TCONTAINER >
static double CalculateClassificationScore (const MvaInterface &classifier, TCONTAINER &&featureContainer)
 Use the trained classifer to calculate the classification score of an example (>0 means boolean class true)
 
template<typename TCONTAINER >
static double CalculateProbability (const MvaInterface &classifier, TCONTAINER &&featureContainer)
 Use the trained mva to calculate a classification probability for an example.
 
template<typename TCONTAINER >
static double CalculateProbability (const MvaInterface &classifier, const pandora::StringVector &featureOrder, TCONTAINER &&featureContainer)
 Use the trained mva to calculate a classification probability for an example – using a map.
 
template<typename... Ts, typename... TARGS>
static MvaFeatureVector CalculateFeatures (const MvaFeatureToolVector< Ts... > &featureToolVector, TARGS &&... args)
 Calculate the features in a given feature tool vector.
 
template<typename... Ts, typename... TARGS>
static MvaFeatureMap CalculateFeatures (const pandora::StringVector &featureToolOrder, const MvaFeatureToolMap< Ts... > &featureToolMap, pandora::StringVector &featureOrder, TARGS &&... args)
 Calculate the features in a given feature tool map, and fill an MvaFeatureMap and vector with feature order.
 
template<typename T , typename... Ts, typename... TARGS>
static MvaFeatureVector CalculateFeaturesOfType (const MvaFeatureToolVector< Ts... > &featureToolVector, TARGS &&... args)
 Calculate the features of a given derived feature tool type in a feature tool vector.
 
template<typename... Ts>
static pandora::StatusCode AddFeatureToolToVector (pandora::AlgorithmTool *const pFeatureTool, MvaFeatureToolVector< Ts... > &featureToolVector)
 Add a feature tool to a vector of feature tools.
 
template<typename... Ts>
static pandora::StatusCode AddFeatureToolToMap (pandora::AlgorithmTool *const pFeatureTool, std::string pFeatureToolName, MvaFeatureToolMap< Ts... > &featureToolMap)
 Add a feature tool to a map of feature tools.
 
static pandora::StatusCode ProcessAlgorithmToolListToMap (const pandora::Algorithm &algorithm, const pandora::TiXmlHandle &xmlHandle, const std::string &listName, pandora::StringVector &algorithToolNameVector, AlgorithmToolMap &algorithmToolMap)
 Process a list of algorithms tools in an xml file, using a map. Idea is for this to go to XmlHelper in PandoraSDK eventually as an overload to ProcessAlgorithmToolList.
 
template<typename TLIST , typename... TLISTS>
static MvaFeatureVector ConcatenateFeatureLists (TLIST &&featureList, TLISTS &&... featureLists)
 Recursively concatenate vectors of features.
 
static MvaFeatureVector ConcatenateFeatureLists ()
 Recursively concatenate vectors of features (terminating method)
 

Static Private Member Functions

static std::string GetTimestampString ()
 Get a timestamp string for this point in time.
 
template<typename TCONTAINER >
static pandora::StatusCode WriteFeaturesToFile (std::ofstream &outfile, const std::string &delimiter, TCONTAINER &&featureContainer)
 Write the features of the given lists to file.
 
template<typename TCONTAINER >
static pandora::StatusCode WriteFeaturesToFileImpl (std::ofstream &outfile, const std::string &delimiter, TCONTAINER &&featureContainer)
 Write the features of the given list to file (implementation method)
 

Detailed Description

LArMvaHelper class.

Definition at line 71 of file LArMvaHelper.h.

Member Typedef Documentation

◆ AlgorithmToolMap

Definition at line 79 of file LArMvaHelper.h.

◆ DoubleMap

typedef std::map<std::string, double> lar_content::LArMvaHelper::DoubleMap

Definition at line 76 of file LArMvaHelper.h.

◆ MvaFeature

◆ MvaFeatureMap

◆ MvaFeatureVector

Member Function Documentation

◆ AddFeatureToolToMap()

template<typename... Ts>
pandora::StatusCode lar_content::LArMvaHelper::AddFeatureToolToMap ( pandora::AlgorithmTool *const  pFeatureTool,
std::string  pFeatureToolName,
MvaFeatureToolMap< Ts... > &  featureToolMap 
)
static

Add a feature tool to a map of feature tools.

Parameters
pFeatureToolthe feature tool
pFeatureToolNamethe name of the feature tool
featureToolMapthe map to append
Returns
success

Definition at line 465 of file LArMvaHelper.h.

Here is the caller graph for this function:

◆ AddFeatureToolToVector()

template<typename... Ts>
pandora::StatusCode lar_content::LArMvaHelper::AddFeatureToolToVector ( pandora::AlgorithmTool *const  pFeatureTool,
MvaFeatureToolVector< Ts... > &  featureToolVector 
)
static

Add a feature tool to a vector of feature tools.

Parameters
pFeatureToolthe feature tool
featureToolVectorthe vector to append
Returns
success

Definition at line 451 of file LArMvaHelper.h.

Here is the caller graph for this function:

◆ CalculateClassificationScore()

template<typename TCONTAINER >
double lar_content::LArMvaHelper::CalculateClassificationScore ( const MvaInterface classifier,
TCONTAINER &&  featureContainer 
)
static

Use the trained classifer to calculate the classification score of an example (>0 means boolean class true)

Parameters
classifierthe classifier
featureContainerthe container of features
Returns
the classification score

Definition at line 361 of file LArMvaHelper.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CalculateFeatures() [1/2]

template<typename... Ts, typename... TARGS>
LArMvaHelper::MvaFeatureVector lar_content::LArMvaHelper::CalculateFeatures ( const MvaFeatureToolVector< Ts... > &  featureToolVector,
TARGS &&...  args 
)
static

Calculate the features in a given feature tool vector.

Parameters
featureToolVectorthe feature tool vector
argsarguments to pass to the tool
Returns
the vector of features

Definition at line 399 of file LArMvaHelper.h.

Here is the caller graph for this function:

◆ CalculateFeatures() [2/2]

template<typename... Ts, typename... TARGS>
LArMvaHelper::MvaFeatureMap lar_content::LArMvaHelper::CalculateFeatures ( const pandora::StringVector featureToolOrder,
const MvaFeatureToolMap< Ts... > &  featureToolMap,
pandora::StringVector featureOrder,
TARGS &&...  args 
)
static

Calculate the features in a given feature tool map, and fill an MvaFeatureMap and vector with feature order.

Parameters
featureToolOrdervector of strings of the ordered keys
featureToolMapthe feature tool map
featureOrdera vector that is to be filled with the order of features in the function
argsarguments to pass to the tool
Returns
the map of features

Definition at line 412 of file LArMvaHelper.h.

◆ CalculateFeaturesOfType()

template<typename T , typename... Ts, typename... TARGS>
LArMvaHelper::MvaFeatureVector lar_content::LArMvaHelper::CalculateFeaturesOfType ( const MvaFeatureToolVector< Ts... > &  featureToolVector,
TARGS &&...  args 
)
static

Calculate the features of a given derived feature tool type in a feature tool vector.

Parameters
featureToolVectorthe feature tool vector
argsarguments to pass to the tool
Returns
the vector of features

Definition at line 434 of file LArMvaHelper.h.

◆ CalculateProbability() [1/2]

template<typename TCONTAINER >
double lar_content::LArMvaHelper::CalculateProbability ( const MvaInterface classifier,
const pandora::StringVector featureOrder,
TCONTAINER &&  featureContainer 
)
static

Use the trained mva to calculate a classification probability for an example – using a map.

Parameters
classifierthe classifier
featureOrderthe vector of strings corresponding to ordered list of keys
featureContainerthe container of features
Returns
the classification probability

Definition at line 377 of file LArMvaHelper.h.

Here is the call graph for this function:

◆ CalculateProbability() [2/2]

template<typename TCONTAINER >
double lar_content::LArMvaHelper::CalculateProbability ( const MvaInterface classifier,
TCONTAINER &&  featureContainer 
)
static

Use the trained mva to calculate a classification probability for an example.

Parameters
classifierthe classifier
featureContainerthe container of features
Returns
the classification probability

Definition at line 369 of file LArMvaHelper.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Classify() [1/2]

template<typename TCONTAINER >
bool lar_content::LArMvaHelper::Classify ( const MvaInterface classifier,
const pandora::StringVector featureOrder,
TCONTAINER &&  featureContainer 
)
static

Use the trained classifier to predict the boolean class of an example – using a map.

Parameters
classifierthe classifier
featureOrderthe vector of strings corresponding to ordered list of keys
featureContainerthe container of features
Returns
the predicted boolean class of the example

Definition at line 339 of file LArMvaHelper.h.

Here is the call graph for this function:

◆ Classify() [2/2]

template<typename TCONTAINER >
bool lar_content::LArMvaHelper::Classify ( const MvaInterface classifier,
TCONTAINER &&  featureContainer 
)
static

Use the trained classifier to predict the boolean class of an example.

Parameters
classifierthe classifier
featureContainerthe container of features
Returns
the predicted boolean class of the example

Definition at line 331 of file LArMvaHelper.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ConcatenateFeatureLists() [1/2]

LArMvaHelper::MvaFeatureVector lar_content::LArMvaHelper::ConcatenateFeatureLists ( )
inlinestatic

Recursively concatenate vectors of features (terminating method)

Definition at line 541 of file LArMvaHelper.h.

Here is the caller graph for this function:

◆ ConcatenateFeatureLists() [2/2]

template<typename TLIST , typename... TLISTS>
LArMvaHelper::MvaFeatureVector lar_content::LArMvaHelper::ConcatenateFeatureLists ( TLIST &&  featureList,
TLISTS &&...  featureLists 
)
static

Recursively concatenate vectors of features.

Parameters
featureLista list of features
featureListsoptional further lists of features
Returns
the concatenated vector of features

Definition at line 523 of file LArMvaHelper.h.

Here is the call graph for this function:

◆ GetTimestampString()

std::string lar_content::LArMvaHelper::GetTimestampString ( )
inlinestaticprivate

Get a timestamp string for this point in time.

Returns
a timestamp string

Definition at line 479 of file LArMvaHelper.h.

Here is the caller graph for this function:

◆ ProcessAlgorithmToolListToMap()

StatusCode lar_content::LArMvaHelper::ProcessAlgorithmToolListToMap ( const pandora::Algorithm algorithm,
const pandora::TiXmlHandle xmlHandle,
const std::string &  listName,
pandora::StringVector algorithToolNameVector,
AlgorithmToolMap algorithmToolMap 
)
static

Process a list of algorithms tools in an xml file, using a map. Idea is for this to go to XmlHelper in PandoraSDK eventually as an overload to ProcessAlgorithmToolList.

Parameters
algorithmthe parent algorithm calling this function
xmlHandlethe relevant xml handle
listNamethe name of the algorithm tool list
algorithmToolMapto receive the vector of addresses of the algorithm tool instances, but also keep the name

Definition at line 16 of file LArMvaHelper.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ProduceTrainingExample() [1/2]

template<typename TCONTAINER >
pandora::StatusCode lar_content::LArMvaHelper::ProduceTrainingExample ( const std::string &  trainingOutputFile,
const bool  result,
const pandora::StringVector featureOrder,
TCONTAINER &&  featureContainer 
)
static

Produce a training example with the given features and result - using a map.

Parameters
trainingOutputFilethe file to which to append the example
featureOrderthe vector of strings corresponding to ordered list of keys
featureContainerthe container of features
Returns
success

Definition at line 308 of file LArMvaHelper.h.

Here is the call graph for this function:

◆ ProduceTrainingExample() [2/2]

template<typename TCONTAINER >
pandora::StatusCode lar_content::LArMvaHelper::ProduceTrainingExample ( const std::string &  trainingOutputFile,
const bool  result,
TCONTAINER &&  featureContainer 
)
static

Produce a training example with the given features and result.

Parameters
trainingOutputFilethe file to which to append the example
featureContainerthe container of features
Returns
success

Definition at line 285 of file LArMvaHelper.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ WriteFeaturesToFile()

template<typename TCONTAINER >
pandora::StatusCode lar_content::LArMvaHelper::WriteFeaturesToFile ( std::ofstream &  outfile,
const std::string &  delimiter,
TCONTAINER &&  featureContainer 
)
inlinestaticprivate

Write the features of the given lists to file.

Parameters
outfilethe std::ofstream object to use
delimiterthe delimiter string
featureContainera container of features to write
Returns
success

Definition at line 500 of file LArMvaHelper.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ WriteFeaturesToFileImpl()

template<typename TCONTAINER >
pandora::StatusCode lar_content::LArMvaHelper::WriteFeaturesToFileImpl ( std::ofstream &  outfile,
const std::string &  delimiter,
TCONTAINER &&  featureContainer 
)
staticprivate

Write the features of the given list to file (implementation method)

Parameters
outfilethe std::ofstream object to use
delimiterthe delimiter string
featureContainera container of features to write
Returns
success

Definition at line 512 of file LArMvaHelper.h.

Here is the caller graph for this function:

The documentation for this class was generated from the following files: