| # Gaudi Framework, version v21r6 |

Home |  | Generated: 11 Nov 2009

# GaudiTuples< PBASE > Class Template Reference

`#include <GaudiAlg/GaudiTuples.h>`

Collaboration diagram for GaudiTuples< PBASE >:

[legend]

List of all members.

## 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.

## 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

## 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 131 of file GaudiTuples.icpp.

    00133 {
    00134   // look up in the table
    00135   Tuples::TupleObj* tuple = m_nTupleMapTitle[ title ]  ;
    00136   if ( 0 != tuple ) { return Tuple( tuple ) ; }                  // RETURN
    00137   // Create the tuple ID
    00138   TupleID ID;
    00139   if ( this->useNumericAutoIDs() || title.empty() )
    00140   {
    00141     if ( ! this->useNumericAutoIDs() )
    00142     {
    00143       this -> Warning( "Cannot generate automatic literal ID from an empty title ! Using numeric ID instead for nTuple ID",
    00144                        StatusCode::SUCCESS );
    00145     }
    00146     // propose the tuple ID
    00147     ID = TupleID ( m_nTupleMapID.size() + 1 + nTupleOffSet() );
    00148     // adjust the proposed ID
    00149     while ( nTupleExists(ID) || evtColExists(ID) )
    00150     { ID = TupleID ( ID.numeric() + 1 ) ; }
    00151   }
    00152   else
    00153   {
    00154     // use the title to create a unique literal ID
    00155     ID = TupleID( this->convertTitleToID(title) );
    00156     // Just in case ...
    00157     while ( nTupleExists(ID) || evtColExists(ID) )
    00158     { ID = TupleID(ID.idAsString()+"_"); }
    00159   }
    00160   // return
    00161   return nTuple( ID , title , clid ) ;
    00162 }

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 209 of file GaudiTuples.icpp.

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

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 170 of file GaudiTuples.icpp.

    00172 {
    00173   // look up in the table
    00174   Tuples::TupleObj* tuple = m_evtColMapTitle[ title ]  ;
    00175   if ( 0 != tuple ) { return Tuple( tuple ) ; }                   // RETURN
    00176   // Create the tuple ID
    00177   TupleID ID;
    00178   if ( this->useNumericAutoIDs() || title.empty() )
    00179   {
    00180     if ( ! this->useNumericAutoIDs() )
    00181     {
    00182       this -> Warning( "Cannot generate automatic literal ID from an empty title ! Using numeric ID instead for evtCol ID",
    00183                        StatusCode::SUCCESS );
    00184     }
    00185     // proposed the tuple ID
    00186     ID = TupleID ( m_evtColMapID.size() + 1 + evtColOffSet() ) ;
    00187     // adjust the proposed ID
    00188     while ( nTupleExists(ID) || evtColExists(ID) )
    00189     { ID = TupleID ( ID.numeric() + 1 ) ; }
    00190   }
    00191   else
    00192   {
    00193     // use the title to create a unique literal ID
    00194     ID = TupleID( this->convertTitleToID(title) );
    00195     // Just in case ...
    00196     while ( nTupleExists(ID) || evtColExists(ID) )
    00197     { ID = TupleID ( ID.idAsString()+"_" ) ; }
    00198   }
    00199   // return
    00200   return evtCol( ID , title , clid ) ;
    00201 }

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 269 of file GaudiTuples.icpp.

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

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 356 of file GaudiTuples.icpp.

    00357 {
    00358
    00359   if ( nTupleMapTitle().empty() && nTupleMapID().empty() )
    00360   { if (this->msgLevel(MSG::DEBUG)) this->debug() << "No N-Tuples   are booked" << endmsg ; }
    00361   else
    00362   { this->always() << "List of booked N-Tuples in directory "
    00363                    << "\"" << nTuplePath() << "\"" << endmsg ; }
    00364
    00365   // helper container to sort it:
    00366   typedef std::map<TupleID,const Tuples::TupleObj*> OrderedMapType;
    00367   OrderedMapType OrderedMap ( nTupleMapID().begin() , nTupleMapID().end() ) ;
    00368   //
    00369   for ( OrderedMapType::const_iterator entry = OrderedMap.begin() ;
    00370         OrderedMap.end() != entry ; ++entry )
    00371   {
    00372     if ( 0 == entry->second ) { continue ; }
    00373     const NTuple::Tuple* tuple = entry->second->tuple() ;
    00374     if ( 0 == tuple )
    00375     { this->error() << " NTuple::Tuple* points to NULL" << endmsg ; continue ; }
    00376     this->always() << GaudiAlg::PrintTuple::print ( tuple , entry->first ) << endmsg ;
    00377   }
    00378   //
    00379   return this->nTupleMapID().size() ;
    00380 }

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 385 of file GaudiTuples.icpp.

    00386 {
    00387   if ( evtColMapTitle().empty() && evtColMapID().empty() )
    00388   { this->always() << "No Event Tag Collections are booked" << endmsg ; }
    00389   else
    00390   { this->always() << "List of booked Event Tag Collections in directory "
    00391                    << "\"" << evtColPath() << "\"" << endmsg ; }
    00392
    00393   // helper container to sort it:
    00394   typedef std::map<TupleID,const Tuples::TupleObj*> OrderedMapType;
    00395   OrderedMapType OrderedMap ( evtColMapID().begin() , evtColMapID().end() ) ;
    00396   //
    00397   for ( OrderedMapType::const_iterator entry = OrderedMap.begin() ;
    00398         OrderedMap.end() != entry ; ++entry )
    00399   {
    00400     if ( 0 == entry->second ) { continue ; }
    00401     const NTuple::Tuple* tuple = entry->second->tuple() ;
    00402     if ( 0 == tuple )
    00403     { this->error() << " NTuple::Tuple* points to NULL" << endmsg ; continue ; }
    00404     this->always() << GaudiAlg::PrintTuple::print ( tuple , entry->first )
    00405                    << " Items:"
    00406                    << Gaudi::Utils::toString ( entry->second->items() ) << endmsg ;
    00407   }
    00408   //
    00409   return this->evtColMapID().size() ;
    00410 }

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 415 of file GaudiTuples.icpp.

    00416 { 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 421 of file GaudiTuples.icpp.

    00422 { 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 331 of file GaudiTuples.icpp.

    00334 {
    00335   return Tuples::createTupleObj
    00336     ( this , "Tuple '" + name  + "'" , tuple , clid , Tuples::NTUPLE ) ;
    00337 }

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 345 of file GaudiTuples.icpp.

    00348 {
    00349   return Tuples::createTupleObj
    00350     ( this , "EvtCol '" + name  + "'" , tuple , clid , Tuples::EVTCOL ) ;
    00351 }

template<class PBASE>

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

standard initialization method

Returns:
  status code

Reimplemented in GaudiTupleAlg, and GaudiTupleTool.

Definition at line 43 of file GaudiTuples.icpp.

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

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 80 of file GaudiTuples.icpp.

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

template<class PBASE>

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

Constructor initialization and job options.

Definition at line 328 of file GaudiTuples.h.

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

template<class PBASE>

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

handler for "NTuplePrint" property

Definition at line 427 of file GaudiTuples.icpp.

    00428 {
    00429   // no action if not yet initialized
    00430   if ( this -> FSMState() < Gaudi::StateMachine::INITIALIZED ) { return ; }
    00431   if ( this -> tuplesPrint() ) { this -> printTuples () ; }
    00432 }

template<class PBASE>

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

handler for "EvtColsPrint" property

Definition at line 437 of file GaudiTuples.icpp.

    00438 {
    00439   // no action if not yet initialized
    00440   if ( this -> FSMState() < Gaudi::StateMachine::INITIALIZED ) { return ; }
    00441   if ( this -> evtColsPrint() ) { this -> printEvtCols () ; }
    00442 }

## 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 405 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 407 of file GaudiTuples.h.

template<class PBASE>

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

name of logical unit for tuple directory

Definition at line 409 of file GaudiTuples.h.

template<class PBASE>

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

top level tuple directory

Definition at line 411 of file GaudiTuples.h.

template<class PBASE>

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

local tuple directory

Definition at line 413 of file GaudiTuples.h.

template<class PBASE>

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

the offset for ntuple numerical ID

Definition at line 415 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 418 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 420 of file GaudiTuples.h.

template<class PBASE>

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

name of Logical Unit for tuple directory

Definition at line 422 of file GaudiTuples.h.

template<class PBASE>

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

top level tuple directory

Definition at line 424 of file GaudiTuples.h.

template<class PBASE>

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

local tuple directory

Definition at line 426 of file GaudiTuples.h.

template<class PBASE>

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

the offset for ntuple numerical ID

Definition at line 428 of file GaudiTuples.h.

template<class PBASE>

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

print tuples at finalization?

Definition at line 431 of file GaudiTuples.h.

template<class PBASE>

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

print event collections at finalization

Definition at line 433 of file GaudiTuples.h.

template<class PBASE>

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

the actual storage of ntuples by title

Definition at line 436 of file GaudiTuples.h.

template<class PBASE>

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

the actual storage of ntuples by ID

Definition at line 438 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 441 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 443 of file GaudiTuples.h.

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

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