The Gaudi Framework  v29r0 (ff2e7097)
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"
26 #include "GaudiKernel/IProperty.h"
28 #include "GaudiKernel/IToolSvc.h"
29 #include "GaudiKernel/MsgStream.h"
31 #include "GaudiKernel/Property.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 // ============================================================================
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>
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>
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:
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>
203 #ifdef __ICC
204  i_gcFinalize
205 #else
206  finalize
207 #endif
208  ()
209 {
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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 // ============================================================================
#define UNLIKELY(x)
Definition: Kernel.h:128
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
void printErrorHandler(Gaudi::Details::PropertyBase &)
handler for "ErrorPrint" property
T empty(T...args)
virtual const std::string & rootName() const =0
Get Name of root Event.
Header file for class GaudiAlgorithm.
Define general base for Gaudi exception.
void printStatHandler(Gaudi::Details::PropertyBase &)
handler for "StatPrint" property
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:120
StatusCode releaseSvc(const IInterface *svc) const
manual forced (and &#39;safe&#39;) release of the service
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.
Implementation of property with value of concrete type.
Definition: Property.h:319
unsigned long getCode() const
Get the status code by value.
Definition: StatusCode.h:94
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:329
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:75
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.
Header file for class GaudiAlgorithm.
T endl(T...args)
Gaudi::Details::PropertyBase * property(const std::string &name) const
void printPropsHandler(Gaudi::Details::PropertyBase &)
handler for "PropertiesPrint" property
T end(T...args)
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:305
STL class.
virtual std::vector< Gaudi::DataHandle * > inputHandles() const =0
virtual std::vector< Gaudi::DataHandle * > outputHandles() const =0
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:28
Definition of the basic interface.
Definition: IInterface.h:277
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...
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
STL class.
T move(T...args)
reverse_wrapper< T > reverse(T &&iterable)
Definition: reverse.h:35
T find(T...args)
T begin(T...args)
void print(string text)
Definition: mergesort.cpp:30
StatusCode releaseTool(const IAlgTool *tool) const
manual forced (and &#39;safe&#39;) release of the tool
The interface implemented by the AlgTool base class.
Definition: IAlgTool.h:23
string s
Definition: gaudirun.py:253
The useful base class for tools.
Definition: GaudiTool.h:101
Implements the common functionality between GaudiTools and GaudiAlgorithms.
Definition: GaudiCommon.h:80
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.
const ValueType & value() const
Backward compatibility (.
Definition: Property.h:479
long printStat(const MSG::Level level=MSG::ALWAYS) const
perform the actual printout of statistical counters
T accumulate(T...args)
virtual StatusCode registerObject(const std::string &fullPath, DataObject *pObject)=0
Register object with the data store.
const std::vector< Gaudi::Details::PropertyBase * > & getProperties() const override
get all properties
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:29
StatusCode release(const IInterface *interface) const
Manual forced (and &#39;safe&#39;) 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:209
virtual const std::string & name() const =0
Retrieve the name of the instance.
void initGaudiCommonConstructor(const IInterface *parent=nullptr)
Constructor initializations.
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.