LArSoft
v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
|
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. More... | |
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. More... | |
template<typename TCONTAINER > | |
static bool | Classify (const MvaInterface &classifier, TCONTAINER &&featureContainer) |
Use the trained classifier to predict the boolean class of an example. More... | |
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. More... | |
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) More... | |
template<typename TCONTAINER > | |
static double | CalculateProbability (const MvaInterface &classifier, TCONTAINER &&featureContainer) |
Use the trained mva to calculate a classification probability for an example. More... | |
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. More... | |
template<typename... Ts, typename... TARGS> | |
static MvaFeatureVector | CalculateFeatures (const MvaFeatureToolVector< Ts... > &featureToolVector, TARGS &&...args) |
Calculate the features in a given feature tool vector. More... | |
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. More... | |
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. More... | |
template<typename... Ts> | |
static pandora::StatusCode | AddFeatureToolToVector (pandora::AlgorithmTool *const pFeatureTool, MvaFeatureToolVector< Ts... > &featureToolVector) |
Add a feature tool to a vector of feature tools. More... | |
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. More... | |
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. More... | |
template<typename TLIST , typename... TLISTS> | |
static MvaFeatureVector | ConcatenateFeatureLists (TLIST &&featureList, TLISTS &&...featureLists) |
Recursively concatenate vectors of features. More... | |
static MvaFeatureVector | ConcatenateFeatureLists () |
Recursively concatenate vectors of features (terminating method) More... | |
Static Private Member Functions | |
static std::string | GetTimestampString () |
Get a timestamp string for this point in time. More... | |
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. More... | |
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) More... | |
LArMvaHelper class.
Definition at line 71 of file LArMvaHelper.h.
typedef std::map<std::string, pandora::AlgorithmTool *> lar_content::LArMvaHelper::AlgorithmToolMap |
Definition at line 79 of file LArMvaHelper.h.
typedef std::map<std::string, double> lar_content::LArMvaHelper::DoubleMap |
Definition at line 76 of file LArMvaHelper.h.
Definition at line 74 of file LArMvaHelper.h.
Definition at line 78 of file LArMvaHelper.h.
Definition at line 75 of file LArMvaHelper.h.
|
static |
Add a feature tool to a map of feature tools.
pFeatureTool | the feature tool |
pFeatureToolName | the name of the feature tool |
featureToolMap | the map to append |
Definition at line 465 of file LArMvaHelper.h.
Referenced by lar_content::ElectronInitialRegionRefinementAlgorithm::ReadSettings(), and lar_content::MvaPfoCharacterisationAlgorithm< T >::ReadSettings().
|
static |
Add a feature tool to a vector of feature tools.
pFeatureTool | the feature tool |
featureToolVector | the vector to append |
Definition at line 451 of file LArMvaHelper.h.
Referenced by lar_content::EnergyKickVertexSelectionAlgorithm::ReadSettings(), and lar_content::TrainedVertexSelectionAlgorithm::ReadSettings().
|
static |
Use the trained classifer to calculate the classification score of an example (>0 means boolean class true)
classifier | the classifier |
featureContainer | the container of features |
Definition at line 361 of file LArMvaHelper.h.
References lar_content::MvaInterface::CalculateClassificationScore().
Referenced by lar_content::BdtBeamParticleIdTool::SliceFeatures::GetAdaBoostDecisionTreeScore().
|
static |
Calculate the features in a given feature tool vector.
featureToolVector | the feature tool vector |
args | arguments to pass to the tool |
Definition at line 399 of file LArMvaHelper.h.
Referenced by lar_content::MvaPfoCharacterisationAlgorithm< T >::IsClearTrack(), lar_content::MvaPfoCharacterisationAlgorithm< T >::MvaPfoCharacterisationAlgorithm(), and lar_content::ElectronInitialRegionRefinementAlgorithm::RefineShower().
|
static |
Calculate the features in a given feature tool map, and fill an MvaFeatureMap and vector with feature order.
featureToolOrder | vector of strings of the ordered keys |
featureToolMap | the feature tool map |
featureOrder | a vector that is to be filled with the order of features in the function |
args | arguments to pass to the tool |
Definition at line 412 of file LArMvaHelper.h.
|
static |
Calculate the features of a given derived feature tool type in a feature tool vector.
featureToolVector | the feature tool vector |
args | arguments to pass to the tool |
Definition at line 434 of file LArMvaHelper.h.
|
static |
Use the trained mva to calculate a classification probability for an example.
classifier | the classifier |
featureContainer | the container of features |
Definition at line 369 of file LArMvaHelper.h.
References lar_content::MvaInterface::CalculateProbability().
Referenced by lar_content::NeutrinoIdTool< T >::SliceFeatures::GetNeutrinoProbability(), lar_content::MvaPfoCharacterisationAlgorithm< T >::IsClearTrack(), and lar_content::MvaPfoCharacterisationAlgorithm< T >::MvaPfoCharacterisationAlgorithm().
|
static |
Use the trained mva to calculate a classification probability for an example – using a map.
classifier | the classifier |
featureOrder | the vector of strings corresponding to ordered list of keys |
featureContainer | the container of features |
Definition at line 377 of file LArMvaHelper.h.
|
static |
Use the trained classifier to predict the boolean class of an example.
classifier | the classifier |
featureContainer | the container of features |
Definition at line 331 of file LArMvaHelper.h.
References lar_content::MvaInterface::Classify().
Referenced by lar_content::MvaVertexSelectionAlgorithm< T >::CompareVertices(), lar_content::MvaPfoCharacterisationAlgorithm< T >::IsClearTrack(), and lar_content::MvaPfoCharacterisationAlgorithm< T >::MvaPfoCharacterisationAlgorithm().
|
static |
Use the trained classifier to predict the boolean class of an example – using a map.
classifier | the classifier |
featureOrder | the vector of strings corresponding to ordered list of keys |
featureContainer | the container of features |
Definition at line 339 of file LArMvaHelper.h.
|
static |
Recursively concatenate vectors of features.
featureList | a list of features |
featureLists | optional further lists of features |
Definition at line 523 of file LArMvaHelper.h.
References value.
|
inlinestatic |
Recursively concatenate vectors of features (terminating method)
Definition at line 541 of file LArMvaHelper.h.
Referenced by lar_content::MvaVertexSelectionAlgorithm< T >::CompareVertices(), and lar_content::TrainedVertexSelectionAlgorithm::ProduceTrainingExamples().
|
inlinestaticprivate |
Get a timestamp string for this point in time.
Definition at line 479 of file LArMvaHelper.h.
|
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.
algorithm | the parent algorithm calling this function |
xmlHandle | the relevant xml handle |
listName | the name of the algorithm tool list |
algorithmToolMap | to receive the vector of addresses of the algorithm tool instances, but also keep the name |
Definition at line 16 of file LArMvaHelper.cc.
Referenced by lar_content::ElectronInitialRegionRefinementAlgorithm::ReadSettings(), and lar_content::MvaPfoCharacterisationAlgorithm< T >::ReadSettings().
|
static |
Produce a training example with the given features and result.
trainingOutputFile | the file to which to append the example |
featureContainer | the container of features |
Definition at line 285 of file LArMvaHelper.h.
Referenced by lar_content::MvaPfoCharacterisationAlgorithm< T >::IsClearTrack(), lar_content::MvaPfoCharacterisationAlgorithm< T >::MvaPfoCharacterisationAlgorithm(), lar_content::TrainedVertexSelectionAlgorithm::ProduceTrainingExamples(), lar_content::ElectronInitialRegionRefinementAlgorithm::RefineShower(), lar_content::NeutrinoIdTool< T >::SelectOutputPfos(), and lar_content::BdtBeamParticleIdTool::SelectOutputPfos().
|
static |
Produce a training example with the given features and result - using a map.
trainingOutputFile | the file to which to append the example |
featureOrder | the vector of strings corresponding to ordered list of keys |
featureContainer | the container of features |
Definition at line 308 of file LArMvaHelper.h.
|
inlinestaticprivate |
Write the features of the given lists to file.
outfile | the std::ofstream object to use |
delimiter | the delimiter string |
featureContainer | a container of features to write |
Definition at line 500 of file LArMvaHelper.h.
References value.
|
staticprivate |
Write the features of the given list to file (implementation method)
outfile | the std::ofstream object to use |
delimiter | the delimiter string |
featureContainer | a container of features to write |
Definition at line 512 of file LArMvaHelper.h.