Omicron  4.2.0
An algorithm to detect and characterize transient events in gravitational-wave detectors
Loading...
Searching...
No Matches
OxInit Class Reference

Ox analysis initialization. More...

#include <OxInit.h>

Inheritance diagram for OxInit:

Public Member Functions

void AttachTree (TTree *aTree)
 Attach a TTree to the output file.
 
void CloseOutputFile (void)
 Closes the current ouput file (if any).
 
bool CreateOutputFile (string &aOutFileName, const unsigned int aTime)
 Creates an ouput file.
 
string GetName (void)
 Returns the object name.
 
string GetOutputDirectory (void)
 Returns the path to the output directory.
 
unsigned int GetOxFileN (void)
 Returns the number of Ox files.
 
bool GetStatus (void)
 Returns the class status.
 
Constructors and destructors
 OxInit (const string aOptionFile)
 Constructor of the OxInit class.
 
virtual ~OxInit (void)
 Destructor of the OxInit class.
 

Protected Member Functions

void AddOptions (void)
 Adds options from the text file.
 
void DefineOption (const string aTag, const string aKey, const double aDefaultValue, const unsigned int aSize)
 Defines an option (double).
 
void DefineOption (const string aTag, const string aKey, const int aDefaultValue, const unsigned int aSize)
 Defines an option (integer).
 
void DefineOption (const string aTag, const string aKey, const string aDefaultValue, const unsigned int aSize)
 Defines an option (string).
 
void DefineOption (const string aTag, const string aKey, const unsigned int aDefaultValue, const unsigned int aSize)
 Defines an option (unsigned integer).
 
string GetOxFileName (const unsigned int aFileIndex)
 Returns the path to the Ox file.
 
void OverloadOption (const string aTag, const string aKey)
 Overloads an option using the text file as a reference.
 

Protected Attributes

GwollumOptions * ox_opt
 List of options.
 
bool status
 Class status.
 

Private Member Functions

void GetOptionsFromOxFiles (void)
 Gets options from a list of Ox files.
 

Private Attributes

string * ox_filename
 List of Ox file names.
 
string ox_name
 Object name.
 
unsigned int ox_nfiles
 Number of input Ox files matching the patterns (without checking content).
 
string ox_opt_filepath
 Path to the option text file.
 
GwollumOptions * ox_opt_text
 List of options extracted from a txt file.
 
string ox_outdir
 Path to the output directory.
 
TFile * ox_outfile
 Output file.
 

Detailed Description

Ox analysis initialization.

This class is designed to initialize an Ox analysis with a set of options.

Constructor & Destructor Documentation

◆ OxInit()

OxInit::OxInit ( const string  aOptionFile)

Constructor of the OxInit class.

The list of options is given in a text file. They are identified with a set of tag and key words:

  • OXI OXFILELIST: list of file patterns pointing to Ox files.
  • OXI NAME: analysis name. If a list of Ox files is provided, the name is extracted from the files.
  • OXI OUTDIR: path to the output directory.

If a list of Ox files is provided, the options are downloaded from the Ox files. Some options are overwritten when provided in the text file:

  • OXI OXFILELIST
  • OXI OUTDIR
Parameters
[in]aOptionFilePath to the option text file.

◆ ~OxInit()

OxInit::~OxInit ( void  )
virtual

Destructor of the OxInit class.

Member Function Documentation

◆ AddOptions()

void OxInit::AddOptions ( void  )
protected

Adds options from the text file.

Options (and values) in the text file are added if:

  1. No Ox files are provided.
  2. The option is missing in the Ox files
  3. New options were defined with DefineOption().

◆ AttachTree()

void OxInit::AttachTree ( TTree *  aTree)
inline

Attach a TTree to the output file.

Parameters
[in]aTreePointer to the TTree.
Precondition
The output file must exist: see CreateOutputFile().

◆ CloseOutputFile()

void OxInit::CloseOutputFile ( void  )

Closes the current ouput file (if any).

All the ROOT objects are saved in the file before closing.

◆ CreateOutputFile()

bool OxInit::CreateOutputFile ( string &  aOutFileName,
const unsigned int  aTime 
)

Creates an ouput file.

A new ROOT file is opened in the output directory to save the Ox analysis results. The file name is "[NAME]_[TIME].root", where "[TIME] must be provided by the user. [NAME] is the name provided in the option file. The file remains open. @warning If [TIME]=0, the [TIME] variable is incremented (+1) to guarantee the output file does not already exist. Moreover, [NAME] also includes a "_results" suffix.

The option TTree is saved in the file.

Note
If a file is already open, it is closed before opening a new file (saving all the pending objects).
Parameters
[out]aOutFileNameOutput ROOT file name.
[in]aTimeTime used to name the ouput file.

◆ DefineOption() [1/4]

void OxInit::DefineOption ( const string  aTag,
const string  aKey,
const double  aDefaultValue,
const unsigned int  aSize 
)
inlineprotected

Defines an option (double).

Parameters
[in]aTagOption tag.
[in]aKeyOption aKey.
[in]aDefaultValueDefault value.
[in]aSizeNumber of values for this option. Use 0 for no limits on the size.

◆ DefineOption() [2/4]

void OxInit::DefineOption ( const string  aTag,
const string  aKey,
const int  aDefaultValue,
const unsigned int  aSize 
)
inlineprotected

Defines an option (integer).

Parameters
[in]aTagOption tag.
[in]aKeyOption aKey.
[in]aDefaultValueDefault value.
[in]aSizeNumber of values for this option. Use 0 for no limits on the size.

◆ DefineOption() [3/4]

void OxInit::DefineOption ( const string  aTag,
const string  aKey,
const string  aDefaultValue,
const unsigned int  aSize 
)
inlineprotected

Defines an option (string).

Parameters
[in]aTagOption tag.
[in]aKeyOption aKey.
[in]aDefaultValueDefault value.
[in]aSizeNumber of values for this option. Use 0 for no limits on the size.

◆ DefineOption() [4/4]

void OxInit::DefineOption ( const string  aTag,
const string  aKey,
const unsigned int  aDefaultValue,
const unsigned int  aSize 
)
inlineprotected

Defines an option (unsigned integer).

Parameters
[in]aTagOption tag.
[in]aKeyOption aKey.
[in]aDefaultValueDefault value.
[in]aSizeNumber of values for this option. Use 0 for no limits on the size.

◆ GetName()

string OxInit::GetName ( void  )
inline

Returns the object name.

◆ GetOptionsFromOxFiles()

void OxInit::GetOptionsFromOxFiles ( void  )
private

Gets options from a list of Ox files.

When a list of Ox files is provided, this function lists all the files matching the file patterns. From these files, the Ox options are extracted. If a file does not contain Ox options, the file is ignored.

The list of options must be uniform across all the Ox files.

◆ GetOutputDirectory()

string OxInit::GetOutputDirectory ( void  )
inline

Returns the path to the output directory.

◆ GetOxFileN()

unsigned int OxInit::GetOxFileN ( void  )
inline

Returns the number of Ox files.

This the number of files matching the patterns listed with OXI/OXFILELIST containing Ox options.

◆ GetOxFileName()

string OxInit::GetOxFileName ( const unsigned int  aFileIndex)
inlineprotected

Returns the path to the Ox file.

Parameters
[in]aFileIndexFile index: must be valid.

◆ GetStatus()

bool OxInit::GetStatus ( void  )
inline

Returns the class status.

◆ OverloadOption()

void OxInit::OverloadOption ( const string  aTag,
const string  aKey 
)
protected

Overloads an option using the text file as a reference.

Parameters
[in]aTagOption tag.
[in]aKeyOption key.

Member Data Documentation

◆ ox_filename

string* OxInit::ox_filename
private

List of Ox file names.

◆ ox_name

string OxInit::ox_name
private

Object name.

◆ ox_nfiles

unsigned int OxInit::ox_nfiles
private

Number of input Ox files matching the patterns (without checking content).

◆ ox_opt

GwollumOptions* OxInit::ox_opt
protected

List of options.

◆ ox_opt_filepath

string OxInit::ox_opt_filepath
private

Path to the option text file.

◆ ox_opt_text

GwollumOptions* OxInit::ox_opt_text
private

List of options extracted from a txt file.

◆ ox_outdir

string OxInit::ox_outdir
private

Path to the output directory.

◆ ox_outfile

TFile* OxInit::ox_outfile
private

Output file.

◆ status

bool OxInit::status
protected

Class status.


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