ROOTANA
|
#include <TRootanaEventLoop.hxx>
Public Member Functions | |
virtual | ~TRootanaEventLoop () |
TDataContainer * | GetDataContainer () |
Method to get the data container that event loop owns. More... | |
virtual bool | ProcessMidasEvent (TDataContainer &dataContainer)=0 |
virtual void | Initialize (void) |
virtual void | BeginRun (int transition, int run, int time) |
virtual void | EndRun (int transition, int run, int time) |
virtual void | InitializeRAD (void) |
Special version of Init method, to be used only by TRootanaDisplay. More... | |
virtual void | BeginRunRAD (int transition, int run, int time) |
virtual void | EndRunRAD (int transition, int run, int time) |
Also special version of EOR method, to be used only by TRootanaDisplay. More... | |
virtual void | Finalize () |
virtual void | Usage (void) |
virtual bool | CheckOption (std::string option) |
virtual bool | PreFilter (TDataContainer &dataContainer) |
bool | IsOnline () const |
Are we processing online data? More... | |
bool | IsOffline () const |
Are we processing offline data? More... | |
int | GetCurrentRunNumber () const |
Current Run Number. More... | |
void | SetCurrentRunNumber (int run) |
Current Run Number. More... | |
int | ExecuteLoop (int argc, char *argv[]) |
Method to actually process the Midas information, either as file or online. More... | |
int | ProcessMidasFile (TApplication *app, const char *fname) |
int | ProcessMidasOnline (TApplication *app, const char *hostname, const char *exptname) |
void | DisableAutoMainWindow () |
Disable automatic creation of MainWindow. More... | |
void | UseBatchMode () |
Use a batch mode, where we don't check ROOT status. More... | |
MVOdb * | GetODB () |
Get pointer to ODB variables. More... | |
void | OpenRootFile (int run, std::string midasFilename=std::string("")) |
Open output ROOT file. More... | |
void | CloseRootFile () |
Cloe output ROOT file. More... | |
bool | IsRootFileValid () |
Check if output ROOT file is valid and open. More... | |
void | DisableRootOutput (bool disable=true) |
int | IsRootOutputEnabled () |
void | SetOutputFilename (std::string name) |
virtual std::string | SetFullOutputFileName (int run, std::string midasFilename) |
void | SetOnlineName (std::string name) |
void | ProcessThisEventID (int eventID) |
bool | CheckEventID (int eventId) |
Little helper method to check if EventID matchs requested EventID list. More... | |
void | SuppressTimestampWarnings () |
bool | GetSuppressTimestampWarnings () |
Suppress timestamp warnings? true = suppress warnings. More... | |
void | UseOnlyRecent (bool setting=true) |
void | SetTHttpServerReadWrite (bool readwrite=true) |
Static Public Member Functions | |
static TRootanaEventLoop & | Get (void) |
template<typename T > | |
static void | CreateSingleton () |
Protected Member Functions | |
bool | CreateOutputFile (std::string name, std::string options="RECREATE") |
TRootanaEventLoop () | |
virtual bool | CheckOptionRAD (std::string option) |
virtual void | UsageRAD (void) |
Also a special version of usage for TRootanaDisplay. See CheckOptionRAD. More... | |
Protected Attributes | |
TDirectory * | fOnlineHistDir |
TDirectory for online histograms. More... | |
Static Protected Attributes | |
static TRootanaEventLoop * | fTRootanaEventLoop = NULL |
The static pointer to the singleton instance. More... | |
Private Member Functions | |
void | PrintHelp () |
Help Message. More... | |
Private Attributes | |
TFile * | fOutputFile |
Output ROOT file. More... | |
std::string | fOutputFilename |
bool | fDisableRootOutput |
Variable for disabling/enabling Root output. More... | |
MVOdb * | fODB |
Pointer to the ODB access instance. More... | |
bool | fIsOffline |
Are we processing offline or online data? More... | |
int | fCurrentRunNumber |
Current run number. More... | |
TDataContainer * | fDataContainer |
std::vector< int > | fProcessEventIDs |
This is the set of eventIDs to process. More... | |
std::string | fBufferName |
Buffer to connect to. More... | |
std::string | fOnlineName |
Name of program, as seen by MIDAS. More... | |
bool | fSuppressTimestampWarnings |
Bool for suppressing the warnings about old timestamps. More... | |
int | fMaxEvents |
TApplication * | fApp |
bool | fCreateMainWindow |
bool | fUseBatchMode |
This is a base class for event loops that are derived from rootana.
The user should create a class that derives from this TRootanaEventLoop class and then fill in the methods that they want to implement.
The user must implement the method ProcessMidasEvent(), which will get executed on each event.
The user can also implement methods like Initialize, BeginRun, EndRun, Finalize if there are actions they want to execute at certain points.
The event loop will work in both offline and online mode (online only if the user has MIDAS installed).
In example of this type of event loop is shown in examples/analyzer_example.cxx
Definition at line 43 of file TRootanaEventLoop.hxx.
|
virtual |
|
protected |
Create the TApplication
Definition at line 94 of file TRootanaEventLoop.cxx.
|
virtual |
Called before the first event of a file is read, but you should prefer Initialize() for general initialization. This method will be called once for each input file.
Reimplemented in MyTestLoop, Analyzer, Analyzer, Analyzer, MyTestLoop, and Analyzer.
Definition at line 131 of file TRootanaEventLoop.cxx.
|
inlinevirtual |
Special version of BOR method, to be used only by TRootanaDisplay This is just so that users still have ability to set their own BOR methods, in addition to what TRootanaDisplay needs to do at BOR
Reimplemented in TRootanaDisplay.
Definition at line 80 of file TRootanaEventLoop.hxx.
bool TRootanaEventLoop::CheckEventID | ( | int | eventId | ) |
Little helper method to check if EventID matchs requested EventID list.
Definition at line 145 of file TRootanaEventLoop.cxx.
|
virtual |
Check an option and return true if it is valid.
The return value is used to flag errors during option handling. If the options are valid, then CheckOption should return true to indicate success. If there is a problem processing the options, then CheckOption should return false. If this returns false, then the event loop will print the Usage message and exit with a non zero value (i.e. indicate failure).
Reimplemented in MyTestLoop.
Definition at line 141 of file TRootanaEventLoop.cxx.
|
protectedvirtual |
This is a special version of CheckOption that is only used by TRootanaDisplay. This is just so that users still have the ability to set options for
executables derived from TRootanaDisplay.
Reimplemented in TRootanaDisplay.
Definition at line 142 of file TRootanaEventLoop.cxx.
void TRootanaEventLoop::CloseRootFile | ( | ) |
Cloe output ROOT file.
Definition at line 538 of file TRootanaEventLoop.cxx.
|
inlineprotected |
Definition at line 213 of file TRootanaEventLoop.hxx.
|
inlinestatic |
This static templated function will make it a little easier for users to create the singleton instance.
Definition at line 137 of file TRootanaEventLoop.hxx.
|
inline |
Disable automatic creation of MainWindow.
Definition at line 147 of file TRootanaEventLoop.hxx.
|
inline |
|
virtual |
Called after the last event of a file is read, but you should prefer Finalize() for general finalization. This method will be called once for each input file.
Reimplemented in MyTestLoop, Analyzer, Analyzer, and MyTestLoop.
Definition at line 133 of file TRootanaEventLoop.cxx.
|
inlinevirtual |
Also special version of EOR method, to be used only by TRootanaDisplay.
Reimplemented in TRootanaDisplay.
Definition at line 82 of file TRootanaEventLoop.hxx.
int TRootanaEventLoop::ExecuteLoop | ( | int | argc, |
char * | argv[] | ||
) |
Method to actually process the Midas information, either as file or online.
Definition at line 244 of file TRootanaEventLoop.cxx.
|
virtual |
Called after the last event has been processed, but before any open output files are closed.
Definition at line 135 of file TRootanaEventLoop.cxx.
|
static |
|
inline |
Current Run Number.
Definition at line 119 of file TRootanaEventLoop.hxx.
|
inline |
Method to get the data container that event loop owns.
Definition at line 52 of file TRootanaEventLoop.hxx.
|
inline |
Get pointer to ODB variables.
Definition at line 153 of file TRootanaEventLoop.hxx.
|
inline |
Suppress timestamp warnings? true = suppress warnings.
Definition at line 201 of file TRootanaEventLoop.hxx.
|
virtual |
|
inlinevirtual |
Special version of Init method, to be used only by TRootanaDisplay.
Reimplemented in TRootanaDisplay.
Definition at line 76 of file TRootanaEventLoop.hxx.
|
inline |
Are we processing offline data?
Definition at line 116 of file TRootanaEventLoop.hxx.
|
inline |
Are we processing online data?
Definition at line 113 of file TRootanaEventLoop.hxx.
|
inline |
Check if output ROOT file is valid and open.
Definition at line 163 of file TRootanaEventLoop.hxx.
|
inline |
Definition at line 171 of file TRootanaEventLoop.hxx.
void TRootanaEventLoop::OpenRootFile | ( | int | run, |
std::string | midasFilename = std::string("") |
||
) |
Open output ROOT file.
Definition at line 504 of file TRootanaEventLoop.cxx.
|
inlinevirtual |
The PreFilter method allows user to specify whether to ignore a particular event. Specifically, if PreFilter returns
true -> then ProcessMidasEvent will be called or false -> then ProcessMidasEvent will not be called
This is particularly useful for the RootanaDisplay, where you might want to only process and plot certain events.
Definition at line 110 of file TRootanaEventLoop.hxx.
|
private |
Help Message.
Get pointer to THttpServer, in order to further configure it. Warning: pointer will be zero if THttpServer not initialized
Definition at line 173 of file TRootanaEventLoop.cxx.
|
pure virtual |
The main method, called for each event. Users must implement this function!
Implemented in MyTestLoop, TRootanaDisplay, Analyzer, Analyzer, Analyzer, and Analyzer.
int TRootanaEventLoop::ProcessMidasFile | ( | TApplication * | app, |
const char * | fname | ||
) |
Treat the begin run and end run events differently.
Definition at line 407 of file TRootanaEventLoop.cxx.
int TRootanaEventLoop::ProcessMidasOnline | ( | TApplication * | app, |
const char * | hostname, | ||
const char * | exptname | ||
) |
Definition at line 720 of file TRootanaEventLoop.cxx.
|
inline |
Provide a way to force program to only process certain event IDs. This method can be called repeatedly to specify several different event IDs to accept. If the method is not called then all eventIDs are accepted.
Definition at line 189 of file TRootanaEventLoop.hxx.
|
inline |
Current Run Number.
Definition at line 122 of file TRootanaEventLoop.hxx.
|
inlinevirtual |
This is an alternative, more complicated way of setting the output ROOT filename. In this case the user is given the run number and the midas file name and, from that information, constructs the output ROOT filename themselves.
Reimplemented in Analyzer.
Definition at line 180 of file TRootanaEventLoop.hxx.
|
inline |
|
inline |
Set the output filename. File name will be XXX.root, where XXX is run number
Definition at line 175 of file TRootanaEventLoop.hxx.
void TRootanaEventLoop::SetTHttpServerReadWrite | ( | bool | readwrite = true | ) |
|
inline |
Suppress the warning methods regarding old timestamp events for online ie warnings about analyzer falling behind data taking.
Definition at line 198 of file TRootanaEventLoop.hxx.
|
virtual |
Called when there is a usage error. This code should print a usage message and then return.
Reimplemented in MyTestLoop.
Definition at line 137 of file TRootanaEventLoop.cxx.
|
protectedvirtual |
Also a special version of usage for TRootanaDisplay. See CheckOptionRAD.
Reimplemented in TRootanaDisplay.
Definition at line 138 of file TRootanaEventLoop.cxx.
|
inline |
Use a batch mode, where we don't check ROOT status.
Definition at line 150 of file TRootanaEventLoop.hxx.
void TRootanaEventLoop::UseOnlyRecent | ( | bool | setting = true | ) |
Method to set whether analyzer should operate in GET_RECENT mode, where we only process data that is less than 1 second old (this is not default). Setting true will use this option.
Definition at line 498 of file TRootanaEventLoop.cxx.
|
private |
Definition at line 295 of file TRootanaEventLoop.hxx.
|
private |
Buffer to connect to.
Definition at line 282 of file TRootanaEventLoop.hxx.
|
private |
Definition at line 298 of file TRootanaEventLoop.hxx.
|
private |
Current run number.
Definition at line 265 of file TRootanaEventLoop.hxx.
|
private |
Pointer to the physics event; the physics event is what we pass to user. The midas event is accessible through physics event. We make a single instance of the physics event for whole execution, because sometimes the decoded information needs to persist across multiple midas events.
Definition at line 273 of file TRootanaEventLoop.hxx.
|
private |
Variable for disabling/enabling Root output.
Definition at line 256 of file TRootanaEventLoop.hxx.
|
private |
Are we processing offline or online data?
Definition at line 262 of file TRootanaEventLoop.hxx.
|
private |
Definition at line 292 of file TRootanaEventLoop.hxx.
|
private |
Pointer to the ODB access instance.
Definition at line 259 of file TRootanaEventLoop.hxx.
|
protected |
TDirectory for online histograms.
Definition at line 227 of file TRootanaEventLoop.hxx.
|
private |
Name of program, as seen by MIDAS.
Definition at line 285 of file TRootanaEventLoop.hxx.
|
private |
Output ROOT file.
Definition at line 249 of file TRootanaEventLoop.hxx.
|
private |
Base part of the output filename File name will be XXX.root, where XXX is run number
Definition at line 253 of file TRootanaEventLoop.hxx.
|
private |
This is the set of eventIDs to process.
Definition at line 276 of file TRootanaEventLoop.hxx.
|
private |
Bool for suppressing the warnings about old timestamps.
Definition at line 288 of file TRootanaEventLoop.hxx.
|
staticprotected |
The static pointer to the singleton instance.
Definition at line 224 of file TRootanaEventLoop.hxx.
|
private |
Definition at line 301 of file TRootanaEventLoop.hxx.