SFrame 3.6
SCycleOutput Class Reference

Special object type for the outputs produced by a cycle. More...

#include <core/include/SCycleOutput.h>

Collaboration diagram for SCycleOutput:

List of all members.

Public Member Functions

 SCycleOutput (TObject *object=0, const char *name="", const char *path="")
 Constructor with child object and name.
virtual ~SCycleOutput ()
 Destructor.
TObject * GetObject () const
 Get the wrapped object.
void SetObject (TObject *object)
 Set the pointer to the wrapped object.
const TString & GetPath () const
 Get the output path of the wrapped object.
void SetPath (const TString &path)
 Set the output path of the wrapped object.
Int_t Merge (TCollection *list)
 Merge the contents of other objects into this one.
virtual Int_t Write (const char *name=0, Int_t option=0, Int_t bufsize=0) const
 Write the wrapped object in the correct output directory (const version)
virtual Int_t Write (const char *name=0, Int_t option=0, Int_t bufsize=0)
 Write the wrapped object in the correct output directory (non-const version)

Detailed Description

Special object type for the outputs produced by a cycle.

In order to specify an output directory for the objects produced in a cycle, the objects can't be put directly into the output list of TSelector. Instead I wrap them into such an object.

The trickiest part of this class is the Merge function that takes care of summing up the results obtained from the individual worder nodes.

Version:
Revision:
191

Definition at line 43 of file SCycleOutput.h.


Constructor & Destructor Documentation

SCycleOutput::SCycleOutput ( TObject *  object = 0,
const char *  name = "",
const char *  path = "" 
)

Constructor with child object and name.

The constructor just initialises the base class and the member(s) to meaningul defauls.

Parameters:
objectPointer to the object that should be wrapped
nameName of this object. The SCycleBase* classes should make sure that this is unique

Definition at line 45 of file SCycleOutput.cxx.

SCycleOutput::~SCycleOutput ( ) [virtual]

Destructor.

Since this wrapper class owns the object it wraps, it deletes it when it is deleted itself.

Definition at line 56 of file SCycleOutput.cxx.


Member Function Documentation

TObject * SCycleOutput::GetObject ( ) const

Get the wrapped object.

Returns:
A pointer to the wrapped object

Definition at line 64 of file SCycleOutput.cxx.

Referenced by SCycleBaseHist::Book(), Merge(), and SCycleBaseHist::Retrieve().

const TString & SCycleOutput::GetPath ( ) const

Get the output path of the wrapped object.

Definition at line 78 of file SCycleOutput.cxx.

Int_t SCycleOutput::Merge ( TCollection *  coll)

Merge the contents of other objects into this one.

Now this is a tricky one. In order to be able to merge trees, histograms, and any other kinds of ROOT objects, this function has to be very generic. (Remember, TObject doesn't define a "Merge" function!) Much of the code here is inspired by ROOT code. (I mean I never would've figured out the usage of TMethodCall without seeing some examples...)

Parameters:
collCollection of objects to merge into this one. Usually PROOF takes care of creating it.

Definition at line 99 of file SCycleOutput.cxx.

References DEBUG, SLogger::endmsg(), GetObject(), REPORT_ERROR, and WARNING.

void SCycleOutput::SetObject ( TObject *  object)

Set the pointer to the wrapped object.

Parameters:
objectPointer to the wrapped object

Definition at line 72 of file SCycleOutput.cxx.

void SCycleOutput::SetPath ( const TString &  path)

Set the output path of the wrapped object.

Definition at line 83 of file SCycleOutput.cxx.

Int_t SCycleOutput::Write ( const char *  name = 0,
Int_t  option = 0,
Int_t  bufsize = 0 
) [virtual]

Write the wrapped object in the correct output directory (non-const version)

Definition at line 279 of file SCycleOutput.cxx.

References Write().

Int_t SCycleOutput::Write ( const char *  name = 0,
Int_t  option = 0,
Int_t  bufsize = 0 
) const [virtual]

Write the wrapped object in the correct output directory (const version)

This function is also quite tricky. It basically does two things:

  • If the output file already contains an object with the same name as the object that we want to save, then instead of overwriting it, it merges the new object into the old one.
  • If there is no pre-existing object in the file, then it just "simply" creates the specified output directory in the file, and saves the object in it.

Definition at line 188 of file SCycleOutput.cxx.

References DEBUG, SLogger::endmsg(), REPORT_ERROR, and REPORT_VERBOSE.

Referenced by Write().


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