| The Gaudi Framework v29r0 (ff2e7097)

- 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 <cstdlib>
8 #include <numeric>
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 =
158 std::accumulate( tokens.begin(), tokens.end(), std::string{}, [&]( 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 {
175 if ( !idhh ) return;
176
177 std::string r;
178 for ( auto h : idhh->inputHandles() ) {
179 r = m_f( h->objKey() );
180 if ( r != h->objKey() ) h->updateKey( r );
181 }
182 for ( auto h : idhh->outputHandles() ) {
183 r = m_f( h->objKey() );
184 if ( r != h->objKey() ) h->updateKey( r );
185 }
186 }
187
188 private:
189 std::function<std::string( const std::string& )> m_f;
190 };
191
192 this->m_updateDataHandles = std::make_unique<DHHFixer>( fixLocation );
193
194 return sc;
195 }
196 //=============================================================================
197
198 //=============================================================================
199 // Finalize the common functionality
200 //=============================================================================
201 template <class PBASE>
202 StatusCode GaudiCommon<PBASE>::
203 #ifdef __ICC
204 i_gcFinalize
205 #else
206 finalize
207 #endif
208 ()
209 {
210 StatusCode sc = StatusCode::SUCCESS;
211
212 // print the general information about statistical counters
213 if ( this->msgLevel( MSG::DEBUG ) || ( statPrint() && !counters().empty() ) ) {
214 // print general statistical counters
215 printStat( statPrint() ? MSG::ALWAYS : MSG::DEBUG );
216 }
217 // add all counters to the CounterSummarySvc
218 if ( m_counterSummarySvc && this->svcLoc()->existsService( "CounterSummarySvc" ) ) {
219 if ( this->msgLevel( MSG::DEBUG ) ) this->debug() << "adding counters to CounterSummarySvc" << endmsg;
220
221 Gaudi::Utils::RegEx::matchList statList{m_statEntityList.value()};
222 Gaudi::Utils::RegEx::matchList counterList{m_counterList.value()};
223
224 for ( const auto& i : this->counters() ) {
225 if ( statList.Or( i.first ) )
226 m_counterSummarySvc->addCounter( this->name(), i.first, i.second, Gaudi::CounterSummary::SaveStatEntity );
227 else if ( counterList.Or( i.first ) )
228 m_counterSummarySvc->addCounter( this->name(), i.first, i.second );
229 }
230 }
231 // release all located tools and services
232 if ( this->msgLevel( MSG::DEBUG ) ) {
233 this->debug() << "Tools to release :";
234 for ( const auto& i : m_managedTools ) {
235 this->debug() << " " << i->name();
236 }
237 this->debug() << endmsg;
238 }
239 while ( !m_managedTools.empty() ) {
240 sc = releaseTool( m_managedTools.back() ) && sc;
241 }
242
243 // release all located services
244 if ( this->msgLevel( MSG::DEBUG ) ) {
245 this->debug() << "Services to release :";
246 for ( const auto& i : m_services ) this->debug() << " " << i->name();
247 this->debug() << endmsg;
248 }
249 while ( !m_services.empty() ) {
250 sc = releaseSvc( m_services.front() ) && sc;
251 }
252
253 // release the CounterSummarySvc manually
254 m_counterSummarySvc.reset();
255
256 // format printout
257 if ( !m_errors.empty() || !m_warnings.empty() || !m_exceptions.empty() ) {
258 this->always() << "Exceptions/Errors/Warnings/Infos Statistics : " << m_exceptions.size() << "/" << m_errors.size()
259 << "/" << m_warnings.size() << "/" << m_infos.size() << endmsg;
260 if ( errorsPrint() ) {
261 printErrors();
262 }
263 }
264
265 // clear *ALL* counters explicitly
266 m_counters.clear();
267 m_exceptions.clear();
268 m_infos.clear();
269 m_warnings.clear();
270 m_errors.clear();
271 m_counterList.clear();
272 m_statEntityList.clear();
273
274 // finalize base class
275 return sc && PBASE::finalize();
276 }
277 //=============================================================================
278
279 //=============================================================================
280 // Methods related to tools and services
281 //=============================================================================
282
283 // ============================================================================
284 // manual forced (and 'safe') release of the active tool or service
285 // ============================================================================
286 template <class PBASE>
287 StatusCode GaudiCommon<PBASE>::release( const IInterface* interface ) const
288 {
289 if ( !interface ) {
290 return Error( "release(IInterface):: IInterface* points to NULL!" );
291 }
292 // dispatch between tools and services
293 const IAlgTool* algTool = dynamic_cast<const IAlgTool*>( interface );
294 // perform the actual release
295 return algTool ? releaseTool( algTool ) : releaseSvc( interface );
296 }
297 // ============================================================================
298
299 // ============================================================================
300 // manual forced (and 'save') release of the tool
301 // ============================================================================
302 template <class PBASE>
303 StatusCode GaudiCommon<PBASE>::releaseTool( const IAlgTool* algTool ) const
304 {
305 if ( !algTool ) {
306 return Error( "releaseTool(IAlgTool):: IAlgTool* points to NULL!" );
307 }
308 if ( !this->toolSvc() ) {
309 return Error( "releaseTool(IAlgTool):: IToolSvc* points to NULL!" );
310 }
311 // find a tool in the list of active tools
312 auto it = std::find( m_managedTools.begin(), m_managedTools.end(), algTool );
313 if ( m_managedTools.end() == it ) {
314 return Warning( "releaseTool(IAlgTool):: IAlgTool* is not active" );
315 }
316 // get the tool
317 IAlgTool* t = *it;
318 // cache name
319 const std::string name = t->name();
320 if ( this->msgLevel( MSG::DEBUG ) ) {
321 this->debug() << "Releasing tool '" << name << "'" << endmsg;
322 }
323 // remove the tool from the lists
324 PBASE::deregisterTool( t );
325 m_managedTools.erase( it );
326 // release tool
327 if ( this->msgLevel( MSG::DEBUG ) ) {
328 this->debug() << "The tool '" << t->name() << "' of type '" << System::typeinfoName( typeid( *t ) )
329 << "' is released" << endmsg;
330 }
331 const StatusCode sc = this->toolSvc()->releaseTool( t );
332 return sc.isSuccess() ? sc : Warning( "releaseTool(IAlgTool):: error from IToolSvc releasing " + name, sc );
333 }
334 // ============================================================================
335
336 // ============================================================================
337 // manual forced (and 'safe') release of the service
338 // ============================================================================
339 template <class PBASE>
340 StatusCode GaudiCommon<PBASE>::releaseSvc( const IInterface* Svc ) const
341 {
342 if ( !Svc ) return Error( "releaseSvc(IInterface):: IInterface* points to NULL!" );
343 SmartIF<IService> svc{const_cast<IInterface*>( Svc )};
344 if ( !svc ) return Warning( "releaseSvc(IInterface):: IInterface* is not a service" );
345 auto it = std::lower_bound( std::begin( m_services ), std::end( m_services ), svc, GaudiCommon_details::svc_lt );
346 if ( it == m_services.end() || !GaudiCommon_details::svc_eq( *it, svc ) ) {
347 return Warning( "releaseSvc(IInterface):: IInterface* is not active" );
348 }
349 if ( this->msgLevel( MSG::DEBUG ) ) {
350 this->debug() << "Releasing service '" << ( *it )->name() << "'" << endmsg;
351 }
352 m_services.erase( it );
353 return StatusCode::SUCCESS;
354 }
355 // ============================================================================
356 // ============================================================================
357
358 // ============================================================================
359 // Add the given service to the list of active services
360 // ============================================================================
361 template <class PBASE>
362 void GaudiCommon<PBASE>::addToServiceList( SmartIF<IService> svc ) const
363 {
364 if ( svc ) {
365 auto i = std::lower_bound( std::begin( m_services ), std::end( m_services ), svc, GaudiCommon_details::svc_lt );
366 if ( i == std::end( m_services ) || !GaudiCommon_details::svc_eq( *i, svc ) ) {
367 m_services.insert( i, std::move( svc ) );
368 } else {
369 this->warning() << "Service " << svc->name() << " already present -- skipping" << endmsg;
370 }
371 }
372 }
373 // ============================================================================
374
375 //=============================================================================
376 // Methods related to messaging
377 //=============================================================================
378
379 // ============================================================================
380 // Print the error message and return status code
381 // ============================================================================
382 template <class PBASE>
383 StatusCode GaudiCommon<PBASE>::Error( const std::string& msg, const StatusCode st, const size_t mx ) const
384 {
385 // increase local counter of errors
386 const size_t num = ++m_errors[msg];
387 // If suppressed, just return
388 if ( num > mx ) {
389 return st;
390 } else if ( UNLIKELY( num == mx ) ) // issue one-time suppression message
391 {
392 return Print( "The ERROR message is suppressed : '" + msg + "'", st, MSG::ERROR );
393 }
394 // return message
395 return Print( msg, st, MSG::ERROR );
396 }
397 // ============================================================================
398
399 // ============================================================================
400 // Print the warning message and return status code
401 // ============================================================================
402 template <class PBASE>
403 StatusCode GaudiCommon<PBASE>::Warning( const std::string& msg, const StatusCode st, const size_t mx ) const
404 {
405 // increase local counter of warnings
406 const size_t num = ++m_warnings[msg];
407 // If suppressed, just return
408 if ( num > mx ) {
409 return st;
410 } else if ( UNLIKELY( num == mx ) ) // issue one-time suppression message
411 {
412 return Print( "The WARNING message is suppressed : '" + msg + "'", st, MSG::WARNING );
413 }
414 // return message
415 return Print( msg, st, MSG::WARNING );
416 }
417 // ============================================================================
418
419 // ============================================================================
420 // Print the info message and return status code
421 // ============================================================================
422 template <class PBASE>
423 StatusCode GaudiCommon<PBASE>::Info( const std::string& msg, const StatusCode st, const size_t mx ) const
424 {
425 // increase local counter of warnings
426 const size_t num = ++m_infos[msg];
427 // If suppressed, just return
428 if ( num > mx ) {
429 return st;
430 } else if ( UNLIKELY( num == mx ) ) // issue one-time suppression message
431 {
432 return Print( "The INFO message is suppressed : '" + msg + "'", st, MSG::INFO );
433 }
434 // return message
435 return Print( msg, st, MSG::INFO );
436 }
437 // ============================================================================
438
439 // ============================================================================
440 // Print the message and return status code
441 // ============================================================================
442 template <class PBASE>
443 StatusCode GaudiCommon<PBASE>::Print( const std::string& msg, const StatusCode st, const MSG::Level lvl ) const
444 {
445 // perform printout ?
446 if ( !this->msgLevel( lvl ) ) {
447 return st;
448 } // RETURN
449
450 // use the predefined stream
451 MsgStream& str = this->msgStream( lvl );
452 if ( typePrint() ) {
453 str << System::typeinfoName( typeid( *this ) ) << ":: ";
454 }
455
456 // print the message
457 str << msg;
458
459 // test status code
460 if ( st.isSuccess() ) {
461 } else if ( StatusCode::FAILURE != st.getCode() ) {
462 str << " StatusCode=" << st.getCode();
463 } else {
464 str << " StatusCode=FAILURE";
465 }
466
467 // perform print operation
468 str << endmsg;
469
470 // return
471 return st;
472 }
473 // ============================================================================
474
475 // ============================================================================
476 // Create and (re)-throw the exception
477 // ============================================================================
478 template <class PBASE>
479 void GaudiCommon<PBASE>::Exception( const std::string& msg, const GaudiException& exc, const StatusCode sc ) const
480 {
481 // increase local counter of exceptions
482 ++m_exceptions[msg];
483 Print( "Exception (re)throw: " + msg, sc, MSG::FATAL ).ignore();
484 throw GaudiException( this->name() + ":: " + msg, this->name(), sc, exc );
485 }
486 // ============================================================================
487
488 // ============================================================================
489 // Create and (re)-throw the exception
490 // ============================================================================
491 template <class PBASE>
492 void GaudiCommon<PBASE>::Exception( const std::string& msg, const std::exception& exc, const StatusCode sc ) const
493 {
494 // increase local counter of exceptions
495 ++m_exceptions[msg];
496 Print( "Exception (re)throw: " + msg, sc, MSG::FATAL ).ignore();
497 throw GaudiException( this->name() + ":: " + msg + "(" + exc.what() + ")", "", sc );
498 }
499 // ============================================================================
500
501 // ============================================================================
502 // Create and throw the exception
503 // ============================================================================
504 template <class PBASE>
505 void GaudiCommon<PBASE>::Exception( const std::string& msg, const StatusCode sc ) const
506 {
507 // increase local counter of exceptions
508 ++m_exceptions[msg];
509 Print( "Exception throw: " + msg, sc, MSG::FATAL ).ignore();
510 throw GaudiException( this->name() + ":: " + msg, "", sc );
511 }
512 // ============================================================================
513
514 // ============================================================================
515 // perform the actual printout of counters
516 // ============================================================================
517 template <class PBASE>
518 long GaudiCommon<PBASE>::printStat( const MSG::Level level ) const
519 {
520 // print statistics
521 if ( counters().empty() ) {
522 return 0;
523 }
524 MsgStream& msg = this->msgStream( level );
525 //
526 msg << "Number of counters : " << counters().size();
527 //
528 if ( !counters().empty() ) {
529 msg << std::endl << m_header.value();
530 }
531 //
532 for ( const auto& entry : counters() ) {
533 msg << std::endl
534 << Gaudi::Utils::formatAsTableRow( entry.first, entry.second, m_useEffFormat, m_format1, m_format2 );
535 }
536 //
537 msg << endmsg;
538 //
539 return counters().size();
540 }
541 // ============================================================================
542
543 // ============================================================================
544 // perform the actual printout of error counters
545 // ============================================================================
546 template <class PBASE>
547 long GaudiCommon<PBASE>::printErrors( const MSG::Level level ) const
548 {
549 // format for printout
550 boost::format ftm( " #%|-10s| = %|.8s| %|23t| Message = '%s'" );
551
552 auto print = [&]( const Counter& c, const std::string& label ) {
553 for ( const auto& i : c ) {
554 this->msgStream( level ) << ( ftm % label % i.second % i.first ) << endmsg;
555 }
556 };
557
558 print( m_exceptions, "EXCEPTIONS" );
559 print( m_errors, "ERRORS" );
560 print( m_warnings, "WARNINGS" );
561 print( m_infos, "INFOS" );
562
563 // return total number of errors+warnings+exceptions
564 return m_exceptions.size() + m_errors.size() + m_warnings.size() + m_infos.size();
565 }
566 // ============================================================================
567
568 // ============================================================================
572 // ============================================================================
573 template <class PBASE>
574 long GaudiCommon<PBASE>::printProps( const MSG::Level level ) const
575 {
576
577 // print ALL properties
578 MsgStream& msg = this->msgStream( level );
579 const auto& properties = this->getProperties();
580 msg << "List of ALL properties of " << System::typeinfoName( typeid( *this ) ) << "/" << this->name()
581 << " #properties = " << properties.size() << endmsg;
582 for ( const auto& property : reverse( properties ) ) {
583 msg << "Property ['Name': Value] = " << *property << endmsg;
584 }
585 return properties.size();
586 }
587 // ============================================================================
588
589 // ============================================================================
590 // Methods for dealing with the TES and TDS
591 // ============================================================================
592
593 // ============================================================================
594 // put results into Gaudi Event Transient Store
595 // ============================================================================
596 template <class PBASE>
597 DataObject* GaudiCommon<PBASE>::put( IDataProviderSvc* svc, DataObject* object, const std::string& location,
598 const bool useRootInTES ) const
599 {
600 // check arguments
601 Assert( svc, "put():: Invalid 'service'!" );
602 Assert( object, "put():: Invalid 'Object'!" );
603 Assert( !location.empty(), "put():: Invalid 'address' = '' " );
604 // final data location
605 const std::string& fullLocation = fullTESLocation( location, useRootInTES );
606 // register the object!
607 const StatusCode status = '/' == fullLocation[0] ? svc->registerObject( fullLocation, object )
608 : svc->registerObject( "/Event/" + fullLocation, object );
609 // check the result!
610 if ( status.isFailure() ) {
611 Exception( "put():: could not register '" + System::typeinfoName( typeid( *object ) ) + "' at address '" +
612 fullLocation + "'",
613 status );
614 }
615 if ( this->msgLevel( MSG::DEBUG ) ) {
616 Print( "The object of type '" + System::typeinfoName( typeid( *object ) ) + "' is registered in TS at address '" +
617 fullLocation + "'",
618 status, MSG::DEBUG )
619 .ignore();
620 }
621 return object;
622 }
623 // ============================================================================
624
625 // ============================================================================
626 // Handle method for changes in the 'ErrorsPrint'
627 // ============================================================================
628 template <class PBASE>
629 void GaudiCommon<PBASE>::printErrorHandler( Gaudi::Details::PropertyBase& /* theProp */ )
630 {
631 // no action if not yet initialized
632 if ( this->FSMState() < Gaudi::StateMachine::INITIALIZED ) {
633 return;
634 }
635 if ( this->errorsPrint() ) {
636 this->printErrors();
637 }
638 }
639 // ============================================================================
640 // Handle method for changes in the 'PropertiesPrint'
641 // ============================================================================
642 template <class PBASE>
643 void GaudiCommon<PBASE>::printPropsHandler( Gaudi::Details::PropertyBase& /* theProp */ )
644 {
645 // no action if not yet initialized
646 if ( this->FSMState() < Gaudi::StateMachine::INITIALIZED ) {
647 return;
648 }
649 if ( this->propsPrint() ) {
650 this->printProps( MSG::ALWAYS );
651 }
652 }
653 // ============================================================================
654 // Handle method for changes in the 'StatPrint'
655 // ============================================================================
656 template <class PBASE>
657 void GaudiCommon<PBASE>::printStatHandler( Gaudi::Details::PropertyBase& /* theProp */ )
658 {
659 // no action if not yet initialized
660 if ( this->FSMState() < Gaudi::StateMachine::INITIALIZED ) {
661 return;
662 }
663 if ( this->statPrint() ) {
664 this->printStat( MSG::ALWAYS );
665 }
666 }
667 // ============================================================================
668
669 // ============================================================================
670 // The END
671 // ============================================================================
System.h
UNLIKELY
#define UNLIKELY(x)
Definition: Kernel.h:128
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
Gaudi::StateMachine::INITIALIZED
Definition: StateMachine.h:17
StatusCode::SUCCESS
Definition: StatusCode.h:31
Algorithm.h
SmartIF< IDataManagerSvc >
GaudiCommon::printErrorHandler
void printErrorHandler(Gaudi::Details::PropertyBase &)
handler for "ErrorPrint" property
Definition: GaudiCommon.icpp:629
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:22
GaudiCommon::printStatHandler
void printStatHandler(Gaudi::Details::PropertyBase &)
handler for "StatPrint" property
Definition: GaudiCommon.icpp:657
format
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:120
GaudiCommon::releaseSvc
StatusCode releaseSvc(const IInterface *svc) const
manual forced (and &#39;safe&#39;) release of the service
Definition: GaudiCommon.icpp:340
gaudirun.c
c
Definition: gaudirun.py:407
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:32
StatusCode::FAILURE
Definition: StatusCode.h:31
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:597
std::function
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:319
StatusCode::getCode
unsigned long getCode() const
Get the status code by value.
Definition: StatusCode.h:94
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:329
GaudiCommon::addToServiceList
void addToServiceList(SmartIF< IService > svc) const
Add the given service to the list of acquired services.
Definition: GaudiCommon.icpp:362
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:75
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:383
Gaudi::Utils::RegEx::matchList
Definition: RegEx.h:27
GaudiAlgorithm.h
Header file for class GaudiAlgorithm.
GaudiPython.HistoUtils.location
location
Definition: HistoUtils.py:899
MSG::DEBUG
Definition: IMessageSvc.h:16
std::endl
T endl(T...args)
property
Gaudi::Details::PropertyBase * property(const std::string &name) const
GaudiCommon::printPropsHandler
void printPropsHandler(Gaudi::Details::PropertyBase &)
handler for "PropertiesPrint" property
Definition: GaudiCommon.icpp:643
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:86
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:305
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:16
IDataHandleVisitor::visit
virtual void visit(const IDataHandleHolder *)=0
MSG::Level
Level
Definition: IMessageSvc.h:16
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:19
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:28
IInterface
Definition of the basic interface.
Definition: IInterface.h:277
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:443
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:403
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:35
IDataHandleVisitor
Definition: IDataHandleHolder.h:38
std::find
T find(T...args)
IProperty.h
gaudiComponentHelp.properties
properties
Definition: gaudiComponentHelp.py:41
std::begin
T begin(T...args)
print
void print(string text)
Definition: mergesort.cpp:30
Property.h
GaudiCommon::releaseTool
StatusCode releaseTool(const IAlgTool *tool) const
manual forced (and &#39;safe&#39;) release of the tool
Definition: GaudiCommon.icpp:303
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:253
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:16
gaudirun.level
level
Definition: gaudirun.py:271
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:423
MSG::WARNING
Definition: IMessageSvc.h:16
Gaudi::Property::value
const ValueType & value() const
Backward compatibility (.
Definition: Property.h:479
GaudiCommon::printStat
long printStat(const MSG::Level level=MSG::ALWAYS) const
perform the actual printout of statistical counters
Definition: GaudiCommon.icpp:518
std::accumulate
T accumulate(T...args)
MSG::INFO
Definition: IMessageSvc.h:16
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:29
GaudiCommon::release
StatusCode release(const IInterface *interface) const
Manual forced (and &#39;safe&#39;) release of the active tool or service.
Definition: GaudiCommon.icpp:287
ISvcLocator.h
GaudiCommon::printProps
long printProps(const MSG::Level level=MSG::ALWAYS) const
perform the actual printout of properties
Definition: GaudiCommon.icpp:574
MSG::ALWAYS
Definition: IMessageSvc.h:16
reverse.h
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
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:547
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:479