LDMX Software
|
Singleton class used to manage the creation and pooling of ntuples. More...
#include <NtupleManager.h>
Public Member Functions | |
void | create (const std::string &tname) |
Create a ROOT tree to hold the ntuple variables (ROOT leaves). | |
template<typename VarType > | |
void | addVar (const std::string &tname, const std::string &vname) |
Add a variable of type VarType to the ROOT tree with name 'tname'. | |
template<typename T > | |
void | setVar (const std::string &vname, const T &value) |
Set the value of the variable named 'vname'. | |
void | fill () |
void | clear () |
Reset all of the variables to their limits. | |
void | reset () |
Reset NtupleManager to blank state. | |
NtupleManager (const NtupleManager &)=delete | |
Hide Copy Constructor. | |
void | operator= (const NtupleManager &)=delete |
Hide Assignment Operator. | |
Static Public Member Functions | |
static NtupleManager & | getInstance () |
Private Member Functions | |
NtupleManager () | |
Private constructor to prevent instantiation. | |
Private Attributes | |
std::unordered_map< std::string, TTree * > | trees_ |
Container for output ROOT trees. | |
framework::Bus | bus_ |
Container for buffering variables. | |
Singleton class used to manage the creation and pooling of ntuples.
Definition at line 36 of file NtupleManager.h.
|
private |
|
inline |
Add a variable of type VarType to the ROOT tree with name 'tname'.
If the variable already exists in any tree or the requested tree does not exists, an exception is thrown.
in] VarType type of variable to add to the tree
[in] | tname | Name of the tree to add the variable to. |
[in] | vname | Name of the variable to add to the tree |
Exception | if tree doesn't exist or variable already does |
Definition at line 58 of file NtupleManager.h.
References framework::Bus::attach(), framework::Bus::board(), bus_, framework::Bus::isOnBoard(), and trees_.
Referenced by ecal::test::EcalCheckEnergyReconstruction::onProcessStart(), and hcal::test::HcalCheckReconstruction::onProcessStart().
void framework::NtupleManager::clear | ( | ) |
Reset all of the variables to their limits.
Definition at line 30 of file NtupleManager.cxx.
References bus_, and framework::Bus::clear().
Referenced by framework::Process::run().
void framework::NtupleManager::create | ( | const std::string & | tname | ) |
Create a ROOT tree to hold the ntuple variables (ROOT leaves).
name | Name of the tree. |
Definition at line 14 of file NtupleManager.cxx.
References trees_.
Referenced by trigger::NtupleWriter::onProcessStart(), ecal::test::EcalCheckEnergyReconstruction::onProcessStart(), and hcal::test::HcalCheckReconstruction::onProcessStart().
void framework::NtupleManager::fill | ( | ) |
Definition at line 25 of file NtupleManager.cxx.
|
static |
Definition at line 8 of file NtupleManager.cxx.
Referenced by trigger::NtupleWriter::onProcessStart(), trigger::NtupleWriter::produce(), framework::Process::run(), and TEST_CASE().
void framework::NtupleManager::reset | ( | ) |
Reset NtupleManager to blank state.
We assume that ROOT handles cleanup of TTrees when writing them to a blank state.
Definition at line 32 of file NtupleManager.cxx.
References bus_, framework::Bus::everybodyOff(), and trees_.
Referenced by framework::Process::run().
|
inline |
Set the value of the variable named 'vname'.
If the variable value is not set, the default value will be used when filling the tree. If the requested variable has not been created, a warning will be printed. This allows a user to choose to make a subset of an ntuple by simply not adding the variable to the tree.
in] T type of variable
[in] | vname | Name of the variable |
[in] | value | The value of the variable |
Definition at line 92 of file NtupleManager.h.
References bus_, framework::Bus::isOnBoard(), and framework::Bus::update().
Referenced by ecal::test::EcalCheckEnergyReconstruction::analyze(), and hcal::test::HcalCheckReconstruction::analyze().
|
private |
|
private |
Container for output ROOT trees.
Definition at line 134 of file NtupleManager.h.