| The Gaudi Framework v28r2-patches (bc4ad17a)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

GaudiCommon.icpp
Go to the documentation of this file.
1 // ============================================================================
2 // include files
3 // ============================================================================
4 // STL & STD
5 // ============================================================================
6 #include <algorithm>
7 #include <numeric>
8 #include <cstdlib>
9 // ============================================================================
10 /* @file GaudiCommon.cpp
11 *
12 * Implementation file for class : GaudiCommon
13 *
14 * @author Chris Jones Christopher.Rob.Jones@cern.ch
15 * @author Vanya BELYAEV Ivan.Belyaev@itep.ru
16 * @author Rob Lambert Rob.Lambert@cern.ch
17 * @date 2009-08-04
18 */
19 // GaudiKernel
20 // ============================================================================
21 #include "GaudiKernel/AlgTool.h"
22 #include "GaudiKernel/Algorithm.h"
23 #include "GaudiKernel/IDataManagerSvc.h"
24 #include "GaudiKernel/IDataProviderSvc.h"
25 #include "GaudiKernel/IJobOptionsSvc.h"
26 #include "GaudiKernel/IProperty.h"
27 #include "GaudiKernel/ISvcLocator.h"
28 #include "GaudiKernel/IToolSvc.h"
29 #include "GaudiKernel/MsgStream.h"
30 #include "GaudiKernel/ObjectVector.h"
31 #include "GaudiKernel/Property.h"
32 #include "GaudiKernel/SmartDataPtr.h"
33 #include "GaudiKernel/SmartRef.h"
34 #include "GaudiKernel/Stat.h"
35 #include "GaudiKernel/StatEntity.h"
36 #include "GaudiKernel/System.h"
37 #include "GaudiKernel/reverse.h"
38 // ============================================================================
39 // GaudiAlg
40 // ============================================================================
41 #include "GaudiAlg/GaudiAlgorithm.h"
42 #include "GaudiAlg/GaudiCommon.h"
43 #include "GaudiAlg/GaudiTool.h"
44 #include "GaudiAlg/Print.h"
45 // ============================================================================
46 // GaudiUtils
47 // ============================================================================
48 #include "GaudiUtils/RegEx.h"
49 // ============================================================================
50 // Boost
51 // ============================================================================
52 #include "boost/format.hpp"
53 #include "boost/tokenizer.hpp"
54 // ============================================================================
55 // Disable warning on windows
56 #ifdef _WIN32
57 #pragma warning( disable : 4661 ) // incomplete explicit templates
58 #endif
59 // ============================================================================
60
61 // ============================================================================
62 // constructor initialisation
63 // ============================================================================
64 template <class PBASE>
65 void GaudiCommon<PBASE>::initGaudiCommonConstructor( const IInterface* parent )
66 {
67 m_errorsPrint.declareUpdateHandler( &GaudiCommon<PBASE>::printErrorHandler, this );
68 m_propsPrint.declareUpdateHandler( &GaudiCommon<PBASE>::printPropsHandler, this );
69 m_statPrint.declareUpdateHandler( &GaudiCommon<PBASE>::printStatHandler, this );
70
71 // setup context from parent if available
72 if ( parent ) {
73 if ( const GaudiAlgorithm* gAlg = dynamic_cast<const GaudiAlgorithm*>( parent ) ) {
74 m_context = gAlg->context();
75 m_rootInTES = gAlg->rootInTES();
76 } else if ( const GaudiTool* gTool = dynamic_cast<const GaudiTool*>( parent ) ) {
77 m_context = gTool->context();
78 m_rootInTES = gTool->rootInTES();
79 }
80 }
81
82 // Get the job option service
83 auto jos = PBASE::template service<IJobOptionsSvc>("JobOptionsSvc");
84 if (!jos) Exception("Cannot get JobOptionsSvc");
85
86 // Get the "Context" option if in the file...
87 const auto myList = jos->getProperties( this->name() );
88 if ( myList ) {
89 // Iterate over the list to set the options
90 for ( const auto& iter : *myList ) {
91 const Gaudi::Property<std::string>* sp = dynamic_cast<const Gaudi::Property<std::string>*>( iter );
92 if ( sp ) {
93 if ( iter->name().compare( "Context" ) == 0 ) {
94 m_context = sp->value();
95 } else if ( iter->name().compare( "RootInTES" ) == 0 ) {
96 m_rootInTES = sp->value();
97 }
98 }
99 }
100 }
101 }
102 //=============================================================================
103
104 //=============================================================================
105 // Initialise the common functionality
106 //=============================================================================
107 template <class PBASE>
108 StatusCode GaudiCommon<PBASE>::
109 #ifdef __ICC
110 i_gcInitialize
111 #else
112 initialize
113 #endif
114 ()
115 {
116
117 // initialize base class
118 const StatusCode sc = PBASE::initialize();
119 if ( sc.isFailure() ) {
120 return Error( "Failed to initialise base class PBASE", sc );
121 }
122
123 // some debug printout
124 if ( this->msgLevel( MSG::DEBUG ) ) {
125 this->debug() << "Initialize base class GaudiCommon<" << System::typeinfoName( typeid( PBASE ) ) << ">" << endmsg;
126 if ( !context().empty() ) this->debug() << "Created with context = '" << context() << "'" << endmsg;
127 }
128
129 // Check rootInTES ends with a /
130 if ( !m_rootInTES.empty() && m_rootInTES[m_rootInTES.size() - 1] != '/' ) m_rootInTES = m_rootInTES + "/";
131
132 // Set up the CounterSummarySvc May need to be changed
133 m_counterSummarySvc = this->svcLoc()->service( "CounterSummarySvc", false );
134 if ( this->msgLevel( MSG::DEBUG ) ) {
135 if ( !m_counterSummarySvc )
136 this->debug() << "could not locate CounterSummarySvc, no counter summary will be made" << endmsg;
137 else
138 this->debug() << "found CounterSummarySvc OK" << endmsg;
139 }
140
141 // properties will be printed if asked for or in "MSG::DEBUG" mode
142 if ( propsPrint() ) {
143 printProps( MSG::ALWAYS );
144 } else if ( this->msgLevel( MSG::DEBUG ) ) {
145 printProps( MSG::DEBUG );
146 }
147
148 // update DataHandles to point to full TES location
149
150 // get root of DataManager
151 SmartIF<IDataManagerSvc> dataMgrSvc( PBASE::evtSvc() );
152 auto rootName = dataMgrSvc->rootName();
153 if ( !rootName.empty() && '/' != rootName.back() ) rootName += "/";
154
155 auto fixLocation = [this, rootName] ( const std::string & location ) -> std::string {
156 auto tokens = boost::tokenizer<boost::char_separator<char>>{location, boost::char_separator<char>{":"}};
157 auto result = std::accumulate( tokens.begin(), tokens.end(), std::string{},
158 [&](std::string s, const std::string& tok) {
159 std::string r = fullTESLocation(tok, UseRootInTES);
160 //check whether we have an absolute path if yes use it - else prepend DataManager Root
161 if (r[0]!='/') r = rootName + r;
162 return s.empty() ? r : s + ':' + r;
163 } );
164 if ( result != location && this->msgLevel( MSG::DEBUG ) )
165 this->debug() << "Changing " << location << " to " << result << endmsg;
166 return result;
167 };
168
169 class DHHFixer : public IDataHandleVisitor
170 {
171 public:
172 DHHFixer( std::function<std::string( const std::string& )> f ): m_f( std::move( f ) ) {}
173 void visit( const IDataHandleHolder* idhh ) override {
174 if (!idhh) return;
175
176 std::string r;
177 for ( auto h : idhh->inputHandles() ) {
178 r = m_f( h->objKey() );
179 if ( r != h->objKey() ) h->updateKey( r );
180 }
181 for ( auto h : idhh->outputHandles() ) {
182 r = m_f( h->objKey() );
183 if ( r != h->objKey() ) h->updateKey( r );
184 }
185 }
186
187 private:
188 std::function<std::string( const std::string& )> m_f;
189 };
190
191 this->m_updateDataHandles = std::make_unique<DHHFixer>( fixLocation );
192
193 return sc;
194 }
195 //=============================================================================
196
197 //=============================================================================
198 // Finalize the common functionality
199 //=============================================================================
200 template <class PBASE>
201 StatusCode GaudiCommon<PBASE>::
202 #ifdef __ICC
203 i_gcFinalize
204 #else
205 finalize
206 #endif
207 ()
208 {
209 StatusCode sc = StatusCode::SUCCESS;
210
211 // print the general information about statistical counters
212 if ( this->msgLevel( MSG::DEBUG ) || ( statPrint() && !counters().empty() ) ) {
213 // print general statistical counters
214 printStat( statPrint() ? MSG::ALWAYS : MSG::DEBUG );
215 }
216 // add all counters to the CounterSummarySvc
217 if ( m_counterSummarySvc && this->svcLoc()->existsService( "CounterSummarySvc" ) ) {
218 if ( this->msgLevel( MSG::DEBUG ) ) this->debug() << "adding counters to CounterSummarySvc" << endmsg;
219
220 Gaudi::Utils::RegEx::matchList statList{m_statEntityList.value()};
221 Gaudi::Utils::RegEx::matchList counterList{m_counterList.value()};
222
223 for ( const auto& i : this->counters() ) {
224 if ( statList.Or( i.first ) )
225 m_counterSummarySvc->addCounter( this->name(), i.first, i.second, Gaudi::CounterSummary::SaveStatEntity );
226 else if ( counterList.Or( i.first ) )
227 m_counterSummarySvc->addCounter( this->name(), i.first, i.second );
228 }
229 }
230 // release all located tools and services
231 if ( this->msgLevel( MSG::DEBUG ) ) {
232 this->debug() << "Tools to release :";
233 for ( const auto& i : m_managedTools ) {
234 this->debug() << " " << i->name();
235 }
236 this->debug() << endmsg;
237 }
238 while ( !m_managedTools.empty() ) {
239 sc = releaseTool( m_managedTools.back() ) && sc;
240 }
241
242 // release all located services
243 if ( this->msgLevel( MSG::DEBUG ) ) {
244 this->debug() << "Services to release :";
245 for ( const auto& i : m_services ) this->debug() << " " << i->name();
246 this->debug() << endmsg;
247 }
248 while ( !m_services.empty() ) {
249 sc = releaseSvc( m_services.front() ) && sc;
250 }
251
252 // release the CounterSummarySvc manually
253 m_counterSummarySvc.reset();
254
255 // format printout
256 if ( !m_errors.empty() || !m_warnings.empty() || !m_exceptions.empty() ) {
257 this->always() << "Exceptions/Errors/Warnings/Infos Statistics : " << m_exceptions.size() << "/" << m_errors.size()
258 << "/" << m_warnings.size() << "/" << m_infos.size() << endmsg;
259 if ( errorsPrint() ) {
260 printErrors();
261 }
262 }
263
264 // clear *ALL* counters explicitly
265 m_counters.clear();
266 m_exceptions.clear();
267 m_infos.clear();
268 m_warnings.clear();
269 m_errors.clear();
270 m_counterList.clear();
271 m_statEntityList.clear();
272
273 // finalize base class
274 return sc && PBASE::finalize();
275 }
276 //=============================================================================
277
278 //=============================================================================
279 // Methods related to tools and services
280 //=============================================================================
281
282 // ============================================================================
283 // manual forced (and 'safe') release of the active tool or service
284 // ============================================================================
285 template <class PBASE>
286 StatusCode GaudiCommon<PBASE>::release( const IInterface* interface ) const
287 {
288 if ( !interface ) {
289 return Error( "release(IInterface):: IInterface* points to NULL!" );
290 }
291 // dispatch between tools and services
292 const IAlgTool* algTool = dynamic_cast<const IAlgTool*>( interface );
293 // perform the actual release
294 return algTool ? releaseTool( algTool ) : releaseSvc( interface );
295 }
296 // ============================================================================
297
298 // ============================================================================
299 // manual forced (and 'save') release of the tool
300 // ============================================================================
301 template <class PBASE>
302 StatusCode GaudiCommon<PBASE>::releaseTool( const IAlgTool* algTool ) const
303 {
304 if ( !algTool ) {
305 return Error( "releaseTool(IAlgTool):: IAlgTool* points to NULL!" );
306 }
307 if ( !this->toolSvc() ) {
308 return Error( "releaseTool(IAlgTool):: IToolSvc* points to NULL!" );
309 }
310 // find a tool in the list of active tools
311 auto it = std::find( m_managedTools.begin(), m_managedTools.end(), algTool );
312 if ( m_managedTools.end() == it ) {
313 return Warning( "releaseTool(IAlgTool):: IAlgTool* is not active" );
314 }
315 // get the tool
316 IAlgTool* t = *it;
317 // cache name
318 const std::string name = t->name();
319 if ( this->msgLevel( MSG::DEBUG ) ) {
320 this->debug() << "Releasing tool '" << name << "'" << endmsg;
321 }
322 // remove the tool from the lists
323 PBASE::deregisterTool( t );
324 m_managedTools.erase( it );
325 // release tool
326 if ( this->msgLevel( MSG::DEBUG ) ) {
327 this->debug() << "The tool '" << t->name() << "' of type '" << System::typeinfoName( typeid( *t ) )
328 << "' is released" << endmsg;
329 }
330 const StatusCode sc = this->toolSvc()->releaseTool( t );
331 return sc.isSuccess() ? sc : Warning( "releaseTool(IAlgTool):: error from IToolSvc releasing " + name, sc );
332 }
333 // ============================================================================
334
335 // ============================================================================
336 // manual forced (and 'safe') release of the service
337 // ============================================================================
338 template <class PBASE>
339 StatusCode GaudiCommon<PBASE>::releaseSvc( const IInterface* Svc ) const
340 {
341 if ( !Svc ) return Error( "releaseSvc(IInterface):: IInterface* points to NULL!" );
342 SmartIF<IService> svc{const_cast<IInterface*>( Svc )};
343 if ( !svc ) return Warning( "releaseSvc(IInterface):: IInterface* is not a service" );
344 auto it = std::lower_bound( std::begin( m_services ), std::end( m_services ), svc, GaudiCommon_details::svc_lt );
345 if ( it == m_services.end() || !GaudiCommon_details::svc_eq( *it, svc ) ) {
346 return Warning( "releaseSvc(IInterface):: IInterface* is not active" );
347 }
348 if ( this->msgLevel( MSG::DEBUG ) ) {
349 this->debug() << "Releasing service '" << ( *it )->name() << "'" << endmsg;
350 }
351 m_services.erase( it );
352 return StatusCode::SUCCESS;
353 }
354 // ============================================================================
355 // ============================================================================
356
357 // ============================================================================
358 // Add the given service to the list of active services
359 // ============================================================================
360 template <class PBASE>
361 void GaudiCommon<PBASE>::addToServiceList( SmartIF<IService> svc ) const
362 {
363 if ( svc ) {
364 auto i = std::lower_bound( std::begin( m_services ), std::end( m_services ), svc, GaudiCommon_details::svc_lt );
365 if ( i == std::end( m_services ) || !GaudiCommon_details::svc_eq( *i, svc ) ) {
366 m_services.insert( i, std::move( svc ) );
367 } else {
368 this->warning() << "Service " << svc->name() << " already present -- skipping" << endmsg;
369 }
370 }
371 }
372 // ============================================================================
373
374 //=============================================================================
375 // Methods related to messaging
376 //=============================================================================
377
378 // ============================================================================
379 // Print the error message and return status code
380 // ============================================================================
381 template <class PBASE>
382 StatusCode GaudiCommon<PBASE>::Error( const std::string& msg, const StatusCode st, const size_t mx ) const
383 {
384 // increase local counter of errors
385 const size_t num = ++m_errors[msg];
386 // If suppressed, just return
387 if ( num > mx ) {
388 return st;
389 } else if ( UNLIKELY( num == mx ) ) // issue one-time suppression message
390 {
391 return Print( "The ERROR message is suppressed : '" + msg + "'", st, MSG::ERROR );
392 }
393 // return message
394 return Print( msg, st, MSG::ERROR );
395 }
396 // ============================================================================
397
398 // ============================================================================
399 // Print the warning message and return status code
400 // ============================================================================
401 template <class PBASE>
402 StatusCode GaudiCommon<PBASE>::Warning( const std::string& msg, const StatusCode st, const size_t mx ) const
403 {
404 // increase local counter of warnings
405 const size_t num = ++m_warnings[msg];
406 // If suppressed, just return
407 if ( num > mx ) {
408 return st;
409 } else if ( UNLIKELY( num == mx ) ) // issue one-time suppression message
410 {
411 return Print( "The WARNING message is suppressed : '" + msg + "'", st, MSG::WARNING );
412 }
413 // return message
414 return Print( msg, st, MSG::WARNING );
415 }
416 // ============================================================================
417
418 // ============================================================================
419 // Print the info message and return status code
420 // ============================================================================
421 template <class PBASE>
422 StatusCode GaudiCommon<PBASE>::Info( const std::string& msg, const StatusCode st, const size_t mx ) const
423 {
424 // increase local counter of warnings
425 const size_t num = ++m_infos[msg];
426 // If suppressed, just return
427 if ( num > mx ) {
428 return st;
429 } else if ( UNLIKELY( num == mx ) ) // issue one-time suppression message
430 {
431 return Print( "The INFO message is suppressed : '" + msg + "'", st, MSG::INFO );
432 }
433 // return message
434 return Print( msg, st, MSG::INFO );
435 }
436 // ============================================================================
437
438 // ============================================================================
439 // Print the message and return status code
440 // ============================================================================
441 template <class PBASE>
442 StatusCode GaudiCommon<PBASE>::Print( const std::string& msg, const StatusCode st, const MSG::Level lvl ) const
443 {
444 // perform printout ?
445 if ( !this->msgLevel( lvl ) ) {
446 return st;
447 } // RETURN
448
449 // use the predefined stream
450 MsgStream& str = this->msgStream( lvl );
451 if ( typePrint() ) {
452 str << System::typeinfoName( typeid( *this ) ) << ":: ";
453 }
454
455 // print the message
456 str << msg;
457
458 // test status code
459 if ( st.isSuccess() ) {
460 } else if ( StatusCode::FAILURE != st.getCode() ) {
461 str << " StatusCode=" << st.getCode();
462 } else {
463 str << " StatusCode=FAILURE";
464 }
465
466 // perform print operation
467 str << endmsg;
468
469 // return
470 return st;
471 }
472 // ============================================================================
473
474 // ============================================================================
475 // Create and (re)-throw the exception
476 // ============================================================================
477 template <class PBASE>
478 void GaudiCommon<PBASE>::Exception( const std::string& msg, const GaudiException& exc, const StatusCode sc ) const
479 {
480 // increase local counter of exceptions
481 ++m_exceptions[msg];
482 Print( "Exception (re)throw: " + msg, sc, MSG::FATAL ).ignore();
483 throw GaudiException( this->name() + ":: " + msg, this->name(), sc, exc );
484 }
485 // ============================================================================
486
487 // ============================================================================
488 // Create and (re)-throw the exception
489 // ============================================================================
490 template <class PBASE>
491 void GaudiCommon<PBASE>::Exception( const std::string& msg, const std::exception& exc, const StatusCode sc ) const
492 {
493 // increase local counter of exceptions
494 ++m_exceptions[msg];
495 Print( "Exception (re)throw: " + msg, sc, MSG::FATAL ).ignore();
496 throw GaudiException( this->name() + ":: " + msg + "(" + exc.what() + ")", "", sc );
497 }
498 // ============================================================================
499
500 // ============================================================================
501 // Create and throw the exception
502 // ============================================================================
503 template <class PBASE>
504 void GaudiCommon<PBASE>::Exception( const std::string& msg, const StatusCode sc ) const
505 {
506 // increase local counter of exceptions
507 ++m_exceptions[msg];
508 Print( "Exception throw: " + msg, sc, MSG::FATAL ).ignore();
509 throw GaudiException( this->name() + ":: " + msg, "", sc );
510 }
511 // ============================================================================
512
513 // ============================================================================
514 // perform the actual printout of counters
515 // ============================================================================
516 template <class PBASE>
517 long GaudiCommon<PBASE>::printStat( const MSG::Level level ) const
518 {
519 // print statistics
520 if ( counters().empty() ) {
521 return 0;
522 }
523 MsgStream& msg = this->msgStream( level );
524 //
525 msg << "Number of counters : " << counters().size();
526 //
527 if ( !counters().empty() ) {
528 msg << std::endl << m_header.value();
529 }
530 //
531 for ( const auto& entry : counters() ) {
532 msg << std::endl
533 << Gaudi::Utils::formatAsTableRow( entry.first, entry.second, m_useEffFormat, m_format1, m_format2 );
534 }
535 //
536 msg << endmsg;
537 //
538 return counters().size();
539 }
540 // ============================================================================
541
542 // ============================================================================
543 // perform the actual printout of error counters
544 // ============================================================================
545 template <class PBASE>
546 long GaudiCommon<PBASE>::printErrors( const MSG::Level level ) const
547 {
548 // format for printout
549 boost::format ftm( " #%|-10s| = %|.8s| %|23t| Message = '%s'" );
550
551 auto print = [&]( const Counter& c, const std::string& label ) {
552 for ( const auto& i : c ) {
553 this->msgStream( level ) << ( ftm % label % i.second % i.first ) << endmsg;
554 }
555 };
556
557 print( m_exceptions, "EXCEPTIONS" );
558 print( m_errors, "ERRORS" );
559 print( m_warnings, "WARNINGS" );
560 print( m_infos, "INFOS" );
561
562 // return total number of errors+warnings+exceptions
563 return m_exceptions.size() + m_errors.size() + m_warnings.size() + m_infos.size();
564 }
565 // ============================================================================
566
567 // ============================================================================
571 // ============================================================================
572 template <class PBASE>
573 long GaudiCommon<PBASE>::printProps( const MSG::Level level ) const
574 {
575
576 // print ALL properties
577 MsgStream& msg = this->msgStream( level );
578 const auto& properties = this->getProperties();
579 msg << "List of ALL properties of " << System::typeinfoName( typeid( *this ) ) << "/" << this->name()
580 << " #properties = " << properties.size() << endmsg;
581 for ( const auto& property : reverse( properties ) ) {
582 msg << "Property ['Name': Value] = " << *property << endmsg;
583 }
584 return properties.size();
585 }
586 // ============================================================================
587
588 // ============================================================================
589 // Methods for dealing with the TES and TDS
590 // ============================================================================
591
592 // ============================================================================
593 // put results into Gaudi Event Transient Store
594 // ============================================================================
595 template <class PBASE>
596 DataObject* GaudiCommon<PBASE>::put( IDataProviderSvc* svc, DataObject* object, const std::string& location,
597 const bool useRootInTES ) const
598 {
599 // check arguments
600 Assert( svc, "put():: Invalid 'service'!" );
601 Assert( object, "put():: Invalid 'Object'!" );
602 Assert( !location.empty(), "put():: Invalid 'address' = '' " );
603 // final data location
604 const std::string& fullLocation = fullTESLocation( location, useRootInTES );
605 // register the object!
606 const StatusCode status = '/' == fullLocation[0] ? svc->registerObject( fullLocation, object )
607 : svc->registerObject( "/Event/" + fullLocation, object );
608 // check the result!
609 if ( status.isFailure() ) {
610 Exception( "put():: could not register '" + System::typeinfoName( typeid( *object ) ) + "' at address '" +
611 fullLocation + "'",
612 status );
613 }
614 if ( this->msgLevel( MSG::DEBUG ) ) {
615 Print( "The object of type '" + System::typeinfoName( typeid( *object ) ) + "' is registered in TS at address '" +
616 fullLocation + "'",
617 status, MSG::DEBUG )
618 .ignore();
619 }
620 return object;
621 }
622 // ============================================================================
623
624 // ============================================================================
625 // Handle method for changes in the 'ErrorsPrint'
626 // ============================================================================
627 template <class PBASE>
628 void GaudiCommon<PBASE>::printErrorHandler( Gaudi::Details::PropertyBase& /* theProp */ )
629 {
630 // no action if not yet initialized
631 if ( this->FSMState() < Gaudi::StateMachine::INITIALIZED ) {
632 return;
633 }
634 if ( this->errorsPrint() ) {
635 this->printErrors();
636 }
637 }
638 // ============================================================================
639 // Handle method for changes in the 'PropertiesPrint'
640 // ============================================================================
641 template <class PBASE>
642 void GaudiCommon<PBASE>::printPropsHandler( Gaudi::Details::PropertyBase& /* theProp */ )
643 {
644 // no action if not yet initialized
645 if ( this->FSMState() < Gaudi::StateMachine::INITIALIZED ) {
646 return;
647 }
648 if ( this->propsPrint() ) {
649 this->printProps( MSG::ALWAYS );
650 }
651 }
652 // ============================================================================
653 // Handle method for changes in the 'StatPrint'
654 // ============================================================================
655 template <class PBASE>
656 void GaudiCommon<PBASE>::printStatHandler( Gaudi::Details::PropertyBase& /* theProp */ )
657 {
658 // no action if not yet initialized
659 if ( this->FSMState() < Gaudi::StateMachine::INITIALIZED ) {
660 return;
661 }
662 if ( this->statPrint() ) {
663 this->printStat( MSG::ALWAYS );
664 }
665 }
666 // ============================================================================
667
668 // ============================================================================
669 // The END
670 // ============================================================================
System.h
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
Gaudi::StateMachine::INITIALIZED
Definition: StateMachine.h:15
StatusCode::SUCCESS
Definition: StatusCode.h:30
Algorithm.h
SmartIF< IDataManagerSvc >
GaudiCommon::printErrorHandler
void printErrorHandler(Gaudi::Details::PropertyBase &)
handler for "ErrorPrint" property
Definition: GaudiCommon.icpp:628
std::string::empty
T empty(T...args)
IDataManagerSvc::rootName
virtual const std::string & rootName() const =0
Get Name of root Event.
GaudiTool.h
Header file for class GaudiAlgorithm.
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:23
GaudiCommon::printStatHandler
void printStatHandler(Gaudi::Details::PropertyBase &)
handler for "StatPrint" property
Definition: GaudiCommon.icpp:656
format
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:119
GaudiCommon::releaseSvc
StatusCode releaseSvc(const IInterface *svc) const
manual forced (and &#39;safe&#39;) release of the service
Definition: GaudiCommon.icpp:339
gaudirun.c
c
Definition: gaudirun.py:391
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
StatusCode::FAILURE
Definition: StatusCode.h:29
GaudiCommon::put
DataObject * put(IDataProviderSvc *svc, DataObject *object, const std::string &location, const bool useRootInTES=true) const
Register a data object or container into Gaudi Event Transient Store.
Definition: GaudiCommon.icpp:596
std::function
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:314
StatusCode::getCode
unsigned long getCode() const
Get the status code by value.
Definition: StatusCode.h:91
MsgStream.h
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:299
GaudiCommon::addToServiceList
void addToServiceList(SmartIF< IService > svc) const
Add the given service to the list of acquired services.
Definition: GaudiCommon.icpp:361
GaudiCommon_details::svc_eq
constexpr const struct GaudiCommon_details::svc_eq_t svc_eq
ObjectVector.h
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
AlgTool.h
GaudiCommon::Error
StatusCode Error(const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const
Print the error message and return with the given StatusCode.
Definition: GaudiCommon.icpp:382
Gaudi::Utils::RegEx::matchList
Definition: RegEx.h:27
GaudiAlgorithm.h
Header file for class GaudiAlgorithm.
GaudiPython.HistoUtils.location
location
Definition: HistoUtils.py:774
MSG::DEBUG
Definition: IMessageSvc.h:18
std::endl
T endl(T...args)
property
Gaudi::Details::PropertyBase * property(const std::string &name) const
UNLIKELY
#define UNLIKELY(x)
Definition: Kernel.h:126
GaudiCommon::printPropsHandler
void printPropsHandler(Gaudi::Details::PropertyBase &)
handler for "PropertiesPrint" property
Definition: GaudiCommon.icpp:642
std::end
T end(T...args)
IDataProviderSvc
Data provider interface definition.
Definition: IDataProviderSvc.h:45
std::lower_bound
T lower_bound(T...args)
boost::spirit
Definition: iter_pos.hpp:13
IToolSvc.h
std::map< std::string, unsigned int >
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:84
GaudiCommon.h
Gaudi::Utils::formatAsTableRow
GAUDI_API std::string formatAsTableRow(const StatEntity &counter, const bool flag, const std::string &format1=" |%|7d| |%|11.7g| |%|#11.5g| |%|#10.5g| |%|#10.5g| |%|#10.5g| |", const std::string &format2="*|%|7d| |%|11.5g| |(%|#9.7g| +- %|-#8.6g|)%%| ----- | ----- |")
print the counter in a form of the table row
Definition: StatEntity.cpp:326
std::string
STL class.
IDataHandleHolder::inputHandles
virtual std::vector< Gaudi::DataHandle * > inputHandles() const =0
IDataHandleHolder::outputHandles
virtual std::vector< Gaudi::DataHandle * > outputHandles() const =0
MSG::FATAL
Definition: IMessageSvc.h:22
IDataHandleVisitor::visit
virtual void visit(const IDataHandleHolder *)=0
MSG::Level
Level
Definition: IMessageSvc.h:15
IDataHandleHolder
Definition: IDataHandleHolder.h:14
IDataManagerSvc.h
IDataProviderSvc.h
GaudiCommon_details::svc_lt
constexpr const struct GaudiCommon_details::svc_lt_t svc_lt
Gaudi::CounterSummary::SaveStatEntity
store only the flag()
Definition: ICounterSummarySvc.h:20
SmartDataPtr.h
std::exception::what
T what(T...args)
HiveAlgSequencer.h
h
Definition: HiveAlgSequencer.py:24
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IInterface
Definition of the basic interface.
Definition: IInterface.h:234
GaudiCommon::Print
StatusCode Print(const std::string &msg, const StatusCode st=StatusCode::SUCCESS, const MSG::Level lev=MSG::INFO) const
Print the message and return with the given StatusCode.
Definition: GaudiCommon.icpp:442
GaudiAlgorithm
The useful base class for data processing algorithms.
Definition: GaudiAlgorithm.h:94
GaudiCommon::Warning
StatusCode Warning(const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const
Print the warning message and return with the given StatusCode.
Definition: GaudiCommon.icpp:402
Print.h
collection of useful utilities to print certain objects (currently used for implementation in class G...
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
std::exception
STL class.
std::move
T move(T...args)
reverse
reverse_wrapper< T > reverse(T &&iterable)
Definition: reverse.h:33
IDataHandleVisitor
Definition: IDataHandleHolder.h:38
std::find
T find(T...args)
IProperty.h
gaudiComponentHelp.properties
properties
Definition: gaudiComponentHelp.py:37
std::begin
T begin(T...args)
print
void print(string text)
Definition: mergesort.cpp:33
Property.h
GaudiCommon::releaseTool
StatusCode releaseTool(const IAlgTool *tool) const
manual forced (and &#39;safe&#39;) release of the tool
Definition: GaudiCommon.icpp:302
SmartRef.h
StatEntity.h
IAlgTool
The interface implemented by the AlgTool base class.
Definition: IAlgTool.h:23
RegEx.h
GaudiMP.FdsRegistry.msg
msg
Definition: FdsRegistry.py:8
gaudirun.s
string s
Definition: gaudirun.py:245
GaudiTool
The useful base class for tools.
Definition: GaudiTool.h:101
Stat.h
GaudiCommon
Implements the common functionality between GaudiTools and GaudiAlgorithms.
Definition: GaudiCommon.h:80
MSG::ERROR
Definition: IMessageSvc.h:21
gaudirun.level
level
Definition: gaudirun.py:261
GaudiCommon::Info
StatusCode Info(const std::string &msg, const StatusCode st=StatusCode::SUCCESS, const size_t mx=10) const
Print the info message and return with the given StatusCode.
Definition: GaudiCommon.icpp:422
MSG::WARNING
Definition: IMessageSvc.h:20
Gaudi::Property::value
const ValueType & value() const
Backward compatibility (.
Definition: Property.h:475
GaudiCommon::printStat
long printStat(const MSG::Level level=MSG::ALWAYS) const
perform the actual printout of statistical counters
Definition: GaudiCommon.icpp:517
std::accumulate
T accumulate(T...args)
MSG::INFO
Definition: IMessageSvc.h:19
IDataProviderSvc::registerObject
virtual StatusCode registerObject(const std::string &fullPath, DataObject *pObject)=0
Register object with the data store.
getProperties
const std::vector< Gaudi::Details::PropertyBase * > & getProperties() const override
get all properties
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
GaudiCommon::release
StatusCode release(const IInterface *interface) const
Manual forced (and &#39;safe&#39;) release of the active tool or service.
Definition: GaudiCommon.icpp:286
ISvcLocator.h
GaudiCommon::printProps
long printProps(const MSG::Level level=MSG::ALWAYS) const
perform the actual printout of properties
Definition: GaudiCommon.icpp:573
MSG::ALWAYS
Definition: IMessageSvc.h:23
reverse.h
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
INamedInterface::name
virtual const std::string & name() const =0
Retrieve the name of the instance.
GaudiCommon::initGaudiCommonConstructor
void initGaudiCommonConstructor(const IInterface *parent=nullptr)
Constructor initializations.
Definition: GaudiCommon.icpp:65
GaudiCommon::printErrors
long printErrors(const MSG::Level level=MSG::ALWAYS) const
perform the actual printout of error counters
Definition: GaudiCommon.icpp:546
IJobOptionsSvc.h
GaudiCommon::Exception
void Exception(const std::string &msg, const GaudiException &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
Create and (re)-throw a given GaudiException.
Definition: GaudiCommon.icpp:478