Diana Software
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Private Attributes | Friends | List of all members
QReader Class Referenceabstract

Base class for diana event readers. More...

Inheritance diagram for QReader:
QBaseModule QModuleTimeProfiling MQinoDataReader QFileReader

Public Member Functions

 QReader ()
 constructor More...
 
virtual ~QReader ()
 destructor More...
 
virtual void Init (QEventAssembler &eva)=0
 Init method is called before event loop, getting the QEventAssembler as argument This method must be implemented by inheriting classes. More...
 
virtual bool Do (QEventAssembler &eva)=0
 Do method is called for each event, getting the QEventAssembler as argument. This method must be implemented by inheriting classes. More...
 
virtual void Done ()=0
 Done method is called after event loop. This method must be implemented by inheriting classes. More...
 
virtual const QErrorJumpToEvent (Long64_t eventnumber)
 Called when another module ask for a specific eventnumber in the next Do(). Implementation of this method is optional. More...
 
const int & GetFileNumber ()
 Get Current file number, used by QWriter (throug QSequence) More...
 
bool DoBase (QEventAssembler &eva)
 DoBase executes Do, and is called by QNeighboursFiller. More...
 
bool NeighboursOn ()
 
- Public Member Functions inherited from QBaseModule
 QBaseModule (Type type)
 constructor More...
 
virtual ~QBaseModule ()
 constructor More...
 
double GetDouble (const std::string &parname, double defVal, bool warnCfg=true) const
 Get a double parameter from config file. More...
 
std::vector< double > GetVectorDouble (const std::string &parname, std::vector< double > defVal, bool warnCfg=true) const
 Get a std::vector<double> parameter from config file with syntax "{x,y,z}". More...
 
int GetInt (const std::string &parname, int defVal, bool warnCfg=true) const
 Get an int parameter from config file ( see GetDouble() ) More...
 
std::vector< int > GetVectorInt (const std::string &parname, std::vector< int > defVal, bool warnCfg=true) const
 Get an vector<int> parameter from config file ( see GetVectorDouble() ) More...
 
bool GetBool (const std::string &parname, bool defVal, bool warnCfg=true) const
 Get a bool parameter from config file ( see GetDouble() ) More...
 
std::vector< bool > GetVectorBool (const std::string &parname, std::vector< bool > defVal, bool warnCfg=true) const
 Get a vector<bool> parameter from config file ( see GetVectorDouble() ) More...
 
const std::string & GetString (const std::string &parname, const std::string &defVal, bool warnCfg=true) const
 Get a string parameter from config file ( see GetDouble() ) More...
 
std::vector< std::string > GetVectorString (const std::string &parname, std::vector< std::string > defVal, bool warnCfg=true) const
 Get a vector<string> parameter from config file ( see GetVectorDouble() ) More...
 
void Debug (const char *descr,...) const
 Send a debug message (used to debug the module) with printf syntax. More...
 
void Info (const char *descr,...) const
 Send an info message (information) with printf syntax. More...
 
void Warn (const char *descr,...) const
 Send a warning message (an error that the framework can recover) with printf syntax. More...
 
void Error (const char *descr,...) const
 Send an error message (an error that the framework cannot recover) with printf syntax. More...
 
void Panic (const char *descr,...) const
 Send a panic message (stops the framework) with printf syntax. More...
 
const QGlobalDataManagerGlobalData () const
 interface for saving and loading global QObjects More...
 
bool GetRunAgain () const
 Check if the sequence will be reiterated. More...
 
void SetRunAgain (bool b)
 Set that the sequence will be reiterated. More...
 
unsigned int GetIteration () const
 Get Current sequence iteration. More...
 
unsigned int GetOccurrence () const
 get the number of times the same module is loaded inside a QSequence More...
 
bool isEnabled () const
 check if module is enabled More...
 
std::string GetFullPath () const
 Get Full Path of module "GetName() + "." + GetOccurrence". More...
 
const std::string & GetName () const
 Get Module name. More...
 
const std::string & GetLabel () const
 Get Module name + the optional ExtraLabel ("name_extralabel") More...
 
MsgLevel GetVerbosity ()
 get verbosity level set from config file More...
 
const QSequenceGetSequence () const
 get reference to this sequence More...
 
void Update (QSequence *s, unsigned int occurrence)
 set the occurrence in the same sequence. MV FIXME: should not be public More...
 
bool NeedNeighbours ()
 check wheter this module needs neighbours (available after the first event is processed) More...
 
void BeginBase (QEventAssembler &ev)
 Begin Base method is called before event loop. More...
 
bool ProcessBase (QEventAssembler &ev, QEventList &evl, const bool exec, QEventList &ovl)
 ProcessBase method is called for each event, getting the event and as argument. More...
 
void EndBase ()
 EndBase method is called after event loop. More...
 
const std::vector< QEventLabel > & GetRequiredLabels () const
 Get labels of objects required by this module. More...
 

Static Public Member Functions

static std::list< std::string > GetFilesList ()
 list of input files More...
 

Protected Member Functions

void InitFileManager ()
 Initialize multiple and single file management. More...
 
void OpenNewFile (const std::string &fileName)
 Call it when opening new file. More...
 
- Protected Member Functions inherited from QBaseModule
QModuleConfigGetConfig ()
 Get module config. More...
 
void SetNeedNeighbours (bool need)
 set wheter this module needs neighbours More...
 
- Protected Member Functions inherited from QModuleTimeProfiling
 QModuleTimeProfiling ()
 ctor initialized internal variables More...
 
virtual ~QModuleTimeProfiling ()
 dtor does nothing More...
 
void SetTimeProfilingOn (bool val)
 Set the time profiling on/off. More...
 
bool GetTimeProfilingOn () const
 Check if the time profiling is on. More...
 
void ResetTimer ()
 Reset the timer to now. More...
 
double GetTimer () const
 return the time since the last reset More...
 
virtual void StartProcessCall ()
 Start of a process call. More...
 
virtual void EndProcessCall ()
 End a process call and increment time and calls. More...
 
unsigned long long GetProcessCalls () const
 Return the total number of process calls. More...
 
double GetTotalProcessTime () const
 Return the total processing time. More...
 
double GetProcessCallTime () const
 Return the average time of a single process call. More...
 
std::string GetTimeProfileReport (const std::string &prefix="") const
 Report the time profiling. More...
 

Protected Attributes

int fFileNumber
 current file number read More...
 
std::vector< std::string > fFileList
 list of files More...
 
bool fReadFileList
 read file list More...
 
std::string fFileListPath
 file list path More...
 
unsigned int fProcessedNumber
 events processed More...
 
int fEventNumberPrintStep
 print event number step More...
 
QError fErr
 Error returned by methods. More...
 
QRWCommonfRWCommon
 object to share file names with QWriter More...
 
- Protected Attributes inherited from QBaseModule
bool fExecuted
 
- Protected Attributes inherited from QModuleTimeProfiling
bool fTimeProfilingOn
 Report the time profiling. More...
 
unsigned long long int fProcessCalls
 NUmber of calls to the process. More...
 
double fProcessTime
 Total time spent running the process. More...
 

Static Protected Attributes

static std::list< std::string > fFullPathFilesList
 list of files More...
 

Private Member Functions

void Begin (QEventAssembler &eva)
 Begin method is called before event loop, and calls Init() More...
 
bool Process (QEventAssembler &eva, QEventList &neigh, const bool exec, QEventList &oneigh)
 Process method is called for each event, and calls Do() More...
 
void End ()
 End method is called after event loop, and calls Done() More...
 
const QErrorBaseJumpToEvent (Long64_t eventnumber)
 Called when another module ask for a specific event number in the next Do(), calls JumpToEvent() More...
 
void ReadFilesList (std::string path)
 Parse the file that contain the files list. More...
 
void NotifyOpenNewFile (const std::string &fileName)
 Call it when opening new file. More...
 

Private Attributes

Long64_t fReadNumber
 last event read More...
 
QNeighboursFillerfNeighboursFiller
 Neighbours filler. More...
 
QReaderEventGeneratorFillerfReaderEventGeneratorFiller
 Event generator
More...
 
std::vector< std::string >::const_iterator fFileListIter
 Iterator on file names
More...
 
bool fNeighboursOn
 Neighbours are on. More...
 
std::string fNextFileName
 
std::map< unsigned int, std::string > fReadNumberAtFileOpen
 
bool fNewFileOpen
 

Friends

class QSequence
 

Additional Inherited Members

- Public Types inherited from QBaseModule
enum  Type {
  Module , Filter , Reader , Writer ,
  Driver
}
 

Detailed Description

Base class for diana event readers.

Author
Marco Vignati

All diana reader must inherit from this class. This class implements some general feature that can be found in any inheriting reader. Config file parameters defined by this class are:

Unlike QModule, the Init() and Do() methods act on a QEventAssembler, that provides full handling of the QEvent object.

Definition at line 49 of file QReader.hh.

Constructor & Destructor Documentation

◆ QReader()

QReader::QReader ( )

constructor

Definition at line 18 of file QReader.cc.

References fNeighboursFiller, and fRWCommon.

◆ ~QReader()

QReader::~QReader ( )
virtual

destructor

Definition at line 24 of file QReader.cc.

Member Function Documentation

◆ BaseJumpToEvent()

const QError & QReader::BaseJumpToEvent ( Long64_t  eventnumber)
private

Called when another module ask for a specific event number in the next Do(), calls JumpToEvent()

Definition at line 134 of file QReader.cc.

References err, fNeighboursFiller, fReadNumber, JumpToEvent(), QBaseModule::Panic(), and QERR_SUCCESS.

Referenced by QSequence::JumpToEvent().

◆ Begin()

void QReader::Begin ( QEventAssembler eva)
privatevirtual

◆ Do()

virtual bool QReader::Do ( QEventAssembler eva)
pure virtual

Do method is called for each event, getting the QEventAssembler as argument. This method must be implemented by inheriting classes.

Implemented in MQinoDataReader.

Referenced by QReaderEventGeneratorFiller::Do(), and DoBase().

◆ DoBase()

bool QReader::DoBase ( QEventAssembler eva)

◆ Done()

virtual void QReader::Done ( )
pure virtual

Done method is called after event loop. This method must be implemented by inheriting classes.

Implemented in MQinoDataReader, and QFileReader.

Referenced by End().

◆ End()

void QReader::End ( )
privatevirtual

◆ GetFileNumber()

const int& QReader::GetFileNumber ( )
inline

Get Current file number, used by QWriter (throug QSequence)

Definition at line 76 of file QReader.hh.

References fFileNumber.

◆ GetFilesList()

static std::list<std::string> QReader::GetFilesList ( )
inlinestatic

list of input files

Definition at line 79 of file QReader.hh.

References fFullPathFilesList.

Referenced by LGuiSessionWriter::SetQObject().

◆ Init()

virtual void QReader::Init ( QEventAssembler eva)
pure virtual

Init method is called before event loop, getting the QEventAssembler as argument This method must be implemented by inheriting classes.

Implemented in MQinoDataReader, and QFileReader.

Referenced by Begin(), and QNeighboursFiller::Init().

◆ InitFileManager()

void QReader::InitFileManager ( )
protected

◆ JumpToEvent()

const QError & QReader::JumpToEvent ( Long64_t  eventnumber)
virtual

Called when another module ask for a specific eventnumber in the next Do(). Implementation of this method is optional.

Reimplemented in MQinoDataReader, and QFileReader.

Definition at line 125 of file QReader.cc.

References fErr, QBaseModule::GetName(), QERR_NOT_IMPLEMENTED, and QError::SetDescription().

Referenced by BaseJumpToEvent().

◆ NeighboursOn()

bool QReader::NeighboursOn ( )
inline

Definition at line 84 of file QReader.hh.

References fNeighboursOn.

Referenced by QSequence::CheckModuleWithNeighbours().

◆ NotifyOpenNewFile()

void QReader::NotifyOpenNewFile ( const std::string &  fileName)
private

◆ OpenNewFile()

void QReader::OpenNewFile ( const std::string &  fileName)
protected

Call it when opening new file.

Definition at line 181 of file QReader.cc.

References fFullPathFilesList, fNewFileOpen, fReadNumber, and fReadNumberAtFileOpen.

Referenced by QFileReader::Do().

◆ Process()

bool QReader::Process ( QEventAssembler eva,
QEventList neigh,
const bool  exec,
QEventList oneigh 
)
privatevirtual

Process method is called for each event, and calls Do()

Implements QBaseModule.

Definition at line 62 of file QReader.cc.

References QEventList::Clear(), QNeighboursFiller::Do(), DoBase(), fEventNumberPrintStep, QBaseModule::fExecuted, fNeighboursFiller, fProcessedNumber, and QBaseModule::Info().

◆ ReadFilesList()

void QReader::ReadFilesList ( std::string  path)
private

Parse the file that contain the files list.

Definition at line 188 of file QReader.cc.

References QBaseModule::Debug(), fFileList, and QBaseModule::Panic().

Referenced by InitFileManager().

Friends And Related Function Documentation

◆ QSequence

friend class QSequence
friend

Definition at line 144 of file QReader.hh.

Member Data Documentation

◆ fErr

QError QReader::fErr
protected

Error returned by methods.

Definition at line 106 of file QReader.hh.

Referenced by QFileReader::JumpToEvent(), and JumpToEvent().

◆ fEventNumberPrintStep

int QReader::fEventNumberPrintStep
protected

print event number step

Definition at line 104 of file QReader.hh.

Referenced by Begin(), and Process().

◆ fFileList

std::vector<std::string> QReader::fFileList
protected

list of files

Definition at line 94 of file QReader.hh.

Referenced by InitFileManager(), and ReadFilesList().

◆ fFileListIter

std::vector<std::string>::const_iterator QReader::fFileListIter
private

Iterator on file names

Definition at line 132 of file QReader.hh.

◆ fFileListPath

std::string QReader::fFileListPath
protected

file list path

Definition at line 100 of file QReader.hh.

Referenced by InitFileManager().

◆ fFileNumber

int QReader::fFileNumber
protected

current file number read

Definition at line 92 of file QReader.hh.

Referenced by GetFileNumber(), QFileReader::Init(), InitFileManager(), and NotifyOpenNewFile().

◆ fFullPathFilesList

Q_BEGIN_NAMESPACE std::list< std::string > QReader::fFullPathFilesList
staticprotected

list of files

Definition at line 96 of file QReader.hh.

Referenced by Begin(), GetFilesList(), QFileReader::Init(), and OpenNewFile().

◆ fNeighboursFiller

QNeighboursFiller* QReader::fNeighboursFiller
private

Neighbours filler.

Definition at line 128 of file QReader.hh.

Referenced by BaseJumpToEvent(), Begin(), End(), Process(), and QReader().

◆ fNeighboursOn

bool QReader::fNeighboursOn
private

Neighbours are on.

Definition at line 134 of file QReader.hh.

Referenced by Begin(), and NeighboursOn().

◆ fNewFileOpen

bool QReader::fNewFileOpen
private

At this event a new file has been opened

Definition at line 141 of file QReader.hh.

Referenced by DoBase(), and OpenNewFile().

◆ fNextFileName

std::string QReader::fNextFileName
private

next file being open (i.e. open by the next neighbour)

Definition at line 137 of file QReader.hh.

◆ fProcessedNumber

unsigned int QReader::fProcessedNumber
protected

events processed

Definition at line 102 of file QReader.hh.

Referenced by Begin(), and Process().

◆ fReaderEventGeneratorFiller

QReaderEventGeneratorFiller* QReader::fReaderEventGeneratorFiller
private

Event generator

Definition at line 130 of file QReader.hh.

Referenced by Begin(), DoBase(), and End().

◆ fReadFileList

bool QReader::fReadFileList
protected

read file list

Definition at line 98 of file QReader.hh.

Referenced by InitFileManager().

◆ fReadNumber

Long64_t QReader::fReadNumber
private

last event read

Definition at line 125 of file QReader.hh.

Referenced by BaseJumpToEvent(), Begin(), DoBase(), and OpenNewFile().

◆ fReadNumberAtFileOpen

std::map<unsigned int,std::string> QReader::fReadNumberAtFileOpen
private

next read number corresponding to the event at file open

Definition at line 139 of file QReader.hh.

Referenced by DoBase(), and OpenNewFile().

◆ fRWCommon

QRWCommon* QReader::fRWCommon
protected

object to share file names with QWriter

Definition at line 108 of file QReader.hh.

Referenced by Begin(), QFileReader::Init(), InitFileManager(), NotifyOpenNewFile(), QReader(), and QSequence::Run().


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