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 
29 class 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 
37 public: // Constructor and Destructor
38 
40  OutputStreamSequencerSvc(const std::string& name, ISvcLocator* pSvcLocator);
42  virtual ~OutputStreamSequencerSvc();
43 
44 public: // 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 
76 private: // 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 
94 private: // properties
96  StringProperty m_incidentName {this, "SequenceIncidentName", "",
97  "Name of the incident that signals the next Event Range start" };
99  BooleanProperty m_reportingOn {this, "ReportingOn", false,
100  "If True, keep info about Ranges for getRangeReport() calls"};
101 
102  std::map<std::string,std::string> m_fnToRangeId;
104 
106 };
107 
108 #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:59
OutputStreamSequencerSvc::inConcurrentEventsMode
static bool inConcurrentEventsMode()
Are there concurrent events? (threads>1)
Definition: OutputStreamSequencerSvc.cxx:74
OutputStreamSequencerSvc::m_lastFileName
std::string m_lastFileName
Recently constructed full file name (useful in single threaded processing)
Definition: OutputStreamSequencerSvc.h:86
OutputStreamSequencerSvc::lastIncident
const std::string & lastIncident()
Last incident type that was handled.
Definition: OutputStreamSequencerSvc.h:74
OutputStreamSequencerSvc::m_fnToRangeId
std::map< std::string, std::string > m_fnToRangeId
Definition: OutputStreamSequencerSvc.h:102
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
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:79
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
OutputStreamSequencerSvc::m_mutex
std::mutex m_mutex
Definition: OutputStreamSequencerSvc.h:105
OutputStreamSequencerSvc::RangeReport_ptr
std::unique_ptr< RangeReport_t > RangeReport_ptr
Definition: OutputStreamSequencerSvc.h:35
OutputStreamSequencerSvc::RangeReport_t
std::pair< std::string, std::string > RangeReport_t
Definition: OutputStreamSequencerSvc.h:34
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:198
OutputStreamSequencerSvc::m_lastIncident
std::string m_lastIncident
Last incident type that was handled.
Definition: OutputStreamSequencerSvc.h:89
OutputStreamSequencerSvc::initialize
virtual StatusCode initialize() override final
Required of all Gaudi services:
Definition: OutputStreamSequencerSvc.cxx:31
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:99
MetaDataSvc
Manages the content of the metadata stores.
Definition: MetaDataSvc.h:89
OutputStreamSequencerSvc::m_metaDataSvc
ServiceHandle< MetaDataSvc > m_metaDataSvc
Definition: OutputStreamSequencerSvc.h:77
OutputStreamSequencerSvc::m_rangeIDinSlot
std::vector< std::string > m_rangeIDinSlot
EventRange ID for all slots.
Definition: OutputStreamSequencerSvc.h:92
OutputStreamSequencerSvc::currentRangeID
std::string currentRangeID() const
The current Event Range ID (only one range is returned)
Definition: OutputStreamSequencerSvc.cxx:187
OutputStreamSequencerSvc::m_currentRangeID
std::string m_currentRangeID
Current EventRange ID constructed on the last NextRange incident.
Definition: OutputStreamSequencerSvc.h:83
OutputStreamSequencerSvc
This class provides configuration properties to enable OutputStream file sequences.
Definition: OutputStreamSequencerSvc.h:30
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
OutputStreamSequencerSvc::handle
virtual void handle(const Incident &) override final
Incident service handle.
Definition: OutputStreamSequencerSvc.cxx:84
OutputStreamSequencerSvc::getRangeReport
RangeReport_ptr getRangeReport()
Definition: OutputStreamSequencerSvc.cxx:218
OutputStreamSequencerSvc::m_fileSequenceNumber
int m_fileSequenceNumber
The event sequence number.
Definition: OutputStreamSequencerSvc.h:80
OutputStreamSequencerSvc::m_finishedRange
std::map< std::string, std::string >::iterator m_finishedRange
Definition: OutputStreamSequencerSvc.h:103
OutputStreamSequencerSvc::publishRangeReport
void publishRangeReport(const std::string &outputFile)
Definition: OutputStreamSequencerSvc.cxx:212
AthService.h
OutputStreamSequencerSvc::finalize
virtual StatusCode finalize() override final
Required of all Gaudi services:
Definition: OutputStreamSequencerSvc.cxx:65
OutputStreamSequencerSvc::~OutputStreamSequencerSvc
virtual ~OutputStreamSequencerSvc()
Destructor.
Definition: OutputStreamSequencerSvc.cxx:28
OutputStreamSequencerSvc::buildSequenceFileName
std::string buildSequenceFileName(const std::string &)
Returns sequenced file name for output stream.
Definition: OutputStreamSequencerSvc.cxx:160
OutputStreamSequencerSvc::m_incidentName
StringProperty m_incidentName
SequenceIncidentName, incident name for triggering file sequencing.
Definition: OutputStreamSequencerSvc.h:96
ServiceHandle< MetaDataSvc >