#include <GaudiAlg/Tuple.h>
Collaboration diagram for Tuples::Tuple:
Public Member Functions | |
Tuple (TupleObj *tuple) | |
standard constructor | |
Tuple (const Tuple &tuple) | |
copy constructor | |
virtual | ~Tuple () |
destructor | |
Tuple & | operator= (const Tuple &tuple) |
assignment operator Tuples could be assigned in a safe way | |
TupleObj * | operator-> () const |
get the pointer to the underlying object | |
bool | valid () const |
check the validity of the tuple object | |
Protected Member Functions | |
TupleObj * | tuple () const |
Return the underlying tuple object. | |
Private Member Functions | |
Tuple () | |
default constructor is private | |
Private Attributes | |
TupleObj * | m_tuple |
The tuple object. |
The main advantages of local ntuples with respect to 'standard' Gaudi NTuples ( NTuple::Tuple ) is their "locality". For 'standard' ntuples one need
NTuple::Tuple
object using INTupleSvc
initialize()
method of the algorithm and the fourth step is done somewhere in execute()
method of the same algorithm. Such approach requires to keep track of the tuple structure through different method and event throught different files. And even minor modification of the structure of teh ntuple will reqire the modification of at least 2 methods and 2 files.
The Tuples::Tuple
wrapper over standard Gaudi NTuple::Tuple
class solves all abouve listed problems with "non-local" nature of Gaudi NTuple::Tuple
objects.
Tuples::Tuple
object is booked and used 'locally'. One does not need to pre-book the ntuple or its columns/items somewhere in different compilation units or other methods different from the actual point of using the ntuple.
The simplest example of usage Tuple object:
Tuple tuple = nTuple( "some more or less uniqe tuple title "); for( Loop D0 = loop( "K- pi+", "D0" ) , D0 , ++D0 ) { tuple -> column ( "mass" , M ( D0 ) / GeV ) ; tuple -> column ( "pt" , PT ( D0 ) / GeV ) ; tuple -> column ( "p" , P ( D0 ) / GeV ) ; tuple -> write () ; }
One could fill some Tuple variables in one go
Tuple tuple = nTuple( "some more or less uniqe tuple title "); for( Loop D0 = loop( "K- pi+", "D0" ) , D0 , ++D0 ) { tuple -> column ( "mass" , M ( D0 ) / GeV ) ; tuple -> fill ( "pt , p " , PT ( D0 ) / GeV , P(D0) / GeV ) ; tuple -> write () ; }
Even ALL variables could be filled in one go:
Tuple tuple = nTuple( "some more or less uniqe tuple title "); for( Loop D0 = loop( "K- pi+", "D0" ) , D0 , ++D0 ) { tuple -> fill ( "mass pt , p ", M(D0)/GeV,PT(D0)/GeV,P(D0)/GeV ) ; tuple -> write () ; }
All these techniques could be easily combined in arbitrary ways
Definition at line 116 of file Tuple.h.
Tuples::Tuple::Tuple | ( | TupleObj * | tuple | ) |
Tuples::Tuple::Tuple | ( | const Tuple & | tuple | ) |
Tuples::Tuple::~Tuple | ( | ) | [virtual] |
Tuples::Tuple::Tuple | ( | ) | [private] |
default constructor is private
Tuples::Tuple & Tuples::Tuple::operator= | ( | const Tuple & | tuple | ) |
assignment operator Tuples could be assigned in a safe way
tuple | tuple to be assigned |
Definition at line 48 of file Tuple.cpp.
00049 { 00050 // self assigenment 00051 if( &tuple == this ) { return *this; } 00052 // temporary variable 00053 Tuples::TupleObj* tmp = tuple.m_tuple ; 00054 // increse reference count 00055 if( 0 != tmp ) { tmp -> addRef () ; } 00056 // decrease reference count 00057 if( 0 != m_tuple ) { m_tuple -> release () ; } 00058 // assigne 00059 m_tuple = tmp ; 00060 // 00061 return *this ; 00062 };
TupleObj* Tuples::Tuple::operator-> | ( | ) | const [inline] |
bool Tuples::Tuple::valid | ( | ) | const [inline] |
TupleObj* Tuples::Tuple::tuple | ( | ) | const [inline, protected] |
TupleObj* Tuples::Tuple::m_tuple [private] |