#ifndef cometEventLoop_hxx_seen #define cometEventLoop_hxx_seen #include "ICOMETEventLoopFunction.hxx" namespace COMET { /// The COMET::cometEventLoop() function provides a basic event loop that will call /// user code for each event. See COMET::ICOMETEventLoopFunction for a base class /// that can be used with this event loop. This is used in code like this: /// /// \code /// class IDumpEvent: public COMET::ICOMETEventLoopFunction { /// public: /// bool operator () (COMET::ICOMETEvent& event) { /// // User Code /// return true; /// } /// }; /// /// int main(int argc, char **argv) { /// IDumpEvent userCode; /// return COMET::cometEventLoop(argc,argv,userCode); /// } /// \endcode /// /// The default number of events to be processed can be specified as the /// fourth argument to COMET::cometEventLoop(). If the argument is not /// specified, or is less than or equal to zero, then all events in the file /// will be read. See \ref eventLoop for more usage documentation. /// /// The above main program results in a basic event loop that provides several /// user options and capabilities. The program options can be listed by /// running the program without an arguments. The most common options are: /// /// \code /// -o Set the name of an output file. /// Multiple output files can be provided. /// -a Read all events /// -b [,c,u,n] Set the field maps load from specified file, current input file, uniforme field with 1 Testla at Z direction, or no field /// NOTICE: if this option is not given and field manager is not set elsewhere, then any access to fieldmap will lead to exception throw. /// -c Set the logging config file name /// -d Increase the debug level /// -D =[error,severe,warn,debug,trace] /// Change the named debug level /// -f Look for a particular event number /// -f , Look for a particular run and event number /// -F Change the order of the input files, one of: /// 'rotate ', 'shuffle []' /// -G Force a geometry file /// -g Force the geometry to be saved /// -H Debug IHandle (slow) /// -I Text file containing a list of input files. Each line be of one of the forms: /// filename [file-type] /// filename [file-type] [list-name] /// filename [file-type] [list-index] /// where file-type is optional, but must be either 'midas' or 'root' depending on /// whether the data is directly from MIDAS or is an oaEvent file, respectively. /// If not given, the value 'root' is assumed and list-name/index cannot be used. /// If given, list-name/index can also be provided, which denotes which IEntryList will \n" /// be used when looping over this file. /// -B Abort (throw error) if file cannot be read /// -R Number of times attempts to open a file before skipping it or aborting. /// Useful for accessing xrootd files, which can fail on first attempt. /// -m MIDAS input file /// -n Only read events [Default: 1] /// -q Decrease the verbosity /// -r COMET ROOT file /// -s Skip events /// -S Stride through events (loop over events out of order). Options: /// primes = use the smallest prime number guaranteed to stride through all events in the input file /// random = Step through the events in a random order /// [0-9]+ = An integer which fixes the number of events to skip over /// -t [bpTPEFecC] Only accept these triggers /// [WARNING: THIS OPTION IS NOT YET VALID FOR COMET AND WILL BE IGNORED] /// -u Log memory usage /// -U Print the memory and CPU usage /// -v Increase the verbosity /// -V =[quiet,log,info,verbose] /// Change the named log level /// /// -O [=] Set an option for the user code /// \endcode /// /// \htmlonly /// There is skeleton code available in /// exampleEventLoop.cxx that can /// be copied to a local directory and modified. If you use this code, do a /// global search and replace on "UserLoop", changing it to some more useful /// name. That will help keep the doxygen documentation useful. /// \endhtmlonly int cometEventLoop(int argc, char** argv, COMET::ICOMETEventLoopFunction& userCode, int defaultReadCount=0); } #endif