|
Gaudi Framework, version v23r2 |
| Home | Generated: Thu Jun 28 2012 |
Templated base class providing common 'ntupling' methods. More...
#include <GaudiAlg/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 | |
Templated base class providing common 'ntupling' methods.
Definition at line 37 of file GaudiTuples.h.
| typedef GaudiAlg::HistoID GaudiTuples< PBASE >::HistoID |
the actual type for histogram identifier
Definition at line 42 of file GaudiTuples.h.
| typedef Tuples::Tuple GaudiTuples< PBASE >::Tuple |
the actual type of the tuple
Reimplemented in TupleTool.
Definition at line 44 of file GaudiTuples.h.
| typedef GaudiAlg::TupleID GaudiTuples< PBASE >::TupleID |
the actual type of N-tuple ID
Reimplemented in TupleTool.
Definition at line 46 of file GaudiTuples.h.
| typedef GaudiAlg::TupleMapID GaudiTuples< PBASE >::TupleMapID |
the actual type of (Numeric ID) -> (tuple) mappping
Definition at line 50 of file GaudiTuples.h.
| typedef GaudiAlg::TupleMapTitle GaudiTuples< PBASE >::TupleMapTitle |
the actual type of (title) -> (tuple) mappping
Definition at line 48 of file GaudiTuples.h.
| GaudiTuples< PBASE >::GaudiTuples | ( | const std::string & | name, |
| ISvcLocator * | pSvcLocator | ||
| ) |
Algorithm constructor.
| GaudiTuples< PBASE >::GaudiTuples | ( | const std::string & | type, |
| const std::string & | name, | ||
| const IInterface * | parent | ||
| ) |
Tool constructor.
| GaudiTuples< PBASE >::~GaudiTuples | ( | ) | [virtual] |
| Tuples::TupleObj * GaudiTuples< PBASE >::createEvtCol | ( | const std::string & | name, |
| NTuple::Tuple * | tuple, | ||
| const CLID & | clid | ||
| ) | const [protected, virtual] |
create TupleObj for event tag collection
| name | name/title |
| tuple | the underlying ntuple implementation |
| clid | unique classID for ntuple |
Definition at line 357 of file GaudiTuples.icpp.
{
return Tuples::createTupleObj
( this , "EvtCol '" + name + "'" , tuple , clid , Tuples::EVTCOL ) ;
}
| Tuples::TupleObj * GaudiTuples< PBASE >::createNTuple | ( | const std::string & | name, |
| NTuple::Tuple * | tuple, | ||
| const CLID & | clid | ||
| ) | const [protected, virtual] |
create TupleObj
| name | name/title |
| tuple | the underlying ntuple implementation |
| clid | unique classID for ntuple |
Definition at line 343 of file GaudiTuples.icpp.
{
return Tuples::createTupleObj
( this , "Tuple '" + name + "'" , tuple , clid , Tuples::NTUPLE ) ;
}
| Tuples::Tuple GaudiTuples< PBASE >::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.
// 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();
| ID | The forced Event Tag Collection ID |
| title | Unique title for Event Tag Collection |
| clid | N-Tuple class identifier (row or column wise) |
Reimplemented in TupleTool.
Definition at line 281 of file GaudiTuples.icpp.
{
// Check ID
if ( ID.undefined() )
{ this->Error("Undefined NTuple ID : Title='"+title1+"'"); return Tuple(0); }
// look up in the table
Tuples::TupleObj* tuple = m_evtColMapID[ID] ;
if ( 0 != tuple ) { return Tuple( tuple ) ; } // RETURN
// convert ID to the string
const std::string tID = ID.idAsString() ;
// adjust the NTuple title
const std::string title = title1.empty() ? ( "EvtCol #" + tID ) : title1 ;
// book new ntuple
if( produceEvtCols() )
{
// book NTuple
NTuple::Tuple* tup = 0;
if ( ID.numeric() )
{
tup = this->evtColSvc()->book ( evtColPath() , ID.numericID() , clid , title ) ;
}
else if ( ID.literal() )
{
tup = this->evtColSvc()->book ( evtColPath() , ID.literalID() , clid , title ) ;
}
else { this->Error( "Undefined NTuple ID" ); }
// assertion
this->Assert( 0 != tup , "Could not book the EvtCol='" + title + "'" ) ;
// some printout
if( 0 != tup -> registry() && this->msgLevel(MSG::DEBUG) )
{ this->debug() << "Booked EvtCol '" << title << "' ID=" << tID
<< "' Path='" << evtColPath() << "' TS='"
<< tup -> registry() -> identifier() << "'" << endmsg ; }
tuple = createEvtCol ( title , tup , clid ) ;
}
else
{
tuple = createEvtCol ( title , (NTuple::Tuple*) 0 , clid ) ;
}
// increment the reference
tuple -> addRef();
//
m_evtColMapID [ ID ] = tuple ;
//
tuple -> addRef();
m_evtColMapTitle[ title ] = tuple ;
// return
return Tuple( tuple ) ;
}
| Tuples::Tuple GaudiTuples< PBASE >::evtCol | ( | const std::string & | title, |
| const CLID & | clid = CLID_ColumnWiseTuple |
||
| ) | const |
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.
| title | Unique title for Event Tag Collection |
| clid | N-Tuple class identifier (row or column wise) |
Reimplemented in TupleTool.
Definition at line 182 of file GaudiTuples.icpp.
{
// look up in the table
Tuples::TupleObj* tuple = m_evtColMapTitle[ title ] ;
if ( 0 != tuple ) { return Tuple( tuple ) ; } // RETURN
// Create the tuple ID
TupleID ID;
if ( this->useNumericAutoIDs() || title.empty() )
{
if ( ! this->useNumericAutoIDs() )
{
this -> Warning( "Cannot generate automatic literal ID from an empty title ! Using numeric ID instead for evtCol ID",
StatusCode::SUCCESS );
}
// proposed the tuple ID
ID = TupleID ( m_evtColMapID.size() + 1 + evtColOffSet() ) ;
// adjust the proposed ID
while ( nTupleExists(ID) || evtColExists(ID) )
{ ID = TupleID ( ID.numeric() + 1 ) ; }
}
else
{
// use the title to create a unique literal ID
ID = TupleID( this->convertTitleToID(title) );
// Just in case ...
while ( nTupleExists(ID) || evtColExists(ID) )
{ ID = TupleID ( ID.idAsString()+"_" ) ; }
}
// return
return evtCol( ID , title , clid ) ;
}
| const std::string& GaudiTuples< PBASE >::evtColDir | ( | ) | const [inline] |
get the Event Tag Collection directory (property "EvtColsDir")
Definition at line 234 of file GaudiTuples.h.
{ return m_evtColDir ; }
| bool GaudiTuples< PBASE >::evtColExists | ( | const TupleID & | ID ) | const |
check the existence AND validity of the Event Tag Collection with the given ID
Definition at line 433 of file GaudiTuples.icpp.
{ return m_evtColMapID.end() != m_evtColMapID.find ( ID ) ; }
| 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.
{ return m_evtColLUN ; }
| 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.
{ return m_evtColMapID ; }
| 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.
{ return m_evtColMapTitle ; }
| 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.
{ return m_evtColOffSet ; }
| std::string GaudiTuples< PBASE >::evtColPath | ( | ) | const [inline] |
get the constructed Event Tag Collection path
Definition at line 238 of file GaudiTuples.h.
{
std::string path = evtColLUN() + "/" + evtColTopDir() + evtColDir();
return ( splitEvtColDir() ? dirHbookName( path ) : path );
}
| bool GaudiTuples< PBASE >::evtColsPrint | ( | ) | const [inline] |
print event collections at finalization
Definition at line 246 of file GaudiTuples.h.
{ return m_evtColsPrint ; }
| 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.
{ return m_evtColTopDir ; }
| StatusCode GaudiTuples< PBASE >::finalize | ( | ) | [protected, virtual] |
standard finalization method
Reimplemented in GaudiTupleAlg, and GaudiTupleTool.
Definition at line 92 of file GaudiTuples.icpp.
{
if ( !( nTupleMapTitle () . empty () &&
nTupleMapID () . empty () &&
evtColMapTitle () . empty () &&
evtColMapID () . empty ()
) )
{
const int nNtuples = nTupleMapID () . size () ;
const int nEvtCols = evtColMapID () . size ();
this->always()
<< "Booked " << nNtuples << " N-Tuples and " << nEvtCols
<< " Event Tag Collections" << endmsg ;
}
if ( produceNTuples () && tuplesPrint () ) { printTuples () ; }
if ( produceEvtCols () && evtColsPrint () ) { printEvtCols () ; }
{ // release ntuples and clear the container
for( TupleMapTitle::iterator itup = m_nTupleMapTitle.begin() ;
m_nTupleMapTitle.end() != itup ; ++itup )
{ if( 0 != itup->second ) { itup->second->release() ; } }
m_nTupleMapTitle.clear() ;
}
{ // release ntuples and clear the container
for( TupleMapID::iterator itup = m_nTupleMapID.begin() ;
m_nTupleMapID.end() != itup ; ++itup )
{ if( 0 != itup->second ) { itup->second->release() ; } }
m_nTupleMapID.clear();
}
{ // release ntuples and clear the container
for( TupleMapTitle::iterator itup = m_evtColMapTitle.begin() ;
m_evtColMapTitle.end() != itup ; ++itup )
{ if( 0 != itup->second ) { itup->second->release() ; } }
m_evtColMapTitle.clear();
}
{ // release ntuples and clear the container
for( TupleMapID::iterator itup = m_evtColMapID.begin() ;
m_evtColMapID.end() != itup ; ++itup )
{ if( 0 != itup->second ) { itup->second->release() ; } }
m_evtColMapID.clear() ;
}
// finalize base class
return PBASE::finalize();
}
| void GaudiTuples< PBASE >::initGaudiTuplesConstructor | ( | ) | [inline, private] |
Constructor initialization and job options.
Definition at line 338 of file GaudiTuples.h.
{
m_produceNTuples = true ; // Switch ON/OFF ntuple production
m_splitNTupleDir = false ; // for HBOOK it is better to use 'true'
m_nTupleLUN = "FILE1" ; // logical unit for ntuples
m_nTupleTopDir = "" ; // top level ntuple directory
m_nTupleDir = this->name() ; // ntuple directory
m_nTupleOffSet = 0 ; // offset for ntuples
//
m_produceEvtCols = false ; // Switch ON/OFF ntupel production
m_splitEvtColDir = false ; // for HBOOK it is better to use 'true'
m_evtColLUN = "EVTCOL" ; // logical unit for ntuples
m_evtColTopDir = "" ; // top level ntuple directory
m_evtColDir = this->name() ; // ntuple directory
m_evtColOffSet = 0 ; // offset for ntuples
//
m_tuplesPrint = true ; // print tuples at end of job
m_evtColsPrint = false ; // print event collections at end of job
//
this -> declareProperty
( "NTupleProduce" , m_produceNTuples ,
"General switch to enable/disable N-tuples" ) ;
this -> declareProperty
( "NTuplePrint" , m_tuplesPrint ,
"Print N-tuple statistics" )
-> declareUpdateHandler ( &GaudiTuples<PBASE>::printNTupleHandler , this ) ;
this -> declareProperty
( "NTupleSplitDir" , m_splitNTupleDir ,
"Split long directory names into short pieces (suitable for HBOOK)" ) ;
this -> declareProperty
( "NTupleOffSet" , m_nTupleOffSet ,
"Offset for numerical N-tuple ID" ) ;
this -> declareProperty
( "NTupleLUN" , m_nTupleLUN ,
"Logical File Unit for N-tuples" ) ;
this -> declareProperty
( "NTupleTopDir" , m_nTupleTopDir ,
"Top-level directory for N-Tuples") ;
this -> declareProperty
( "NTupleDir" , m_nTupleDir ,
"Subdirectory for N-Tuples" ) ;
// ========================================================================
this -> declareProperty
( "EvtColsProduce" , m_produceEvtCols ,
"General switch to enable/disable Event Tag Collections" ) ;
this -> declareProperty
( "EvtColsPrint" , m_evtColsPrint ,
"Print statistics for Event Tag Collections " )
-> declareUpdateHandler ( &GaudiTuples<PBASE>::printEvtColHandler , this ) ;
this -> declareProperty
( "EvtColSplitDir" , m_splitEvtColDir ,
"Split long directory names into short pieces" ) ;
this -> declareProperty
( "EvtColOffSet" , m_evtColOffSet ,
"Offset for numerical N-tuple ID" ) ;
this -> declareProperty
( "EvtColLUN" , m_evtColLUN ,
"Logical File Unit for Event Tag Collections" ) ;
this -> declareProperty
( "EvtColTopDir" , m_evtColTopDir ,
"Top-level directory for Event Tag Collections" ) ;
this -> declareProperty
( "EvtColDir" , m_evtColDir ,
"Subdirectory for Event Tag Collections" ) ;
// ========================================================================
}
| StatusCode GaudiTuples< PBASE >::initialize | ( | ) | [protected, virtual] |
standard initialization method
Reimplemented in GaudiTupleAlg, and GaudiTupleTool.
Definition at line 49 of file GaudiTuples.icpp.
{
// initialize base class
const StatusCode sc = PBASE::initialize();
if ( sc.isFailure() ) return sc;
if ( produceNTuples() )
{
// check the existance of service
if ( this->ntupleSvc() == 0 )
{ return this->Error( "INTupleSvc* points to NULL!" ); }
// Print ntuple path
this->Print( "The N-Tuple path is set to be '" + nTuplePath() + "'",
StatusCode(StatusCode::SUCCESS, true) , MSG::DEBUG);
}
else
{ this->debug() << "Production of N-Tuples is switched OFF" << endmsg; }
if ( produceEvtCols() )
{
// check the existance of service
if ( 0 == this->evtColSvc() )
{ return this->Error( "INTupleSvc* points to NULL!" ); }
// Print EvtCol path
this->Print( "The EventCol path is set to be '" + evtColPath() + "'",
StatusCode(StatusCode::SUCCESS, true) , MSG::DEBUG );
}
else
{ this->debug() << "Production of Event Collections is switched OFF" << endmsg; }
return sc;
}
| Tuples::Tuple GaudiTuples< PBASE >::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.
// 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();
| ID | The forced N-Tuple ID |
| title | Unique title for N-Tuple |
| clid | N-Tuple class identifier (row or column wise) |
Reimplemented in TupleTool.
Definition at line 221 of file GaudiTuples.icpp.
{
// Check ID
if ( ID.undefined() )
{ this->Error("Undefined NTuple ID : Title='"+title1+"'"); return Tuple(0); }
// look up in the table
Tuples::TupleObj * tuple = m_nTupleMapID[ ID ] ;
if( 0 != tuple ) { return Tuple( tuple ) ; } // RETURN
// convert ID to the string
const std::string tID = ID.idAsString() ;
// adjust the NTuple title
const std::string title = title1.empty() ? ( "NTuple #" + tID ) : title1 ;
// book new ntuple
if( produceNTuples() )
{
// book NTupel
NTuple::Tuple * tup = 0;
if ( ID.numeric() )
{
tup = this->ntupleSvc() -> book ( nTuplePath() , ID.numericID() , clid , title );
}
else if ( ID.literal() )
{
tup = this->ntupleSvc() -> book ( nTuplePath() , ID.literalID() , clid , title );
}
else { this->Error( "Undefined NTuple ID" ); }
// assertion
this->Assert( 0 != tup , "Could not book the N-Tuple='" + title + "'" ) ;
// some printout
if( 0 != tup -> registry() && this->msgLevel(MSG::DEBUG) )
{ this->debug() << "Booked NTuple '" << title << "' ID=" << tID
<< "' Path='" << nTuplePath() << "' TS='"
<< tup -> registry() -> identifier() << "'" << endmsg; }
tuple = createNTuple ( title , tup , clid ) ;
}
else
{
tuple = createNTuple ( title , (NTuple::Tuple*) 0 , clid ) ;
}
// increment the reference
tuple -> addRef();
//
m_nTupleMapID [ ID ] = tuple ;
//
tuple -> addRef();
m_nTupleMapTitle[ title ] = tuple ;
// return
return Tuple( tuple ) ;
}
| Tuples::Tuple GaudiTuples< PBASE >::nTuple | ( | const std::string & | title, |
| const CLID & | clid = CLID_ColumnWiseTuple |
||
| ) | const |
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();
| title | Unique title for N-Tuple |
| clid | N-Tuple class identifier (row or column wise) |
Reimplemented in TupleTool.
Definition at line 143 of file GaudiTuples.icpp.
{
// look up in the table
Tuples::TupleObj* tuple = m_nTupleMapTitle[ title ] ;
if ( 0 != tuple ) { return Tuple( tuple ) ; } // RETURN
// Create the tuple ID
TupleID ID;
if ( this->useNumericAutoIDs() || title.empty() )
{
if ( ! this->useNumericAutoIDs() )
{
this -> Warning( "Cannot generate automatic literal ID from an empty title ! Using numeric ID instead for nTuple ID",
StatusCode::SUCCESS );
}
// propose the tuple ID
ID = TupleID ( m_nTupleMapID.size() + 1 + nTupleOffSet() );
// adjust the proposed ID
while ( nTupleExists(ID) || evtColExists(ID) )
{ ID = TupleID ( ID.numeric() + 1 ) ; }
}
else
{
// use the title to create a unique literal ID
ID = TupleID( this->convertTitleToID(title) );
// Just in case ...
while ( nTupleExists(ID) || evtColExists(ID) )
{ ID = TupleID(ID.idAsString()+"_"); }
}
// return
return nTuple( ID , title , clid ) ;
}
| const std::string& GaudiTuples< PBASE >::nTupleDir | ( | ) | const [inline] |
get the N-Tuple directory (property "NTupleDir")
Definition at line 216 of file GaudiTuples.h.
{ return m_nTupleDir ; }
| bool GaudiTuples< PBASE >::nTupleExists | ( | const TupleID & | ID ) | const |
check the existence AND validity of the N-Tuple with the given ID
Definition at line 427 of file GaudiTuples.icpp.
{ return m_nTupleMapID.end() != m_nTupleMapID.find ( ID ) ; }
| 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.
{ return m_nTupleLUN ; }
| const TupleMapID& GaudiTuples< PBASE >::nTupleMapID | ( | ) | const [inline, protected] |
access to the all ntuples by numeric ID
Definition at line 273 of file GaudiTuples.h.
{ return m_nTupleMapID ; }
| const TupleMapTitle& GaudiTuples< PBASE >::nTupleMapTitle | ( | ) | const [inline, protected] |
access to the all ntuples by title
Definition at line 269 of file GaudiTuples.h.
{ return m_nTupleMapTitle ; }
| TupleID::NumericID GaudiTuples< PBASE >::nTupleOffSet | ( | ) | const [inline] |
get the value for N-Tuple offset (property "NTupleOffSet")
Definition at line 218 of file GaudiTuples.h.
{ return m_nTupleOffSet ; }
| std::string GaudiTuples< PBASE >::nTuplePath | ( | ) | const [inline] |
get the constructed N-Tuple path
Definition at line 220 of file GaudiTuples.h.
{
const std::string path = nTupleLUN() + "/" + nTupleTopDir() + nTupleDir();
return ( splitNTupleDir() ? dirHbookName( path ) : path ) ;
}
| 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.
{ return m_nTupleTopDir ; }
| void GaudiTuples< PBASE >::printEvtColHandler | ( | Property & | ) | [private] |
handler for "EvtColsPrint" property
Definition at line 449 of file GaudiTuples.icpp.
{
// no action if not yet initialized
if ( this -> FSMState() < Gaudi::StateMachine::INITIALIZED ) { return ; }
if ( this -> evtColsPrint() ) { this -> printEvtCols () ; }
}
| long GaudiTuples< PBASE >::printEvtCols | ( | ) | const |
perform the actual printout of Event Tag Collections
Definition at line 397 of file GaudiTuples.icpp.
{
if ( evtColMapTitle().empty() && evtColMapID().empty() )
{ this->always() << "No Event Tag Collections are booked" << endmsg ; }
else
{ this->always() << "List of booked Event Tag Collections in directory "
<< "\"" << evtColPath() << "\"" << endmsg ; }
// helper container to sort it:
typedef std::map<TupleID,const Tuples::TupleObj*> OrderedMapType;
OrderedMapType OrderedMap ( evtColMapID().begin() , evtColMapID().end() ) ;
//
for ( OrderedMapType::const_iterator entry = OrderedMap.begin() ;
OrderedMap.end() != entry ; ++entry )
{
if ( 0 == entry->second ) { continue ; }
const NTuple::Tuple* tuple = entry->second->tuple() ;
if ( 0 == tuple )
{ this->error() << " NTuple::Tuple* points to NULL" << endmsg ; continue ; }
this->always() << GaudiAlg::PrintTuple::print ( tuple , entry->first )
<< " Items:"
<< Gaudi::Utils::toString ( entry->second->items() ) << endmsg ;
}
//
return this->evtColMapID().size() ;
}
| void GaudiTuples< PBASE >::printNTupleHandler | ( | Property & | ) | [private] |
handler for "NTuplePrint" property
Definition at line 439 of file GaudiTuples.icpp.
{
// no action if not yet initialized
if ( this -> FSMState() < Gaudi::StateMachine::INITIALIZED ) { return ; }
if ( this -> tuplesPrint() ) { this -> printTuples () ; }
}
| long GaudiTuples< PBASE >::printTuples | ( | ) | const |
perform the actual printout of N-tuples
Definition at line 368 of file GaudiTuples.icpp.
{
if ( nTupleMapTitle().empty() && nTupleMapID().empty() )
{ if (this->msgLevel(MSG::DEBUG)) this->debug() << "No N-Tuples are booked" << endmsg ; }
else
{ this->always() << "List of booked N-Tuples in directory "
<< "\"" << nTuplePath() << "\"" << endmsg ; }
// helper container to sort it:
typedef std::map<TupleID,const Tuples::TupleObj*> OrderedMapType;
OrderedMapType OrderedMap ( nTupleMapID().begin() , nTupleMapID().end() ) ;
//
for ( OrderedMapType::const_iterator entry = OrderedMap.begin() ;
OrderedMap.end() != entry ; ++entry )
{
if ( 0 == entry->second ) { continue ; }
const NTuple::Tuple* tuple = entry->second->tuple() ;
if ( 0 == tuple )
{ this->error() << " NTuple::Tuple* points to NULL" << endmsg ; continue ; }
this->always() << GaudiAlg::PrintTuple::print ( tuple , entry->first ) << endmsg ;
}
//
return this->nTupleMapID().size() ;
}
| bool GaudiTuples< PBASE >::produceEvtCols | ( | ) | const [inline] |
get the flag for Event Tag Collection production (property "EvtColsProduce")
Definition at line 226 of file GaudiTuples.h.
{ return m_produceEvtCols ; }
| bool GaudiTuples< PBASE >::produceNTuples | ( | ) | const [inline] |
get the flag for N-Tuple production (property "NTupleProduce")
Definition at line 208 of file GaudiTuples.h.
{ return m_produceNTuples ; }
| 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.
{ return m_splitEvtColDir ; }
| bool GaudiTuples< PBASE >::splitNTupleDir | ( | ) | const [inline] |
get the flag for N-Tuple path split (property "NTupleSplitDir")
Definition at line 210 of file GaudiTuples.h.
{ return m_splitNTupleDir ; }
| bool GaudiTuples< PBASE >::tuplesPrint | ( | ) | const [inline] |
print tuples at finalization
Definition at line 244 of file GaudiTuples.h.
{ return m_tuplesPrint ; }
std::string GaudiTuples< PBASE >::m_evtColDir [private] |
local tuple directory
Definition at line 436 of file GaudiTuples.h.
std::string GaudiTuples< PBASE >::m_evtColLUN [private] |
name of Logical Unit for tuple directory
Definition at line 432 of file GaudiTuples.h.
TupleMapID GaudiTuples< PBASE >::m_evtColMapID [mutable, private] |
the actual storage of event collections by ID
Definition at line 453 of file GaudiTuples.h.
TupleMapTitle GaudiTuples< PBASE >::m_evtColMapTitle [mutable, private] |
the actual storage of event collections by title
Definition at line 451 of file GaudiTuples.h.
TupleID::NumericID GaudiTuples< PBASE >::m_evtColOffSet [private] |
the offset for ntuple numerical ID
Definition at line 438 of file GaudiTuples.h.
bool GaudiTuples< PBASE >::m_evtColsPrint [private] |
print event collections at finalization
Definition at line 443 of file GaudiTuples.h.
std::string GaudiTuples< PBASE >::m_evtColTopDir [private] |
top level tuple directory
Definition at line 434 of file GaudiTuples.h.
std::string GaudiTuples< PBASE >::m_nTupleDir [private] |
local tuple directory
Definition at line 423 of file GaudiTuples.h.
std::string GaudiTuples< PBASE >::m_nTupleLUN [private] |
name of logical unit for tuple directory
Definition at line 419 of file GaudiTuples.h.
TupleMapID GaudiTuples< PBASE >::m_nTupleMapID [mutable, private] |
the actual storage of ntuples by ID
Definition at line 448 of file GaudiTuples.h.
TupleMapTitle GaudiTuples< PBASE >::m_nTupleMapTitle [mutable, private] |
the actual storage of ntuples by title
Definition at line 446 of file GaudiTuples.h.
TupleID::NumericID GaudiTuples< PBASE >::m_nTupleOffSet [private] |
the offset for ntuple numerical ID
Definition at line 425 of file GaudiTuples.h.
std::string GaudiTuples< PBASE >::m_nTupleTopDir [private] |
top level tuple directory
Definition at line 421 of file GaudiTuples.h.
bool GaudiTuples< PBASE >::m_produceEvtCols [private] |
flag to switch ON/OFF the ntuple filling and booking
Definition at line 428 of file GaudiTuples.h.
bool GaudiTuples< PBASE >::m_produceNTuples [private] |
flag to switch ON/OFF the ntuple filling and booking
Definition at line 415 of file GaudiTuples.h.
bool GaudiTuples< PBASE >::m_splitEvtColDir [private] |
flag to indicate splitting of tuple directories (useful for HBOOK)
Definition at line 430 of file GaudiTuples.h.
bool GaudiTuples< PBASE >::m_splitNTupleDir [private] |
flag to indicate splitting of tuple directories (useful for HBOOK)
Definition at line 417 of file GaudiTuples.h.
bool GaudiTuples< PBASE >::m_tuplesPrint [private] |
print tuples at finalization?
Definition at line 441 of file GaudiTuples.h.