AliPhysics  d565ceb (d565ceb)
PWG::Tools::AliYAMLConfiguration Class Reference

YAML configuration class for AliPhysics. More...

#include <AliYAMLConfiguration.h>

Inheritance diagram for PWG::Tools::AliYAMLConfiguration:

Public Member Functions

 AliYAMLConfiguration (const std::string prefixString="AliEmcalCorrection", const std::string delimiterCharacter=":")
 
virtual ~AliYAMLConfiguration ()
 
Setup the configurations at various points of the analysis.
bool Initialize ()
 
bool Reinitialize ()
 
Add a new particular configuration under a given name.
int AddEmptyConfiguration (const std::string &configurationName)
 Add YAML configuration at configurationFilename to available configurations. More...
 
int AddConfiguration (std::string configurationFilename, std::string configurationName="")
 
int AddConfiguration (const YAML::Node node, std::string configurationName="")
 
Get a particular configuration by index or name.
bool DoesConfigurationExist (const int i) const
 
bool DoesConfigurationExist (const std::string &name) const
 
const std::pair< std::string, YAML::Node > & GetConfiguration (const int i) const
 
const std::pair< std::string, YAML::Node > & GetConfiguration (const std::string &name) const
 
std::pair< std::string, YAML::Node > & GetConfiguration (const int i)
 
std::pair< std::string, YAML::Node > & GetConfiguration (const std::string &name)
 
Translate between configuration name and index.
std::string GetConfigurationNameFromIndex (const unsigned int i) const
 
int GetConfigurationIndexFromName (const std::string &name) const
 
Remove a particular configuration by index or name.
bool RemoveConfiguration (const unsigned int i)
 
bool RemoveConfiguration (const std::string &name)
 
Get a property from the available configurations
template<typename T >
bool GetProperty (std::vector< std::string > propertyPath, const std::string &propertyName, T &property, const bool requiredProperty) const
 
template<typename T >
bool GetProperty (const std::vector< std::string > propertyPath, T &property, const bool requiredProperty) const
 
template<typename T >
bool GetProperty (std::string propertyName, T &property, const bool requiredProperty=true) const
 
Write a property to a particular configuration
template<typename T >
bool WriteProperty (std::string propertyName, T &property, std::string configurationName="")
 
Write a particular configuration at a given index or name to a file.
bool WriteConfiguration (const std::string &filename, const unsigned int i) const
 
bool WriteConfiguration (const std::string &filename, const std::string &configurationName) const
 
bool CompareConfigurations (const int config1, const int config2) const
 
bool CompareConfigurations (const int config1, const std::string &config2) const
 
bool CompareConfigurations (const std::string &config1, const std::string &config2) const
 

Protected Member Functions

bool DoesFileExist (const std::string &filename) const
 
void SetupReadingConfigurationFilePath (std::string &filename, const std::string &fileIdentifier) const
 
void WriteConfigurationToFilePath (const std::string &localFilename, std::string filename) const
 
void PrintConfiguration (std::ostream &stream, const std::pair< std::string, YAML::Node > &configPair) const
 
template<typename T >
unsigned int GetConfigurationIndexFromName (const std::string &name, const std::vector< std::pair< std::string, T >> &configurations) const
 
bool IsSharedValue (std::string &value) const
 
template<typename T >
auto PrintRetrievedPropertyValueImpl (std::stringstream &tempMessage, const T &property, int) const -> decltype(tempMessage<< property, void())
 
template<typename T >
auto PrintRetrievedPropertyValueImpl (std::stringstream &tempMessage, const std::vector< T > &property, int) const -> decltype(property.begin(), property.end(), tempMessage<< std::declval< T >(), void())
 
template<typename T >
void PrintRetrievedPropertyValueImpl (std::stringstream &tempMessage, const T &property, long) const
 
template<typename T >
void PrintRetrievedPropertyValue (std::stringstream &tempMessage, const T &property) const
 
template<typename T >
bool GetPropertyFromNode (const YAML::Node &node, std::string propertyName, T &property) const
 
template<typename T >
bool GetProperty (YAML::Node &node, YAML::Node &sharedParametersNode, const std::string &configurationName, std::string propertyName, T &property) const
 
template<typename T >
void WriteValue (YAML::Node &node, std::string propertyName, T &proeprty)
 

Protected Attributes

std::vector< std::pair< std::string, YAML::Node > > fConfigurations
 ! Contains all YAML configurations. The first element has the highest precedence. More...
 
std::vector< std::pair< std::string, std::string > > fConfigurationsStrings
 Contains all YAML configurations as strings so that they can be streamed. More...
 
bool fInitialized
 True if the configurations have been initialized. More...
 
std::string fPrefixString
 Contains the prefix of any names base node names which should be removed. More...
 
std::string fDelimiter
 Delimiter character to separate each level of the request. More...
 

Print a particular configuration at a given index or name to a file.

std::string toString (const int index=-1) const
 
std::ostream & Print (std::ostream &in, const int index=-1) const
 
std::ostream & Print (std::ostream &in, const std::string &configurationName) const
 
void Print (Option_t *="") const
 
std::ostream & operator<< (std::ostream &in, const AliYAMLConfiguration &myTask)
 

Detailed Description

YAML configuration class for AliPhysics.

A class to handle generic reading and writing to YAML files. This can be used to configure tasks, coordinate trains, or many other tasks which require configuration. While yaml-cpp can be used directly, this class handles many details such as accessing files on AliEn, as well as generally simplifying the user experience. The class can also handle multiple configuration files, first looking in the first file, and then if the value is not found, looking in subsequent configurations until the value is found. Values that are used in multiple places can be set together using "Shared Paramaters" (see the section below) or using YAML anchors.

Usage information:

Consider the following example YAML configuration.

hello:
world:
exampleValue: 10
example: 12.2
importantValues:
- entry1
- entry2
- entry3

To use the class, at least one YAML configuration file must be added to the class. To do so, use:

config.AddConfiguration(filename, name);
// Will only be checked if a requested value is not in the first configuration.
config.AddConfiguration(filename2, name2);
// Can also just start with an empty configuration if desired. Perhaps for writing.
config.AddEmptyConfiguration(name3);
// Once all configuration is done and the YAML nodes will not be modified any more
// (for example, at the end of an AddTask), call Initialize() to lock in the configurations
// for streaming to the grid.
config.Initialize();

YAML objects cannot be streamed, so after the configuration class is streamed, it must be re-initialized. This can be done in any function after streaming has been completed, such as UserCreateOutputObjects(). It only needs to be performed once.

fYAMLConfig.Reinitialize();

To access a value, use the GetProperty(...) or WriteProperty(...) functions. To use them, you must define an object of the desired type that you would like to read or write, and then describe the path to the property. The path consists of the names of YAML nodes, separated by a user specified delimiter (":" is the default). For the example YAML above, to read "exampleValue", the user would define an int to be set to the read value and the path would be "hello:world:exampleValue". As a convenience, there is a helper function which simplifies specifying the path. It will instead take a std::vector of strings to specify the path, thereby also setting the proper delimiter. So the path would be {"hello", "world", "exampleValue"}. Note that you may need to explicitly specify such an initialization as std::vector<std::string> if you don't define it as a variable.

Explicitly, this would look like:

int tempInt = 0;
// True specifies that the value must exist in the config
config.GetProperty({"hello", "world", "examplePath"}, tempInt, true);
std::cout << tempInt << "\n"; // Returns "10"
// Alternatively, you could specify the path explicitly (although not recommended)
config.GetProperty("hello:world:exampleValue", tempInt);
// The type specifies what is returned
double tempDouble = 0.;
config.GetProperty("example", tempDouble);
std::vector <std::string> importantValues;
config.GetProperty("importantValues", importantValues);
// The vector "importantValues" now contains three strings

That's basically all there is to using it. For more information, look at the documentation of the various GetProperty(...) and WriteProperty(...) functions. The interfaces to both functions are fairly similar.

Notes on using shared parameters:

sharedParameters are inherently limited. It can only retrieve values where the requested type is arithmetic, string, or bool. The retrieved shared parameters value can only be of those same types. Note that the shared parameters correspond to each configuration file. ie. If "sharedParameters:test" is requested in the first configuration file, then it will only look for the sharedParameters value in that configuration. Thus, if a sharedParameter is requested in a later configuration file, the earlier configuration shared parameter values will not be considered.

Given the limitations, YAML anchors are recommended for more advanced usage as they can be much more sophisticated.

Author
Raymond Ehlers raymo.nosp@m.nd.e.nosp@m.hlers.nosp@m.@yal.nosp@m.e.edu, Yale University
Date
Sept 19, 2017

Definition at line 143 of file AliYAMLConfiguration.h.

Constructor & Destructor Documentation

PWG::Tools::AliYAMLConfiguration::AliYAMLConfiguration ( const std::string  prefixString = "AliEmcalCorrection",
const std::string  delimiterCharacter = ":" 
)

Default constructor.

Parameters
[in]prefixStringPrefix to remove when gettnig a property.
[in]delimiterCharacterCharacter that delimits between each part of the YAML path.

Definition at line 27 of file AliYAMLConfiguration.cxx.

virtual PWG::Tools::AliYAMLConfiguration::~AliYAMLConfiguration ( )
inlinevirtual

Definition at line 146 of file AliYAMLConfiguration.h.

Member Function Documentation

int PWG::Tools::AliYAMLConfiguration::AddConfiguration ( std::string  configurationFilename,
std::string  configurationName = "" 
)

Add YAML configuration at a given filename to the available configurations.

Parameters
[in]configurationFilenameFilename of the YAML configuration file to be added.
[in]configurationNameName of the YAML node. The node will be stored under this name.
Returns
Position of configuration if the configuration was added successfully. -1 if unsuccessful.

Definition at line 59 of file AliYAMLConfiguration.cxx.

Referenced by AddEmptyConfiguration(), AliAnalysisTaskEmcalEmbeddingHelper::AutoConfigurePtHardBins(), AliEmcalCorrectionTask::CompareToStoredConfiguration(), PWGJE::EMCALJetTasks::AliAnalysisTaskEmcalJetHPerformance::Initialize(), AliEmcalCorrectionTask::InitializeConfiguration(), and AliAnalysisTaskEmcalEmbeddingHelper::InitializeYamlConfig().

int PWG::Tools::AliYAMLConfiguration::AddConfiguration ( const YAML::Node  node,
std::string  configurationName = "" 
)

Add a YAML node to the available configurations.

Parameters
[in]nodeYAML node to be added.
[in]configurationNameName of the YAML node. The node will be stored under this name.
Returns
Position of configuration if the configuration was added successfully. -1 if unsuccessful.

Definition at line 89 of file AliYAMLConfiguration.cxx.

int PWG::Tools::AliYAMLConfiguration::AddEmptyConfiguration ( const std::string &  configurationName)

Add YAML configuration at configurationFilename to available configurations.

Create an empty YAML node and adds it to the available configurations.

Parameters
[in]configurationNameName of the YAML node. The node will be stored under this name.
Returns
Position of configuration if the configuration was added successfully. -1 if unsuccessful.

Definition at line 44 of file AliYAMLConfiguration.cxx.

Referenced by AliAnalysisTaskEmcalEmbeddingHelper::AutoConfigurePtHardBins().

bool PWG::Tools::AliYAMLConfiguration::CompareConfigurations ( const int  configIndex1,
const int  configIndex2 
) const

Compare two configurations to see if they are identical.

Parameters
[in]configIndex1Index of the first configuration.
[in]configIndex2Index of the second configuration.
Returns
True if the configurations are the same.

Definition at line 183 of file AliYAMLConfiguration.cxx.

Referenced by AliEmcalCorrectionTask::CompareToStoredConfiguration().

bool PWG::Tools::AliYAMLConfiguration::CompareConfigurations ( const int  config1,
const std::string &  config2 
) const
inline

Definition at line 223 of file AliYAMLConfiguration.h.

Referenced by CompareConfigurations().

bool PWG::Tools::AliYAMLConfiguration::CompareConfigurations ( const std::string &  config1,
const std::string &  config2 
) const
inline

Definition at line 224 of file AliYAMLConfiguration.h.

Referenced by CompareConfigurations().

bool PWG::Tools::AliYAMLConfiguration::DoesConfigurationExist ( const int  i) const
inline
bool PWG::Tools::AliYAMLConfiguration::DoesConfigurationExist ( const std::string &  name) const
inline

Definition at line 169 of file AliYAMLConfiguration.h.

Referenced by DoesConfigurationExist().

bool PWG::Tools::AliYAMLConfiguration::DoesFileExist ( const std::string &  filename) const
inlineprotected

Checks if a file exists. This is done inline to make it efficient. See: https://stackoverflow.com/a/19841704

Parameters
filenameString containing the filename of the file to check.
Returns
True if the file exists.

Definition at line 242 of file AliYAMLConfiguration.cxx.

Referenced by AddConfiguration().

const std::pair<std::string, YAML::Node>& PWG::Tools::AliYAMLConfiguration::GetConfiguration ( const int  i) const
inline
const std::pair<std::string, YAML::Node>& PWG::Tools::AliYAMLConfiguration::GetConfiguration ( const std::string &  name) const
inline

Definition at line 171 of file AliYAMLConfiguration.h.

Referenced by GetConfiguration().

std::pair<std::string, YAML::Node>& PWG::Tools::AliYAMLConfiguration::GetConfiguration ( const int  i)
inline

Definition at line 172 of file AliYAMLConfiguration.h.

std::pair<std::string, YAML::Node>& PWG::Tools::AliYAMLConfiguration::GetConfiguration ( const std::string &  name)
inline

Definition at line 173 of file AliYAMLConfiguration.h.

Referenced by GetConfiguration().

int PWG::Tools::AliYAMLConfiguration::GetConfigurationIndexFromName ( const std::string &  name) const
inline
template<typename T >
unsigned int PWG::Tools::AliYAMLConfiguration::GetConfigurationIndexFromName ( const std::string &  name,
const std::vector< std::pair< std::string, T >> &  configurations 
) const
protected

Get the index of the configuration given the configuration name. If the same name is used multiple times, then the first instance will be returned.

Parameters
[in]nameName of the configuration.
[in]configurationsConfigurations to search through (could contain YAML nodes, or the string copies).
Returns
Index of the configuration, or -1 if not found.

Definition at line 680 of file AliYAMLConfiguration.h.

std::string PWG::Tools::AliYAMLConfiguration::GetConfigurationNameFromIndex ( const unsigned int  i) const
inline

Definition at line 179 of file AliYAMLConfiguration.h.

template<typename T >
bool PWG::Tools::AliYAMLConfiguration::GetProperty ( std::vector< std::string >  propertyPath,
const std::string &  propertyName,
T property,
const bool  requiredProperty 
) const

Helper function for main retrieval function. It automatically adds the property name to the end of the property path. By doing so, it allows the user to specify a general property path and then vary the property name between function calls.

Parameters
[in]propertyPathPath to the property in the YAML file.
[in]propertyNameName of the property to be retrieved.
[out]propertyContains the retrieved property.
[in]requiredPropertyTrue if the property is required
Returns
True if the property was set successfully

Definition at line 387 of file AliYAMLConfiguration.h.

Referenced by AliEmcalCorrectionTask::AddContainer(), AliEmcalCorrectionTask::AddContainersToComponent(), AliAnalysisTaskEmcalEmbeddingHelper::AutoConfigurePtHardBins(), AliEmcalCorrectionTask::CreateInputObjects(), AliEmcalCorrectionTask::DetermineComponentsToExecute(), AliEmcalCorrectionComponent::GetProperty(), AliEmcalCorrectionComponent::Initialize(), AliEmcalCorrectionTask::Initialize(), AliEmcalCorrectionCellEmulateCrosstalk::RetrieveAndSetProperties(), PWGJE::EMCALJetTasks::AliAnalysisTaskEmcalJetHPerformance::RetrieveAndSetTaskPropertiesFromYAMLConfig(), AliAnalysisTaskEmcalEmbeddingHelper::RetrieveTaskPropertiesFromYAMLConfig(), AliEmcalCorrectionTask::SetupCellsInfo(), AliEmcalCorrectionTask::SetupContainer(), PWGJE::EMCALJetTasks::AliAnalysisTaskEmcalJetHPerformance::SetupJetContainersFromYAMLConfig(), PWGJE::EMCALJetTasks::AliAnalysisTaskEmcalJetHPerformance::SetupResponseMatrixHists(), and AliAnalysisTaskEmcalEmbeddingHelper::UserCreateOutputObjects().

template<typename T >
bool PWG::Tools::AliYAMLConfiguration::GetProperty ( const std::vector< std::string >  propertyPath,
T property,
const bool  requiredProperty 
) const

Helper function for main retrieval function. Each value in the property path will be joined together, separated by the delimiter set in the configuration class.

Parameters
[in]propertyPathPath to the property in the YAML file.
[out]propertyContains the retrieved property.
[in]requiredPropertyTrue if the property is required
Returns
True if the property was set successfully

Definition at line 404 of file AliYAMLConfiguration.h.

template<typename T >
bool PWG::Tools::AliYAMLConfiguration::GetProperty ( std::string  propertyName,
T property,
const bool  requiredProperty = true 
) const

Main general function to get a property from a set of YAML configuration files. It first calls checks the user configuration, and then if the property is not found, it then checks the default configuration. If the property is required but it is not found, a fatal error is thrown.

Parameters
[in]propertyNameName of the property to retrieve
[out]propertyContains the retrieved property
[in]requiredPropertyTrue if the property is required
Returns
True if the property was set successfully

Definition at line 434 of file AliYAMLConfiguration.h.

template<typename T >
bool PWG::Tools::AliYAMLConfiguration::GetProperty ( YAML::Node &  node,
YAML::Node &  sharedParametersNode,
const std::string &  configurationName,
std::string  propertyName,
T property 
) const
protected

Actually handles retrieving parameters from YAML nodes.

For propertyName = "hello:example_special:property", the retrieval procedure is as follows:

  • Extract node name by searching the propertyName up to the delimiter (in this case, "hello").
  • Look up the node name.
    • If the node exists, recurse with node[nodeName] and with remaining propertyName = "example_special:property".
    • If it doesn't exist, check for the specialization delimiter (default: "_") and take the node name as everything before the delimiter (for example, "example_special" leads to "example").
  • If the delimiter is not found, then atempt to extract the property with the remaining node name.
    • If the property is arithmetic, std::string, or bool, it will check if the property is instead a shared parameter. If so, it will retrieve the shared parameter value.
    • The property is stored in the property, and true is returned if the effort was successful.
Parameters
[in]nodeMain YAML node containing the properties
[in]sharedParametersNodeYAML node containing the shared parameters
[in]configurationNameName of the configuration type.
[in]propertyNameName of the property to retrieve
[out]propertyContains the retrieved property
Returns
True if the property was set successfully

Definition at line 498 of file AliYAMLConfiguration.h.

template<typename T >
bool PWG::Tools::AliYAMLConfiguration::GetPropertyFromNode ( const YAML::Node &  node,
std::string  propertyName,
T property 
) const
protected

Utility function to retrieve the property from a already selected YAML node.

Parameters
[in]nodeYAML node from which the property should be retrieved
[in]propertyNameName of the property to retrieve
[out]propertyContains the retrieved property
Returns
True if the property was set successfully

Definition at line 365 of file AliYAMLConfiguration.h.

Referenced by AddConfiguration().

bool PWG::Tools::AliYAMLConfiguration::Initialize ( )

Initialize configurations.

This includes storing the contents of the YAML configurations into strings so that they can be streamed to the grid. (yaml-cpp objects do not work properly with ROOT streamers).

NOTE: fConfigurationInitialized is set to true if the function is successful.

Definition at line 340 of file AliYAMLConfiguration.cxx.

Referenced by PWGJE::EMCALJetTasks::AliAnalysisTaskEmcalJetHPerformance::Initialize(), AliAnalysisTaskEmcalEmbeddingHelper::Initialize(), and AliEmcalCorrectionTask::InitializeConfiguration().

bool PWG::Tools::AliYAMLConfiguration::IsSharedValue ( std::string &  value) const
protected

Check if value is a shared parameter, meaning we should look at another node. Also edits the input string to remove "sharedParameters:" if it exists, making it ready for use.

Parameters
[in]valueString containing the string value return by the parameter.
Returns
True if the value is shared.

Definition at line 400 of file AliYAMLConfiguration.cxx.

std::ostream & PWG::Tools::AliYAMLConfiguration::Print ( std::ostream &  in,
const int  index = -1 
) const

Print YAML configuration information on an output stream using the string representation provided by AliYAMLConfiguration::toString(). Used by operator<<.

If index = -1 (which is the default argument), then all configurations will be printed!

Parameters
inoutput stream stream
indexIndex of the configuration to print.
Returns
reference to the output stream

Definition at line 475 of file AliYAMLConfiguration.cxx.

Referenced by CompareConfigurations(), operator<<(), and Print().

std::ostream & PWG::Tools::AliYAMLConfiguration::Print ( std::ostream &  in,
const std::string &  configurationName 
) const

Print YAML configuration information on an output stream using the string representation provided by AliYAMLConfiguration::toString(). Used by operator<<

Parameters
inoutput stream stream.
configurationNameName of the configuration to print.
Returns
reference to the output stream

Definition at line 488 of file AliYAMLConfiguration.cxx.

void PWG::Tools::AliYAMLConfiguration::Print ( Option_t opt = "") const

Print basic YAML configuration information using the string representation provided by AliYAMLConfiguration::toString()

Definition at line 497 of file AliYAMLConfiguration.cxx.

void PWG::Tools::AliYAMLConfiguration::PrintConfiguration ( std::ostream &  stream,
const std::pair< std::string, YAML::Node > &  configPair 
) const
protected

Print a particular configuration.

Parameters
[in,out]streamoutput stream.
[in]configPairPair of string and YAML::Node containing the configuration to be printed.

Definition at line 419 of file AliYAMLConfiguration.cxx.

Referenced by toString().

template<typename T >
void PWG::Tools::AliYAMLConfiguration::PrintRetrievedPropertyValue ( std::stringstream &  tempMessage,
const T property 
) const
protected

Wrapper function to resolve ambiguity in function overloading. By passing 0 as the last argument to the PrintRetrievedPropertyValueImpl(...) functions, it will first attempt to use the matching int function, and then fall back the to the long function. This is effectively a hack to help c++ properly resolve the function to call.

Inspired by: https://stackoverflow.com/a/38283990

Parameters
[in]propertyProperty to be printed
[in,out]tempMessageStringstream into which the property should be streamed

Definition at line 349 of file AliYAMLConfiguration.h.

template<typename T >
auto PWG::Tools::AliYAMLConfiguration::PrintRetrievedPropertyValueImpl ( std::stringstream &  tempMessage,
const T property,
int   
) const -> decltype(tempMessage << property, void())
protected

Prints the retrieved property value if the type implements operator<<(). For more on how this achieved, see: https://stackoverflow.com/a/22759368 and https://stackoverflow.com/a/11866675. NOTE: This function should not be called directly, but through PrintRetrievedPropertyValue(...)

NOTE: This function returns void!

Parameters
[in]propertyProperty to be printed
[in,out]tempMessageStringstream into which the property should be streamed

Definition at line 297 of file AliYAMLConfiguration.h.

template<typename T >
auto PWG::Tools::AliYAMLConfiguration::PrintRetrievedPropertyValueImpl ( std::stringstream &  tempMessage,
const std::vector< T > &  property,
int   
) const -> decltype(property.begin(), property.end(), tempMessage << std::declval<T>(), void())
protected

Prints the retrieved values in a vector if the value is a vector (more specifically, if it implements begin() and end()) and if the type of the vector can be streamed in an ostream object. NOTE: This function should not be called directly, but through PrintRetrievedPropertyValue(...)

Parameters
[in]propertyProperty to be printed
[in,out]tempMessageStringstream into which the property should be streamed

Definition at line 311 of file AliYAMLConfiguration.h.

template<typename T >
void PWG::Tools::AliYAMLConfiguration::PrintRetrievedPropertyValueImpl ( std::stringstream &  tempMessage,
const T property,
long   
) const
protected

Handles all other cases where the property is not covered by the other functions.

NOTE: This function should not be called directly, but through PrintRetrievedPropertyValue(...)

NOTE: Cannot use "..." as a function argument here as a fall back because it causes problems with ROOT dictionary generation...

Parameters
[in]propertyProperty to be printed
[in,out]tempMessageStringstream into which the property should be streamed

Definition at line 331 of file AliYAMLConfiguration.h.

bool PWG::Tools::AliYAMLConfiguration::Reinitialize ( )

Reinitialize the configurations from the strings after streaming. This is required because the YAML node objects cannot be streamed.

This should be called immediately after the object is streamed on the grid. For example, at UserCreateOutputObjects().

Returns
True if the configurations were re-initialized.

Definition at line 366 of file AliYAMLConfiguration.cxx.

Referenced by AliEmcalCorrectionTask::CompareToStoredConfiguration(), PWGJE::EMCALJetTasks::AliAnalysisTaskEmcalJetHPerformance::UserCreateOutputObjects(), AliAnalysisTaskEmcalEmbeddingHelper::UserCreateOutputObjects(), and AliEmcalCorrectionTask::UserCreateOutputObjects().

bool PWG::Tools::AliYAMLConfiguration::RemoveConfiguration ( const unsigned int  i)

Remove a configuration at a given index.

Parameters
[in]iIndex of the configuration to be rmeoved.
Returns
true if the configuration was removed.

Definition at line 118 of file AliYAMLConfiguration.cxx.

Referenced by AliEmcalCorrectionTask::CompareToStoredConfiguration().

bool PWG::Tools::AliYAMLConfiguration::RemoveConfiguration ( const std::string &  name)
inline

Definition at line 187 of file AliYAMLConfiguration.h.

Referenced by RemoveConfiguration().

void PWG::Tools::AliYAMLConfiguration::SetupReadingConfigurationFilePath ( std::string &  filename,
const std::string &  fileIdentifier 
) const
protected

Handles setting up the configuration file to be opened, including in AliPhysics and on the grid. Cannot just use TFile::Open() because the YAML file is just text as opposed to a root file. In the case of a file on the grid, it is copied locally.

Parameters
[in,out]filenameName of the file to be open
[in]fileIdentifierAdditional file identifier to add onto the file name

Definition at line 256 of file AliYAMLConfiguration.cxx.

Referenced by AddConfiguration().

std::string PWG::Tools::AliYAMLConfiguration::toString ( const int  index = -1) const

Prints information about the YAML configuration(s).

If index = -1 (which is the default argument), then all configurations will be printed!

Parameters
indexIndex of the YAML configuration to be printed.
Returns
std::string containing information about the task.

Definition at line 433 of file AliYAMLConfiguration.cxx.

Referenced by Print().

bool PWG::Tools::AliYAMLConfiguration::WriteConfiguration ( const std::string &  filename,
const unsigned int  index 
) const

Write a YAML configuration node to file.

Parameters
[in]indexIndex of the YAML configuration node.
[in]filenameFilename to write the node to.
Returns
True if write was successful.

Definition at line 138 of file AliYAMLConfiguration.cxx.

Referenced by AliAnalysisTaskEmcalEmbeddingHelper::AutoConfigurePtHardBins(), WriteConfiguration(), and AliEmcalCorrectionTask::WriteConfigurationFile().

bool PWG::Tools::AliYAMLConfiguration::WriteConfiguration ( const std::string &  filename,
const std::string &  configurationName 
) const

Write a YAML configuration node to file.

Parameters
[in]configurationNameName of the YAML configuration node.
[in]filenameFilename to write the node to.
Returns
True if write was successful.

Definition at line 170 of file AliYAMLConfiguration.cxx.

void PWG::Tools::AliYAMLConfiguration::WriteConfigurationToFilePath ( const std::string &  localFilename,
std::string  filename 
) const
protected

Write a selected YAML configuration to file. Practically, it copies a local file to the desired location] to ensure seamless access to AliEn.

Parameters
[in]filenameFilename to which the configuration should be written.
[in]localFilenameFilename where the configuration was written locally.

Definition at line 299 of file AliYAMLConfiguration.cxx.

Referenced by WriteConfiguration().

template<typename T >
bool PWG::Tools::AliYAMLConfiguration::WriteProperty ( std::string  propertyName,
T property,
std::string  configurationName = "" 
)

Write a value to a YAML configuration. Note that the value is written to the YAML configuration, but then the YAML configuration needs to explicitly be written to file if the changes should be persistent.

Parameters
[in]propertyNamePath to the property in the YAML file.
[in]propertyProperty to be written.
[in]configurationNameName of the YAML configuration file to which the property should be written.
Returns
True if the write was successful.

Definition at line 606 of file AliYAMLConfiguration.h.

Referenced by AliAnalysisTaskEmcalEmbeddingHelper::AutoConfigurePtHardBins().

template<typename T >
void PWG::Tools::AliYAMLConfiguration::WriteValue ( YAML::Node &  node,
std::string  propertyName,
T property 
)
protected

Determine where the value should be written and write it to the appropriate YAML node.

Parameters
[in,out]nodeYAML node where the property should (eventually) be written.
[in]propertyNameName of the property to be written.
[in]propertyProperty to be written to the YAML node.

Definition at line 635 of file AliYAMLConfiguration.h.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  in,
const AliYAMLConfiguration myTask 
)
friend

Implementation of the output stream operator for AliYAMLConfiguration. Printing basic YAML configuration information provided by the function toString(). Note that since this is friend, it is defined outside the namespace.

Parameters
inoutput stream
myTaskTask which will be printed
Returns
Reference to the output stream

Definition at line 514 of file AliYAMLConfiguration.cxx.

Member Data Documentation

std::vector<std::pair<std::string, YAML::Node> > PWG::Tools::AliYAMLConfiguration::fConfigurations
protected

! Contains all YAML configurations. The first element has the highest precedence.

Definition at line 272 of file AliYAMLConfiguration.h.

Referenced by AddConfiguration(), Initialize(), Print(), Reinitialize(), RemoveConfiguration(), toString(), and WriteConfiguration().

std::vector<std::pair<std::string, std::string> > PWG::Tools::AliYAMLConfiguration::fConfigurationsStrings
protected

Contains all YAML configurations as strings so that they can be streamed.

Definition at line 274 of file AliYAMLConfiguration.h.

Referenced by Initialize(), Reinitialize(), and toString().

std::string PWG::Tools::AliYAMLConfiguration::fDelimiter
protected

Delimiter character to separate each level of the request.

Definition at line 278 of file AliYAMLConfiguration.h.

Referenced by toString().

bool PWG::Tools::AliYAMLConfiguration::fInitialized
protected

True if the configurations have been initialized.

Definition at line 276 of file AliYAMLConfiguration.h.

Referenced by Initialize(), Reinitialize(), and toString().

std::string PWG::Tools::AliYAMLConfiguration::fPrefixString
protected

Contains the prefix of any names base node names which should be removed.

Definition at line 277 of file AliYAMLConfiguration.h.

Referenced by toString().


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