The Gaudi Framework  v30r1 (5d4f4ae2)
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  std::map<std::string, StatEntity> ordered_counters{begin( this->counters() ), end( this->counters() )};
225  for ( const auto& i : ordered_counters ) {
226  if ( statList.Or( i.first ) )
227  m_counterSummarySvc->addCounter( this->name(), i.first, i.second, Gaudi::CounterSummary::SaveStatEntity );
228  else if ( counterList.Or( i.first ) )
229  m_counterSummarySvc->addCounter( this->name(), i.first, i.second );
230  }
231  }
232  // release all located tools and services
233  if ( this->msgLevel( MSG::DEBUG ) ) {
234  this->debug() << "Tools to release :";
235  for ( const auto& i : m_managedTools ) {
236  this->debug() << " " << i->name();
237  }
238  this->debug() << endmsg;
239  }
240  while ( !m_managedTools.empty() ) {
241  sc = releaseTool( m_managedTools.back() ) && sc;
242  }
243 
244  // release all located services
245  if ( this->msgLevel( MSG::DEBUG ) ) {
246  this->debug() << "Services to release :";
247  for ( const auto& i : m_services ) this->debug() << " " << i->name();
248  this->debug() << endmsg;
249  }
250  while ( !m_services.empty() ) {
251  sc = releaseSvc( m_services.front() ) && sc;
252  }
253 
254  // release the CounterSummarySvc manually
255  m_counterSummarySvc.reset();
256 
257  // format printout
258  if ( !m_errors.empty() || !m_warnings.empty() || !m_exceptions.empty() ) {
259  this->always() << "Exceptions/Errors/Warnings/Infos Statistics : " << m_exceptions.size() << "/" << m_errors.size()
260  << "/" << m_warnings.size() << "/" << m_infos.size() << endmsg;
261  if ( errorsPrint() ) {
262  printErrors();
263  }
264  }
265 
266  // clear *ALL* counters explicitly
267  m_counters.clear();
268  m_exceptions.clear();
269  m_infos.clear();
270  m_warnings.clear();
271  m_errors.clear();
272  m_counterList.clear();
273  m_statEntityList.clear();
274 
275  // finalize base class
276  return sc && PBASE::finalize();
277 }
278 //=============================================================================
279 
280 //=============================================================================
281 // Methods related to tools and services
282 //=============================================================================
283 
284 // ============================================================================
285 // manual forced (and 'safe') release of the active tool or service
286 // ============================================================================
287 template <class PBASE>
289 {
290  if ( !interface ) {
291  return Error( "release(IInterface):: IInterface* points to NULL!" );
292  }
293  // dispatch between tools and services
294  const IAlgTool* algTool = dynamic_cast<const IAlgTool*>( interface );
295  // perform the actual release
296  return algTool ? releaseTool( algTool ) : releaseSvc( interface );
297 }
298 // ============================================================================
299 
300 // ============================================================================
301 // manual forced (and 'save') release of the tool
302 // ============================================================================
303 template <class PBASE>
305 {
306  if ( !algTool ) {
307  return Error( "releaseTool(IAlgTool):: IAlgTool* points to NULL!" );
308  }
309  if ( !this->toolSvc() ) {
310  return Error( "releaseTool(IAlgTool):: IToolSvc* points to NULL!" );
311  }
312  // find a tool in the list of active tools
313  auto it = std::find( m_managedTools.begin(), m_managedTools.end(), algTool );
314  if ( m_managedTools.end() == it ) {
315  return Warning( "releaseTool(IAlgTool):: IAlgTool* is not active" );
316  }
317  // get the tool
318  IAlgTool* t = *it;
319  // cache name
320  const std::string name = t->name();
321  if ( this->msgLevel( MSG::DEBUG ) ) {
322  this->debug() << "Releasing tool '" << name << "'" << endmsg;
323  }
324  // remove the tool from the lists
325  PBASE::deregisterTool( t );
326  m_managedTools.erase( it );
327  // release tool
328  if ( this->msgLevel( MSG::DEBUG ) ) {
329  this->debug() << "The tool '" << t->name() << "' of type '" << System::typeinfoName( typeid( *t ) )
330  << "' is released" << endmsg;
331  }
332  const StatusCode sc = this->toolSvc()->releaseTool( t );
333  return sc.isSuccess() ? sc : Warning( "releaseTool(IAlgTool):: error from IToolSvc releasing " + name, sc );
334 }
335 // ============================================================================
336 
337 // ============================================================================
338 // manual forced (and 'safe') release of the service
339 // ============================================================================
340 template <class PBASE>
342 {
343  if ( !Svc ) return Error( "releaseSvc(IInterface):: IInterface* points to NULL!" );
344  SmartIF<IService> svc{const_cast<IInterface*>( Svc )};
345  if ( !svc ) return Warning( "releaseSvc(IInterface):: IInterface* is not a service" );
346  auto it = std::lower_bound( std::begin( m_services ), std::end( m_services ), svc, GaudiCommon_details::svc_lt );
347  if ( it == m_services.end() || !GaudiCommon_details::svc_eq( *it, svc ) ) {
348  return Warning( "releaseSvc(IInterface):: IInterface* is not active" );
349  }
350  if ( this->msgLevel( MSG::DEBUG ) ) {
351  this->debug() << "Releasing service '" << ( *it )->name() << "'" << endmsg;
352  }
353  m_services.erase( it );
354  return StatusCode::SUCCESS;
355 }
356 // ============================================================================
357 // ============================================================================
358 
359 // ============================================================================
360 // Add the given service to the list of active services
361 // ============================================================================
362 template <class PBASE>
364 {
365  if ( svc ) {
366  auto i = std::lower_bound( std::begin( m_services ), std::end( m_services ), svc, GaudiCommon_details::svc_lt );
367  if ( i == std::end( m_services ) || !GaudiCommon_details::svc_eq( *i, svc ) ) {
368  m_services.insert( i, std::move( svc ) );
369  } else {
370  this->warning() << "Service " << svc->name() << " already present -- skipping" << endmsg;
371  }
372  }
373 }
374 // ============================================================================
375 
376 //=============================================================================
377 // Methods related to messaging
378 //=============================================================================
379 
380 // ============================================================================
381 // Print the error message and return status code
382 // ============================================================================
383 template <class PBASE>
384 StatusCode GaudiCommon<PBASE>::Error( const std::string& msg, const StatusCode st, const size_t mx ) const
385 {
386  // increase local counter of errors
387  const size_t num = ++m_errors[msg];
388  // If suppressed, just return
389  if ( num > mx ) {
390  return st;
391  } else if ( UNLIKELY( num == mx ) ) // issue one-time suppression message
392  {
393  return Print( "The ERROR message is suppressed : '" + msg + "'", st, MSG::ERROR );
394  }
395  // return message
396  return Print( msg, st, MSG::ERROR );
397 }
398 // ============================================================================
399 
400 // ============================================================================
401 // Print the warning message and return status code
402 // ============================================================================
403 template <class PBASE>
404 StatusCode GaudiCommon<PBASE>::Warning( const std::string& msg, const StatusCode st, const size_t mx ) const
405 {
406  // increase local counter of warnings
407  const size_t num = ++m_warnings[msg];
408  // If suppressed, just return
409  if ( num > mx ) {
410  return st;
411  } else if ( UNLIKELY( num == mx ) ) // issue one-time suppression message
412  {
413  return Print( "The WARNING message is suppressed : '" + msg + "'", st, MSG::WARNING );
414  }
415  // return message
416  return Print( msg, st, MSG::WARNING );
417 }
418 // ============================================================================
419 
420 // ============================================================================
421 // Print the info message and return status code
422 // ============================================================================
423 template <class PBASE>
424 StatusCode GaudiCommon<PBASE>::Info( const std::string& msg, const StatusCode st, const size_t mx ) const
425 {
426  // increase local counter of warnings
427  const size_t num = ++m_infos[msg];
428  // If suppressed, just return
429  if ( num > mx ) {
430  return st;
431  } else if ( UNLIKELY( num == mx ) ) // issue one-time suppression message
432  {
433  return Print( "The INFO message is suppressed : '" + msg + "'", st, MSG::INFO );
434  }
435  // return message
436  return Print( msg, st, MSG::INFO );
437 }
438 // ============================================================================
439 
440 // ============================================================================
441 // Print the message and return status code
442 // ============================================================================
443 template <class PBASE>
445 {
446  // perform printout ?
447  if ( !this->msgLevel( lvl ) ) {
448  return st;
449  } // RETURN
450 
451  // use the predefined stream
452  MsgStream& str = this->msgStream( lvl );
453  if ( typePrint() ) {
454  str << System::typeinfoName( typeid( *this ) ) << ":: ";
455  }
456 
457  // print the message
458  str << msg;
459 
460  // test status code
461  if ( st.isSuccess() ) {
462  } else if ( StatusCode::FAILURE != st ) {
463  str << " StatusCode=" << st.getCode();
464  } else {
465  str << " StatusCode=FAILURE";
466  }
467 
468  // perform print operation
469  str << endmsg;
470 
471  // return
472  return st;
473 }
474 // ============================================================================
475 
476 // ============================================================================
477 // Create and (re)-throw the exception
478 // ============================================================================
479 template <class PBASE>
480 void GaudiCommon<PBASE>::Exception( const std::string& msg, const GaudiException& exc, const StatusCode sc ) const
481 {
482  // increase local counter of exceptions
483  ++m_exceptions[msg];
484  Print( "Exception (re)throw: " + msg, sc, MSG::FATAL ).ignore();
485  throw GaudiException( this->name() + ":: " + msg, this->name(), sc, exc );
486 }
487 // ============================================================================
488 
489 // ============================================================================
490 // Create and (re)-throw the exception
491 // ============================================================================
492 template <class PBASE>
493 void GaudiCommon<PBASE>::Exception( const std::string& msg, const std::exception& exc, const StatusCode sc ) const
494 {
495  // increase local counter of exceptions
496  ++m_exceptions[msg];
497  Print( "Exception (re)throw: " + msg, sc, MSG::FATAL ).ignore();
498  throw GaudiException( this->name() + ":: " + msg + "(" + exc.what() + ")", "", sc );
499 }
500 // ============================================================================
501 
502 // ============================================================================
503 // Create and throw the exception
504 // ============================================================================
505 template <class PBASE>
507 {
508  // increase local counter of exceptions
509  ++m_exceptions[msg];
510  Print( "Exception throw: " + msg, sc, MSG::FATAL ).ignore();
511  throw GaudiException( this->name() + ":: " + msg, "", sc );
512 }
513 // ============================================================================
514 
515 // ============================================================================
516 // perform the actual printout of counters
517 // ============================================================================
518 template <class PBASE>
520 {
521  // print statistics
522  if ( counters().empty() ) {
523  return 0;
524  }
525  MsgStream& msg = this->msgStream( level );
526  //
527  msg << "Number of counters : " << counters().size();
528  //
529  if ( !counters().empty() ) {
530  msg << std::endl << m_header.value();
531  }
532  //
533  std::map<std::string, StatEntity> ordered_counters{begin( counters() ), end( counters() )};
534  for ( const auto& entry : ordered_counters ) {
535  msg << std::endl
536  << Gaudi::Utils::formatAsTableRow( entry.first, entry.second, m_useEffFormat, m_format1, m_format2 );
537  }
538  //
539  msg << endmsg;
540  //
541  return counters().size();
542 }
543 // ============================================================================
544 
545 // ============================================================================
546 // perform the actual printout of error counters
547 // ============================================================================
548 template <class PBASE>
550 {
551  // format for printout
552  boost::format ftm( " #%|-10s| = %|.8s| %|23t| Message = '%s'" );
553 
554  auto print = [&]( const Counter& c, const std::string& label ) {
555  for ( const auto& i : c ) {
556  this->msgStream( level ) << ( ftm % label % i.second % i.first ) << endmsg;
557  }
558  };
559 
560  print( m_exceptions, "EXCEPTIONS" );
561  print( m_errors, "ERRORS" );
562  print( m_warnings, "WARNINGS" );
563  print( m_infos, "INFOS" );
564 
565  // return total number of errors+warnings+exceptions
566  return m_exceptions.size() + m_errors.size() + m_warnings.size() + m_infos.size();
567 }
568 // ============================================================================
569 
570 // ============================================================================
574 // ============================================================================
575 template <class PBASE>
577 {
578 
579  // print ALL properties
580  MsgStream& msg = this->msgStream( level );
581  const auto& properties = this->getProperties();
582  msg << "List of ALL properties of " << System::typeinfoName( typeid( *this ) ) << "/" << this->name()
583  << " #properties = " << properties.size() << endmsg;
584  for ( const auto& property : reverse( properties ) ) {
585  msg << "Property ['Name': Value] = " << *property << endmsg;
586  }
587  return properties.size();
588 }
589 // ============================================================================
590 
591 // ============================================================================
592 // Methods for dealing with the TES and TDS
593 // ============================================================================
594 
595 // ============================================================================
596 // put results into Gaudi Event Transient Store
597 // ============================================================================
598 template <class PBASE>
600  const bool useRootInTES ) const
601 {
602  // check arguments
603  Assert( svc, "put():: Invalid 'service'!" );
604  Assert( object, "put():: Invalid 'Object'!" );
605  Assert( !location.empty(), "put():: Invalid 'address' = '' " );
606  // final data location
607  const std::string& fullLocation = fullTESLocation( location, useRootInTES );
608  // register the object!
609  const StatusCode status = '/' == fullLocation[0] ? svc->registerObject( fullLocation, object )
610  : svc->registerObject( "/Event/" + fullLocation, object );
611  // check the result!
612  if ( status.isFailure() ) {
613  Exception( "put():: could not register '" + System::typeinfoName( typeid( *object ) ) + "' at address '" +
614  fullLocation + "'",
615  status );
616  }
617  if ( this->msgLevel( MSG::DEBUG ) ) {
618  Print( "The object of type '" + System::typeinfoName( typeid( *object ) ) + "' is registered in TS at address '" +
619  fullLocation + "'",
620  status, MSG::DEBUG )
621  .ignore();
622  }
623  return object;
624 }
625 // ============================================================================
626 
627 // ============================================================================
628 // Handle method for changes in the 'ErrorsPrint'
629 // ============================================================================
630 template <class PBASE>
632 {
633  // no action if not yet initialized
634  if ( this->FSMState() < Gaudi::StateMachine::INITIALIZED ) {
635  return;
636  }
637  if ( this->errorsPrint() ) {
638  this->printErrors();
639  }
640 }
641 // ============================================================================
642 // Handle method for changes in the 'PropertiesPrint'
643 // ============================================================================
644 template <class PBASE>
646 {
647  // no action if not yet initialized
648  if ( this->FSMState() < Gaudi::StateMachine::INITIALIZED ) {
649  return;
650  }
651  if ( this->propsPrint() ) {
652  this->printProps( MSG::ALWAYS );
653  }
654 }
655 // ============================================================================
656 // Handle method for changes in the 'StatPrint'
657 // ============================================================================
658 template <class PBASE>
660 {
661  // no action if not yet initialized
662  if ( this->FSMState() < Gaudi::StateMachine::INITIALIZED ) {
663  return;
664  }
665  if ( this->statPrint() ) {
666  this->printStat( MSG::ALWAYS );
667  }
668 }
669 // ============================================================================
670 
671 // ============================================================================
672 // The END
673 // ============================================================================
#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)
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:69
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:332
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:50
WARN_UNUSED 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)
STL class.
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:61
auto begin(reverse_wrapper< T > &w)
Definition: reverse.h:58
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:26
Definition of the basic interface.
Definition: IInterface.h:277
WARN_UNUSED 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.
WARN_UNUSED 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.
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:64
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.
virtual const std::string & rootName() const =0
Get Name of root Event.
T move(T...args)
reverse_wrapper< T > reverse(T &&iterable)
Definition: reverse.h:35
T find(T...args)
T begin(T...args)
virtual StatusCode registerObject(boost::string_ref fullPath, DataObject *pObject)=0
Register object with the data store.
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:100
WARN_UNUSED 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:478
long printStat(const MSG::Level level=MSG::ALWAYS) const
perform the actual printout of statistical counters
T accumulate(T...args)
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:30
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.