Write triggers on disk. More...
#include <MakeTriggers.h>
Public Member Functions | |
bool | InitUserMetaData (vector< string > aMusername, vector< string > aMusertype) |
Initializes the user-defined meta-data fields. | |
void | Reset (void) |
Resets all. | |
void | SetMprocessname (const string aMprocessname) |
Set the process name for the meta-data field 'Mprocessname'. | |
void | SetProcessVersion (const string aMprocessversion) |
Sets the version for this process. | |
bool | SetUserMetaData (const string aMusername, const string aMuservalue) |
Set user-defined meta-data. | |
bool | SetUserMetaData (const string aMusername, const int aMuservalue) |
Set user-defined meta-data. | |
bool | SetUserMetaData (const string aMusername, const double aMuservalue) |
Set user-defined meta-data. | |
string | Write (const string aOutDir=".", const string aFileFormat="root", const string aFileName="default", const string aSubDir="", const string aWriteMode="RECREATE", const bool aWriteMeta=true) |
Writes triggers on disk. | |
Constructors and destructors | |
MakeTriggers (const string aStreamName, const int aVerbose=0) | |
Constructor of the MakeTriggers class. | |
virtual | ~MakeTriggers (void) |
Destructor of the MakeTriggers class. | |
Protected Attributes | |
double * | Mdvar |
user metatree var - double | |
double | Mend |
meta end time | |
double | Mfmax |
meta maximum fend | |
double | Mfmin |
meta minimum fstart | |
int * | Mivar |
user metatree var - int | |
string | Mprocessname |
meta process name | |
string | Mprocessuser |
meta user name | |
string | Mprocessversion |
meta process version | |
double | Mqmax |
meta maximum Q | |
double | Mqmin |
meta minimum Q | |
double | Msnrmax |
meta maximum SNR | |
double | Msnrmin |
meta minimum SNR | |
double | Mstart |
meta start time | |
string | Mstreamname |
meta stream name | |
string * | Msvar |
user metatree var - string | |
TTree * | Mtree |
metadata tree | |
vector< string > | Musername |
user metadata name | |
vector< string > | Musertype |
user metadata type |
Write triggers on disk.
This class was designed to write triggers in a ROOT tree following the GWOLLUM convention for triggers (some other output formats are also available). When triggers are produced by some external algorithms, the MakeTriggers class can be used to manage output triggers, to save them and to perform some basic operations (like clustering).
The user is responsible to fill both the Segments and the Triggers structure from which this class inherits. In particular, one must make sure that the segments and the triggers match the GWOLLUM convention for triggers.
MakeTriggers::MakeTriggers | ( | const string | aStreamName, | |
const int | aVerbose = 0 | |||
) |
Constructor of the MakeTriggers class.
The different structures are initialized: the input stream, the trigger tree, the segments, the cluster tree and the metadata tree.
aStreamName | stream name | |
aVerbose | verbosity level |
MakeTriggers::~MakeTriggers | ( | void | ) | [virtual] |
Destructor of the MakeTriggers class.
bool MakeTriggers::InitUserMetaData | ( | vector< string > | aMusername, | |
vector< string > | aMusertype | |||
) |
Initializes the user-defined meta-data fields.
'aMusername' should be a non-empty vector with the list of meta-data names. 'aMuservalue' should be a vector with the list of meta-data types (same size as aMusername). Supported types: "d" for double, "i" for int, "s" for string. Default values are -1 for double and int types and "none" for string type.
aMusername | vector of metadata names | |
aMusertype | vector of metadata types (i/d/s) |
void MakeTriggers::Reset | ( | void | ) |
Resets all.
the memory is cleaned up:
Reimplemented from Segments.
void MakeTriggers::SetMprocessname | ( | const string | aMprocessname | ) | [inline] |
Set the process name for the meta-data field 'Mprocessname'.
See GWOLLUM convention. By default Mprocessname = "PROC".
aMprocessname | process name |
void MakeTriggers::SetProcessVersion | ( | const string | aMprocessversion | ) | [inline] |
Sets the version for this process.
By default = "0".
aMprocessversion | process version |
bool MakeTriggers::SetUserMetaData | ( | const string | aMusername, | |
const string | aMuservalue | |||
) |
Set user-defined meta-data.
Set the meta-data named 'aMusername' with the value 'aMuservalue'.
aMusername | metadata name | |
aMuservalue | metadata value |
bool MakeTriggers::SetUserMetaData | ( | const string | aMusername, | |
const int | aMuservalue | |||
) |
Set user-defined meta-data.
Set the meta-data named 'aMusername' with the value 'aMuservalue'.
aMusername | metadata name | |
aMuservalue | metadata value |
bool MakeTriggers::SetUserMetaData | ( | const string | aMusername, | |
const double | aMuservalue | |||
) |
Set user-defined meta-data.
Set the meta-data named 'aMusername' with the value 'aMuservalue'.
aMusername | metadata name | |
aMuservalue | metadata value |
string MakeTriggers::Write | ( | const string | aOutDir = "." , |
|
const string | aFileFormat = "root" , |
|||
const string | aFileName = "default" , |
|||
const string | aSubDir = "" , |
|||
const string | aWriteMode = "RECREATE" , |
|||
const bool | aWriteMeta = true | |||
) |
Writes triggers on disk.
This function writes all the triggers added until now in an output file as well as the segments and metadata trees. The MakeTriggers object is then completely reset (see Triggers::ResetTriggers()).
The output file path is returned. In case of several formats, root then txt then xml file is returned. "none" is returned if this function fails in some way. Several output formats are supported:
Multiple output formats can be requested. Use a single string to list the requested formats. Note that for the xml and txt formats, if triggers were clustered, only clusters are saved. For the root format, only triggers are saved.
The optional argument 'aFileName' is used to bypass the file naming convention of GWOLLUM. With this option, the trigger file will be given a new name: [aFileName].[format]
For ROOT files, it is possible to write the trees in a ROOT sub-directory. Use the optional argument 'aSubDir'. Only in this case, the trigger file can be updated when adding several directories. To do this, use aWriteMode="UPDATE".
aOutDir | output directory, must exist | |
aFileFormat | list of file formats | |
aFileName | new base name for ouput file | |
aSubDir | ROOT sub-directory name to write the triggers (only for ROOT format) | |
aWriteMode | write mode: "RECREATE" or "UPDATE" (only with sub-directories) | |
aWriteMeta | flag to write (or not) the metadata tree |
double* MakeTriggers::Mdvar [protected] |
user metatree var - double
double MakeTriggers::Mend [protected] |
meta end time
double MakeTriggers::Mfmax [protected] |
meta maximum fend
double MakeTriggers::Mfmin [protected] |
meta minimum fstart
int* MakeTriggers::Mivar [protected] |
user metatree var - int
string MakeTriggers::Mprocessname [protected] |
meta process name
string MakeTriggers::Mprocessuser [protected] |
meta user name
string MakeTriggers::Mprocessversion [protected] |
meta process version
double MakeTriggers::Mqmax [protected] |
meta maximum Q
double MakeTriggers::Mqmin [protected] |
meta minimum Q
double MakeTriggers::Msnrmax [protected] |
meta maximum SNR
double MakeTriggers::Msnrmin [protected] |
meta minimum SNR
double MakeTriggers::Mstart [protected] |
meta start time
string MakeTriggers::Mstreamname [protected] |
meta stream name
string* MakeTriggers::Msvar [protected] |
user metatree var - string
TTree* MakeTriggers::Mtree [protected] |
metadata tree
vector<string> MakeTriggers::Musername [protected] |
user metadata name
vector<string> MakeTriggers::Musertype [protected] |
user metadata type