ATLAS Offline Software
Loading...
Searching...
No Matches
Athena Namespace Reference

Some weak symbol referencing magic... These are declared in AthenaKernel/getMessageSvc.h and will be non-nullptr in case the GaudiSvc/AthenaKernel shared libraries have been loaded. More...

Namespaces

namespace  DsoUtils
namespace  Options
namespace  detail
namespace  Units

Classes

class  Chrono
 Exception-safe IChronoSvc caller. More...
class  CondObjDeleter
 Deletion object for conditions payloads. More...
class  IMessageSvcHolder
 get a IMessageSvc* on 1st use (if not set) and release it on ~ More...
class  IConditionsCleanerSvc
 Interface for doing garbage collection of conditions objects. More...
class  IInputRename
 Interface to retrieve input rename map. More...
class  ToolLock
 RAII helper for acquiring the lock of an ILockableTool. More...
struct  InputRenameEntry
 Type of the input rename map: sgkey_t -> sgkey_t. More...
class  IRCUSvc
 Interface for RCU service. More...
class  ISlimmingHdlr
 This class defines a protocol to slim objects (removing parts of that object). More...
class  IThinningHdlr
 This class defines a protocol to pack and unpack thinned collections. More...
class  DvThinningHdlr
 Handle DataProxy holding DataVector. More...
class  StdThinningHdlr
 Handle DataProxy holding std::vector<T> This class defines a (type-safe) protocol to pack and unpack thinned DataVector. More...
class  IdcThinningHdlr
 Handle DataProxy holding IdentifiableContainer This class defines a (type-safe) protocol to pack and unpack thinned IdentifiableContainer. More...
struct  get_thinning_handler
 metafunction to automagically dispatch on the type of a container and fetch the right thinning handler More...
class  RCURead
 Helper to read data from a RCUObject. More...
class  RCUReadQuiesce
 Helper to read data from a RCUObject. More...
class  RCUUpdate
 Helper to update data in a RCUObject. More...
class  IRCUObject
 Base object class for RCU-style synchronization for Athena. More...
class  RCUObject
 Wrapper object controlled by RCU synchonization. More...
class  RCUUpdater
 Implementation of Updater for RCUSvc. More...
class  RecyclableDataQueue
 Holder for recyclable objects. More...
class  Timeout
 Singleton to access the timeout flag. More...
class  TimeoutMaster
 Class to modify timeout flag. More...
struct  TPCnvVers
struct  TPCnvType
struct  StatusCategory
struct  RCUObjectGraceSets
class  ConditionsCleanerSvc
 Facade class for conditions garbage collection. More...
class  DelayedConditionsCleanerSvcProps
class  DelayedConditionsCleanerSvc
 Clean conditions containers after a delay. More...
class  RCUSvc
 Service to allow cleaning up RCU objects at the EndEvent. More...
class  ROOTMessageFilterSvc
 Service for filtering "ROOT messages" in Athena. More...
class  ThinningCacheTool
 Create ThinningCache for a given stream. More...
class  Signal
 Utilities for handling signals and fatal errors. More...
class  LeafCnv
class  NtupleCnvSvc
class  RootAsciiDumperAlg
class  RootBranchAddress
 A simple class to hold the buffer of a TBranch from a TTree. More...
class  RootCnv
 This class provides the abstract converter to translate an object to/from its persistent ROOT representation. More...
class  RootCnvSvc
 This class provides the interface between Athena and RootSvc. More...
class  RootConnection
 This class provides the implementation of Athena::RootConnection class, similar to Gaudi IDataConnection. More...
class  DataBucketBranch
class  RootGlobalsRestore
 state of a few global resources from ROOT and restores their initial value upon d-tor call. More...
class  RootNtupleEventContext
 ROOT specific event selector context. More...
class  RootNtupleEventSelector
 Class implementing the GAUDI IEvtSelector interface using ROOT TTree as a backend. More...
class  RootNtupleOutputMetadataTool
 This is the AthenaRoot version of AthenaServices/AthenaOutputStreamTool. More...
class  RootNtupleOutputStream
 algorithm that marks for write data objects in SG More...
class  RootOutputStreamTool
 This is the AthenaRoot version of AthenaServices/AthenaOutputStreamTool. More...
class  RootSvc
 This class provides the interface to the ROOT software. More...
class  xAODBranchAddress
 A simple class to do the retrieve from TEvent. More...
class  xAODCnv
class  xAODCnvSvc
class  xAODEventContext
 event selector context ... just holds reference back to the selector More...
class  xAODEventSelector
 Class implementing the GAUDI IEvtSelector interface using ROOT TTree as a backend. More...
class  DBLock
 Common database lock. More...

Typedefs

using InputRenameMap_t = SG::SGKeyMap<InputRenameEntry>
typedef void(* DummyHandlerType) (int)
 Dummy handler type for standard signal() function.
typedef RootNtupleEventContext::FileNames_t FileNames_t

Enumerations

enum class  Status : StatusCode::code_t { TIMEOUT = 10 , MISSING_DATA = 11 }
 Athena specific StatusCode values. More...

Functions

std::string typeinfoName (const std::type_info &ti)
 Convert a type_info to a demangled string.
IMessageSvc * getMessageSvc (bool quiet=false)
IMessageSvc * getMessageSvc (const Options::CreateOptions o, bool quiet=false)
void reportMessage (IMessageSvc *ims, const std::string &source, int type, const std::string &message)
 Wrappers for some of the IMessageSvc methods These can be used from libraries without explicit Gaudi dependency via weak linking.
int outputLevel (const IMessageSvc *ims, const std::string &source)
void setOutputLevel (IMessageSvc *ims, const std::string &source, int level)
template<typename... ARGS>
 RecyclableDataObject (std::shared_ptr< queue_t > queue, ARGS &&... args)
 Helper for recycling objects from event to event.
virtual unsigned long release () override
 DataObject release method.
StatusCode ROOTMessageFilterSvc::initialize ATLAS_NOT_THREAD_SAFE (void)
 Return the file descriptor #fataldump() uses for output.
static void SignalDumpLibs (const SharedLibrary::LibraryInfo &info, IOFD fd)
 Internal #Signal::fataldump() dumper to produce the list of currently loaded shared libraries.
void Signal::handleQuit ATLAS_NOT_THREAD_SAFE (QuitHook hook)
void Signal::handleFatal ATLAS_NOT_THREAD_SAFE (const char *applicationName, IOFD fd, FatalHook hook, FatalReturn mainreturn, unsigned options)
 Install default handler for fatal signals.
void Signal::quit ATLAS_NOT_THREAD_SAFE (int sig, siginfo_t *info, void *x)
 The quit signal handler.
bool Signal::fatalDump ATLAS_NOT_THREAD_SAFE (int sig, siginfo_t *info, void *extra, IOFD fd, unsigned options)
 find_coll_idx (-1, coll_idx, tuple_idx)
return m_collEvts back ().back().max_entries

Variables

std::atomic< bool > getMessageSvcQuiet
 Set this to force off the warning messages from getMessageSvc (in unit tests, for example).
std::shared_ptr< queue_t > m_queue
 The queue on which this object will be placed when it is recycled.
static SharedLibrary::InfoHandlerSignalDumpCallback = 0
 Shared library dump callback for #Signal::fataldump().
static char buf [SIGNAL_MESSAGE_BUFSIZE]
 Dump application state information on a fatal signal.
 const
 helper method to get the collection index (into m_inputCollectionsName) and tuple index (into m_tupleNames') for a given event index evtidx`.

Detailed Description

Some weak symbol referencing magic... These are declared in AthenaKernel/getMessageSvc.h and will be non-nullptr in case the GaudiSvc/AthenaKernel shared libraries have been loaded.

Typedef Documentation

◆ DummyHandlerType

typedef void(* Athena::DummyHandlerType) (int)

Dummy handler type for standard signal() function.

Definition at line 108 of file SealSignal.cxx.

◆ FileNames_t

◆ InputRenameMap_t

Enumeration Type Documentation

◆ Status

enum class Athena::Status : StatusCode::code_t
strong

Athena specific StatusCode values.

These can be used in place of Gaudi's StatusCode::XYZ if additional information should be returned. Some of these codes will result in special treatment of the event (e.g. sending them to the debug stream in the HLT).

Only generic return codes should be defined here. Algorithm-specific return values should be encoded in separate enums in the respective packages.

Enumerator
TIMEOUT 

Timeout during event processing.

MISSING_DATA 

Missing/corrupted input data.

Definition at line 22 of file AthStatusCode.h.

22 : StatusCode::code_t {
23 TIMEOUT = 10,
24 MISSING_DATA = 11
25};
@ TIMEOUT
Timeout during event processing.
@ MISSING_DATA
Missing/corrupted input data.

Function Documentation

◆ ATLAS_NOT_THREAD_SAFE() [1/5]

void Signal::handleFatal Athena::ATLAS_NOT_THREAD_SAFE ( const char * applicationName,
IOFD fd,
FatalHook hook,
FatalReturn mainreturn,
unsigned options )

Install default handler for fatal signals.

This method installs a handler for fatal signals such as floating point exceptions, illegal instructions, and memory violations. The behaviour is more precisely determined by options, a bitwise or of the option constants defined in the class declaration.

applicationName sets the application name to be used to report the signal in #fatalDump(). fd sets the file descriptor to which the fatal signal message is written; by default this will be the standard error output. hook sets the pre-exit application hook to invoke, mainreturn sets the hook to return to back to the application "main loop" (i.e. ignore the signal by jumping out of the signal back to the somewhere higher up in the application).

Options left to default values will not change the current state. This allows one to re-install signal handlers without disturbing already registered information. Use this to restore handlers after some other library has meddled with the handlers.

This installs #fatal() as the handler for fatal signals and on Windows for otherwise unhandled fatal structured exceptions. If #FATAL_ON_QUIT is included in options, quitting related signals (see #quit()) are also considered fatal. If #FATAL_ON_INT is set, SIGINT is considered fatal—but see also #fatal() documentation. If #USR1_DUMP_CORE is set, DebugAids::coredump is registered as a handler for SIGUSR1 (please note the security risks of this option in its documentation).

A multi-threaded application should call this method in each thread. (FIXME: Calling this in one thread and blocking signals in others won't work on Linux, and in any case will probably produce nonsense stack traces (unless stacktrace can be fixed to dump the stacks of all the threads). Since the handler is always the same, I am not sure it will make the slightest difference which thread catches the signals, and on the other hand, it is best to dump the problems in the faulting thread if possible.)

Definition at line 645 of file SealSignal.cxx.

650{
651 // FIXME: Provide means to install handlers for fatal signals that
652 // an application has requested and app was supposed to register a
653 // handler before making the request? (So that if the app handler
654 // is not installed for some reason, an internal error hook can
655 // run?) Such fatal signals include:
656 // - SIGPIPE: read or write to broken pipe; child died
657 // (read or write to socket with ASYNC io?)
658 // - SIGLOST: lost a resource (e.g., lock on nfs server reboot)
659 // - SIGALRM: interval timer elapsed
660 // - SIGUSR1, SIGUSR2
661 // - SIGPOLL: pollable streams device events
662 // - SIGIO: i/o possible (from async i/o)
663 // - SIGVTALRM: virtual timer expired
664 // - SIGPROF: profiling timer expired
665 // - SIGRTMIN - SIGRTMAX: POSIX real-time signals
666 //
667 // Some of these the application should probably just #block()
668 // (e.g. SIGPIPE). Some of them the app should block and then
669 // wait or poll for events (SIGPOLL, SIGIO, possibly SIGALRM, the
670 // real-time signals if they are used).
671
672 static const int hups [] = {
673#ifdef SIGHUP
674 SIGHUP, // hang up (lost terminal or process group leader)
675#endif
676#ifdef SIGTERM
677 SIGTERM, // terminate (e.g. system going down)
678#endif
679#ifdef SIGQUIT
680 SIGQUIT, /* user request to quit and leave debuggable
681 state (from quit key on controlling
682 terminal) */
683
684#endif
685 -1
686 };
687
688 static int fatals [] = {
689#ifdef SIGFPE
690 SIGFPE, // arithmetic exception
691#endif
692#ifdef SIGILL
693 SIGILL, // illegal instruction
694#endif
695#ifdef SIGSEGV
696 SIGSEGV, // illegal address
697#endif
698#ifdef SIGBUS
699 SIGBUS, // hardware exception
700#endif
701#ifdef SIGIOT
702 SIGIOT, /* IOT trap. Before SIGABRT so that if SIGIOT
703 == SIGABRT then SIGABRT overrides SIGIOT;
704 SIGABRT is in ISO C and POSIX.1, SIGIOT is
705 not. */
706#endif
707#ifdef SIGABRT
708 SIGABRT, // abort
709
710#endif
711#ifdef SIGTRAP
712 SIGTRAP, // trace/breakpoint reached
713#endif
714#ifdef SIGEMT
715 SIGEMT, // emulation trap (may be used by profiler?)
716#endif
717#ifdef SIGSYS
718 SIGSYS, // invalid system call
719#endif
720#ifdef SIGXCPU
721 SIGXCPU, // cpu time limit exceeded
722#endif
723#ifdef SIGXFSZ
724 SIGXFSZ, // file size limit exceeded
725#endif
726 -1
727 };
728
729 // Make sure `strsignal' is properly initialised.
730 name (1);
731
732 // Remember app name if specified
733 if (applicationName && *applicationName)
734 s_applicationName = applicationName;
735
736 // Automatically initialise s_fatalFd on first access
737 if (s_fatalFd == IOFD_INVALID)
738 s_fatalFd = STDERR_HANDLE;
739
740 // Remember the fatal output fd if defined
741 if (fd != IOFD_INVALID)
742 s_fatalFd = fd;
743
744 // Now that we know the fd, setup a callback for dumping shared
745 // libraries via #SignalDumpLibs. This avoids having to allocate
746 // memory for the callback implementation in the middle of a fatal
747 // signal, and on the other hand avoids a global object which
748 // might not be initialised yet.
749 delete SignalDumpCallback;
751 (CreateCallback (&SignalDumpLibs, s_fatalFd));
752
753 // Remember the hooks if specified
754 if (hook)
755 s_fatalHook = hook;
756
757 if (mainreturn)
758 s_fatalReturn = mainreturn;
759
760 // Remember the new options
761 s_fatalOptions = options;
762
763 // Signal::fatal() requires this, otherwise weird things can happen.
764 // Programs not wanting to return to main should set FATAL_AUTO_EXIT.
765 assert (s_fatalReturn || (s_fatalOptions & FATAL_AUTO_EXIT));
766
767 // Install signal handlers.
768 if (options & FATAL_ON_QUIT)
769 for (unsigned sig = 0; hups [sig] != -1; ++sig)
770 handle (hups [sig], fatal);
771
772 for (unsigned sig = 0; fatals [sig] != -1; ++sig)
773 handle (fatals [sig], fatal);
774
775#ifdef SIGINT
776 // interrupt key from controlling terminal
777 if (options & FATAL_ON_INT)
778 handle (SIGINT, fatal);
779#endif
780
781#ifdef SIGUSR1
782 // program-defined signals SIGUSR1 and SIGUSR2
783 if (options & USR1_DUMP_CORE)
784 handle (SIGUSR1, (HandlerType) DebugAids::coredump);
785#endif
786
787#ifdef _WIN32
788 SetUnhandledExceptionFilter (&SEHFatal);
789#endif
790}
#define IOFD_INVALID
Invalid channel descriptor constant.
Definition SealCommon.h:20
#define STDERR_HANDLE
Callback1Rep< T1 > * CreateCallback(void(*function)(T1, T2), const T2 &fill_2)
static void coredump(int sig,...)
Drop a core dump and continue.
Callback1< const LibraryInfo & > InfoHandler
static void SignalDumpLibs(const SharedLibrary::LibraryInfo &info, IOFD fd)
Internal Signal::fataldump() dumper to produce the list of currently loaded shared libraries.
static SharedLibrary::InfoHandler * SignalDumpCallback
Shared library dump callback for Signal::fataldump().
virtual void handle(const Incident &inc)
Handle end of run incidents to save the metadata at that point.

◆ ATLAS_NOT_THREAD_SAFE() [2/5]

bool Signal::fatalDump Athena::ATLAS_NOT_THREAD_SAFE ( int sig,
siginfo_t * info,
void * extra,
IOFD fd,
unsigned options )

Definition at line 1519 of file SealSignal.cxx.

1522{
1523 const unsigned int buf_size = sizeof (buf);
1524 bool haveCore = false;
1525 if (sig < 0)
1526 {
1527 sig = -sig;
1528 haveCore = true;
1529 }
1530
1531 if (options & FATAL_DUMP_SIG)
1532 {
1533 MYWRITE (fd, "\n", 1);
1534 if (s_applicationName)
1535 {
1536 MYWRITE (fd, s_applicationName,
1537 STDC::strlen (s_applicationName));
1538 MYWRITE (fd, " ", 1);
1539 }
1540
1541 MYWRITE (fd, buf,
1542 snprintf (buf, SIGNAL_MESSAGE_BUFSIZE, "(pid=%ld ppid=%ld) received fatal signal %d"
1543 " (%.100s)%s\n",
1544 (long) ProcessInfo__pid (), (long) ProcessInfo__ppid (), // wlav :: -> __ (x2)
1545 sig, name (sig), haveCore ? " (core dumped)" : ""));
1546
1547 MYWRITE (fd, buf, snprintf(buf, buf_size, "signal context:\n"));
1548 dumpInfo (fd, buf, buf_size, sig, info);
1549 }
1550
1551 unsigned long sp = 0;
1552 if (options & FATAL_DUMP_CONTEXT)
1553 sp = dumpContext (fd, buf, buf_size, extra);
1554
1555 if (options & FATAL_DUMP_STACK)
1556 {
1557 MYWRITE (fd, buf, snprintf(buf, buf_size, "\nstack trace:\n"));
1558 if (s_lastSP) {
1559 MYWRITE (fd, buf, snprintf(buf, buf_size, "\n(backtrace failed; raw dump follows)\n"));
1560 MYWRITE (fd, buf, snprintf(buf, buf_size, "%016lx:", s_lastSP.load()));
1561 dumpMemory (fd, buf, buf_size, reinterpret_cast<void*>(s_lastSP.load()), 1024);
1562 MYWRITE (fd, buf, snprintf(buf, buf_size, "\n\n"));
1563 }
1564 else {
1565 s_lastSP = sp;
1566 DebugAids::stacktrace (fd);
1567 }
1568 s_lastSP = 0;
1569 }
1570
1571 if (options & FATAL_DUMP_LIBS)
1572 {
1573 MYWRITE (fd, buf, snprintf(buf, buf_size, "\nshared libraries present:\n"));
1575 catch (...) { ; }
1576 }
1577
1578 return true;
1579}
static Double_t sp
#define MYWRITE(fd, data, n)
static pid_t ProcessInfo__pid(void)
Get the process id.
static const int SIGNAL_MESSAGE_BUFSIZE
static pid_t ProcessInfo__ppid(void)
Get the parent process id.
static void loaded(InfoHandler &handler)
Iterate and provide information about all currently loaded shared libraries.
static char buf[SIGNAL_MESSAGE_BUFSIZE]
Dump application state information on a fatal signal.

◆ ATLAS_NOT_THREAD_SAFE() [3/5]

bool Signal::fatalDump Athena::ATLAS_NOT_THREAD_SAFE ( int sig,
siginfo_t * info,
void * x )

The quit signal handler.

The fatal signal handler.

This is the handler installed by #handleQuit(). Please use #handleQuit() and this method instead of installing your own handlers with #handle().

This handler first invokes the application hook if one was given to #handleQuit(). If the hook returns true, the signal handler for this signal (number sig) is reset to its default handler, and the signal is re-raised. This causes the program to exit via the signal and have a the correct exit status.

The application should do whatever is necessary for a graceful shutdown. Note however that this signal may arrive asynchronously at any time, hence it probably isn't safe to allocate memory, use the standard output streams, and so forth. What you can do is to set a flag, return false to return back to your application, detect the flag setting and drain your current event loop, and then quit. But do note that if #FATAL_AUTO_EXIT was set in call to #handleFatal(), #fatal() will call #quit() which in turn calls the application hook. Thus the hook should make sure it returns true if the application has crashed as noted in the documentation for <<QuitHook>>.

This is the handler installed by #handleFatal(). Please use #handleFatal() and this method instead of installing your handlers with #handle(). You should be able use the handler options to specify all the control you need.

The first thing this handler does is to reinstall itself for the benefit of platforms with single-delivery signals. Immediately after that it unblocks the delivery of that signal again, in case the signal handler itself gets in trouble. The next step is to check if the current crash level (the recursion of calls to #fatal(), see #fatalLevel()) exceeds the predefined limit of 4; if so, we give up and let the application die with this this signal. The handler then determines whether the signal is fatal: everything except SIGINT is, and SIGINT is fatal if #FATAL_ON_INT was set. If the signal is fatal, crash indicator is set (see #crashed()).

If this is not a nested fatal signal, the signal is fatal, and #FATAL_DUMP_CORE is set, the handler tries dump a core file. Then the handler will either attempt to quit or to return to the main program depending on #FATAL_AUTO_EXIT option setting. If it is set or this is a nested fatal signal, the handler will attempt to exit as follows: the application hook (or #fatalDump() in its absence) is invoked. If the hook returns true, #quit() is called; otherwise the signal handler will return (and crash or get an infinite sequence of fatal signals). Note that if an application hook is registered, #fataldump() is not called by default; the application hook must invoke it itself to get the dump.

If #FATAL_AUTO_EXIT is not set, the application must have registered a main return hook, which will be invoked. The hook must not return, but do a siglongjmp back to the main program (it should not throw unless all code is built with options that allow exceptions to be thrown from signal handlers). Note that the fatal signal may be asynchronous and may have arisen in code left in unsafe state, so returning back to the main program may not buy you much. It may make sense for a few things like rogue null pointer dereferences or floating point exceptions.

An interactive application using a main return hook should do something like this when the sigsetjmp in the main loop returns:

  • disable "main loop entered" status
  • inform the user about the fatal error (e.g. with a popup); the popup window should be precreated for best stability
  • reset any locks the application holds, especially for user interface, including status bars, wait icons etc.
  • suggest to run a debugger against the program right there
  • in a windowing system ungrab pointer, keyboard and the server
  • unblock the signal via #block(sig, false) as the operating system may think the signal is still being processed
  • add an idle processor to re-return the "main loop entered" once all pending event queue events have been drained
  • go onto processing gui events

Using a main return will most likely leak memory like a sieve, but in balance, the application just got a fatal signal and the leak is unlikely to be the greatest concern.

Definition at line 816 of file SealSignal.cxx.

817{
818 // Quit if no hook has been registered: we are coming in via
819 // FATAL_AUTO_EXIT in fatal and the application did not call
820 // handleQuit.
821 if (! s_quitHook || (*s_quitHook) (sig, info, x))
822 {
823 // Reactivate the default signal handling behaviour for this
824 // signal, which is to terminate the application one way or
825 // the other. Then exit through the signal. This makes the
826 // process exit status correct.
827 revert (sig);
828 raise (sig);
829 }
830}
#define x

◆ ATLAS_NOT_THREAD_SAFE() [4/5]

void Signal::handleQuit Athena::ATLAS_NOT_THREAD_SAFE ( QuitHook hook)

Definition at line 580 of file SealSignal.cxx.

581{
582 static int hups [] = {
583#ifdef SIGHUP
584 // hang up (lost terminal or process group leader)
585 SIGHUP,
586#endif
587#ifdef SIGTERM
588 // terminate (e.g. system going down)
589 SIGTERM,
590#endif
591#ifdef SIGQUIT
592 // user request to quit and leave debuggable state (from quit
593 // key on controlling terminal)
594 SIGQUIT,
595#endif
596 -1
597 };
598
599 if (hook)
600 s_quitHook = hook;
601
602 for (unsigned sig = 0; hups [sig] != -1; ++sig)
603 handle (hups [sig], quit);
604}

◆ ATLAS_NOT_THREAD_SAFE() [5/5]

bool Signal::crashed Athena::ATLAS_NOT_THREAD_SAFE ( void )

Return the file descriptor #fataldump() uses for output.

Return the crash status indicator: true if a fatal signal has been received since the program started.

Return the depth to which #fatal() is currently recursively entered, or zero if #fatal() is not currently active.

Return the current application quit signal hook.

Return the current fatal signal handling options.

Return the application fatal signal return hook.

Return the application fatal signal hook.

Registered through #handleFatal().

Registered through #handleFatal().

See also
#fatal()

Registered through #handleFatal().

See also
#fatal().

Set on invocation to #handleFatal().

Registered through #handleQuit().

Use this method in application fatal hook to decide which operations are safe to perform. For example, if the attempts to notify the user result in further signals, it is best to avoid such attempts at deeper recursion levels. Currently #fatal() ceases to call the application's hooks and forces termination if the nesting level reaches 4.

Set if #fatal() is entered with a fatal signal.

Definition at line 103 of file ROOTMessageFilterSvc.cxx.

103 {
104
105 // Print the received configuration.
106 ATH_MSG_DEBUG("Using: " << m_suppressionRules);
107
108 // Extend the global list of suppression rules with the ones configured on
109 // this service.
110 for (const auto& rule : m_suppressionRules.value()) {
111 s_data.m_suppressionRules.insert({
112 std::regex{std::get<0>(rule)}, // locationPattern
113 std::regex{std::get<1>(rule)}, // messagePattern
114 std::get<2>(rule), // severity
115 std::hash<std::string>{}(std::get<0>(rule) + std::get<1>(rule) +
116 std::to_string(std::get<2>(rule))) // hash
117 });
118 }
119
120 // Set up our own error handler, while remembering the original one. But only
121 // if we have not set it up already.
122 if (!s_data.m_errorHandler) {
123 s_data.m_errorHandler = ::SetErrorHandler(::errorHandler);
124 }
125
126 // Return gracefully.
127 return StatusCode::SUCCESS;
128}
#define ATH_MSG_DEBUG(x)
static void errorHandler()

◆ back()

return m_collEvts Athena::back ( )

◆ find_coll_idx()

Athena::find_coll_idx ( - 1,
coll_idx ,
tuple_idx  )

◆ getMessageSvc() [1/2]

IMessageSvc * Athena::getMessageSvc ( bool quiet = false)

Definition at line 20 of file getMessageSvc.cxx.

20{ return getMessageSvc( Options::Lazy, quiet ); }
IMessageSvc * getMessageSvc(bool quiet=false)

◆ getMessageSvc() [2/2]

IMessageSvc * Athena::getMessageSvc ( const Options::CreateOptions o,
bool quiet = false )

Definition at line 21 of file getMessageSvc.cxx.

21 {
22
23 // We cache the MessageSvc, but only once it has been found. This ensures that an
24 // early call to this method (before MessageSvc is available) does not prevent
25 // from finding it in subsequent calls. The limited use of ServiceHandle for this
26 // purpose should be thread-safe:
27 static ServiceHandle<IMessageSvc> msgSvc ATLAS_THREAD_SAFE ("MessageSvc", "getMessageSvc");
28
29 IMessageSvc* svc = nullptr;
30 try {
31 svc = msgSvc.get();
32 if (svc) {
33 svc->addRef(); // even if cached, maintain correct ref-count
34 return svc;
35 }
36
37 const bool warn = !(quiet || Athena::getMessageSvcQuiet);
38 if ( ((opt==Athena::Options::Lazy && !Gaudi::svcLocator()->existsService("MessageSvc")) ||
39 msgSvc.retrieve().isFailure()) && warn ) {
40 std::cerr << "Athena::getMessageSvc: WARNING MessageSvc not found, will use std::cout" << std::endl;
41 }
42 svc = msgSvc.get();
43 }
44 catch (const GaudiException& e)
45 {
46 std::cerr << "Athena::getMessageSvc: WARNING Got Gaudi exception " << e
47 << "; will use std::out" << std::endl;
48 return nullptr;
49 }
50
51
52 return svc;
53}
#define ATLAS_THREAD_SAFE
std::atomic< bool > getMessageSvcQuiet
Set this to force off the warning messages from getMessageSvc (in unit tests, for example).
AthROOTErrorHandlerSvc * svc

◆ outputLevel()

int Athena::outputLevel ( const IMessageSvc * ims,
const std::string & source )

Definition at line 60 of file getMessageSvc.cxx.

60 {
61 if (ims) return ims->outputLevel(source);
62 else return MSG::INFO;
63}

◆ RecyclableDataObject()

template<typename... ARGS>
Athena::RecyclableDataObject ( std::shared_ptr< queue_t > queue,
ARGS &&... args )

Helper for recycling objects from event to event.

In some cases, one wants to reuse already-allocated objects from event to event, rather than deleting and recreating them each time. This has typically been done for complicated objects, such as classes deriving from IdentfiableContainer.

Some care is obviously needed for this to work in a MT job. Rather than holding a pointer to a specific object from a class member, we instead maintain a concurrent_queue of pointers to objects. When we want an object, we get one from the queue; if the queue is empty, then we allocate a new one.

The object used should derive from DataObject. We bump the reference count by 1 when the object is allocated so that it won't get deleted by StoreGate. We also override release() so that when the reference count goes back to 1 it is `recycled'. When this happens, we call the recycle() method on the object (which should probably be protected) and put the object back on the queue to be allocated again.

Example use: *

class MyDataObj : public DataObject { ...
public:
MyDataObj (bool createColl); ...
protected:
void recycle();
... };
class MyConverter { ...
private:
RecyclableDataQueue<MyDataObj> m_queue;
... };
StatusCode MyConverter::createObj (...) { ...
MyDataObj* obj = m_queue.get (true);
std::shared_ptr< queue_t > m_queue
The queue on which this object will be placed when it is recycled.
::StatusCode StatusCode
StatusCode definition for legacy code.

DOBJ should derive from DataObject and should provide a member recycle().

Implementation note: one needs to be careful about the order in which objects are deleted during finalization. In particular, it is possible for a Gaudi component that holds a RecyclableDataQueue as a member to be deleted while there are still associated data objects registered in the event store. To be robust against this, we allocate the actual queue object separately from RecyclableDataQueue and manage it with shared_ptr; RecyclableDataObject then references the queue with a shared_ptr. */ template <class DOBJ> class RecyclableDataObject : public DOBJ { public: / Underlying queue type holding these objects. typedef tbb::concurrent_queue<DOBJ*> queue_t;

/**

Constructor.

Parameters
queueQueue on which this object will be entered when it is released.
args...Additional arguments to pass to the DOBJ constructor.

◆ release()

virtual unsigned long Athena::release ( )
overridevirtual

DataObject release method.

This overrides the release() method of DataObject. Once the reference count falls back to 1 (meaning that the object is no longer referenced from StoreGate), we recycle the object back to the queue.

◆ reportMessage()

void Athena::reportMessage ( IMessageSvc * ims,
const std::string & source,
int type,
const std::string & message )

Wrappers for some of the IMessageSvc methods These can be used from libraries without explicit Gaudi dependency via weak linking.

(see e.g. TrigConf::MsgStream in TrigConfBase)

DO NOT MODIFY THE SIGNATURE OF THESE METHODS WITHOUT UPDATING THE TRIGCONF SIDE !!!

Definition at line 56 of file getMessageSvc.cxx.

56 {
57 if (ims) ims->reportMessage(source, type, message);
58}

◆ setOutputLevel()

void Athena::setOutputLevel ( IMessageSvc * ims,
const std::string & source,
int level )

Definition at line 65 of file getMessageSvc.cxx.

65 {
66 if(ims) ims->setOutputLevel(source, level);
67}

◆ SignalDumpLibs()

void Athena::SignalDumpLibs ( const SharedLibrary::LibraryInfo & info,
IOFD fd )
static

Internal #Signal::fataldump() dumper to produce the list of currently loaded shared libraries.

Called for every library detected by SharedLibrary::loaded().

Parameters
infoInformation about this particular library.
fdThe file descriptor to output to.

Definition at line 174 of file SealSignal.cxx.

175{
176 const int buf_size = BitTraits<unsigned long>::HexDigits + 5;
177 char buf [buf_size];
178 MYWRITE (fd, buf, snprintf (buf, buf_size, " 0x%08lx ", info.m_text_start));
179 MYWRITE (fd, info.m_filename, strlen (info.m_filename));
180 MYWRITE (fd, "\n", 1);
181}

◆ typeinfoName()

std::string Athena::typeinfoName ( const std::type_info & ti)

Convert a type_info to a demangled string.

Parameters
tiThe type_info to convert.

A wrapper around System::typeinfoName. Moved out-of-line so that this header does not need to depend on System.h.

Definition at line 23 of file AthenaKernel/src/ClassName.cxx.

24{
25 return System::typeinfoName (ti);
26}

Variable Documentation

◆ buf

char Athena::buf[SIGNAL_MESSAGE_BUFSIZE]
static

Dump application state information on a fatal signal.

Use this method to dump program state on a delivery of a fatal signal. #fatal() uses this function automatically if no fatal handler hook has not been registered by the application.

This function attempts to be as maximally robust given that it runs in a signal handler in conditions where the program by definition is unstable. In other words, it allocates no memory and writes its output directly to a file descriptor with direct system calls. For this reason some initialisation is required; use #handleFatal() to register the current application name and an output file descriptor, preferably as early in the program as possible.

The dump will consist of the following items:

  • if #FATAL_DUMP_SIG option is set:
    • the application name if registered with #handleFatal()
    • a title describing telling which fatal signal has been received (defined by sig, the signal number, or its negative if core has been dumped)
    • information available from the info argument
  • if #FATAL_DUMP_CONTEXT option is set, all the available CPU context information like registers
  • if #FATAL_DUMP_STACK option is set, the stack trace
  • if #FATAL_DUMP_LIBS option is set, the list of currently loaded shared libraries

This always returns true so it is convenient for the application fatal hook to return with a call to this function.

Note that this function will not flush std::cerr or stderr before producing output, for stability reasons. If the streams have unflushed output in their buffers, that output may get mixed with unbuffered direct output from this function. If you wish to avoid this mixup and are willing to take the risk that those calls might crash, install an application hook that flushes the streams and then calls this function.

Definition at line 1512 of file SealSignal.cxx.

◆ const

Athena::const
Initial value:
{
long coll_idx, tuple_idx

helper method to get the collection index (into m_inputCollectionsName) and tuple index (into m_tupleNames') for a given event index evtidx`.

returns -1 if not found. */ void RootNtupleEventSelector::find_coll_idx (int evtidx, long& coll_idx, long& tuple_idx) const { coll_idx = -1; tuple_idx = -1;

std::cout << "--find_coll_idx(" << evtidx << ")..." << std::endl << "--collsize: " << m_collEvts.size() << std::endl; for (size_t ituple = 0; ituple < m_collEvts.size(); ++ituple) { for (size_t icoll = 0; icoll < m_collEvts[ituple].size(); ++icoll) { CollMetaData &itr = m_collEvts[ituple][icoll]; if (itr.min_entries == -1) { TTree *tree = fetchNtuple(m_inputCollectionsName.value()[icoll], m_tupleNames[ituple]); if (tree) { long offset = 0; if (icoll > 0) { offset = m_collEvts[ituple][icoll-1].max_entries; } else if (ituple > 0) { offset = m_collEvts[ituple-1].back().max_entries; } itr.entries = tree->GetEntriesFast(); itr.min_entries = offset; itr.max_entries = offset + itr.entries; } else { throw "RootNtupleEventSelector: Unable to fetch ntuple"; } } std::cout << "--[" << i << "] => [" << itr.min_entries << ", " << itr.max_entries << ") evtidx=[" << evtidx << "]" << std::endl; if (itr.min_entries <= evtidx && evtidx < itr.max_entries) { coll_idx = icoll; tuple_idx = ituple; return; } } } }

/return total number of events in all TTree int RootNtupleEventSelector::size (Context& /*refCtxt

Definition at line 1305 of file RootNtupleEventSelector.cxx.

◆ getMessageSvcQuiet

std::atomic< bool > Athena::getMessageSvcQuiet
extern

Set this to force off the warning messages from getMessageSvc (in unit tests, for example).

Definition at line 18 of file getMessageSvc.cxx.

◆ m_queue

std::shared_ptr<queue_t> Athena::m_queue
private

The queue on which this object will be placed when it is recycled.

Definition at line 115 of file RecyclableDataObject.h.

◆ SignalDumpCallback

SharedLibrary::InfoHandler* Athena::SignalDumpCallback = 0
static

Shared library dump callback for #Signal::fataldump().

Allocated at initialisation time in #Signal::handleFatal() so that we won't need to allocate memory in the middle of a fatal handler. This variable is deliberately private to this file (to keep Signal headers from referring to SharedLibrary for the local class).

Definition at line 117 of file SealSignal.cxx.