ATLAS Offline Software
ByteStreamCnvSvc.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 BYTESTREAMCNVSVC_BYTESTREAMCNVSVC_H
6 #define BYTESTREAMCNVSVC_BYTESTREAMCNVSVC_H
7 
13 #include "StoreGate/StoreGateSvc.h"
15 #include "GaudiKernel/ThreadLocalContext.h"
16 #include "GaudiKernel/ServiceHandle.h"
17 
18 #include <map>
19 
21 
36 class ByteStreamCnvSvc : public extends<ByteStreamCnvSvcBase,
37  IByteStreamCnvSvc, IByteStreamEventAccess> {
38 public:
40  ByteStreamCnvSvc(const std::string& name, ISvcLocator* svc);
41 
43  virtual ~ByteStreamCnvSvc();
44 
46  virtual StatusCode initialize() override;
47  virtual StatusCode finalize() override;
48 
50  virtual StatusCode connectOutput(const std::string& t, const std::string& mode) override;
51  virtual StatusCode connectOutput(const std::string& t) override;
52 
54  virtual StatusCode commitOutput(const std::string& outputConnection, bool b) override;
55 
57  virtual RawEventWrite* getRawEvent() override
58  {
59  return m_slots->m_rawEventWrite.get();
60  }
61 
62 protected:
63  RawEventWrite* setRawEvent (std::unique_ptr<RawEventWrite> rawEventWrite);
64 
66  virtual FullEventAssemblerBase* findFullEventAssembler(const std::string& name) const override;
67  virtual StatusCode storeFullEventAssembler(std::unique_ptr<FullEventAssemblerBase> fea, const std::string& name) override;
68 
69 private:
71  std::string m_ioSvcName;
72 
74  Gaudi::Property<std::vector<std::string>> m_ioSvcNameList{ this, "ByteStreamOutputSvcList", {}, "", "OrderedSet<T>"};
75 
77  Gaudi::Property<bool> m_fillTriggerBits{this, "FillTriggerBits", true, "Read in xTrigDecision and use it to fill Trigger bits in event header"};
78 
80  std::map<std::string, IByteStreamOutputSvc*> m_ioSvcMap;
81 
84 
86  std::string m_userType;
87 
89  struct SlotData
90  {
91  std::unique_ptr<RawEventWrite> m_rawEventWrite;
92  std::map<std::string, std::unique_ptr<FullEventAssemblerBase>> m_feaMap;
93  std::vector<uint32_t> m_tagBuff;
94  std::vector<uint32_t> m_l1Buff;
95  std::vector<uint32_t> m_l2Buff;
96  std::vector<uint32_t> m_efBuff;
97 
98  void clear()
99  {
100  m_rawEventWrite.reset();
101  m_feaMap.clear();
102  m_tagBuff.clear();
103  m_l1Buff.clear();
104  m_l2Buff.clear();
105  m_efBuff.clear();
106  }
107  };
109 
111  void writeFEA (SlotData& slot);
112 };
113 
114 #endif
ByteStreamCnvSvc::commitOutput
virtual StatusCode commitOutput(const std::string &outputConnection, bool b) override
Implements ConversionSvc's commitOutput.
Definition: ByteStreamCnvSvc.cxx:194
ByteStreamCnvSvc::SlotData
Slot-specific state.
Definition: ByteStreamCnvSvc.h:90
RawEventWrite
OFFLINE_FRAGMENTS_NAMESPACE_WRITE::FullEventFragment RawEventWrite
data type for writing raw event
Definition: RawEvent.h:39
ByteStreamCnvSvc::SlotData::m_feaMap
std::map< std::string, std::unique_ptr< FullEventAssemblerBase > > m_feaMap
Definition: ByteStreamCnvSvc.h:92
ByteStreamCnvSvc::SlotData::m_efBuff
std::vector< uint32_t > m_efBuff
Definition: ByteStreamCnvSvc.h:96
ByteStreamCnvSvc::SlotData::clear
void clear()
Definition: ByteStreamCnvSvc.h:98
ByteStreamCnvSvc::~ByteStreamCnvSvc
virtual ~ByteStreamCnvSvc()
Standard Destructor.
Definition: ByteStreamCnvSvc.cxx:44
ByteStreamCnvSvc::m_evtStore
ServiceHandle< StoreGateSvc > m_evtStore
Event store.
Definition: ByteStreamCnvSvc.h:83
ByteStreamCnvSvc::getRawEvent
virtual RawEventWrite * getRawEvent() override
Implementation of IByteStreamEventAccess: Get RawEvent.
Definition: ByteStreamCnvSvc.h:57
ByteStreamCnvSvc::m_slots
SG::SlotSpecificObj< SlotData > m_slots
Definition: ByteStreamCnvSvc.h:108
ByteStreamCnvSvc::ByteStreamCnvSvc
ByteStreamCnvSvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
Definition: ByteStreamCnvSvc.cxx:34
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
IByteStreamEventAccess.h
ByteStreamCnvSvc::SlotData::m_l1Buff
std::vector< uint32_t > m_l1Buff
Definition: ByteStreamCnvSvc.h:94
ByteStreamCnvSvc::m_ioSvcName
std::string m_ioSvcName
name of the service
Definition: ByteStreamCnvSvc.h:71
FullEventAssemblerBase
base class for assembling a full atlas raw event from subfragments
Definition: FullEventAssembler.h:23
SG::SlotSpecificObj
Maintain a set of objects, one per slot.
Definition: AthenaKernel/AthenaKernel/SlotSpecificObj.h:70
ByteStreamCnvSvc
Gaudi Conversion Service class for ByteStream Persistency.
Definition: ByteStreamCnvSvc.h:37
ByteStreamCnvSvc::findFullEventAssembler
virtual FullEventAssemblerBase * findFullEventAssembler(const std::string &name) const override
Implementation of IByteStreamCnvSvc interface.
Definition: ByteStreamCnvSvc.cxx:47
IByteStreamOutputSvc.h
This file contains the interface for the ByteStreamOutputSvc classes.
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ByteStreamCnvSvc::SlotData::m_l2Buff
std::vector< uint32_t > m_l2Buff
Definition: ByteStreamCnvSvc.h:95
ByteStreamCnvSvc::SlotData::m_rawEventWrite
std::unique_ptr< RawEventWrite > m_rawEventWrite
Definition: ByteStreamCnvSvc.h:91
ByteStreamCnvSvc::m_userType
std::string m_userType
user type
Definition: ByteStreamCnvSvc.h:86
Preparation.mode
mode
Definition: Preparation.py:94
ByteStreamCnvSvc::initialize
virtual StatusCode initialize() override
Gaudi Service Interface method implementations:
Definition: ByteStreamCnvSvc.cxx:63
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
FullEventAssembler.h
ByteStreamCnvSvc::finalize
virtual StatusCode finalize() override
Definition: ByteStreamCnvSvc.cxx:100
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
ByteStreamCnvSvc::writeFEA
void writeFEA(SlotData &slot)
Write the FEA to RawEvent.
Definition: ByteStreamCnvSvc.cxx:243
ByteStreamCnvSvc::m_fillTriggerBits
Gaudi::Property< bool > m_fillTriggerBits
fill trigger bits
Definition: ByteStreamCnvSvc.h:77
ByteStreamCnvSvc::SlotData::m_tagBuff
std::vector< uint32_t > m_tagBuff
Definition: ByteStreamCnvSvc.h:93
ByteStreamCnvSvc::storeFullEventAssembler
virtual StatusCode storeFullEventAssembler(std::unique_ptr< FullEventAssemblerBase > fea, const std::string &name) override
Definition: ByteStreamCnvSvc.cxx:55
SlotSpecificObj.h
Maintain a set of objects, one per slot.
ByteStreamCnvSvcBase.h
ByteStreamCnvSvc::setRawEvent
RawEventWrite * setRawEvent(std::unique_ptr< RawEventWrite > rawEventWrite)
Definition: ByteStreamCnvSvc.cxx:255
ByteStreamCnvSvc::connectOutput
virtual StatusCode connectOutput(const std::string &t, const std::string &mode) override
Implements ConversionSvc's connectOutput.
Definition: ByteStreamCnvSvc.cxx:104
ByteStreamCnvSvc::m_ioSvcNameList
Gaudi::Property< std::vector< std::string > > m_ioSvcNameList
list of service names
Definition: ByteStreamCnvSvc.h:74
IByteStreamCnvSvc.h
StoreGateSvc.h
ByteStreamCnvSvc::m_ioSvcMap
std::map< std::string, IByteStreamOutputSvc * > m_ioSvcMap
Services for writing output.
Definition: ByteStreamCnvSvc.h:80
ServiceHandle< StoreGateSvc >