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