seed::TEventSample


class description - source file - inheritance tree

class seed::TEventSample : public TObject


    protected:
TClonesArray** CreateCA(seed::TSeedABC* pSeed) TFile* CreateOutputFile() TClonesArray* *const GetCAPtrAddr(const Char_t* strSeed) static TTree* GetNtupleFromFile(const Char_t* cNtupleFileName, const Char_t* cNtupleID, Int_t debug = 1) static Bool_t MakeSeed_Branch(ofstream& fsHeader, ofstream& fsSource, TBranch* pB) static Bool_t MakeSeed_Leaf(ofstream& fsHeader, ofstream& fsSource, TLeaf* pL, Int_t iNumLeaves) static Bool_t ParseSeedActivationFile(const Char_t* cSAFName) Bool_t SetupBranches() public:
seed::TEventSample TEventSample() seed::TEventSample TEventSample(const seed::TEventSample& es) virtual void ~TEventSample() static void AddError() seed::TEventSample& AddFile(const Char_t* strRootFileName) Bool_t AddGlobalObject(const Char_t* cName, TObject* pObj) static void AddWarning() static TClass* Class() Bool_t Create(const Char_t* cNtupleFileName, const Char_t* cNtupleID = "NULL") Bool_t Create(TTree* pNtupleTree) Bool_t EnableSeed(const Char_t* cSeed, Bool_t bEnable = kTRUE) TClonesArray* GetClonesArray(const Char_t* strSeed) TFile* GetCurrentFile() const Int_t GetDebugLevel() const TObject* GetGlobalObject(const Char_t* cName) const Int_t GetNEvents() const Int_t GetNumberOf(const Char_t* strSeed) Int_t GetNumEntries() const static Int_t GetNumErrors() static Int_t GetNumWarnings() TTree* GetTree() virtual TClass* IsA() const static seed::TEventSample* Load(const Char_t* strRootFileName, const Char_t* cSAFName = "SeedActivation.ini") static Bool_t MakeSeed(const Char_t* cNtupleFileName, const Char_t* cNtupleID = "NULL", const Char_t* cBranch = "NULL", const Char_t* cSeedName = "TMySeed", const Char_t* cDataClass = "NULL") static Bool_t MakeSeed(TTree* pNtupleTree = NULL, const Char_t* cBranch = "NULL", const Char_t* cSeedName = "TMySeed", const Char_t* cDataClass = "NULL") static TString Ntuple2SeedFileName(const Char_t* strNTupleFileName) seed::TEventSample& PrintSettings() Bool_t ReadSettings(const Char_t* cSettingsFile) static void ResetErrorCounter() Bool_t SaveSettings(const Char_t* cSettingsFile) seed::TEventSample& SetAuthor(const Char_t* cAuthor) seed::TEventSample& SetCrossEventRefs(Bool_t bCER = kFALSE) seed::TEventSample& SetDebug(const Int_t iDebugLevel = 1) Bool_t SetEvent(const Int_t iEventIdx) seed::TEventSample& SetFirstEntry(const Int_t iFirstEntry = 0) seed::TEventSample& SetNEvents(const Int_t iNumEntries = -1) seed::TEventSample& SetNumEntries(const Int_t iNumEntries = -1) seed::TEventSample& SetOutputFileName(const Char_t* cSeedFileName) seed::TEventSample& SetOutputFileOption(const Char_t* cOption = "NEW") seed::TEventSample& SetProcessEvent(seed::TProcessEventABC* pProcessEvent = NULL) seed::TEventSample& SetSaveOutput(Bool_t bSave = kTRUE) seed::TEventSample& SetSeedActivationFile(const Char_t* cSAF = "SeedActivation.ini") seed::TEventSample& SetUserParameter(void* pUserParameter = NULL) seed::TEventSample& SetUserParameter(const Char_t* strSeed, void* pUserParameter = NULL) virtual void ShowMembers(TMemberInspector& insp, char* parent) static Bool_t ShowNtuple(const Char_t* cNTupleFileName, const Char_t* strNTupleID = "NULL") virtual void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b)

Data Members


    protected:
seed::TEventSampleInfo fEsInfo some information on the TEventSample TTree* fTreeEvent ! tree of data classes filled by seeds, written and read "by hand" map<std::string,TClonesArray*> fMapCA ! pointer to TClonesArrays in Seeds map<std::string,TObject*> fMapGlobalObjects ! map of global objects which have to be streamed in Create Bool_t fDisableSetEntry ! to temporarily disable seed::TEvenTSample::SetEvent, e.g. for OnTheFly map<std::string,void*> fMapUserParameters ! map of seed specific user parameters TString fStrClassFileName where to store the TEventSample - as it's a member one can always rename it to its original filename (might be nice) const Char_t* fNtupleFileName ! name of the ntuple (input) file const Char_t* fNtupleID ! name of the ntuple's key in ntuple file const Char_t* fSeedFileOption ! options for opening the seed data (ouput) file const Char_t* fSAFName ! name of the seed activation file Int_t fDebug ! local debug level, debug level = max(fDebug, gDebug) Int_t fFirstEntry ! first entry to be processed in ntuple Int_t fNumEntries ! number of entries to be processed in ntuple void* fUserParameter ! user defined parameter, passed to seed::TSeedABC::FillSeedData TTree* fNtupleTree ! pointer to ntuple (input) TTree Bool_t fSaveSeedData ! the seed data (output) is saved to file seed::TProcessEventABC* fProcessEvent ! class to be used for on-the-fly analysis of seed data Bool_t fCrossEventRefs ! allow TRefs to span different events TFile* fFileCF ! class file for Create static Int_t fNumErrors number of errors issued during creation / load static Int_t fNumWarnings number of warnings issued during creation / load

Class Description

      This class manages the data conversion from n-tuple to class objects as well
  as the data stored in class objects themselves. See the documentation on SEED

  A short summary: To work with a seed::TEventSample you have to
  1) write your own seed (deriving from seed::TSeedABC) which fills data from an n-tuple into a class
  2) create a seed::TEventSample from an n-tuple calling the seed::TEventSample::Create method using your seed::TSeed's
  3) load it using the seed::TEventSample::Load method and read its data by means of the seed::TSeedData class


TEventSample(): fTreeEvent(NULL), fDisableSetEntry(kFALSE), fNtupleFileName(NULL), fNtupleID(NULL), fSeedFileOption("NEW"), fSAFName("SeedActivation.ini"), fDebug(gDebug>1?gDebug:1), fFirstEntry(0), fNumEntries(-1), fUserParameter(NULL), fNtupleTree(NULL), fSaveSeedData(kTRUE), fProcessEvent(NULL), fCrossEventRefs(kFALSE), fFileCF(NULL)
 default constructor. Should only be called before seed::TEventSample::Create.
 Otherwise use the static seed::TEventSample::Load which returns a
  seed::TEventSample*

TEventSample(const seed::TEventSample & es)
 copy constructor. May not be used, as seed::TEventSample represents one TTree.
 Use multiple references to one seed::TEventSample instead.

~TEventSample()
 default destructor

Bool_t SetEvent(const Int_t iEventIdx)
 Sets the event currently accessible by classes deriving from TSeedABC.
 Only to be called when reading data, i.e. not during Create.

 Returns kFALSE if the event could not be selected.

 Parameters
     iEventIdx:    Index of the event to select (see TTree::GetEntry).

TClonesArray* GetClonesArray(const Char_t *strSeed)
 returns the address of the TClonesArray corresponding to a given seed / branch
 returns NULL if either the seed is unknown or no events have been read (TClonesArray
 not yet initialized)

 Parameters
     strSeed: Name of the Seed / branch

Int_t GetNumberOf(const Char_t *strSeed)
 returns the number of entries of a given seed (branch) in the current event
 returns -1 if the seed/branch does not exist (no entry in fMapCA)
 returns -2 if the seed/branch is not activated or not yet read (fPCAArray's entry is NULL)

 Parameters
     strSeed: Name of the Seed / branch

Bool_t SetupBranches()
 Creates a TClonesArray for each used branch in fTreeEvents and
 enables it via TTree::SetBranchStatus. The user can enable / disable branches
 in the seed activation file

 Returns kFALSE is branch setup was not successful

TClonesArray** CreateCA(seed::TSeedABC * pSeed)
 Creates a TClonesArray for the class given by pSeed's seed::TSeedABC::GetClassName
 Internal method.


Bool_t ParseSeedActivationFile(const Char_t *cSAFName)
 With the Seed Activation File (SAF) one can steer which seeds will be
 used in seed::TEventSample::Create() and seed::TEventSample::Load().
 All characters beyond a '#' in a line are ignored. Each word in the file
 outside the comments is assumed to be a seed to be activated.
 If the SAF is not found, all available seeds are activated. If one seed
 given in the SAF is not found (e.g. because it is not #include'd) a
 warning is issued.

 This method can be called directly, superseding seeds activated by a
 prior call to ParseSeedActivationFile, e.g. from withing
 seed::TEventSample::Load or seed::TEventSample::Create.

 Returns kTRUE if all requested seeds are known

 Parameters:
   cSAFName: Path and name of the seed activation file

Bool_t ShowNtuple(const Char_t *strNTupleFileName, const Char_t *strNTupleID)
 Calls TTree::Print for a given ntuple in a given file.

 Parameters
     strNTupleFileName:  name of the file containing the n-tuple.
     strNTupleID:        name of the n-tuple in the file.


TTree* GetNtupleFromFile(const Char_t *cNtupleFileName, const Char_t *cNtupleID, Int_t debug)
 Extracts the n-tuple from the file and with the key name set by Create
 Internal method.

TString Ntuple2SeedFileName(const Char_t * strNTupleFileName)
 Given a ntuple file name this method gives a root file name.
 It simply appends "root" to the n-tuple file name - only if the
 ntuple file name already ends on ".root" the resulting filename
 will end on ".seed.root".
 This method is used if SetOutputFileName was not called with a file name
 before Create is called.

TFile* CreateOutputFile()
 Creates the output file for the Create method.
 Internal method

 It uses the file name given by SetOutputFileName or generates
 it via Ntuple2SeedFileName. It uses TFile::Open with options
 set by SetOutputFileOption. This method deletes all prior
 entries of keys with name "EventSample" from the file!

seed::TEventSample* Load(const Char_t *strRootFileName, const Char_t* cSAFName)
 ===========================================================================================================

      Loads a seed::TEventSample created by seed::TEventSample::Create from a file.

 Opens a file, extracts the TEventSample and accesses data which belongs to activated seeds
 (as given in the seed activation file, see ParseSeedActivationFile).

 Parameters
     strRootFileName: name of the file containing the seed::TEventSample. Can contain
                      wildcards for loading multiple files, see TChain::Add for valid syntax
     cSAFName:        name of the seed activation file (see ParseSeedActivationFile)

 ===========================================================================================================

seed::TEventSample AddFile(const Char_t* strRootFileName)
 Adds another file for reading. To be call after Load. Syntax for
 strRootFileName is the same as for TChain::Add

 Parameters
   strRootFileName: Name of the files to add, for syntax see TChain::Add

Bool_t AddGlobalObject(const Char_t *cName, TObject * pObj)
 Adds an object to the file holding the TEventSample during Create phase.

 To be called before Create. The object will not be part of the tree.
 It is global and thus independent of the current event / entry in the tree.
 AddGlobalObject creates a new key in the output file, the object will be
 written when the TEventSample is written (within Create).

 Parameters
   cName: Name under which the object can be accessed with GetGlobalObject
          (identical with the name of the key created in the output file for
          this object).
   pObj:  Pointer to a TObject to be stored in the output file.

TObject* GetGlobalObject(const Char_t *cName) const
 Returns an entry in seed::TEventSample's file created by AddGlobalObject.

 Parameters
   cName: Name of the object as given by AddGlobalObject (identical with its key name)

Bool_t Create(const Char_t *cNtupleFileName, const Char_t *cNtupleID)
 ===========================================================================================================

 Creates a TEventSample from an ntuple.

 See Set-methods for additional initializations of this method. Returns kFALSE if an error occurred.

 Parameters
   cNtupleFileName: name of the file containing the n-tuple to be processed
   cNtupleID:       optional key name of the n-tuple in the file. If not given (or NULL or ""),
                    the first key of type TTree in the file is used.

 ===========================================================================================================

Bool_t Create(TTree* pNtupleTree)
 ===========================================================================================================

 Creates a TEventSample from an ntuple.

 See Set-methods for additional initializations of this method.

 Parameters
   pNtupleTree: pointer to a TTree which will be processed by TEventSample.
                This pointer can also be a TChain* as TChain derives from
                TTree, allowing multiple TTrees to be processed.

 ===========================================================================================================

seed::TEventSample SetSeedActivationFile(const Char_t *cSAF)
 Sets the file to be parsed by ParseSeedActivationFile

seed::TEventSample SetOutputFileName(const Char_t *cSeedFileName)
 Sets the file name of the seed data (=output) file. Set the TFile
 option (new / append / recreate) by SetOutputFileOption.

 Parameters
   cSeedFileName: Name of the file, see TFile::Open for available syntax

seed::TEventSample SetOutputFileOption(const Char_t *cOption)
 Sets the TFile::Open options (new / append / recreate) for the
 seed data (=output) file.

 Parameters
   cOption: Options, see TFile::Open

seed::TEventSample SetDebug(const Int_t iDebugLevel)
 Set the debug level for TEventSample. The higher the value, the more
 debug information will be printed out (0 = off). If the value set by
 this method would be lower than the global ROOT gDebug level, ROOT's
 gDebug level is assumed. Defaults to 1.

 Debug output for the different debug levels:
 0: No output, only the used seeds are printed
 1: 0 + number and type of objects created, Print of resulting tree
 2: 0+1 + trace of actions taken once for each conversion
 3: 0+1+2 + trace of actions taken once for each entry
 4: 0+1+2+3 + trace of actions taken once for each new object

 Parameters
    iDebugLevel: level for debug information output.


seed::TEventSample SetAuthor(const Char_t *cAuthor)
 Sets the author entry in this TEventSample's seed::TEventSampleInfo
 Parameters
    cAuthor:  string to be passed to seed::TEventSampleInfo::SetAuthor

seed::TEventSample SetFirstEntry(const Int_t iFirstEntry)
 Sets the index of the first entry in the n-tuple to be converted by Create
 Default value: 0
 Parameters
    iFirstEntry: First entry in n-tuple to be converted by Create

seed::TEventSample SetNEvents(const Int_t iNumEntries)
 Sets the number of entries in the n-tuple file to be converted by Create
 Forwarded to SetNumEntries.
 "-1" means "all". Default value: -1
 Parameters
    iNumEntries: Number of entries in n-tuple file to be converted by
                 Create, "-1" means "all"

seed::TEventSample SetNumEntries(const Int_t iNumEntries)
 Sets the number of entries in the n-tuple file to be converted by Create
 "-1" means "all". Default value: -1
 Parameters
    iNumEntries: Number of entries in n-tuple file to be converted by
                 Create, "-1" means "all"

seed::TEventSample SetUserParameter(void* pUserParameter)
 Sets the global "user parameter". It can be retrieved via
 seed::TSingleEntryTree::GetUserParameter(const Char_t*), which is
 accessible e.g. from within seed::TSeedABC::FillSeedData
 Parameters
    pUserParameter: something that the use wants to have passed to seeds

seed::TEventSample SetUserParameter( const Char_t* strSeed, void* pUserParameter)
 Sets the "user parameter" for a given seed. It can be retrieved via
 seed::TSingleEntryTree::GetUserParameter(const Char_t*), which is
 accessible e.g. from within seed::TSeedABC::FillSeedData
 Parameters
    strSeed:        name of the seed
    pUserParameter: something that the use wants to have passed to seeds

seed::TEventSample SetSaveOutput(Bool_t bSave)
 If kTRUE (default), the output generated by Create will be saved to
 file given by SetOutputFile.

 Parameters
   bSave: kTRUE if output is to be saved.

seed::TEventSample SetCrossEventRefs(Bool_t bCER)

seed::TEventSample SetProcessEvent(seed::TProcessEventABC *pProcessEvent)
 Sets the class deriving from seed::TProcessEventABC which will be used
 for on-the-fly processing of the generated seed data. This class has to
 be provided by the user, implementing the seed::TProcessEventABC::Process
 method. This method is called after each event that has been processed by
 Create allowing access to the generated seed data via seed::TSeedDataABC
 derived classes (as defined by MAKE_SEED, see seed::TSeedABC).

 Parameters
   pProcessEvent: Pointer to a TProcessEventABC derived class

Bool_t ReadSettings(const Char_t *cSettingsFile)
 Loads the settings from a text file to which it was saved by a prior
 call to SaveSettings. These settings will be used for the next Create
 call.

 Parameters
   cSettingsFile: name of the file storing settings for Create

Bool_t SaveSettings(const Char_t *cSettingsFile)
 Saves all settings set via the seed::TEventSample::Set___ methods
 to a file. These settings can be re-used by ReadSettings.
 Settings that are stored are:

   fSeedFileOption (see SetOutoutFileOption)
   fSAFName (see SetSeedActivationFile)
   fDebug (see SetDebug)
   fFirstEntry (see SetFirstEntry)
   fNumEntries (see SetNumEntries)
   fSaveSeedData (see SetSaveOutput)

 Parameters
   cSettingsFile: name of the file in which settings should be stored

seed::TEventSample PrintSettings()
 Prints current settings for Create as set by
 seed::TEventSample::Set___ (or their default values).
 These settings will be used in the next call of the Create method.

Bool_t MakeSeed(const Char_t *cNtupleFileName, const Char_t *cNtupleID, const Char_t *cBranch, const Char_t *cSeedName, const Char_t *cDataClass)
 Create a seed source and header file nor a given ntuple.

 Comments in the form '[[[ TEXT ]]]' will be created in the source to
 show code that needs to be adopted. The created code will not compile
 before these changes are made. The number of changes necessary varies
 depending on the information (number of valid parameters) passed to
 MakeSeed (only two changes in case all parameters are given).

 Parameters
    cNtupleFileName,
    cNtupleID:   from the file cNtupleFileName, load the ntuple with key
                 name cNtupleID (Default for cNtupleID: NULL: load the
                 TTree in the file. See GetNtupleFromFile.) All leaves
                 of this tree will be available to the seed.
    cBranch:     only leaves in this branch will be available to the seed
                 (Default: NULL: all branches in ntuple)
    cSeedName:   name of the seed that will be created. It reflects both
                 class name and file name. (Default: "TMySeed")
    cDataClass:  name of the class where the ntuple data should be
                 transferred to (data class). (Default: NULL: create
                 comments where to change the created skeleton)


Bool_t MakeSeed(TTree* pNtupleTree, const Char_t *cBranch, const Char_t *cSeedName, const Char_t *cDataClass)
 Create a seed source and header file nor a given ntuple.

 Comments in the form '[[[ TEXT ]]]' will be created in the source to
 show code that needs to be adopted. The created code will not compile
 before these changes are made. The number of changes necessary varies
 depending on the information (number of valid parameters) passed to
 MakeSeed (only two changes in case all parameters are given).

 Parameters
    pNtupleTree: if given, all leaves of this ntuple will be available
                 to the seed (Default: NULL: generate a skeleton
                 independent of leaves)
    cBranch:     only leaves in this branch will be available to the seed
                 (Default: NULL: all branches in ntuple pNtupleTree)
    cSeedName:   name of the seed that will be created. It reflects both
                 class name and file name. (Default: "TMySeed")
    cDataClass:  name of the class where the ntuple data should be
                 transferred to (data class). (Default: NULL: create
                 comments where to change the created skeleton)


TFile* GetCurrentFile() const

Bool_t MakeSeed_Branch( std::ofstream &fsHeader, std::ofstream &fsSource, TBranch* pB)
 internal method, used by MakeSeed
 creates all entries in fsHeader and fsSource for
 all leafs and branches for current branch

Bool_t MakeSeed_Leaf( std::ofstream &fsHeader, std::ofstream &fsSource, TLeaf* pL, Int_t iNumLeaves)

Bool_t EnableSeed(const Char_t* cSeed, Bool_t bEnable)
 enables / disables seeds.
 Disableing even works while processing input, it removes
 already existing output by the seed from the output tree

void AddWarning()

void AddError()

Int_t GetNumWarnings()

Int_t GetNumErrors()

void ResetErrorCounter()



Inline Functions


                       Int_t GetNEvents() const
                       Int_t GetNumEntries() const
                      TTree* GetTree()
                       Int_t GetDebugLevel() const
        TClonesArray* *const GetCAPtrAddr(const Char_t* strSeed)
                     TClass* Class()
                     TClass* IsA() const
                        void ShowMembers(TMemberInspector& insp, char* parent)
                        void Streamer(TBuffer& b)
                        void StreamerNVirtual(TBuffer& b)


Author: Axel Naumann 10/02/2001
Last update: Tue Feb 25 11:33:19 2003


ROOT page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.