KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVRunListLine Class Reference

Detailed Description

Base class for reading runlists for experiments ,.

Id
KVRunListLine.h,v 1.4 2006/10/19 14:32:43 franklan Exp

Base class for reading runlists for experiments, either 'real' runlists with all info (KVLineCSV) or the minimalist files used for old data and based on the DST runlists kept at CC-IN2P3 (KVLineDST).

For backwards compatibility, this uses KVString whenever possible.

Definition at line 26 of file KVRunListLine.h.

#include <KVRunListLine.h>

Public Member Functions

 KVRunListLine ()
 
virtual ~KVRunListLine ()
 
Int_t BreakLineIntoFields (const char)
 
void Clear ()
 
Bool_t FieldContains (const Char_t *, const Char_t *) const
 Returns true if "field" exists, has been filled, and contains "string" as part or all of its value.
 
Bool_t FieldsSet () const
 
virtual const Char_tGetField (const Char_t *) const
 
TObjStringGetFieldString (const Char_t *) const
 
Float_t GetFloatField (const Char_t *)
 
Int_t GetIntField (const Char_t *)
 
virtual Int_t GetTrigger (const Char_t *field_name="Trigger", const Char_t *fmt="M>=%d")
 
virtual Bool_t GoodRunLine ()
 Returns kTRUE if and only if current line contains integer values for ALL the fields defined by SetRunKeys.
 
Bool_t HasField (const Char_t *) const
 INLINES_______________________________________________________________________________.
 
Bool_t HasFieldValue (const Char_t *) const
 
virtual Bool_t IsFieldHeader ()
 Returns kTRUE if and only if current line contains ALL of the keywords defined by SetFieldKeys()
 
Bool_t IsFloat (const Char_t *name)
 
virtual void Print () const
 
void PrintFieldValue (const Char_t *name) const
 
template<typename T , typename... Args>
void SetFieldKeys (T key0, Args... keys)
 
virtual void SetFields ()
 
void SetLine (const Char_t *)
 
void SetLine (TString &)
 
template<typename T , typename... Args>
void SetRunKeys (T key0, Args... keys)
 

Private Member Functions

Int_t GetFieldIndex (const Char_t *) const
 
void SetFieldKeys ()
 
void SetRunKeys ()
 

Private Attributes

bool calling_field_keys
 
bool calling_run_keys
 
KVList fFieldKeys
 key words used to recognise field headings
 
TObjArrayfFields
 array of all fields after break down of fLine
 
Bool_t fFieldsSet
 flag set once fields have been set
 
KVNameValueList fIndexList
 list of integer indexes corresponding to field names
 
TString fLine
 line to analyse
 
Int_t fMaxNFields
 maximum allowed number of fields i.e. size of TObjArray fFields
 
KVList fRunKeys
 fields that must be present (have a value) for a line to be considered a "good run line"
 

Constructor & Destructor Documentation

◆ KVRunListLine()

KVRunListLine::KVRunListLine ( )

Default ctor Initial size of TObjArray (fMaxNFields) is 5. This will be increased if necessary in BreakLineIntoFields().

Definition at line 20 of file KVRunListLine.cpp.

◆ ~KVRunListLine()

KVRunListLine::~KVRunListLine ( )
virtual

Definition at line 37 of file KVRunListLine.cpp.

Member Function Documentation

◆ BreakLineIntoFields()

Int_t KVRunListLine::BreakLineIntoFields ( const char  _delim)

Break down "line" into fields separated by the delimiter "_delim". Fields are stored in TObjArray of TObjString s (including empty fields i.e. 2 consecutive delimiters in "line" with nothing between are translated as a field whose content is "". TString::Tokenize() simply skips over such cases, so we can't use it with our field idxing system). Remove leading/trailing white space from each field. Return the total number of fields found (including empty fields).

Definition at line 55 of file KVRunListLine.cpp.

◆ Clear()

void KVRunListLine::Clear ( )
inline

reset before reading new line

Definition at line 175 of file KVRunListLine.h.

◆ FieldContains()

Bool_t KVRunListLine::FieldContains ( const Char_t field,
const Char_t string 
) const

Returns true if "field" exists, has been filled, and contains "string" as part or all of its value.

Definition at line 300 of file KVRunListLine.cpp.

◆ FieldsSet()

Bool_t KVRunListLine::FieldsSet ( ) const
inline

Definition at line 62 of file KVRunListLine.h.

◆ GetField()

const Char_t * KVRunListLine::GetField ( const Char_t fname) const
virtual

returns a string containing the field in the line corresponding to column title "fname". returns 0 if field not found

Definition at line 177 of file KVRunListLine.cpp.

◆ GetFieldIndex()

Int_t KVRunListLine::GetFieldIndex ( const Char_t fname) const
inlineprivate

PROTECTED method. Returns index of field with name 'fname' This index can be used to retrieve the field-value from fFields Returns -1 if : field indices not set yet (no call to SetFields) or if : field is unknown

Definition at line 146 of file KVRunListLine.h.

◆ GetFieldString()

TObjString * KVRunListLine::GetFieldString ( const Char_t fname) const

returns a TObjString containing the field in the line corresponding to column title "fname". Check that field indices are set and field is known otherwise return 0

Definition at line 158 of file KVRunListLine.cpp.

◆ GetFloatField()

Float_t KVRunListLine::GetFloatField ( const Char_t fname)

returns the floating-point translation of the field in the line corresponding to column title "fname". We check that the field is a floating point number (IsFloat=kTRUE) If not, 0 is returned.

Definition at line 219 of file KVRunListLine.cpp.

◆ GetIntField()

Int_t KVRunListLine::GetIntField ( const Char_t fname)

Returns the integer translation of the field in the line corresponding to column title "fname". We check the field is present in current line and that all characters in the field are numbers (KVString::IsDigit). If not, 0 is returned.

Definition at line 196 of file KVRunListLine.cpp.

◆ GetTrigger()

Int_t KVRunListLine::GetTrigger ( const Char_t field_name = "Trigger",
const Char_t fmt = "M>=%d" 
)
virtual

Returns value of "Trigger" field, assuming it is written with format "fmt" i.e. if fmt = "M>=%d" (default) we expect "M>=1", "M>=4" etc. The actual field name for the trigger is given as first argument (default value = "Trigger") If trigger field is not present, we return -1 (but no error) If format is not respected, an error message is printed and -1 is returned.

Definition at line 322 of file KVRunListLine.cpp.

◆ GoodRunLine()

Bool_t KVRunListLine::GoodRunLine ( )
virtual

Returns kTRUE if and only if current line contains integer values for ALL the fields defined by SetRunKeys.

Definition at line 377 of file KVRunListLine.cpp.

◆ HasField()

Bool_t KVRunListLine::HasField ( const Char_t fname) const
inline

INLINES_______________________________________________________________________________.

we check that the field in question is set, i.e. does the current definition of possible fields include field "fname" ?

Definition at line 122 of file KVRunListLine.h.

◆ HasFieldValue()

Bool_t KVRunListLine::HasFieldValue ( const Char_t fname) const
inline

we check that the field in question exists and has been filled in this line if the field index is greater than the actual number of fields in the line, we assume the field was not filled (HasFieldValue=kFALSE) fields which are present but empty or filled with whitespace are not considered to have a field value

Definition at line 132 of file KVRunListLine.h.

◆ IsFieldHeader()

Bool_t KVRunListLine::IsFieldHeader ( )
virtual

Returns kTRUE if and only if current line contains ALL of the keywords defined by SetFieldKeys()

Definition at line 352 of file KVRunListLine.cpp.

◆ IsFloat()

Bool_t KVRunListLine::IsFloat ( const Char_t name)

Returns kTRUE if field "name" contains a floating point number Examples are: 64320 6.4320 6.43e20 6.43E20 6.43e-20 6.43E-20

Definition at line 274 of file KVRunListLine.cpp.

◆ Print()

void KVRunListLine::Print ( ) const
virtual

Print information on this reader object. If fields have been set, we show which fields have been found. Break down of current line is shown.

Definition at line 242 of file KVRunListLine.cpp.

◆ PrintFieldValue()

void KVRunListLine::PrintFieldValue ( const Char_t name) const
inline

for a given field "name", print out current value of field as: Field name : current value if the field is absent from current line (HasFieldValue=kFALSE) we print Field name : [absent]

Definition at line 184 of file KVRunListLine.h.

◆ SetFieldKeys() [1/2]

void KVRunListLine::SetFieldKeys ( )
inlineprivate

Definition at line 40 of file KVRunListLine.h.

◆ SetFieldKeys() [2/2]

template<typename T , typename... Args>
void KVRunListLine::SetFieldKeys ( T  key0,
Args...  keys 
)
inline

Set keywords used to identify lines in the file which define the column headings, i.e. the field names. Give the list of keywords (at least one).

Each and every keyword given as argument here (at least one word must be given) must appear in a line for it to be considered a column heading. Lines identified as such (by IsFieldHeader()) are used to set indices for each column (SetFields()).

at beginning of call, clear out list of keywords

Definition at line 82 of file KVRunListLine.h.

◆ SetFields()

void KVRunListLine::SetFields ( )
virtual

set field idxes based on field header line in file identified by IsFieldHeader(). this method is called automatically by BreakLineIntoFields(). we check that at least one index has been defined at the end previous definitions are forgotten clear index list

Definition at line 117 of file KVRunListLine.cpp.

◆ SetLine() [1/2]

void KVRunListLine::SetLine ( const Char_t line)
inline

set new line to be read

Definition at line 159 of file KVRunListLine.h.

◆ SetLine() [2/2]

void KVRunListLine::SetLine ( TString line)
inline

set new line to be read

Definition at line 167 of file KVRunListLine.h.

◆ SetRunKeys() [1/2]

void KVRunListLine::SetRunKeys ( )
inlineprivate

Definition at line 44 of file KVRunListLine.h.

◆ SetRunKeys() [2/2]

template<typename T , typename... Args>
void KVRunListLine::SetRunKeys ( T  key0,
Args...  keys 
)
inline

Set list of fields which must have values for a line to be considered a "good" run line Give the list of field names (at least one).

at beginning of call, clear out list of keywords

Definition at line 99 of file KVRunListLine.h.

Member Data Documentation

◆ calling_field_keys

bool KVRunListLine::calling_field_keys
private

Definition at line 38 of file KVRunListLine.h.

◆ calling_run_keys

bool KVRunListLine::calling_run_keys
private

Definition at line 39 of file KVRunListLine.h.

◆ fFieldKeys

KVList KVRunListLine::fFieldKeys
private

key words used to recognise field headings

Definition at line 33 of file KVRunListLine.h.

◆ fFields

TObjArray* KVRunListLine::fFields
private

array of all fields after break down of fLine

Definition at line 32 of file KVRunListLine.h.

◆ fFieldsSet

Bool_t KVRunListLine::fFieldsSet
private

flag set once fields have been set

Definition at line 31 of file KVRunListLine.h.

◆ fIndexList

KVNameValueList KVRunListLine::fIndexList
private

list of integer indexes corresponding to field names

Definition at line 50 of file KVRunListLine.h.

◆ fLine

TString KVRunListLine::fLine
private

line to analyse

Definition at line 30 of file KVRunListLine.h.

◆ fMaxNFields

Int_t KVRunListLine::fMaxNFields
private

maximum allowed number of fields i.e. size of TObjArray fFields

Definition at line 29 of file KVRunListLine.h.

◆ fRunKeys

KVList KVRunListLine::fRunKeys
private

fields that must be present (have a value) for a line to be considered a "good run line"

Definition at line 34 of file KVRunListLine.h.