33 #pragma warning ( disable:4661 ) // incomplete explicit templates
38 template <
class PBASE>
43 template <
class PBASE>
56 if ( produceNTuples() )
59 if ( this->ntupleSvc() == 0 )
60 {
return this->Error(
"INTupleSvc* points to NULL!" ); }
62 this->Print(
"The N-Tuple path is set to be '" + nTuplePath() +
"'",
66 { this->debug() <<
"Production of N-Tuples is switched OFF" <<
endmsg; }
68 if ( produceEvtCols() )
71 if ( 0 == this->evtColSvc() )
72 {
return this->Error(
"INTupleSvc* points to NULL!" ); }
74 this->Print(
"The EventCol path is set to be '" + evtColPath() +
"'",
78 { this->debug() <<
"Production of Event Collections is switched OFF" <<
endmsg; }
86 template <
class PBASE>
95 if ( !( nTupleMapTitle () .
empty () &&
96 nTupleMapID () .
empty () &&
97 evtColMapTitle () .
empty () &&
98 evtColMapID () .
empty ()
101 const int nNtuples = nTupleMapID () . size () ;
102 const int nEvtCols = evtColMapID () . size ();
104 <<
"Booked " << nNtuples <<
" N-Tuples and " << nEvtCols
105 <<
" Event Tag Collections" <<
endmsg ;
108 if ( produceNTuples () && tuplesPrint () ) { printTuples () ; }
109 if ( produceEvtCols () && evtColsPrint () ) { printEvtCols () ; }
113 m_nTupleMapTitle.end() != itup ; ++itup )
114 {
if( 0 != itup->second ) { itup->second->release() ; } }
115 m_nTupleMapTitle.clear() ;
119 m_nTupleMapID.end() != itup ; ++itup )
120 {
if( 0 != itup->second ) { itup->second->release() ; } }
121 m_nTupleMapID.clear();
125 m_evtColMapTitle.end() != itup ; ++itup )
126 {
if( 0 != itup->second ) { itup->second->release() ; } }
127 m_evtColMapTitle.clear();
131 m_evtColMapID.end() != itup ; ++itup )
132 {
if( 0 != itup->second ) { itup->second->release() ; } }
133 m_evtColMapID.clear() ;
136 return PBASE::finalize();
142 template <
class PBASE>
145 const CLID& clid )
const
149 if ( 0 != tuple ) {
return Tuple( tuple ) ; }
152 if ( this->useNumericAutoIDs() || title.empty() )
154 if ( ! this->useNumericAutoIDs() )
156 this -> Warning(
"Cannot generate automatic literal ID from an empty title ! Using numeric ID instead for nTuple ID",
160 ID =
TupleID ( m_nTupleMapID.size() + 1 + nTupleOffSet() );
162 while ( nTupleExists(ID) || evtColExists(ID) )
168 ID =
TupleID( this->convertTitleToID(title) );
170 while ( nTupleExists(ID) || evtColExists(ID) )
174 return nTuple( ID , title , clid ) ;
181 template <
class PBASE>
184 const CLID& clid )
const
188 if ( 0 != tuple ) {
return Tuple( tuple ) ; }
191 if ( this->useNumericAutoIDs() || title.empty() )
193 if ( ! this->useNumericAutoIDs() )
195 this -> Warning(
"Cannot generate automatic literal ID from an empty title ! Using numeric ID instead for evtCol ID",
199 ID =
TupleID ( m_evtColMapID.size() + 1 + evtColOffSet() ) ;
201 while ( nTupleExists(ID) || evtColExists(ID) )
207 ID =
TupleID( this->convertTitleToID(title) );
209 while ( nTupleExists(ID) || evtColExists(ID) )
213 return evtCol( ID , title , clid ) ;
220 template <
class PBASE>
224 const CLID& clid )
const
228 { this->Error(
"Undefined NTuple ID : Title='"+title1+
"'");
return Tuple(0); }
232 if( 0 != tuple ) {
return Tuple( tuple ) ; }
241 if( produceNTuples() )
247 tup = this->ntupleSvc() ->
book ( nTuplePath() , ID.
numericID() , clid , title );
251 tup = this->ntupleSvc() ->
book ( nTuplePath() , ID.
literalID() , clid , title );
253 else { this->Error(
"Undefined NTuple ID" ); }
256 this->Assert( 0 != tup ,
"Could not book the N-Tuple='" + title +
"'" ) ;
258 if( 0 != tup -> registry() && this->msgLevel(
MSG::DEBUG) )
259 { this->debug() <<
"Booked NTuple '" << title <<
"' ID=" << tID
260 <<
"' Path='" << nTuplePath() <<
"' TS='"
261 << tup -> registry() -> identifier() <<
"'" <<
endmsg; }
263 tuple = createNTuple ( title , tup , clid ) ;
272 m_nTupleMapID [ ID ] = tuple ;
275 m_nTupleMapTitle[ title ] = tuple ;
277 return Tuple( tuple ) ;
280 template <
class PBASE>
284 const CLID& clid )
const
288 { this->Error(
"Undefined NTuple ID : Title='"+title1+
"'");
return Tuple(0); }
292 if ( 0 != tuple ) {
return Tuple( tuple ) ; }
301 if( produceEvtCols() )
307 tup = this->evtColSvc()->book ( evtColPath() , ID.
numericID() , clid , title ) ;
311 tup = this->evtColSvc()->book ( evtColPath() , ID.
literalID() , clid , title ) ;
313 else { this->Error(
"Undefined NTuple ID" ); }
316 this->Assert( 0 != tup ,
"Could not book the EvtCol='" + title +
"'" ) ;
318 if( 0 != tup -> registry() && this->msgLevel(
MSG::DEBUG) )
319 { this->debug() <<
"Booked EvtCol '" << title <<
"' ID=" << tID
320 <<
"' Path='" << evtColPath() <<
"' TS='"
321 << tup -> registry() -> identifier() <<
"'" <<
endmsg ; }
323 tuple = createEvtCol ( title , tup , clid ) ;
332 m_evtColMapID [ ID ] = tuple ;
335 m_evtColMapTitle[ title ] = tuple ;
337 return Tuple( tuple ) ;
342 template <
class PBASE>
346 const CLID& clid )
const
349 (
this ,
"Tuple '" + name +
"'" , tuple , clid ,
Tuples::NTUPLE ) ;
356 template <
class PBASE>
360 const CLID& clid )
const
363 (
this ,
"EvtCol '" + name +
"'" , tuple , clid ,
Tuples::EVTCOL ) ;
368 template <
class PBASE>
372 if ( nTupleMapTitle().
empty() && nTupleMapID().
empty() )
373 {
if (this->msgLevel(
MSG::DEBUG)) this->debug() <<
"No N-Tuples are booked" <<
endmsg ; }
375 { this->always() <<
"List of booked N-Tuples in directory "
376 <<
"\"" << nTuplePath() <<
"\"" <<
endmsg ; }
380 OrderedMapType OrderedMap ( nTupleMapID().begin() , nTupleMapID().
end() ) ;
382 for ( OrderedMapType::const_iterator entry = OrderedMap.begin() ;
383 OrderedMap.end() != entry ; ++entry )
385 if ( 0 == entry->second ) { continue ; }
388 { this->error() <<
" NTuple::Tuple* points to NULL" <<
endmsg ; continue ; }
392 return this->nTupleMapID().size() ;
397 template <
class PBASE>
400 if ( evtColMapTitle().
empty() && evtColMapID().
empty() )
401 { this->always() <<
"No Event Tag Collections are booked" <<
endmsg ; }
403 { this->always() <<
"List of booked Event Tag Collections in directory "
404 <<
"\"" << evtColPath() <<
"\"" <<
endmsg ; }
408 OrderedMapType OrderedMap ( evtColMapID().begin() , evtColMapID().
end() ) ;
410 for ( OrderedMapType::const_iterator entry = OrderedMap.begin() ;
411 OrderedMap.end() != entry ; ++entry )
413 if ( 0 == entry->second ) { continue ; }
416 { this->error() <<
" NTuple::Tuple* points to NULL" <<
endmsg ; continue ; }
422 return this->evtColMapID().size() ;
427 template <
class PBASE>
430 return m_nTupleMapID.end() != m_nTupleMapID.find ( ID ) ;
435 template <
class PBASE>
438 return m_evtColMapID.end() != m_evtColMapID.find ( ID ) ;
443 template <
class PBASE>
448 if (
this -> tuplesPrint() ) {
this -> printTuples () ; }
453 template <
class PBASE>
458 if (
this -> evtColsPrint() ) {
this -> printEvtCols () ; }
463 template <
class PBASE>
466 const std::string path = nTupleLUN() +
"/" + nTupleTopDir() + nTupleDir();
467 return ( splitNTupleDir() ? dirHbookName( path ) : path ) ;
472 template <
class PBASE>
476 return ( splitEvtColDir() ? dirHbookName( path ) : path );