32 #pragma warning ( disable:4661 ) // incomplete explicit templates
37 template <
class PBASE>
42 template <
class PBASE>
55 if ( produceNTuples() )
58 if ( this->ntupleSvc() == 0 )
59 {
return this->Error(
"INTupleSvc* points to NULL!" ); }
61 this->Print(
"The N-Tuple path is set to be '" + nTuplePath() +
"'",
65 { this->debug() <<
"Production of N-Tuples is switched OFF" <<
endmsg; }
67 if ( produceEvtCols() )
70 if ( 0 == this->evtColSvc() )
71 {
return this->Error(
"INTupleSvc* points to NULL!" ); }
73 this->Print(
"The EventCol path is set to be '" + evtColPath() +
"'",
77 { this->debug() <<
"Production of Event Collections is switched OFF" <<
endmsg; }
85 template <
class PBASE>
94 if ( !( nTupleMapTitle () .
empty () &&
95 nTupleMapID () .
empty () &&
96 evtColMapTitle () .
empty () &&
97 evtColMapID () .
empty ()
100 const int nNtuples = nTupleMapID () . size () ;
101 const int nEvtCols = evtColMapID () . size ();
103 <<
"Booked " << nNtuples <<
" N-Tuples and " << nEvtCols
104 <<
" Event Tag Collections" <<
endmsg ;
107 if ( produceNTuples () && tuplesPrint () ) { printTuples () ; }
108 if ( produceEvtCols () && evtColsPrint () ) { printEvtCols () ; }
112 m_nTupleMapTitle.end() != itup ; ++itup )
113 {
if( 0 != itup->second ) { itup->second->release() ; } }
114 m_nTupleMapTitle.clear() ;
118 m_nTupleMapID.end() != itup ; ++itup )
119 {
if( 0 != itup->second ) { itup->second->release() ; } }
120 m_nTupleMapID.clear();
124 m_evtColMapTitle.end() != itup ; ++itup )
125 {
if( 0 != itup->second ) { itup->second->release() ; } }
126 m_evtColMapTitle.clear();
130 m_evtColMapID.end() != itup ; ++itup )
131 {
if( 0 != itup->second ) { itup->second->release() ; } }
132 m_evtColMapID.clear() ;
135 return PBASE::finalize();
141 template <
class PBASE>
144 const CLID& clid )
const
148 if ( 0 != tuple ) {
return Tuple( tuple ) ; }
151 if ( this->useNumericAutoIDs() || title.empty() )
153 if ( ! this->useNumericAutoIDs() )
155 this -> Warning(
"Cannot generate automatic literal ID from an empty title ! Using numeric ID instead for nTuple ID",
159 ID =
TupleID ( m_nTupleMapID.size() + 1 + nTupleOffSet() );
161 while ( nTupleExists(ID) || evtColExists(ID) )
167 ID =
TupleID( this->convertTitleToID(title) );
169 while ( nTupleExists(ID) || evtColExists(ID) )
173 return nTuple( ID , title , clid ) ;
180 template <
class PBASE>
183 const CLID& clid )
const
187 if ( 0 != tuple ) {
return Tuple( tuple ) ; }
190 if ( this->useNumericAutoIDs() || title.empty() )
192 if ( ! this->useNumericAutoIDs() )
194 this -> Warning(
"Cannot generate automatic literal ID from an empty title ! Using numeric ID instead for evtCol ID",
198 ID =
TupleID ( m_evtColMapID.size() + 1 + evtColOffSet() ) ;
200 while ( nTupleExists(ID) || evtColExists(ID) )
206 ID =
TupleID( this->convertTitleToID(title) );
208 while ( nTupleExists(ID) || evtColExists(ID) )
212 return evtCol( ID , title , clid ) ;
219 template <
class PBASE>
223 const CLID& clid )
const
227 { this->Error(
"Undefined NTuple ID : Title='"+title1+
"'");
return Tuple(0); }
231 if( 0 != tuple ) {
return Tuple( tuple ) ; }
240 if( produceNTuples() )
246 tup = this->ntupleSvc() ->
book ( nTuplePath() , ID.
numericID() , clid , title );
250 tup = this->ntupleSvc() ->
book ( nTuplePath() , ID.
literalID() , clid , title );
252 else { this->Error(
"Undefined NTuple ID" ); }
255 this->Assert( 0 != tup ,
"Could not book the N-Tuple='" + title +
"'" ) ;
257 if( 0 != tup -> registry() && this->msgLevel(
MSG::DEBUG) )
258 { this->debug() <<
"Booked NTuple '" << title <<
"' ID=" << tID
259 <<
"' Path='" << nTuplePath() <<
"' TS='"
260 << tup -> registry() -> identifier() <<
"'" <<
endmsg; }
262 tuple = createNTuple ( title , tup , clid ) ;
271 m_nTupleMapID [ ID ] = tuple ;
274 m_nTupleMapTitle[ title ] = tuple ;
276 return Tuple( tuple ) ;
279 template <
class PBASE>
283 const CLID& clid )
const
287 { this->Error(
"Undefined NTuple ID : Title='"+title1+
"'");
return Tuple(0); }
291 if ( 0 != tuple ) {
return Tuple( tuple ) ; }
300 if( produceEvtCols() )
306 tup = this->evtColSvc()->book ( evtColPath() , ID.
numericID() , clid , title ) ;
310 tup = this->evtColSvc()->book ( evtColPath() , ID.
literalID() , clid , title ) ;
312 else { this->Error(
"Undefined NTuple ID" ); }
315 this->Assert( 0 != tup ,
"Could not book the EvtCol='" + title +
"'" ) ;
317 if( 0 != tup -> registry() && this->msgLevel(
MSG::DEBUG) )
318 { this->debug() <<
"Booked EvtCol '" << title <<
"' ID=" << tID
319 <<
"' Path='" << evtColPath() <<
"' TS='"
320 << tup -> registry() -> identifier() <<
"'" <<
endmsg ; }
322 tuple = createEvtCol ( title , tup , clid ) ;
331 m_evtColMapID [ ID ] = tuple ;
334 m_evtColMapTitle[ title ] = tuple ;
336 return Tuple( tuple ) ;
341 template <
class PBASE>
345 const CLID& clid )
const
348 (
this ,
"Tuple '" + name +
"'" , tuple , clid ,
Tuples::NTUPLE ) ;
355 template <
class PBASE>
359 const CLID& clid )
const
362 (
this ,
"EvtCol '" + name +
"'" , tuple , clid ,
Tuples::EVTCOL ) ;
367 template <
class PBASE>
371 if ( nTupleMapTitle().
empty() && nTupleMapID().
empty() )
372 {
if (this->msgLevel(
MSG::DEBUG)) this->debug() <<
"No N-Tuples are booked" <<
endmsg ; }
374 { this->always() <<
"List of booked N-Tuples in directory "
375 <<
"\"" << nTuplePath() <<
"\"" <<
endmsg ; }
379 OrderedMapType OrderedMap ( nTupleMapID().begin() , nTupleMapID().
end() ) ;
381 for ( OrderedMapType::const_iterator entry = OrderedMap.begin() ;
382 OrderedMap.end() != entry ; ++entry )
384 if ( 0 == entry->second ) { continue ; }
387 { this->error() <<
" NTuple::Tuple* points to NULL" <<
endmsg ; continue ; }
391 return this->nTupleMapID().size() ;
396 template <
class PBASE>
399 if ( evtColMapTitle().
empty() && evtColMapID().
empty() )
400 { this->always() <<
"No Event Tag Collections are booked" <<
endmsg ; }
402 { this->always() <<
"List of booked Event Tag Collections in directory "
403 <<
"\"" << evtColPath() <<
"\"" <<
endmsg ; }
407 OrderedMapType OrderedMap ( evtColMapID().begin() , evtColMapID().
end() ) ;
409 for ( OrderedMapType::const_iterator entry = OrderedMap.begin() ;
410 OrderedMap.end() != entry ; ++entry )
412 if ( 0 == entry->second ) { continue ; }
415 { this->error() <<
" NTuple::Tuple* points to NULL" <<
endmsg ; continue ; }
421 return this->evtColMapID().size() ;
426 template <
class PBASE>
428 {
return m_nTupleMapID.end() != m_nTupleMapID.find ( ID ) ; }
432 template <
class PBASE>
434 {
return m_evtColMapID.end() != m_evtColMapID.find ( ID ) ; }
438 template <
class PBASE>
443 if (
this -> tuplesPrint() ) {
this -> printTuples () ; }
448 template <
class PBASE>
453 if (
this -> evtColsPrint() ) {
this -> printEvtCols () ; }