SFrame 3.6
SInputData Class Reference

Class describing one kind of input data. More...

#include <core/include/SInputData.h>

Collaboration diagram for SInputData:

List of all members.

Public Member Functions

 SInputData (const char *name="SInputData")
 Default constructor.
virtual ~SInputData ()
 Default desctructor.
void SetType (const TString &type)
 Set the name of the input data type.
void SetVersion (const TString &version)
 Set the "version" of the input data.
void SetTotalLumi (Double_t lumi)
 Set the total luminosity of the input data.
void SetNEventsMax (Long64_t nevents)
 Set the maximal number of events to process from the input data.
void SetNEventsSkip (Long64_t nevents)
 Set the number of events to skip at the beginning of the input data.
void SetCacheable (Bool_t flag=kTRUE)
 Set whether the file properties can be cached.
Bool_t GetCacheable () const
 Get whether the file properties can be caches.
void SetSkipValid (Bool_t flag=kTRUE)
 Set whether the file/dataset validation can be skipped.
Bool_t GetSkipValid () const
 Get whether the file/dataset validation can be skipped.
void SetEventTreeEntry (Long64_t entry)
 Set the current entry which is being read from the input.
Long64_t GetEventTreeEntry () const
 Get the current entry which is being read from the input.
void AddGenCut (const SGeneratorCut &gencuts)
 Add a new generator cut to the input data.
void AddSFileIn (const SFile &sfile)
 Add a new input file to the input data.
void AddTree (Int_t type, const STree &stree)
 Add a new tree to the input data.
void AddDataSet (const SDataSet &dset)
 Add a new dataset to the input data.
void AddEvents (Long64_t events)
 Add some number of events to the input data.
void ValidateInput (const char *pserver=0) throw ( SError )
 Collect information about the input files (needed before running)
const TString & GetType () const
 Get the name of the input data type.
const TString & GetVersion () const
 Get the version of the input data type.
const std::vector
< SGeneratorCut > & 
GetSGeneratorCuts () const
 Get all the defined generator cuts.
const std::vector< SFile > & GetSFileIn () const
 Get all the defined input files.
std::vector< SFile > & GetSFileIn ()
 Get all the defined input files.
const std::vector< STree > * GetTrees (Int_t type) const
 Get all the defined trees of a given type.
const std::map< Int_t,
std::vector< STree > > & 
GetTrees () const
 Get all the defined trees.
const std::vector< SDataSet > & GetDataSets () const
 Get all the defined input datasets.
Bool_t HasInputTrees () const
 Simple function answering whether there are any input trees in the configuration.
TDSet * GetDSet () const
 Get the dataset representing all the input files.
Double_t GetTotalLumi () const
 Get the total luminosity of the input data.
Double_t GetScaledLumi () const
 Get the total luminosity scaled to the number of events to process.
Long64_t GetEventsTotal () const
 Get the total number of events in the input data files.
Long64_t GetNEventsMax () const
 Get the maximal number of events to process from the input data.
Long64_t GetNEventsSkip () const
 Get the number of events to skip at the beginning of the input data.
SInputDataoperator= (const SInputData &parent)
 Assignment operator.
Bool_t operator== (const SInputData &rh) const
 Equality operator.
Bool_t operator!= (const SInputData &rh) const
 Non-equality operator.
void Print (const Option_t *opt=0) const
 Function printing the contents of the object.
TString GetStringConfig () const
 Get the input data configuration as a TString object.

Detailed Description

Class describing one kind of input data.

This class is used to describe all the properties (files, trees in the files, etc.) if an input data type. It is created by the framework from the configuration values put in the configuration XML file.

Version:
Revision:
331
Examples:

FirstCycle.cxx, FirstCycle.h, SecondCycle.cxx, and SecondCycle.h.

Definition at line 202 of file SInputData.h.


Constructor & Destructor Documentation

SInputData::SInputData ( const char *  name = "SInputData")

Default constructor.

The constructor initialises all member data to some initial value.

Definition at line 181 of file SInputData.cxx.

References REPORT_VERBOSE.

SInputData::~SInputData ( ) [virtual]

Default desctructor.

Another one of the "I don't do anything" destructors. Notice that I'm not deleting the TDSet object. This is basically because TDSet's copy-constructor is private... Since the whole point in storing a TDSet object is to have a *validated* TDSet object, I can't create new objects every time I copy the SInputData object. So I just copy the pointer to the TDSet object, and let all the SInputData instances use the same TDSet.

Unfortunately this results in a small memory leak. But since the only solution I see right now is to use Boost (which is not available on all supported platforms by default), I chose to accept this leak for now...

Definition at line 203 of file SInputData.cxx.

References REPORT_VERBOSE.


Member Function Documentation

void SInputData::AddDataSet ( const SDataSet dset)

Add a new dataset to the input data.

This adds a new dataset to the input data, taking care of adding the luminosity of the dataset to the total.

Parameters:
dsetThe dataset to be added to the input data

Definition at line 242 of file SInputData.cxx.

References SDataSet::lumi.

Referenced by SCycleBaseConfig::InitializeInputData().

void SInputData::AddEvents ( Long64_t  events) [inline]

Add some number of events to the input data.

Definition at line 246 of file SInputData.h.

void SInputData::AddGenCut ( const SGeneratorCut gencuts) [inline]

Add a new generator cut to the input data.

Definition at line 237 of file SInputData.h.

Referenced by SCycleBaseConfig::InitializeInputData().

void SInputData::AddSFileIn ( const SFile sfile)

Add a new input file to the input data.

The function adds a new input file to the input data, correctly adding the luminosity of the file to the total luminosity sum of the input data.

Parameters:
sfileThe file to add to the input data

Definition at line 215 of file SInputData.cxx.

References SFile::lumi.

Referenced by SCycleBaseConfig::InitializeInputData().

void SInputData::AddTree ( Int_t  type,
const STree stree 
)

Add a new tree to the input data.

This is a generic function for adding a new TTree that is to be handled by SFrame in this input data. Now there can be any number of types of TTrees, which makes adding new functionality quite a bit easier.

Parameters:
typeType of the TTree. See the definitions in the STreeType namespace
streeThe STree object to add for the specified type

Definition at line 230 of file SInputData.cxx.

Referenced by SCycleBaseConfig::InitializeInputData().

Bool_t SInputData::GetCacheable ( ) const [inline]

Get whether the file properties can be caches.

Definition at line 224 of file SInputData.h.

Referenced by Print().

const std::vector< SDataSet >& SInputData::GetDataSets ( ) const [inline]

Get all the defined input datasets.

Definition at line 266 of file SInputData.h.

TDSet * SInputData::GetDSet ( ) const

Get the dataset representing all the input files.

Definition at line 349 of file SInputData.cxx.

Long64_t SInputData::GetEventsTotal ( ) const [inline]

Get the total number of events in the input data files.

Definition at line 279 of file SInputData.h.

Referenced by SCycleController::ExecuteNextCycle(), and SCycleBaseExec::Process().

Long64_t SInputData::GetEventTreeEntry ( ) const [inline]

Get the current entry which is being read from the input.

Definition at line 234 of file SInputData.h.

Long64_t SInputData::GetNEventsMax ( ) const [inline]

Get the maximal number of events to process from the input data.

Definition at line 281 of file SInputData.h.

Referenced by Print(), and SCycleBaseExec::Process().

Long64_t SInputData::GetNEventsSkip ( ) const [inline]

Get the number of events to skip at the beginning of the input data.

Definition at line 283 of file SInputData.h.

Referenced by Print().

Double_t SInputData::GetScaledLumi ( ) const

Get the total luminosity scaled to the number of events to process.

Definition at line 370 of file SInputData.cxx.

References GetTotalLumi().

const std::vector< SFile >& SInputData::GetSFileIn ( ) const [inline]

Get all the defined input files.

Definition at line 258 of file SInputData.h.

std::vector< SFile >& SInputData::GetSFileIn ( ) [inline]

Get all the defined input files.

Definition at line 260 of file SInputData.h.

const std::vector< SGeneratorCut >& SInputData::GetSGeneratorCuts ( ) const [inline]

Get all the defined generator cuts.

Definition at line 256 of file SInputData.h.

Bool_t SInputData::GetSkipValid ( ) const [inline]

Get whether the file/dataset validation can be skipped.

Definition at line 229 of file SInputData.h.

Referenced by Print().

TString SInputData::GetStringConfig ( ) const

Get the input data configuration as a TString object.

This function is used to get an "XML representation" of the configuration stored in this input data object. It is used to archive the cycle configuration into the job's output file.

Returns:
The InputData configuration as an XML string

Definition at line 506 of file SInputData.cxx.

References STreeTypeDecoder::GetXMLName(), and STreeTypeDecoder::Instance().

Referenced by SCycleConfig::GetStringConfig().

Double_t SInputData::GetTotalLumi ( ) const

Get the total luminosity of the input data.

Definition at line 354 of file SInputData.cxx.

References SLogger::endmsg(), FATAL, and GetType().

Referenced by GetScaledLumi(), and Print().

const std::vector< STree > * SInputData::GetTrees ( Int_t  type) const

Get all the defined trees of a given type.

This function has a slightly different interface than all the other functions. Unforunately I wasn't able to come up with any better ideas on how to signal it to the user when a particular tree type is not available. Which is a pretty normal condition.

So now this function returns a null-pointer when there are no trees of the requested type, and returns a pointer to an actual vector when there is at least one such tree.

Parameters:
typeType of the tree(s)
Returns:
null-pointer if requested trees don't exist, pointer to valid vector otherwise

Definition at line 324 of file SInputData.cxx.

Referenced by SCycleBaseExec::SlaveBegin().

const std::map< Int_t, std::vector< STree > >& SInputData::GetTrees ( ) const [inline]

Get all the defined trees.

Definition at line 264 of file SInputData.h.

const TString& SInputData::GetType ( ) const [inline]
const TString& SInputData::GetVersion ( ) const [inline]
Bool_t SInputData::HasInputTrees ( ) const

Simple function answering whether there are any input trees in the configuration.

Definition at line 334 of file SInputData.cxx.

References STree::EVENT_TREE, and STree::INPUT_TREE.

Bool_t SInputData::operator!= ( const SInputData rh) const

Non-equality operator.

The non-equality operator is put in to make code such as

if( inputData1 != inputData2 ) ...

possible.

Definition at line 448 of file SInputData.cxx.

SInputData & SInputData::operator= ( const SInputData parent)

Assignment operator.

It is only necessary for some technical affairs.

Definition at line 386 of file SInputData.cxx.

Bool_t SInputData::operator== ( const SInputData rh) const

Equality operator.

The equality operator is put in to make code such as

if( inputData1 == inputData2 ) ...

possible.

Definition at line 418 of file SInputData.cxx.

void SInputData::Print ( const Option_t *  opt = 0) const

Function printing the contents of the object.

At initialisation the cycles print the configuration of the input data which was configured in the XML file. This function is used to print the configuration of a given input data object.

Definition at line 459 of file SInputData.cxx.

References SLogger::endmsg(), GetCacheable(), STreeTypeDecoder::GetName(), GetNEventsMax(), GetNEventsSkip(), GetSkipValid(), GetTotalLumi(), GetType(), GetVersion(), INFO, and STreeTypeDecoder::Instance().

void SInputData::SetCacheable ( Bool_t  flag = kTRUE) [inline]

Set whether the file properties can be cached.

Definition at line 222 of file SInputData.h.

Referenced by SCycleBaseConfig::InitializeInputData().

void SInputData::SetEventTreeEntry ( Long64_t  entry) [inline]

Set the current entry which is being read from the input.

Definition at line 232 of file SInputData.h.

Referenced by SCycleBaseExec::Process().

void SInputData::SetNEventsMax ( Long64_t  nevents) [inline]

Set the maximal number of events to process from the input data.

Definition at line 217 of file SInputData.h.

Referenced by SCycleBaseConfig::InitializeInputData().

void SInputData::SetNEventsSkip ( Long64_t  nevents) [inline]

Set the number of events to skip at the beginning of the input data.

Definition at line 219 of file SInputData.h.

Referenced by SCycleBaseConfig::InitializeInputData().

void SInputData::SetSkipValid ( Bool_t  flag = kTRUE) [inline]

Set whether the file/dataset validation can be skipped.

Definition at line 227 of file SInputData.h.

Referenced by SCycleBaseConfig::InitializeInputData().

void SInputData::SetTotalLumi ( Double_t  lumi) [inline]

Set the total luminosity of the input data.

Definition at line 215 of file SInputData.h.

Referenced by SCycleBaseConfig::InitializeInputData().

void SInputData::SetType ( const TString &  type) [inline]

Set the name of the input data type.

Definition at line 211 of file SInputData.h.

Referenced by SCycleBaseConfig::InitializeInputData().

void SInputData::SetVersion ( const TString &  version) [inline]

Set the "version" of the input data.

Definition at line 213 of file SInputData.h.

Referenced by SCycleBaseConfig::InitializeInputData().

void SInputData::ValidateInput ( const char *  pserver = 0) throw ( SError )

Collect information about the input files (needed before running)

This function takes care of investigating all the input files defined in the configuration, and checking how many events they each contain. This information is used at run time to calculate the correct weights of the events.

The function is smart enough to load already gathered information from a cache file if it exists. The feature has to be enabled by setting Cacheable="1" in the declaration of the InputData block in the configuration XML.

Definition at line 258 of file SInputData.cxx.

References SLogger::endmsg(), ERROR, INFO, SError::SkipInputData, and WARNING.


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