ATLAS Offline Software
Loading...
Searching...
No Matches
OutputStreamSequencerSvc.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef OUTPUTSTREAMSEQUENCERSVC_H
6#define OUTPUTSTREAMSEQUENCERSVC_H
7
12
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
23class MetaDataSvc;
24
25
29class OutputStreamSequencerSvc : public extends<AthService,
30 IIncidentListener> {
31
32 public:
33 using IService::interfaceID;
34 typedef std::pair<std::string,std::string> RangeReport_t; // (RangeID,RangeFileName)
35 typedef std::unique_ptr<RangeReport_t> RangeReport_ptr;
36
37public: // Constructor and Destructor
38
40 OutputStreamSequencerSvc(const std::string& name, ISvcLocator* pSvcLocator);
43
44public: // Non-static members
46 virtual StatusCode initialize() override final;
48 virtual StatusCode finalize() override final;
49
51 virtual void handle(const Incident& /*inc*/) override final;
52
54 std::string buildSequenceFileName(const std::string&);
55 void publishRangeReport(const std::string& outputFile);
57
59 std::string incidentName() const { return m_incidentName.value(); }
60
62 std::string currentRangeID() const;
63
65 std::string setRangeID(const std::string & rangeID);
66
68 bool inUse() const;
69
71 static bool inConcurrentEventsMode();
72
74 const std::string& lastIncident() { return m_lastIncident; }
75
76private: // data
78
81
83 std::string m_currentRangeID;
84
86 std::string m_lastFileName;
87
89 std::string m_lastIncident;
90
92 std::vector<std::string> m_rangeIDinSlot;
93
94private: // properties
96 StringProperty m_incidentName {this, "SequenceIncidentName", "",
97 "Name of the incident that signals the next Event Range start" };
98
99 BooleanProperty m_reportingOn {this, "ReportingOn", false,
100 "If True, keep info about Ranges for getRangeReport() calls"};
101
104 BooleanProperty m_replaceRangeMode{
105 this, "ReplaceRangeMode", false,
106 "If True, everything between [ and ] in the output filename is treated "
107 "as a comma-separated list, and the range_idth element of the list is "
108 "selected"};
109
110 std::map<std::string,std::string> m_fnToRangeId;
111 std::map<std::string,std::string>::iterator m_finishedRange{};
112
113 mutable std::mutex m_mutex;
114};
115
116#endif
Manages the content of the metadata stores.
Definition MetaDataSvc.h:89
std::pair< std::string, std::string > RangeReport_t
void publishRangeReport(const std::string &outputFile)
bool inUse() const
Is the service in active use? (true after the first range incident is handled)
OutputStreamSequencerSvc(const std::string &name, ISvcLocator *pSvcLocator)
Standard Service Constructor.
virtual void handle(const Incident &) override final
Incident service handle.
std::string currentRangeID() const
The current Event Range ID (only one range is returned)
std::string m_lastFileName
Recently constructed full file name (useful in single threaded processing)
StringProperty m_incidentName
SequenceIncidentName, incident name for triggering file sequencing.
std::string setRangeID(const std::string &rangeID)
set the RangeID (possibly temporarily) so the right Range Filename may be generated
ServiceHandle< MetaDataSvc > m_metaDataSvc
int m_fileSequenceNumber
The event sequence number.
BooleanProperty m_replaceRangeMode
Flag to put in ReplaceRangeMode (i.e.
virtual StatusCode finalize() override final
Required of all Gaudi services:
std::string incidentName() const
The name of the incident that starts a new event sequence.
std::string buildSequenceFileName(const std::string &)
Returns sequenced file name for output stream.
std::string m_currentRangeID
Current EventRange ID constructed on the last NextRange incident.
const std::string & lastIncident()
Last incident type that was handled.
virtual ~OutputStreamSequencerSvc()
Destructor.
std::vector< std::string > m_rangeIDinSlot
EventRange ID for all slots.
BooleanProperty m_reportingOn
Flag to switch on storage of reporting info in fnToRangeId.
static bool inConcurrentEventsMode()
Are there concurrent events? (threads>1)
std::string m_lastIncident
Last incident type that was handled.
std::unique_ptr< RangeReport_t > RangeReport_ptr
std::map< std::string, std::string >::iterator m_finishedRange
virtual StatusCode initialize() override final
Required of all Gaudi services:
std::map< std::string, std::string > m_fnToRangeId
STL namespace.