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'. | |
bool | SetOutputDirectory (const string aOutDir) |
Sets a new output directory to save trigger files. | |
void | SetProcessVersion (const string aVersion) |
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 aFileName="default", const string aSubDir="", const string aWriteMode="RECREATE", const bool aWriteMeta=true) |
Writes triggers on disk. | |
Constructors and destructors | |
MakeTriggers (const string aOutDir, const string aStreamName, const string aFileFormat="root", const int aVerbose=0) | |
Constructor of the MakeTriggers class. | |
virtual | ~MakeTriggers (void) |
Destructor of the MakeTriggers class. | |
Protected Attributes | |
vector< string > | FileFormat |
output file formats | |
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 | |
string | OutDir |
output directory |
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 | aOutDir, | |
const string | aStreamName, | |||
const string | aFileFormat = "root" , |
|||
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.
The trigger files are saved in the directory 'aOutDir'. The base name for the trigger files is the stream name. The file name is completed by the timing of the triggers contained in the file. The output file format is set with 'aFileFormat'. The verbosity level, set by 'aVerbose', follows the GWOLLUM convention for verbosity.
Supported file formats:
To save the triggers in several different formats, enter a string containing all the desired formats (e.g. "rootxml").
It should be noted that saving triggers in another format than ROOT is a dead-end for GWOLLUM. Indeed, GWOLLUM is entirely based on ROOT, therefore, GWOLLUM routines can only read and process triggers if they are saved in a ROOT format. For this reason, the user is strongly encouraged to save triggers in a ROOT format.
aOutDir | output directory | |
aStreamName | stream name | |
aFileFormat | output file formats | |
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 = "none".
aMprocessname | process name |
bool MakeTriggers::SetOutputDirectory | ( | const string | aOutDir | ) | [inline] |
Sets a new output directory to save trigger files.
The new directory must exist.
aOutDir | new output directory |
void MakeTriggers::SetProcessVersion | ( | const string | aVersion | ) | [inline] |
Sets the version for this process.
aUserName | user name |
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 | 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 the output file as well as the segment and metadata trees. The MakeTriggers object is then completely reset (see Triggers::ResetTriggers()).
The output file path is returned. "none" is returned if this function fails in some way.
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 triggers in a 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".
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 |
vector<string> MakeTriggers::FileFormat [protected] |
output file formats
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
string MakeTriggers::OutDir [protected] |
output directory