ATLAS Offline Software
AthenaSummarySvc.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ATHENASERVICES_ATHENASUMSVC_H
6 #define ATHENASERVICES_ATHENASUMSVC_H
7 
8 /*****************************************************************************
9  *
10  * AthenaSummarySvc.h
11  * AthenaSummarySvc
12  *
13  * Author: Charles Leggett
14  *
15  * Provides summary at end of athena job
16  *
17  *****************************************************************************/
18 
23 
24 #include "GaudiKernel/StatusCode.h"
25 #include "GaudiKernel/ServiceHandle.h"
26 #include "GaudiKernel/IIncidentSvc.h"
27 #include "GaudiKernel/IIncidentListener.h"
28 
29 #include <list>
30 #include <map>
31 #include <string>
32 #include <fstream>
33 
34 
36  public extends<AthService, IIncidentListener, IAthenaSummarySvc> {
37 
38 public:
39 
40  AthenaSummarySvc( const std::string& name, ISvcLocator* svc );
41 
42  virtual StatusCode initialize() override;
43  virtual StatusCode reinitialize() override;
44  virtual StatusCode finalize() override;
45 
46  virtual StatusCode createSummary() override;
47  virtual void setStatus(int s) override {m_status = s;}
48  virtual void addListener(const std::string& incident_name) override;
49  virtual void addSummary(const std::string& dict_key, const std::string& data) override;
50  virtual const std::string& getOutputFile() const override { return m_summaryFile; }
51 
52 private:
53 
54  void createDict(std::ofstream& );
55  void createASCII(std::ofstream& );
56  virtual void handle(const Incident &inc) override;
57  static void newHandler();
58 
59  // properties
60  StringProperty m_summaryFile{this, "SummaryFile", "AthSummary.txt",
61  "Output File"};
62  StringProperty m_summaryFormat{this, "SummaryFileFormat", "both",
63  "output format: one of 'ascii', 'python', 'both'"};
64  StringArrayProperty m_extraInc{this, "ExtraIncidents", {},
65  "user incidets to monitor"};
66  StringArrayProperty m_keywords{this, "keywords", {},
67  "kewords to scan for in MessageSvc. WARNING: THIS IS VERY SLOW!!!"};
68 
69  // member data
72 
73  static char* s_block ATLAS_THREAD_SAFE; // used during initialize
74  static bool s_badalloc ATLAS_THREAD_SAFE; // flag set after bad-alloc
75 
76  std::list<std::string> m_inputFilesRead;
77  std::list<std::string> m_outputFiles;
78  std::list<std::string> m_outputFilesError;
79 
80  std::map< std::string, std::map<std::string, int> > m_extraIncidents;
81  std::vector< std::pair<std::string, std::string> > m_extraInfo;
82 
83  std::new_handler m_new{nullptr};
84  int m_status{0};
85  unsigned int m_eventsRead{0};
86  unsigned int m_eventsWritten{0};
87  unsigned int m_eventsSkipped{0};
88  unsigned int m_runs{0};
89 };
90 
91 #endif
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
AthenaSummarySvc::AthenaSummarySvc
AthenaSummarySvc(const std::string &name, ISvcLocator *svc)
Definition: AthenaSummarySvc.cxx:122
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
AthenaSummarySvc::ATLAS_THREAD_SAFE
static char *s_block ATLAS_THREAD_SAFE
Definition: AthenaSummarySvc.h:82
AthenaSummarySvc::handle
virtual void handle(const Incident &inc) override
Definition: AthenaSummarySvc.cxx:285
AthenaSummarySvc::m_summaryFile
StringProperty m_summaryFile
Definition: AthenaSummarySvc.h:69
AthenaSummarySvc::reinitialize
virtual StatusCode reinitialize() override
Definition: AthenaSummarySvc.cxx:194
AthenaSummarySvc::createASCII
void createASCII(std::ofstream &)
Definition: AthenaSummarySvc.cxx:366
AthenaSummarySvc::getOutputFile
virtual const std::string & getOutputFile() const override
Definition: AthenaSummarySvc.h:59
AthenaSummarySvc::finalize
virtual StatusCode finalize() override
Definition: AthenaSummarySvc.cxx:203
AthenaSummarySvc::m_extraInc
StringArrayProperty m_extraInc
Definition: AthenaSummarySvc.h:73
AthenaSummarySvc::m_new
std::new_handler m_new
Definition: AthenaSummarySvc.h:92
AthenaSummarySvc::m_extraInfo
std::vector< std::pair< std::string, std::string > > m_extraInfo
Definition: AthenaSummarySvc.h:90
AthenaSummarySvc
Definition: AthenaSummarySvc.h:36
AthenaSummarySvc::m_summaryFormat
StringProperty m_summaryFormat
Definition: AthenaSummarySvc.h:71
AthenaSummarySvc::m_runs
unsigned int m_runs
Definition: AthenaSummarySvc.h:97
AthenaSummarySvc::m_eventsRead
unsigned int m_eventsRead
Definition: AthenaSummarySvc.h:94
ILoggedMessageSvc
Definition: ILoggedMessageSvc.h:21
AthenaSummarySvc::m_eventsSkipped
unsigned int m_eventsSkipped
Definition: AthenaSummarySvc.h:96
AthenaSummarySvc::setStatus
virtual void setStatus(int s) override
Definition: AthenaSummarySvc.h:56
ILoggedMessageSvc.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
AthenaSummarySvc::p_incSvc
ServiceHandle< IIncidentSvc > p_incSvc
Definition: AthenaSummarySvc.h:79
AthenaSummarySvc::initialize
virtual StatusCode initialize() override
Definition: AthenaSummarySvc.cxx:131
AthenaSummarySvc::m_status
int m_status
Definition: AthenaSummarySvc.h:93
AthenaSummarySvc::createSummary
virtual StatusCode createSummary() override
Definition: AthenaSummarySvc.cxx:335
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
AthenaSummarySvc::newHandler
static void newHandler()
Definition: AthenaSummarySvc.cxx:245
AthenaSummarySvc::addSummary
virtual void addSummary(const std::string &dict_key, const std::string &data) override
Definition: AthenaSummarySvc.cxx:233
AthenaSummarySvc::m_outputFiles
std::list< std::string > m_outputFiles
Definition: AthenaSummarySvc.h:86
AthenaSummarySvc::m_extraIncidents
std::map< std::string, std::map< std::string, int > > m_extraIncidents
Definition: AthenaSummarySvc.h:89
AthenaSummarySvc::m_outputFilesError
std::list< std::string > m_outputFilesError
Definition: AthenaSummarySvc.h:87
AthenaSummarySvc::m_inputFilesRead
std::list< std::string > m_inputFilesRead
Definition: AthenaSummarySvc.h:85
AthenaSummarySvc::m_keywords
StringArrayProperty m_keywords
Definition: AthenaSummarySvc.h:75
AthenaSummarySvc::createDict
void createDict(std::ofstream &)
Definition: AthenaSummarySvc.cxx:472
AthService.h
AthenaSummarySvc::p_logMsg
ILoggedMessageSvc * p_logMsg
Definition: AthenaSummarySvc.h:80
AthenaSummarySvc::addListener
virtual void addListener(const std::string &incident_name) override
Definition: AthenaSummarySvc.cxx:217
checker_macros.h
Define macros for attributes used to control the static checker.
AthenaSummarySvc::m_eventsWritten
unsigned int m_eventsWritten
Definition: AthenaSummarySvc.h:95
IAthenaSummarySvc.h
ServiceHandle< IIncidentSvc >