List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Attributes | Private Member Functions | Private Attributes
EventFileReaderOG::EventFileReader Class Reference

Read in a real or simulated events in various formats. More...

#include <EventFileReader.h>

Inheritance diagram for EventFileReaderOG::EventFileReader:
Inheritance graph
[legend]

Public Types

enum  ResultFlag { eSuccess, eFailure, eBreakLoop, eContinueLoop }
 Flag returned by module methods to the RunController. More...
 
enum  VersionInfoType {
  eFilename = 1, eRevisionNumber = 2, eDate = 3, eTime = 4,
  eLastEditor = 5
}
 Different types of version info that can be retrieved from GetVersionInfo. More...
 

Public Member Functions

 EventFileReader ()
 
fwk::VModule::ResultFlag Finish ()
 Finish: invoked at end of the run (NOT end of the event) More...
 
const std::string & GetCurrentFilename () const
 
int GetEventsRead () const
 
utl::StopwatchGetStopwatch ()
 
const utl::StopwatchGetStopwatch () const
 
std::string GetVersionInfo (const VersionInfoType v) const
 Retrieve different sorts of module version info. More...
 
fwk::VModule::ResultFlag Init ()
 Initialize: invoked at beginning of run (NOT beginning of event) More...
 
void InitTiming ()
 
fwk::VModule::ResultFlag Run (evt::Event &theEvent)
 Run: invoked once per event. More...
 
ResultFlag RunWithTiming (evt::Event &event)
 
 ~EventFileReader ()
 

Static Public Member Functions

static std::string GetResultFlagByName (const ResultFlag flag)
 

Protected Types

enum  InfoLevel { eInfoNone = 0, eInfoFinal = 1, eInfoIntermediate = 2, eInfoDebug = 3 }
 

Protected Attributes

int fInfoLevel = 0
 

Private Member Functions

fwk::VModule::ResultFlag OpenFiles ()
 
 REGISTER_MODULE ("EventFileReaderOG", EventFileReader)
 

Private Attributes

utl::Branch fBranch
 
std::string fCurrentFilename
 
io::EventFileChainfEventFiles = nullptr
 
int fEventsRead = 0
 
bool fIgnoreExpeptions = false
 
bool fReportFilenames = false
 

Detailed Description

Read in a real or simulated events in various formats.

Author
T. Porter

This module is used to load real or simulated data from a variety of formats, and make the data therein available through the evt::Event. Based on the configuration you provide, it invokes all of the behind-the-scenes code which knows how to deal with various data formats.

File types

The file type you wish to read is specified in the <InputFileType/> element. It must be one of:

Specifying filenames, and various fun tricks

The name of one or more files to read can be specified in the <InputFilenames> element. Multiple filenames should be space or carriage return delimited. For example:

<InputFilenames> 
   file1.root file2.root
   file3.root
</InputFilenames>

You can also use backtick expanded commands in the <InputFilenames> element in order to generate filenames and/or paths automatically. For example, the following <InputFilenames> element will cause the EventFileReader to suck in all files in the curent directory beginning with sd_id and ending with root.

<InputFilenames> 
  `find . -name sd_id\*.root`
</InputFilenames>

Here is another example of backtick expansion use. Suppose you are running a batch job, and want the EventFileReader to use a file which gets staged in a temporary area, with the path to the staging area specified by an environment variable $TEMPAREA which gets set in the batch shell. You could then write something like this to get the correct path for the file:

<InputFilenames> 
  `echo $TEMPAREA/my.file`
</InputFilenames>

Extracting configuration logs

The EventFileReader may also be used to strip the configuration data from a file written in Offline format, and dump it into an xml file. To do this you would specify the Offline file of interest in the <InputFilenames> element, and then add the <DumpConfig> element to sepcify what name you want to give to the dumped configuration xml file:

For example, the following would extract configuration data from offline.root and write it in offlineConfig.xml:

  <InputFilenames> offline.root </InputFilenames>
  <DumpConfig>     offlineConfig.xml </DumpConfig>

For more information on how you can use configuration data, see the documentation for fwk::CentralConfig.

Definition at line 16 of file EventFileReader.h.

Member Enumeration Documentation

enum fwk::VModule::InfoLevel
protectedinherited
Enumerator
eInfoNone 
eInfoFinal 
eInfoIntermediate 
eInfoDebug 

Definition at line 125 of file VModule.h.

enum fwk::VModule::ResultFlag
inherited

Flag returned by module methods to the RunController.

Enumerator
eSuccess 

Report success to RunController.

eFailure 

Report failure to RunController, causing RunController to terminate execution.

eBreakLoop 

Break current loop. It works for nested loops too!

eContinueLoop 

Skip remaining modules in the current loop and continue with next iteration of the loop.

Definition at line 60 of file VModule.h.

Different types of version info that can be retrieved from GetVersionInfo.

Enumerator
eFilename 
eRevisionNumber 
eDate 
eTime 
eLastEditor 

Definition at line 110 of file VModule.h.

Constructor & Destructor Documentation

EventFileReaderOG::EventFileReader::EventFileReader ( )
inline

Definition at line 19 of file EventFileReader.h.

EventFileReader::~EventFileReader ( )

Definition at line 73 of file EventFileReader.cc.

Member Function Documentation

VModule::ResultFlag EventFileReader::Finish ( )
virtual

Finish: invoked at end of the run (NOT end of the event)

This method is for things that should be done at the end of the run (for example, closing files or writing out histograms) {You must override this method in your concrete module}

Implements fwk::VModule.

Definition at line 211 of file EventFileReader.cc.

References io::eSuccess, EventFileReaderOG::gStopwatch, and INFO.

const string & EventFileReader::GetCurrentFilename ( ) const

Definition at line 232 of file EventFileReader.cc.

int EventFileReaderOG::EventFileReader::GetEventsRead ( ) const
inline

Definition at line 27 of file EventFileReader.h.

References fEventsRead.

std::string fwk::VModule::GetResultFlagByName ( const ResultFlag  flag)
staticinherited
utl::Stopwatch& fwk::VModule::GetStopwatch ( )
inlineinherited

Definition at line 106 of file VModule.h.

References fwk::VModule::fStopwatch.

const utl::Stopwatch& fwk::VModule::GetStopwatch ( ) const
inlineinherited

Definition at line 107 of file VModule.h.

References fwk::VModule::fStopwatch.

std::string fwk::VModule::GetVersionInfo ( const VersionInfoType  v) const
inherited
VModule::ResultFlag EventFileReader::Init ( )
virtual

Initialize: invoked at beginning of run (NOT beginning of event)

This method is for things that should be done once at the beginning of a run (for example, booking histograms, performing calculations that need to be done only once, initializing parameters) {You must override this method in your concrete module}

Implements fwk::VModule.

Definition at line 80 of file EventFileReader.cc.

References io::eSuccess, utl::Branch::GetChild(), utl::Branch::GetFirstChild(), utl::Branch::GetNextSibling(), and utl::Branch::GetTopBranch().

void fwk::VModule::InitTiming ( )
inlineinherited

Definition at line 95 of file VModule.h.

References fwk::VModule::fStopwatch, and utl::Stopwatch::Reset().

VModule::ResultFlag EventFileReader::OpenFiles ( )
private

Definition at line 103 of file EventFileReader.cc.

References io::eSuccess, and INFO.

EventFileReaderOG::EventFileReader::REGISTER_MODULE ( "EventFileReaderOG"  ,
EventFileReader   
)
private
VModule::ResultFlag EventFileReader::Run ( evt::Event event)
virtual

Run: invoked once per event.

This method is for things that should be done once per event {You must override this method in your concrete module}

Implements fwk::VModule.

Definition at line 125 of file EventFileReader.cc.

References io::eAires, io::eCONEX, io::eCONEXRandom, io::eCorsika, io::eEndOfFiles, io::eEOF, io::eEVA, io::eFail, io::eRadioAERA, io::eRadioAERAroot, io::eREAS, io::eSELFAS, io::eSeneca, io::eSkipEvent, io::eSuccess, io::eZHAireS, file, evt::Header::GetId(), evt::Header::GetTime(), evt::Event::HasRawEvent(), INFO, and result.

ResultFlag fwk::VModule::RunWithTiming ( evt::Event event)
inlineinherited

Member Data Documentation

utl::Branch EventFileReaderOG::EventFileReader::fBranch
private

Definition at line 34 of file EventFileReader.h.

std::string EventFileReaderOG::EventFileReader::fCurrentFilename
private

Definition at line 37 of file EventFileReader.h.

io::EventFileChain* EventFileReaderOG::EventFileReader::fEventFiles = nullptr
private

Definition at line 36 of file EventFileReader.h.

int EventFileReaderOG::EventFileReader::fEventsRead = 0
private

Definition at line 38 of file EventFileReader.h.

Referenced by GetEventsRead().

bool EventFileReaderOG::EventFileReader::fIgnoreExpeptions = false
private

Definition at line 33 of file EventFileReader.h.

int fwk::VModule::fInfoLevel = 0
protectedinherited
bool EventFileReaderOG::EventFileReader::fReportFilenames = false
private

Definition at line 32 of file EventFileReader.h.


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

, generated on Tue Sep 26 2023.