| # Gaudi Framework, version v21r7 |

Home |  | Generated: 22 Jan 2010

# GaudiTuples< PBASE > Class Template Reference

Templated base class providing common 'ntupling' methods. More...

`#include <GaudiAlg/GaudiTuples.h>`

Collaboration diagram for GaudiTuples< PBASE >:

[legend]

List of all members.

## Public Types
typedef GaudiAlg::HistoID | HistoID
| the actual type for histogram identifier
typedef Tuples::Tuple | Tuple
| the actual type of the tuple
typedef GaudiAlg::TupleID | TupleID
| the actual type of N-tuple ID
typedef GaudiAlg::TupleMapTitle | TupleMapTitle
| the actual type of (title) -> (tuple) mappping
typedef GaudiAlg::TupleMapID | TupleMapID
| the actual type of (Numeric ID) -> (tuple) mappping
## Public Member Functions
Tuple | nTuple (const std::string &title, const CLID &clid=CLID_ColumnWiseTuple) const
| Access an N-Tuple object (book on-demand) with unique identifier.
Tuple | nTuple (const TupleID &ID, const std::string &title, const CLID &clid=CLID_ColumnWiseTuple) const
| Access an N-Tuple object (book on-demand) with forced identifier.
Tuple | evtCol (const std::string &title, const CLID &clid=CLID_ColumnWiseTuple) const
| Access an Event Tag Collection object (book on-demand) with unique identifier.
Tuple | evtCol (const TupleID &ID, const std::string &title, const CLID &clid=CLID_ColumnWiseTuple) const
| Access an Event Tag Collection object (book on-demand) with forced identifier.
bool | produceNTuples () const
| get the flag for N-Tuple production (property "NTupleProduce")
bool | splitNTupleDir () const
| get the flag for N-Tuple path split (property "NTupleSplitDir")
const std::string & | nTupleLUN () const
| get the logical unit for N-Tuples (property "NTupleLUN")
const std::string & | nTupleTopDir () const
| get the top-level N-Tuple directory (property "NTupleTopDir")
const std::string & | nTupleDir () const
| get the N-Tuple directory (property "NTupleDir")
TupleID::NumericID | nTupleOffSet () const
| get the value for N-Tuple offset (property "NTupleOffSet")
std::string | nTuplePath () const
| get the constructed N-Tuple path
bool | produceEvtCols () const
| get the flag for Event Tag Collection production (property "EvtColsProduce")
bool | splitEvtColDir () const
| get the flag for Event Tag Collection path split (property "EvtColsSplitDir")
const std::string & | evtColLUN () const
| get the logical unit for Event Tag Collections (property "EvtColsLUN")
const std::string & | evtColTopDir () const
| get the top-level Event Tag Collection directory (property "EvtColsTopDir")
const std::string & | evtColDir () const
| get the Event Tag Collection directory (property "EvtColsDir")
TupleID::NumericID | evtColOffSet () const
| get the value for Event Tag Collection offset (property "EvtColsOffSet")
std::string | evtColPath () const
| get the constructed Event Tag Collection path
bool | tuplesPrint () const
| print tuples at finalization
bool | evtColsPrint () const
| print event collections at finalization
long | printTuples () const
| perform the actual printout of N-tuples
long | printEvtCols () const
| perform the actual printout of Event Tag Collections
bool | nTupleExists (const TupleID &ID) const
| check the existence AND validity of the N-Tuple with the given ID
bool | evtColExists (const TupleID &ID) const
| check the existence AND validity of the Event Tag Collection with the given ID
| GaudiTuples (const std::string &name, ISvcLocator *pSvcLocator)
| Algorithm constructor.
| GaudiTuples (const std::string &type, const std::string &name, const IInterface *parent)
| Tool constructor.
virtual | ~GaudiTuples ()
| Destructor.
## Protected Member Functions
const TupleMapTitle & | nTupleMapTitle () const
| access to the all ntuples by title
const TupleMapTitle & | evtColMapTitle () const
| access to the all evet tag collections by title
const TupleMapID & | nTupleMapID () const
| access to the all ntuples by numeric ID
const TupleMapID & | evtColMapID () const
| access to the all evet tag collections by numeric ID
virtual Tuples::TupleObj * | createNTuple (const std::string &name, NTuple::Tuple *tuple, const CLID &clid) const
| create TupleObj
virtual Tuples::TupleObj * | createEvtCol (const std::string &name, NTuple::Tuple *tuple, const CLID &clid) const
| create TupleObj for event tag collection
virtual StatusCode | initialize ()
| standard initialization method
virtual StatusCode | finalize ()
| standard finalization method
## Private Member Functions
void | initGaudiTuplesConstructor ()
| Constructor initialization and job options.
void | printNTupleHandler (Property &)
| handler for "NTuplePrint" property
void | printEvtColHandler (Property &)
| handler for "EvtColsPrint" property
## Private Attributes
bool | m_produceNTuples
| flag to switch ON/OFF the ntuple filling and booking
bool | m_splitNTupleDir
| flag to indicate splitting of tuple directories (useful for HBOOK)
std::string | m_nTupleLUN
| name of logical unit for tuple directory
std::string | m_nTupleTopDir
| top level tuple directory
std::string | m_nTupleDir
| local tuple directory
TupleID::NumericID | m_nTupleOffSet
| the offset for ntuple numerical ID
bool | m_produceEvtCols
| flag to switch ON/OFF the ntuple filling and booking
bool | m_splitEvtColDir
| flag to indicate splitting of tuple directories (useful for HBOOK)
std::string | m_evtColLUN
| name of Logical Unit for tuple directory
std::string | m_evtColTopDir
| top level tuple directory
std::string | m_evtColDir
| local tuple directory
TupleID::NumericID | m_evtColOffSet
| the offset for ntuple numerical ID
bool | m_tuplesPrint
| print tuples at finalization?
bool | m_evtColsPrint
| print event collections at finalization
TupleMapTitle | m_nTupleMapTitle
| the actual storage of ntuples by title
TupleMapID | m_nTupleMapID
| the actual storage of ntuples by ID
TupleMapTitle | m_evtColMapTitle
| the actual storage of event collections by title
TupleMapID | m_evtColMapID
| the actual storage of event collections by ID

## Detailed Description

### template<class PBASE>
class GaudiTuples< PBASE >

Templated base class providing common 'ntupling' methods.

Author:
  Chris Jones Christopher.Rob.Jones@cern.ch

  Vanya BELYAEV Ivan.Belyaev@itep.ru

Date:
  2005-08-08

Definition at line 37 of file GaudiTuples.h.

## Member Typedef Documentation

template<class PBASE>

typedef GaudiAlg::HistoID GaudiTuples< PBASE >::HistoID

the actual type for histogram identifier

Definition at line 42 of file GaudiTuples.h.

template<class PBASE>

typedef Tuples::Tuple GaudiTuples< PBASE >::Tuple

the actual type of the tuple

Reimplemented in TupleTool.

Definition at line 44 of file GaudiTuples.h.

template<class PBASE>

typedef GaudiAlg::TupleID GaudiTuples< PBASE >::TupleID

the actual type of N-tuple ID

Reimplemented in TupleTool.

Definition at line 46 of file GaudiTuples.h.

template<class PBASE>

typedef GaudiAlg::TupleMapTitle GaudiTuples< PBASE >::TupleMapTitle

the actual type of (title) -> (tuple) mappping

Definition at line 48 of file GaudiTuples.h.

template<class PBASE>

typedef GaudiAlg::TupleMapID GaudiTuples< PBASE >::TupleMapID

the actual type of (Numeric ID) -> (tuple) mappping

Definition at line 50 of file GaudiTuples.h.

## Constructor & Destructor Documentation

template<class PBASE>

GaudiTuples< PBASE >::GaudiTuples | ( | const std::string & | name,
|  | ISvcLocator * | pSvcLocator |
| ) |  |  |

Algorithm constructor.

template<class PBASE>

GaudiTuples< PBASE >::GaudiTuples | ( | const std::string & | type,
|  | const std::string & | name,
|  | const IInterface * | parent |
| ) |  |  |

Tool constructor.

template<class PBASE>

GaudiTuples< PBASE >::~GaudiTuples | ( |  | ) | `[inline, virtual]`

Destructor.

Definition at line 38 of file GaudiTuples.icpp.

    00038 {}

## Member Function Documentation

template<class PBASE>

Tuples::Tuple GaudiTuples< PBASE >::nTuple | ( | const std::string & | title,
|  | const CLID & | clid = `CLID_ColumnWiseTuple` |
| ) |  |  | const`[inline]`

Access an N-Tuple object (book on-demand) with unique identifier.

      Tuple tuple = nTuple( "My N-Tuple" ) ;
      tuple->column( "A" , sin(0.1) );
      tuple->column( "B" , cos(0.1) );
      tuple->column( "C" , tan(0.1) );
      tuple->write();

Attention:
  The NTuple will get a unique identifier automatically assigned which by default will be equal to the histogram title. An option exists to instead use numerical IDs. In this case the first NTuple booked will be ID=1 the next ID=2 and so on. Note though this scheme is not recommended as it does NOT guarantee predictability of the ID a given NTuple will be given when filled under conditional statements, since in these circumstances the order in which the NTuple are first filled, and thus booked, will depend on the nature of the first few events read. This is particularly problematic when users submit many parallel 'sub-jobs' and then attempt to merge the final output ROOT (or HBOOK) files, since a given NTuple could have different IDs in each of the sub-jobs. Consequently it is strongly recommended that users do not use numerical automatic IDs unless they are sure they understand what they are doing.

Parameters:

  | title | Unique title for N-Tuple
  | clid | N-Tuple class identifier (row or column wise)

Returns:
  ntuple The ntuple object

Reimplemented in TupleTool.

Definition at line 143 of file GaudiTuples.icpp.

    00145 {
    00146   // look up in the table
    00147   Tuples::TupleObj* tuple = m_nTupleMapTitle[ title ]  ;
    00148   if ( 0 != tuple ) { return Tuple( tuple ) ; }                  // RETURN
    00149   // Create the tuple ID
    00150   TupleID ID;
    00151   if ( this->useNumericAutoIDs() || title.empty() )
    00152   {
    00153     if ( ! this->useNumericAutoIDs() )
    00154     {
    00155       this -> Warning( "Cannot generate automatic literal ID from an empty title ! Using numeric ID instead for nTuple ID",
    00156                        StatusCode::SUCCESS );
    00157     }
    00158     // propose the tuple ID
    00159     ID = TupleID ( m_nTupleMapID.size() + 1 + nTupleOffSet() );
    00160     // adjust the proposed ID
    00161     while ( nTupleExists(ID) || evtColExists(ID) )
    00162     { ID = TupleID ( ID.numeric() + 1 ) ; }
    00163   }
    00164   else
    00165   {
    00166     // use the title to create a unique literal ID
    00167     ID = TupleID( this->convertTitleToID(title) );
    00168     // Just in case ...
    00169     while ( nTupleExists(ID) || evtColExists(ID) )
    00170     { ID = TupleID(ID.idAsString()+"_"); }
    00171   }
    00172   // return
    00173   return nTuple( ID , title , clid ) ;
    00174 }

template<class PBASE>

Tuples::Tuple GaudiTuples< PBASE >::nTuple | ( | const TupleID & | ID,
|  | const std::string & | title,
|  | const CLID & | clid = `CLID_ColumnWiseTuple` |
| ) |  |  | const`[inline]`

Access an N-Tuple object (book on-demand) with forced identifier.

      // Book Ntuple with a numeric ID
      Tuple tuple = nTuple(  1,  "My tuple" ) ;
      // ... or
      Tuple tuple = nTuple( "1", "My tuple" ) ;

      // ... or, Book Ntuple with a literal ID
      Tuple tuple = nTuple( "mytuple", "My tuple" ) ;

      // ... or, Book Ntuple with a literal ID in a sub-dir
      Tuple tuple = nTuple( "subdir/mytuple", "My tuple" ) ;

      // Fill and write NTuple
      tuple->column( "A" , sin(0.1) );
      tuple->column( "B" , cos(0.1) );
      tuple->column( "C" , tan(0.1) );
      tuple->write();

Attention:
  If the N-Tuple with given ID is already booked through automatic assignment of N-Tuple ID, the error will not be detected. Therefore it is recommended to use a non-trivial N-Tuple ID offset (property "NTupleOffSet") if one need to combine these techniques together It is still desirable to use the unique N-Tuple title to avoid a bad interference.

Parameters:

  | ID | The forced N-Tuple ID
  | title | Unique title for N-Tuple
  | clid | N-Tuple class identifier (row or column wise)

Returns:
  ntuple The ntuple object

Reimplemented in TupleTool.

Definition at line 221 of file GaudiTuples.icpp.

    00224 {
    00225   // Check ID
    00226   if ( ID.undefined() )
    00227   { this->Error("Undefined NTuple ID : Title='"+title1+"'"); return Tuple(0); }
    00228
    00229   // look up in the table
    00230   Tuples::TupleObj * tuple = m_nTupleMapID[ ID ] ;
    00231   if( 0 != tuple ) { return Tuple( tuple ) ; }                   // RETURN
    00232
    00233   // convert ID to the string
    00234   const std::string tID = ID.idAsString() ;
    00235
    00236   // adjust the NTuple title
    00237   const std::string title = title1.empty() ? ( "NTuple #" + tID ) : title1 ;
    00238
    00239   // book new ntuple
    00240   if( produceNTuples() )
    00241   {
    00242     // book NTupel
    00243     NTuple::Tuple * tup = 0;
    00244     if ( ID.numeric() )
    00245     {
    00246       tup = this->ntupleSvc() -> book ( nTuplePath() , ID.numericID() , clid , title );
    00247     }
    00248     else if ( ID.literal() )
    00249     {
    00250       tup = this->ntupleSvc() -> book ( nTuplePath() , ID.literalID() , clid , title );
    00251     }
    00252     else { this->Error( "Undefined NTuple ID" ); }
    00253
    00254     // assertion
    00255     this->Assert( 0 != tup , "Could not book the N-Tuple='" + title + "'" ) ;
    00256     // some printout
    00257     if( 0 != tup -> registry() && this->msgLevel(MSG::DEBUG) )
    00258     { this->debug() << "Booked NTuple '" << title << "' ID=" << tID
    00259                     << "' Path='"  << nTuplePath() << "' TS='"
    00260                     << tup -> registry() -> identifier() << "'" << endmsg; }
    00261
    00262     tuple = createNTuple ( title , tup                , clid ) ;
    00263   }
    00264   else
    00265   {
    00266     tuple = createNTuple ( title , (NTuple::Tuple*) 0 , clid ) ;
    00267   }
    00268   // increment the reference
    00269   tuple -> addRef();
    00270   //
    00271   m_nTupleMapID [ ID ] = tuple ;
    00272   //
    00273   tuple -> addRef();
    00274   m_nTupleMapTitle[ title ] = tuple ;
    00275   // return
    00276   return Tuple( tuple ) ;
    00277 }

template<class PBASE>

Tuples::Tuple GaudiTuples< PBASE >::evtCol | ( | const std::string & | title,
|  | const CLID & | clid = `CLID_ColumnWiseTuple` |
| ) |  |  | const`[inline]`

Access an Event Tag Collection object (book on-demand) with unique identifier.

      Tuple tuple = evtCol( "My Tag Collection" ) ;
      tuple->column( "A" , sin(0.1) );
      tuple->column( "B" , cos(0.1) );
      tuple->column( "C" , tan(0.1) );
      tuple->write();

The Event Tag Collection will get a unique identifier automatically assigned which by default will be equal to the histogram title. An option exists to instead use numerical IDs. In this case the first Event Tag Collection booked will be ID=1 the next ID=2 and so on. Note though this scheme is not recommended as it does NOT guarantee predictability of the ID a given Event Tag Collection will be given when filled under conditional statements, since in these circumstances the order in which the Event Tag Collection are first filled, and thus booked, will depend on the nature of the first few events read. This is particularly problematic when users submit many parallel 'sub-jobs' and then attempt to merge the final output ROOT (or HBOOK) files, since a given Event Tag Collection could have different IDs in each of the sub-jobs. Consequently it is strongly recommended that users do not use numerical automatic IDs unless they are sure they understand what they are doing.

Parameters:

  | title | Unique title for Event Tag Collection
  | clid | N-Tuple class identifier (row or column wise)

Returns:
  ntuple The Event Tag Collection object

Reimplemented in TupleTool.

Definition at line 182 of file GaudiTuples.icpp.

    00184 {
    00185   // look up in the table
    00186   Tuples::TupleObj* tuple = m_evtColMapTitle[ title ]  ;
    00187   if ( 0 != tuple ) { return Tuple( tuple ) ; }                   // RETURN
    00188   // Create the tuple ID
    00189   TupleID ID;
    00190   if ( this->useNumericAutoIDs() || title.empty() )
    00191   {
    00192     if ( ! this->useNumericAutoIDs() )
    00193     {
    00194       this -> Warning( "Cannot generate automatic literal ID from an empty title ! Using numeric ID instead for evtCol ID",
    00195                        StatusCode::SUCCESS );
    00196     }
    00197     // proposed the tuple ID
    00198     ID = TupleID ( m_evtColMapID.size() + 1 + evtColOffSet() ) ;
    00199     // adjust the proposed ID
    00200     while ( nTupleExists(ID) || evtColExists(ID) )
    00201     { ID = TupleID ( ID.numeric() + 1 ) ; }
    00202   }
    00203   else
    00204   {
    00205     // use the title to create a unique literal ID
    00206     ID = TupleID( this->convertTitleToID(title) );
    00207     // Just in case ...
    00208     while ( nTupleExists(ID) || evtColExists(ID) )
    00209     { ID = TupleID ( ID.idAsString()+"_" ) ; }
    00210   }
    00211   // return
    00212   return evtCol( ID , title , clid ) ;
    00213 }

template<class PBASE>

Tuples::Tuple GaudiTuples< PBASE >::evtCol | ( | const TupleID & | ID,
|  | const std::string & | title,
|  | const CLID & | clid = `CLID_ColumnWiseTuple` |
| ) |  |  | const`[inline]`

Access an Event Tag Collection object (book on-demand) with forced identifier.

      // Book Ntuple with a numeric ID
      Tuple tuple = evtCol(  1,  "My Tag Collection" ) ;
      // ... or
      Tuple tuple = evtCol( "1", "My Tag Collection" ) ;

      // ... or, Book Ntuple with a literal ID
      Tuple tuple = evtCol( "mytuple", "My Tag Collection" ) ;

      // ... or, Book Ntuple with a literal ID in a sub-dir
      Tuple tuple = evtCol( "subdir/mytuple", "My Tag Collection" ) ;

      // Fill and write
      tuple->column( "A" , sin(0.1) );
      tuple->column( "B" , cos(0.1) );
      tuple->column( "C" , tan(0.1) );
      tuple->write();

Attention:
  If the Event Tag Collection with given ID is already booked through automatic assignment of Event Tag Collection ID, the error will not be detected. Therefore it is recommended to use a non-trivial Event Tag Collection ID offset (property "EvtColOffSet") if one need to combine these techniques together It is still desirable to use the unique Event Tag Collection title to avoid a bad interference.

Parameters:

  | ID | The forced Event Tag Collection ID
  | title | Unique title for Event Tag Collection
  | clid | N-Tuple class identifier (row or column wise)

Returns:
  ntuple The Event Tag Collection object

Reimplemented in TupleTool.

Definition at line 281 of file GaudiTuples.icpp.

    00284 {
    00285   // Check ID
    00286   if ( ID.undefined() )
    00287   { this->Error("Undefined NTuple ID : Title='"+title1+"'"); return Tuple(0); }
    00288
    00289   // look up in the table
    00290   Tuples::TupleObj* tuple = m_evtColMapID[ID] ;
    00291   if ( 0 != tuple ) { return Tuple( tuple ) ; }                   // RETURN
    00292
    00293   // convert ID to the string
    00294   const std::string tID = ID.idAsString() ;
    00295
    00296   // adjust the NTuple title
    00297   const std::string title = title1.empty() ? ( "EvtCol #" + tID ) : title1 ;
    00298
    00299   // book new ntuple
    00300   if( produceEvtCols() )
    00301   {
    00302     // book NTuple
    00303     NTuple::Tuple* tup = 0;
    00304     if (  ID.numeric() )
    00305     {
    00306       tup = this->evtColSvc()->book ( evtColPath() , ID.numericID() , clid , title ) ;
    00307     }
    00308     else if ( ID.literal() )
    00309     {
    00310       tup = this->evtColSvc()->book ( evtColPath() , ID.literalID() , clid , title ) ;
    00311     }
    00312     else { this->Error( "Undefined NTuple ID" ); }
    00313
    00314     // assertion
    00315     this->Assert( 0 != tup , "Could not book the EvtCol='" + title + "'" ) ;
    00316     // some printout
    00317     if( 0 != tup -> registry() && this->msgLevel(MSG::DEBUG) )
    00318     { this->debug() << "Booked EvtCol '" << title << "' ID=" << tID
    00319                     << "' Path='" << evtColPath() << "' TS='"
    00320                     << tup -> registry() -> identifier() << "'" << endmsg ; }
    00321
    00322     tuple = createEvtCol ( title , tup                , clid ) ;
    00323   }
    00324   else
    00325   {
    00326     tuple = createEvtCol ( title , (NTuple::Tuple*) 0 , clid ) ;
    00327   }
    00328   // increment the reference
    00329   tuple -> addRef();
    00330   //
    00331   m_evtColMapID [ ID ] = tuple ;
    00332   //
    00333   tuple -> addRef();
    00334   m_evtColMapTitle[ title ] = tuple ;
    00335   // return
    00336   return Tuple( tuple ) ;
    00337 }

template<class PBASE>

bool GaudiTuples< PBASE >::produceNTuples | ( |  | ) | const`[inline]`

get the flag for N-Tuple production (property "NTupleProduce")

Definition at line 208 of file GaudiTuples.h.

    00208 { return m_produceNTuples ; }

template<class PBASE>

bool GaudiTuples< PBASE >::splitNTupleDir | ( |  | ) | const`[inline]`

get the flag for N-Tuple path split (property "NTupleSplitDir")

Definition at line 210 of file GaudiTuples.h.

    00210 { return m_splitNTupleDir ; }

template<class PBASE>

const std::string& GaudiTuples< PBASE >::nTupleLUN | ( |  | ) | const`[inline]`

get the logical unit for N-Tuples (property "NTupleLUN")

Definition at line 212 of file GaudiTuples.h.

    00212 { return m_nTupleLUN      ; }

template<class PBASE>

const std::string& GaudiTuples< PBASE >::nTupleTopDir | ( |  | ) | const`[inline]`

get the top-level N-Tuple directory (property "NTupleTopDir")

Definition at line 214 of file GaudiTuples.h.

    00214 { return m_nTupleTopDir   ; }

template<class PBASE>

const std::string& GaudiTuples< PBASE >::nTupleDir | ( |  | ) | const`[inline]`

get the N-Tuple directory (property "NTupleDir")

Definition at line 216 of file GaudiTuples.h.

    00216 { return m_nTupleDir      ; }

template<class PBASE>

TupleID::NumericID GaudiTuples< PBASE >::nTupleOffSet | ( |  | ) | const`[inline]`

get the value for N-Tuple offset (property "NTupleOffSet")

Definition at line 218 of file GaudiTuples.h.

    00218 { return m_nTupleOffSet   ; }

template<class PBASE>

std::string GaudiTuples< PBASE >::nTuplePath | ( |  | ) | const`[inline]`

get the constructed N-Tuple path

Definition at line 220 of file GaudiTuples.h.

    00221   {
    00222     const std::string path = nTupleLUN() + "/" + nTupleTopDir() + nTupleDir();
    00223     return ( splitNTupleDir() ? dirHbookName( path ) : path ) ;
    00224   }

template<class PBASE>

bool GaudiTuples< PBASE >::produceEvtCols | ( |  | ) | const`[inline]`

get the flag for Event Tag Collection production (property "EvtColsProduce")

Definition at line 226 of file GaudiTuples.h.

    00226 { return m_produceEvtCols ; }

template<class PBASE>

bool GaudiTuples< PBASE >::splitEvtColDir | ( |  | ) | const`[inline]`

get the flag for Event Tag Collection path split (property "EvtColsSplitDir")

Definition at line 228 of file GaudiTuples.h.

    00228 { return m_splitEvtColDir ; }

template<class PBASE>

const std::string& GaudiTuples< PBASE >::evtColLUN | ( |  | ) | const`[inline]`

get the logical unit for Event Tag Collections (property "EvtColsLUN")

Definition at line 230 of file GaudiTuples.h.

    00230 { return m_evtColLUN      ; }

template<class PBASE>

const std::string& GaudiTuples< PBASE >::evtColTopDir | ( |  | ) | const`[inline]`

get the top-level Event Tag Collection directory (property "EvtColsTopDir")

Definition at line 232 of file GaudiTuples.h.

    00232 { return m_evtColTopDir   ; }

template<class PBASE>

const std::string& GaudiTuples< PBASE >::evtColDir | ( |  | ) | const`[inline]`

get the Event Tag Collection directory (property "EvtColsDir")

Definition at line 234 of file GaudiTuples.h.

    00234 { return m_evtColDir      ; }

template<class PBASE>

TupleID::NumericID GaudiTuples< PBASE >::evtColOffSet | ( |  | ) | const`[inline]`

get the value for Event Tag Collection offset (property "EvtColsOffSet")

Definition at line 236 of file GaudiTuples.h.

    00236 { return m_evtColOffSet   ; }

template<class PBASE>

std::string GaudiTuples< PBASE >::evtColPath | ( |  | ) | const`[inline]`

get the constructed Event Tag Collection path

Definition at line 238 of file GaudiTuples.h.

    00239   {
    00240     std::string path = evtColLUN() + "/" + evtColTopDir() + evtColDir();
    00241     return ( splitEvtColDir() ? dirHbookName( path ) : path );
    00242   }

template<class PBASE>

bool GaudiTuples< PBASE >::tuplesPrint | ( |  | ) | const`[inline]`

print tuples at finalization

Definition at line 244 of file GaudiTuples.h.

    00244 { return m_tuplesPrint  ; }

template<class PBASE>

bool GaudiTuples< PBASE >::evtColsPrint | ( |  | ) | const`[inline]`

print event collections at finalization

Definition at line 246 of file GaudiTuples.h.

    00246 { return m_evtColsPrint ; }

template<class PBASE>

long GaudiTuples< PBASE >::printTuples | ( |  | ) | const`[inline]`

perform the actual printout of N-tuples

Returns:
  number of active N-Tuples

Definition at line 368 of file GaudiTuples.icpp.

    00369 {
    00370
    00371   if ( nTupleMapTitle().empty() && nTupleMapID().empty() )
    00372   { if (this->msgLevel(MSG::DEBUG)) this->debug() << "No N-Tuples   are booked" << endmsg ; }
    00373   else
    00374   { this->always() << "List of booked N-Tuples in directory "
    00375                    << "\"" << nTuplePath() << "\"" << endmsg ; }
    00376
    00377   // helper container to sort it:
    00378   typedef std::map<TupleID,const Tuples::TupleObj*> OrderedMapType;
    00379   OrderedMapType OrderedMap ( nTupleMapID().begin() , nTupleMapID().end() ) ;
    00380   //
    00381   for ( OrderedMapType::const_iterator entry = OrderedMap.begin() ;
    00382         OrderedMap.end() != entry ; ++entry )
    00383   {
    00384     if ( 0 == entry->second ) { continue ; }
    00385     const NTuple::Tuple* tuple = entry->second->tuple() ;
    00386     if ( 0 == tuple )
    00387     { this->error() << " NTuple::Tuple* points to NULL" << endmsg ; continue ; }
    00388     this->always() << GaudiAlg::PrintTuple::print ( tuple , entry->first ) << endmsg ;
    00389   }
    00390   //
    00391   return this->nTupleMapID().size() ;
    00392 }

template<class PBASE>

long GaudiTuples< PBASE >::printEvtCols | ( |  | ) | const`[inline]`

perform the actual printout of Event Tag Collections

Returns:
  number of active Event Tag Collections

Definition at line 397 of file GaudiTuples.icpp.

    00398 {
    00399   if ( evtColMapTitle().empty() && evtColMapID().empty() )
    00400   { this->always() << "No Event Tag Collections are booked" << endmsg ; }
    00401   else
    00402   { this->always() << "List of booked Event Tag Collections in directory "
    00403                    << "\"" << evtColPath() << "\"" << endmsg ; }
    00404
    00405   // helper container to sort it:
    00406   typedef std::map<TupleID,const Tuples::TupleObj*> OrderedMapType;
    00407   OrderedMapType OrderedMap ( evtColMapID().begin() , evtColMapID().end() ) ;
    00408   //
    00409   for ( OrderedMapType::const_iterator entry = OrderedMap.begin() ;
    00410         OrderedMap.end() != entry ; ++entry )
    00411   {
    00412     if ( 0 == entry->second ) { continue ; }
    00413     const NTuple::Tuple* tuple = entry->second->tuple() ;
    00414     if ( 0 == tuple )
    00415     { this->error() << " NTuple::Tuple* points to NULL" << endmsg ; continue ; }
    00416     this->always() << GaudiAlg::PrintTuple::print ( tuple , entry->first )
    00417                    << " Items:"
    00418                    << Gaudi::Utils::toString ( entry->second->items() ) << endmsg ;
    00419   }
    00420   //
    00421   return this->evtColMapID().size() ;
    00422 }

template<class PBASE>

bool GaudiTuples< PBASE >::nTupleExists | ( | const TupleID & | ID | ) | const`[inline]`

check the existence AND validity of the N-Tuple with the given ID

Definition at line 427 of file GaudiTuples.icpp.

    00428 { return m_nTupleMapID.end() != m_nTupleMapID.find ( ID ) ; }

template<class PBASE>

bool GaudiTuples< PBASE >::evtColExists | ( | const TupleID & | ID | ) | const`[inline]`

check the existence AND validity of the Event Tag Collection with the given ID

Definition at line 433 of file GaudiTuples.icpp.

    00434 { return m_evtColMapID.end() != m_evtColMapID.find ( ID ) ; }

template<class PBASE>

const TupleMapTitle& GaudiTuples< PBASE >::nTupleMapTitle | ( |  | ) | const`[inline, protected]`

access to the all ntuples by title

Definition at line 269 of file GaudiTuples.h.

    00269 { return m_nTupleMapTitle ; }

template<class PBASE>

const TupleMapTitle& GaudiTuples< PBASE >::evtColMapTitle | ( |  | ) | const`[inline, protected]`

access to the all evet tag collections by title

Definition at line 271 of file GaudiTuples.h.

    00271 { return m_evtColMapTitle ; }

template<class PBASE>

const TupleMapID& GaudiTuples< PBASE >::nTupleMapID | ( |  | ) | const`[inline, protected]`

access to the all ntuples by numeric ID

Definition at line 273 of file GaudiTuples.h.

    00273 { return m_nTupleMapID    ; }

template<class PBASE>

const TupleMapID& GaudiTuples< PBASE >::evtColMapID | ( |  | ) | const`[inline, protected]`

access to the all evet tag collections by numeric ID

Definition at line 275 of file GaudiTuples.h.

    00275 { return m_evtColMapID    ; }

template<class PBASE>

Tuples::TupleObj * GaudiTuples< PBASE >::createNTuple | ( | const std::string & | name,
|  | NTuple::Tuple * | tuple,
|  | const CLID & | clid |
| ) |  |  | const`[inline, protected, virtual]`

create TupleObj

Attention:
  The method should never used directly by users

Parameters:

  | name | name/title
  | tuple | the underlying ntuple implementation
  | clid | unique classID for ntuple

Returns:
  pointer to newly created TupleObj

Definition at line 343 of file GaudiTuples.icpp.

    00346 {
    00347   return Tuples::createTupleObj
    00348     ( this , "Tuple '" + name  + "'" , tuple , clid , Tuples::NTUPLE ) ;
    00349 }

template<class PBASE>

Tuples::TupleObj * GaudiTuples< PBASE >::createEvtCol | ( | const std::string & | name,
|  | NTuple::Tuple * | tuple,
|  | const CLID & | clid |
| ) |  |  | const`[inline, protected, virtual]`

create TupleObj for event tag collection

Attention:
  The method should never used directly by users

Parameters:

  | name | name/title
  | tuple | the underlying ntuple implementation
  | clid | unique classID for ntuple

Returns:
  pointer to newly created TupelObj

Definition at line 357 of file GaudiTuples.icpp.

    00360 {
    00361   return Tuples::createTupleObj
    00362     ( this , "EvtCol '" + name  + "'" , tuple , clid , Tuples::EVTCOL ) ;
    00363 }

template<class PBASE>

StatusCode GaudiTuples< PBASE >::initialize | ( |  | ) | `[inline, protected, virtual]`

standard initialization method

Returns:
  status code

Reimplemented in GaudiTupleAlg, and GaudiTupleTool.

Definition at line 49 of file GaudiTuples.icpp.

    00050 {
    00051   // initialize base class
    00052   const StatusCode sc = PBASE::initialize();
    00053   if ( sc.isFailure() ) return sc;
    00054
    00055   if ( produceNTuples() )
    00056   {
    00057     // check the existance of service
    00058     if ( this->ntupleSvc() == 0 )
    00059     { return  this->Error( "INTupleSvc* points to NULL!" ); }
    00060     // Print ntuple path
    00061     this->Print( "The N-Tuple   path is set to be '" + nTuplePath() + "'",
    00062                  StatusCode(StatusCode::SUCCESS, true) , MSG::DEBUG);
    00063   }
    00064   else
    00065   { this->debug() << "Production of N-Tuples is switched OFF" << endmsg; }
    00066
    00067   if ( produceEvtCols() )
    00068   {
    00069     // check the existance of service
    00070     if ( 0 == this->evtColSvc() )
    00071     { return  this->Error( "INTupleSvc* points to NULL!" ); }
    00072     // Print EvtCol path
    00073     this->Print( "The EventCol  path is set to be '" + evtColPath() + "'",
    00074                  StatusCode(StatusCode::SUCCESS, true) , MSG::DEBUG );
    00075   }
    00076   else
    00077   { this->debug() << "Production of Event Collections is switched OFF" << endmsg; }
    00078
    00079   return sc;
    00080 }

template<class PBASE>

StatusCode GaudiTuples< PBASE >::finalize | ( | void |  | ) | `[inline, protected, virtual]`

standard finalization method

Returns:
  status code

Reimplemented in GaudiTupleAlg, and GaudiTupleTool.

Definition at line 92 of file GaudiTuples.icpp.

    00093 {
    00094   if ( !( nTupleMapTitle () . empty () &&
    00095           nTupleMapID    () . empty () &&
    00096           evtColMapTitle () . empty () &&
    00097           evtColMapID    () . empty ()
    00098           ) )
    00099   {
    00100     const int nNtuples = nTupleMapID () . size () ;
    00101     const int nEvtCols = evtColMapID () . size ();
    00102     this->always()
    00103       << "Booked " << nNtuples << " N-Tuples and " << nEvtCols
    00104       << " Event Tag Collections" << endmsg ;
    00105   }
    00106
    00107   if ( produceNTuples () && tuplesPrint  () ) { printTuples  () ; }
    00108   if ( produceEvtCols () && evtColsPrint () ) { printEvtCols () ; }
    00109
    00110   { // release ntuples and clear the container
    00111     for( TupleMapTitle::iterator itup = m_nTupleMapTitle.begin() ;
    00112          m_nTupleMapTitle.end() != itup ; ++itup )
    00113     { if( 0 != itup->second ) { itup->second->release() ; } }
    00114     m_nTupleMapTitle.clear() ;
    00115   }
    00116   { // release ntuples and clear the container
    00117     for( TupleMapID::iterator itup = m_nTupleMapID.begin() ;
    00118          m_nTupleMapID.end() != itup ; ++itup )
    00119     { if( 0 != itup->second ) { itup->second->release() ; } }
    00120     m_nTupleMapID.clear();
    00121   }
    00122   { // release ntuples and clear the container
    00123     for( TupleMapTitle::iterator itup = m_evtColMapTitle.begin() ;
    00124          m_evtColMapTitle.end() != itup ; ++itup )
    00125     { if( 0 != itup->second ) { itup->second->release() ; } }
    00126     m_evtColMapTitle.clear();
    00127   }
    00128   { // release ntuples and clear the container
    00129     for( TupleMapID::iterator itup = m_evtColMapID.begin() ;
    00130          m_evtColMapID.end() != itup ; ++itup )
    00131     { if( 0 != itup->second ) { itup->second->release() ; } }
    00132     m_evtColMapID.clear() ;
    00133   }
    00134   // finalize base class
    00135   return PBASE::finalize();
    00136 }

template<class PBASE>

void GaudiTuples< PBASE >::initGaudiTuplesConstructor | ( |  | ) | `[inline, private]`

Constructor initialization and job options.

Definition at line 338 of file GaudiTuples.h.

    00339   {
    00340     m_produceNTuples = true ;     // Switch ON/OFF ntuple production
    00341     m_splitNTupleDir = false ;    // for HBOOK it is better to use 'true'
    00342     m_nTupleLUN      = "FILE1" ;  // logical unit for ntuples
    00343     m_nTupleTopDir   = "" ;       // top level ntuple directory
    00344     m_nTupleDir      = this->name() ;   // ntuple directory
    00345     m_nTupleOffSet   = 0  ;       // offset for ntuples
    00346     //
    00347     m_produceEvtCols = false ;    // Switch ON/OFF ntupel production
    00348     m_splitEvtColDir = false ;    // for HBOOK it is better to use 'true'
    00349     m_evtColLUN      = "EVTCOL" ; // logical unit for ntuples
    00350     m_evtColTopDir   = ""    ;    // top level ntuple directory
    00351     m_evtColDir      = this->name() ;   // ntuple directory
    00352     m_evtColOffSet   = 0   ;      // offset for ntuples
    00353     //
    00354     m_tuplesPrint    = true  ;    // print tuples at end of job
    00355     m_evtColsPrint   = false  ;   // print event collections at end of job
    00356     //
    00357     this -> declareProperty
    00358       ( "NTupleProduce"  , m_produceNTuples         ,
    00359         "General switch to enable/disable N-tuples" ) ;
    00360     this -> declareProperty
    00361       ( "NTuplePrint"    , m_tuplesPrint    ,
    00362         "Print N-tuple statistics"        )
    00363       -> declareUpdateHandler ( &GaudiTuples<PBASE>::printNTupleHandler , this ) ;
    00364     this -> declareProperty
    00365       ( "NTupleSplitDir" , m_splitNTupleDir ,
    00366         "Split long directory names into short pieces (suitable for HBOOK)" ) ;
    00367     this -> declareProperty
    00368       ( "NTupleOffSet"   , m_nTupleOffSet   ,
    00369         "Offset for numerical N-tuple ID" ) ;
    00370     this -> declareProperty
    00371       ( "NTupleLUN"      , m_nTupleLUN      ,
    00372         "Logical File Unit for N-tuples"  ) ;
    00373     this -> declareProperty
    00374       ( "NTupleTopDir"   , m_nTupleTopDir   ,
    00375         "Top-level directory for N-Tuples") ;
    00376     this -> declareProperty
    00377       ( "NTupleDir"      , m_nTupleDir      ,
    00378         "Subdirectory for N-Tuples"       ) ;
    00379     // ========================================================================
    00380     this -> declareProperty
    00381       ( "EvtColsProduce" , m_produceEvtCols ,
    00382         "General switch to enable/disable Event Tag Collections" ) ;
    00383     this -> declareProperty
    00384       ( "EvtColsPrint"   , m_evtColsPrint   ,
    00385         "Print statistics for Event Tag Collections " )
    00386       -> declareUpdateHandler ( &GaudiTuples<PBASE>::printEvtColHandler , this ) ;
    00387     this -> declareProperty
    00388       ( "EvtColSplitDir" , m_splitEvtColDir ,
    00389         "Split long directory names into short pieces" ) ;
    00390     this -> declareProperty
    00391       ( "EvtColOffSet"   , m_evtColOffSet   ,
    00392         "Offset for numerical N-tuple ID" ) ;
    00393     this -> declareProperty
    00394       ( "EvtColLUN"      , m_evtColLUN      ,
    00395         "Logical File Unit for Event Tag Collections"   ) ;
    00396     this -> declareProperty
    00397       ( "EvtColTopDir"   , m_evtColTopDir   ,
    00398         "Top-level directory for Event Tag Collections" ) ;
    00399     this -> declareProperty
    00400       ( "EvtColDir"      , m_evtColDir      ,
    00401         "Subdirectory for Event Tag Collections"        ) ;
    00402     // ========================================================================
    00403   }

template<class PBASE>

void GaudiTuples< PBASE >::printNTupleHandler | ( | Property & |  | ) | `[inline, private]`

handler for "NTuplePrint" property

Definition at line 439 of file GaudiTuples.icpp.

    00440 {
    00441   // no action if not yet initialized
    00442   if ( this -> FSMState() < Gaudi::StateMachine::INITIALIZED ) { return ; }
    00443   if ( this -> tuplesPrint() ) { this -> printTuples () ; }
    00444 }

template<class PBASE>

void GaudiTuples< PBASE >::printEvtColHandler | ( | Property & |  | ) | `[inline, private]`

handler for "EvtColsPrint" property

Definition at line 449 of file GaudiTuples.icpp.

    00450 {
    00451   // no action if not yet initialized
    00452   if ( this -> FSMState() < Gaudi::StateMachine::INITIALIZED ) { return ; }
    00453   if ( this -> evtColsPrint() ) { this -> printEvtCols () ; }
    00454 }

## Member Data Documentation

template<class PBASE>

bool GaudiTuples< PBASE >::m_produceNTuples`[private]`

flag to switch ON/OFF the ntuple filling and booking

Definition at line 415 of file GaudiTuples.h.

template<class PBASE>

bool GaudiTuples< PBASE >::m_splitNTupleDir`[private]`

flag to indicate splitting of tuple directories (useful for HBOOK)

Definition at line 417 of file GaudiTuples.h.

template<class PBASE>

std::string GaudiTuples< PBASE >::m_nTupleLUN`[private]`

name of logical unit for tuple directory

Definition at line 419 of file GaudiTuples.h.

template<class PBASE>

std::string GaudiTuples< PBASE >::m_nTupleTopDir`[private]`

top level tuple directory

Definition at line 421 of file GaudiTuples.h.

template<class PBASE>

std::string GaudiTuples< PBASE >::m_nTupleDir`[private]`

local tuple directory

Definition at line 423 of file GaudiTuples.h.

template<class PBASE>

TupleID::NumericID GaudiTuples< PBASE >::m_nTupleOffSet`[private]`

the offset for ntuple numerical ID

Definition at line 425 of file GaudiTuples.h.

template<class PBASE>

bool GaudiTuples< PBASE >::m_produceEvtCols`[private]`

flag to switch ON/OFF the ntuple filling and booking

Definition at line 428 of file GaudiTuples.h.

template<class PBASE>

bool GaudiTuples< PBASE >::m_splitEvtColDir`[private]`

flag to indicate splitting of tuple directories (useful for HBOOK)

Definition at line 430 of file GaudiTuples.h.

template<class PBASE>

std::string GaudiTuples< PBASE >::m_evtColLUN`[private]`

name of Logical Unit for tuple directory

Definition at line 432 of file GaudiTuples.h.

template<class PBASE>

std::string GaudiTuples< PBASE >::m_evtColTopDir`[private]`

top level tuple directory

Definition at line 434 of file GaudiTuples.h.

template<class PBASE>

std::string GaudiTuples< PBASE >::m_evtColDir`[private]`

local tuple directory

Definition at line 436 of file GaudiTuples.h.

template<class PBASE>

TupleID::NumericID GaudiTuples< PBASE >::m_evtColOffSet`[private]`

the offset for ntuple numerical ID

Definition at line 438 of file GaudiTuples.h.

template<class PBASE>

bool GaudiTuples< PBASE >::m_tuplesPrint`[private]`

print tuples at finalization?

Definition at line 441 of file GaudiTuples.h.

template<class PBASE>

bool GaudiTuples< PBASE >::m_evtColsPrint`[private]`

print event collections at finalization

Definition at line 443 of file GaudiTuples.h.

template<class PBASE>

TupleMapTitle GaudiTuples< PBASE >::m_nTupleMapTitle`[mutable, private]`

the actual storage of ntuples by title

Definition at line 446 of file GaudiTuples.h.

template<class PBASE>

TupleMapID GaudiTuples< PBASE >::m_nTupleMapID`[mutable, private]`

the actual storage of ntuples by ID

Definition at line 448 of file GaudiTuples.h.

template<class PBASE>

TupleMapTitle GaudiTuples< PBASE >::m_evtColMapTitle`[mutable, private]`

the actual storage of event collections by title

Definition at line 451 of file GaudiTuples.h.

template<class PBASE>

TupleMapID GaudiTuples< PBASE >::m_evtColMapID`[mutable, private]`

the actual storage of event collections by ID

Definition at line 453 of file GaudiTuples.h.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r7/GaudiAlg/GaudiAlg/GaudiTuples.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r7/GaudiAlg/GaudiAlg/GaudiTuples.icpp