GET library
GETRunSerie Class Reference

#include <GETRunSerie.hh>

Inheritance diagram for GETRunSerie:
GETRunList GETRunFile

Public Member Functions

Constructors, affectation, destructor
 GETRunSerie (const string &pattern="", const string &serie="", bool open=true)
 
virtual ~GETRunSerie ()
 
File operations
virtual int Open ()
 
virtual int Close ()
 
virtual bool IsOpen () const
 
virtual int OpenNext ()
 
virtual bool AtEnd () const
 
virtual int SetNextRunList (bool skip=true)
 
virtual int SetRunList (int rnum)
 
File information
virtual int SetRunPattern (const string &pattern)
 
virtual int SetRunSerie (const string &serie)
 
const string & GetRunPattern () const
 
string & GetRunPattern ()
 
string GetRunSerie () const
 
u_int GetRunCount () const
 
int GetCurrentRun () const
 
void InitCurrentRun ()
 
virtual void EventCountIncr ()
 
int GetSerieEventCount () const
 
ROOT related functions
 ClassDef (GETRunSerie, 0)
 
- Public Member Functions inherited from GETRunList
 GETRunList (const string &pattern="", bool open=true)
 
virtual ~GETRunList ()
 
virtual int SetFilePattern (const string &pattern)
 
const string & GetFilePattern () const
 
string & GetFilePattern ()
 
const GStringList & GetFileList () const
 
GStringList & GetFileList ()
 
u_int GetFileCount () const
 
int GetListEventCount () const
 
 ClassDef (GETRunList, 0)
 
- Public Member Functions inherited from GETRunFile
 GETRunFile (const string &fname="", bool open=true)
 
virtual ~GETRunFile ()
 
virtual int Open (const string &fname)
 
int GetFileLun () const
 
virtual int SetFileName (const string &fname)
 
const string & GetFileName () const
 
string & GetFileName ()
 
FILE * GetFilePtr ()
 
int GetFileEventCount () const
 
 ClassDef (GETRunFile, 0)
 

Protected Attributes

int current_run_num
 Current run number (-1 if none)
 
GString run_pattern
 Pattern for file name (containing "%*r" information)
 
GIntervalList run_serie
 List of effective run files.
 
u_int serie_event_count
 Number of events in the runs serie.
 
- Protected Attributes inherited from GETRunList
int current_file_num
 Number of currently opened file (-1 if none)
 
u_int list_event_count
 Number of events in the file list.
 
GStringList run_file_list
 List of effective run files.
 
string run_file_pattern
 Pattern for file name selection.
 
- Protected Attributes inherited from GETRunFile
u_int file_event_count
 Number of events in the file.
 
string run_file_name
 Name of the experimental data file.
 
FILE * run_file_ptr
 Pointer to experimental data file.
 

Private Member Functions

 GObject (GETRunSerie)
 

Detailed Description

This class defines a serie of runs data files, identified by a list of run numbers and a file pattern.

The file pattern must contain a "%R" indicating where the run number is specified in the file name, or "%<n>R" if the run number is padded with 0.

Constructor & Destructor Documentation

GETRunSerie::GETRunSerie ( const string &  pattern = "",
const string &  serie = "",
bool  open = true 
)

Constructor.

Parameters
patternpattern for the run file list selection, with "%*r" for run number indication
seriestring defining the list of run numbers
openwhether the first file should be opened when created

References current_run_num, Open(), run_pattern, serie_event_count, SetRunPattern(), and SetRunSerie().

GETRunSerie::~GETRunSerie ( )
virtual

Destructor.

Member Function Documentation

bool GETRunSerie::AtEnd ( ) const
inlinevirtual

Return true if at end of the last file in the list. The function also returns true if no file is opened.

Reimplemented from GETRunList.

References GETRunList::AtEnd(), current_run_num, and run_serie.

GETRunSerie::ClassDef ( GETRunSerie  ,
 
)

for use within ROOT.

int GETRunSerie::Close ( )
virtual

Close the current run file, if open. The function returns 0 if no error occured

Reimplemented from GETRunList.

References GETRunList::Close(), GetRunSerie(), InitCurrentRun(), GETRunList::IsOpen(), and IsOpen().

void GETRunSerie::EventCountIncr ( )
inlinevirtual

Increment the event counter.

Reimplemented from GETRunList.

References GETRunList::EventCountIncr(), and serie_event_count.

int GETRunSerie::GetCurrentRun ( ) const
inline

Return the current run number.

References current_run_num.

u_int GETRunSerie::GetRunCount ( ) const
inline

Return the number of runs in the current serie.

References run_serie.

Referenced by Open(), SetNextRunList(), and SetRunSerie().

const string & GETRunSerie::GetRunPattern ( ) const
inline

Return the pattern for the files selection.

References run_pattern.

string & GETRunSerie::GetRunPattern ( )
inline

Return the pattern for the files selection.

References run_pattern.

string GETRunSerie::GetRunSerie ( ) const
inline

Return a string defining the serie of runs.

References run_serie.

Referenced by Close(), and Open().

int GETRunSerie::GetSerieEventCount ( ) const
inline

Return the event counter since the run serie was started.

References serie_event_count.

GETRunSerie::GObject ( GETRunSerie  )
private

Macro from GCpp library that defines the following functions:

  • ClassName(): return the real class name of the object
  • StaticClassName(): return the used class name of the object (that may be a base class of the real object).
  • IsInstanceOf<T>(): return true if the current object is an instance of the template class name argument
  • Clone(): return an allocated copy of the object.
void GETRunSerie::InitCurrentRun ( )
inline

Initialize the current run number.

References current_run_num, and run_serie.

Referenced by Close(), Open(), and SetRunSerie().

bool GETRunSerie::IsOpen ( ) const
inlinevirtual

Return true if the file is currently opened.

Reimplemented from GETRunList.

References current_run_num, GETRunList::IsOpen(), and run_serie.

Referenced by Close(), Open(), OpenNext(), SetRunPattern(), and SetRunSerie().

int GETRunSerie::Open ( )
virtual

Open the file list, starting at first file.

Reimplemented from GETRunList.

References GetRunCount(), GetRunSerie(), InitCurrentRun(), IsOpen(), GETRunList::Open(), serie_event_count, and SetNextRunList().

Referenced by GETRunSerie().

int GETRunSerie::OpenNext ( )
virtual

Open the next effective file. First try in the current file serie, and if at end, try next run number.

It returns -1 when there no next file, or a positive value in case of error.

Reimplemented from GETRunList.

References GETRunList::AtEnd(), GETRunList::Close(), GETRunList::IsOpen(), IsOpen(), GETRunList::Open(), GETRunList::OpenNext(), and SetNextRunList().

int GETRunSerie::SetNextRunList ( bool  skip = true)
virtual

Prepare the list of run files for the next run number. If argument skip is true, if no file is found in the list, try the next run number, until a file is found.

Parameters
skipskip run number with no files

References current_run_num, GetRunCount(), run_serie, and SetRunList().

Referenced by Open(), and OpenNext().

int GETRunSerie::SetRunList ( int  rnum)
virtual

Prepare the list of run files for a given run number. If argument skip is true, if no file is found in the list, try the next run number, until a file is found.

The funtion returns 0 if no error occured, a positive value in case of error, and -1 if there is no file matching.

Parameters
rnumrun number for which the list of files should be built

References GETRunList::GetFileCount(), run_pattern, and GETRunList::SetFilePattern().

Referenced by SetNextRunList().

int GETRunSerie::SetRunPattern ( const string &  pattern)
virtual

Defines the pattern used to identify the run files. The pattern must contain at least one occurence of the run number indication "%R" or "%<n>R".

If successful, it initializes the current selected file. The function returns 0 if no error occured. If the file is already opened, an error is returned.

Parameters
patternpattern for the file list selection

References IsOpen(), and run_pattern.

Referenced by GETRunSerie().

int GETRunSerie::SetRunSerie ( const string &  serie)
virtual

Defines the serie of run numbers.

If successful, it initializes the current run number.

The function returns 0 if no error occured. If a file is already opened, an error is returned.

Parameters
seriestring defining the list of run numbers

References GetRunCount(), InitCurrentRun(), IsOpen(), and run_serie.

Referenced by GETRunSerie().


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