ATLAS Offline Software
OutputStreamSequencerSvc.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef OUTPUTSTREAMSEQUENCERSVC_H
6 #define OUTPUTSTREAMSEQUENCERSVC_H
7 
13 #include "GaudiKernel/ServiceHandle.h"
14 #include "Gaudi/Property.h" // no forward decl: typedef
15 #include "GaudiKernel/IIncidentListener.h"
17 
18 #include <memory>
19 #include <map>
20 #include <mutex>
21 
22 // Forward declarations
23 class MetaDataSvc;
24 
25 static const InterfaceID IID_OutputStreamSequencerSvc("OutputStreamSequencerSvc", 1, 0);
26 
27 template <class TYPE> class SvcFactory;
28 
33  virtual public IIncidentListener {
34 
35  public:
36  typedef std::pair<std::string,std::string> RangeReport_t; // (RangeID,RangeFileName)
37  typedef std::unique_ptr<RangeReport_t> RangeReport_ptr;
38 
39 public: // Constructor and Destructor
41  OutputStreamSequencerSvc(const std::string& name, ISvcLocator* pSvcLocator);
43  virtual ~OutputStreamSequencerSvc();
44 
46  static const InterfaceID& interfaceID() { return IID_OutputStreamSequencerSvc; }
47 
48 public: // Non-static members
50  virtual StatusCode initialize() override final;
52  virtual StatusCode finalize() override final;
54  virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvInterface) override final;
55 
57  virtual void handle(const Incident& /*inc*/) override final;
58 
60  std::string buildSequenceFileName(const std::string&);
61  void publishRangeReport(const std::string& outputFile);
63 
65  std::string incidentName() const { return m_incidentName.value(); }
66 
68  std::string currentRangeID() const;
69 
71  std::string setRangeID(const std::string & rangeID);
72 
74  bool inUse() const;
75 
77  static bool inConcurrentEventsMode();
78 
80  const std::string& lastIncident() { return m_lastIncident; }
81 
82 private: // data
84 
87 
89  std::string m_currentRangeID;
90 
92  std::string m_lastFileName;
93 
95  std::string m_lastIncident;
96 
98  std::vector<std::string> m_rangeIDinSlot;
99 
100 private: // properties
102  StringProperty m_incidentName {this, "SequenceIncidentName", "",
103  "Name of the incident that signals the next Event Range start" };
105  BooleanProperty m_reportingOn {this, "ReportingOn", false,
106  "If True, keep info about Ranges for getRangeReport() calls"};
107 
108  std::map<std::string,std::string> m_fnToRangeId;
110 
112 };
113 
114 #endif
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
OutputStreamSequencerSvc::incidentName
std::string incidentName() const
The name of the incident that starts a new event sequence.
Definition: OutputStreamSequencerSvc.h:65
OutputStreamSequencerSvc::inConcurrentEventsMode
static bool inConcurrentEventsMode()
Are there concurrent events? (threads>1)
Definition: OutputStreamSequencerSvc.cxx:84
OutputStreamSequencerSvc::m_lastFileName
std::string m_lastFileName
Recently constructed full file name (useful in single threaded processing)
Definition: OutputStreamSequencerSvc.h:92
OutputStreamSequencerSvc::lastIncident
const std::string & lastIncident()
Last incident type that was handled.
Definition: OutputStreamSequencerSvc.h:80
OutputStreamSequencerSvc::m_fnToRangeId
std::map< std::string, std::string > m_fnToRangeId
Definition: OutputStreamSequencerSvc.h:108
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
SvcFactory
Definition: AthCnvSvc.h:28
OutputStreamSequencerSvc::OutputStreamSequencerSvc
OutputStreamSequencerSvc(const std::string &name, ISvcLocator *pSvcLocator)
Standard Service Constructor.
Definition: OutputStreamSequencerSvc.cxx:20
OutputStreamSequencerSvc::inUse
bool inUse() const
Is the service in active use? (true after the first range incident is handled)
Definition: OutputStreamSequencerSvc.cxx:89
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:562
OutputStreamSequencerSvc::m_mutex
std::mutex m_mutex
Definition: OutputStreamSequencerSvc.h:111
OutputStreamSequencerSvc::RangeReport_ptr
std::unique_ptr< RangeReport_t > RangeReport_ptr
Definition: OutputStreamSequencerSvc.h:37
OutputStreamSequencerSvc::RangeReport_t
std::pair< std::string, std::string > RangeReport_t
Definition: OutputStreamSequencerSvc.h:36
compareGeometries.outputFile
string outputFile
Definition: compareGeometries.py:25
OutputStreamSequencerSvc::setRangeID
std::string setRangeID(const std::string &rangeID)
set the RangeID (possibly temporarily) so the right Range Filename may be generated
Definition: OutputStreamSequencerSvc.cxx:208
OutputStreamSequencerSvc::m_lastIncident
std::string m_lastIncident
Last incident type that was handled.
Definition: OutputStreamSequencerSvc.h:95
OutputStreamSequencerSvc::initialize
virtual StatusCode initialize() override final
Required of all Gaudi services:
Definition: OutputStreamSequencerSvc.cxx:30
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
OutputStreamSequencerSvc::m_reportingOn
BooleanProperty m_reportingOn
Flag to switch on storage of reporting info in fnToRangeId.
Definition: OutputStreamSequencerSvc.h:105
AthService
Definition: AthService.h:32
MetaDataSvc
Manages the content of the metadata stores.
Definition: MetaDataSvc.h:95
OutputStreamSequencerSvc::queryInterface
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvInterface) override final
Required of all Gaudi services: see Gaudi documentation for details.
Definition: OutputStreamSequencerSvc.cxx:72
OutputStreamSequencerSvc::m_metaDataSvc
ServiceHandle< MetaDataSvc > m_metaDataSvc
Definition: OutputStreamSequencerSvc.h:83
OutputStreamSequencerSvc::m_rangeIDinSlot
std::vector< std::string > m_rangeIDinSlot
EventRange ID for all slots.
Definition: OutputStreamSequencerSvc.h:98
OutputStreamSequencerSvc::currentRangeID
std::string currentRangeID() const
The current Event Range ID (only one range is returned)
Definition: OutputStreamSequencerSvc.cxx:197
OutputStreamSequencerSvc::m_currentRangeID
std::string m_currentRangeID
Current EventRange ID constructed on the last NextRange incident.
Definition: OutputStreamSequencerSvc.h:89
OutputStreamSequencerSvc
This class provides configuration properties to enable OutputStream file sequences.
Definition: OutputStreamSequencerSvc.h:33
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
OutputStreamSequencerSvc::handle
virtual void handle(const Incident &) override final
Incident service handle.
Definition: OutputStreamSequencerSvc.cxx:94
OutputStreamSequencerSvc::getRangeReport
RangeReport_ptr getRangeReport()
Definition: OutputStreamSequencerSvc.cxx:228
OutputStreamSequencerSvc::m_fileSequenceNumber
int m_fileSequenceNumber
The event sequence number.
Definition: OutputStreamSequencerSvc.h:86
OutputStreamSequencerSvc::m_finishedRange
std::map< std::string, std::string >::iterator m_finishedRange
Definition: OutputStreamSequencerSvc.h:109
OutputStreamSequencerSvc::interfaceID
static const InterfaceID & interfaceID()
Retrieve interface ID.
Definition: OutputStreamSequencerSvc.h:46
OutputStreamSequencerSvc::publishRangeReport
void publishRangeReport(const std::string &outputFile)
Definition: OutputStreamSequencerSvc.cxx:222
AthService.h
OutputStreamSequencerSvc::finalize
virtual StatusCode finalize() override final
Required of all Gaudi services:
Definition: OutputStreamSequencerSvc.cxx:64
OutputStreamSequencerSvc::~OutputStreamSequencerSvc
virtual ~OutputStreamSequencerSvc()
Destructor.
Definition: OutputStreamSequencerSvc.cxx:27
OutputStreamSequencerSvc::buildSequenceFileName
std::string buildSequenceFileName(const std::string &)
Returns sequenced file name for output stream.
Definition: OutputStreamSequencerSvc.cxx:170
OutputStreamSequencerSvc::m_incidentName
StringProperty m_incidentName
SequenceIncidentName, incident name for triggering file sequencing.
Definition: OutputStreamSequencerSvc.h:102
ServiceHandle< MetaDataSvc >