ATLAS Offline Software
Loading...
Searching...
No Matches
OutputStreamSequencerSvc.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 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"
18
19#include <memory>
20#include <map>
21#include <mutex>
22
23// Forward declarations
24class MetaDataSvc;
25
26
30class OutputStreamSequencerSvc : public extends<AthService,
31 IIncidentListener> {
32
33 public:
34 using IService::interfaceID;
35 typedef std::pair<std::string,std::string> RangeReport_t; // (RangeID,RangeFileName)
36 typedef std::unique_ptr<RangeReport_t> RangeReport_ptr;
37
38public: // Constructor and Destructor
39
41 OutputStreamSequencerSvc(const std::string& name, ISvcLocator* pSvcLocator);
44
45public: // Non-static members
47 virtual StatusCode initialize() override final;
49 virtual StatusCode finalize() override final;
50
52 virtual void handle(const Incident& /*inc*/) override final;
53
55 std::string buildSequenceFileName(const EventContext& ctx, const std::string&);
56 void publishRangeReport(const std::string& outputFile);
58
60 std::string incidentName() const { return m_incidentName.value(); }
61
63 std::string currentRangeID(const EventContext& ctx) const;
64
66 std::string setRangeID(const EventContext& ctx, const std::string & rangeID);
67
69 bool inUse() const;
70
72 static bool inConcurrentEventsMode();
73
75 const std::string& lastIncident() { return m_lastIncident; }
76
77private: // data
79
82
84 std::string m_currentRangeID;
85
87 std::string m_lastFileName;
88
90 std::string m_lastIncident;
91
94
95private: // properties
97 StringProperty m_incidentName {this, "SequenceIncidentName", "",
98 "Name of the incident that signals the next Event Range start" };
99
100 BooleanProperty m_reportingOn {this, "ReportingOn", false,
101 "If True, keep info about Ranges for getRangeReport() calls"};
102
105 BooleanProperty m_replaceRangeMode{
106 this, "ReplaceRangeMode", false,
107 "If True, everything between [ and ] in the output filename is treated "
108 "as a comma-separated list, and the range_idth element of the list is "
109 "selected"};
110
111 std::map<std::string,std::string> m_fnToRangeId;
112 std::map<std::string,std::string>::iterator m_finishedRange{};
113
114 mutable std::mutex m_mutex;
115};
116
117#endif
Maintain a set of objects, one per slot.
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)
SG::SlotSpecificObj< std::string, SG::InvalidSlot::Enabled > m_rangeIDinSlot
EventRange ID for all slots.
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.
std::string buildSequenceFileName(const EventContext &ctx, const std::string &)
Returns sequenced file name for output stream.
virtual void handle(const Incident &) override final
Incident service handle.
std::string m_lastFileName
Recently constructed full file name (useful in single threaded processing).
std::string currentRangeID(const EventContext &ctx) const
The current Event Range ID (only one range is returned).
StringProperty m_incidentName
SequenceIncidentName, incident name for triggering file sequencing.
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 m_currentRangeID
Current EventRange ID constructed on the last NextRange incident.
const std::string & lastIncident()
Last incident type that was handled.
virtual ~OutputStreamSequencerSvc()
Destructor.
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::string setRangeID(const EventContext &ctx, const std::string &rangeID)
set the RangeID (possibly temporarily) so the right Range Filename may be generated
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
Maintain a set of objects, one per slot.
STL namespace.