ATLAS Offline Software
Loading...
Searching...
No Matches
DumpEventDataToJsonAlg.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef DUMPEVENTDATATOJSONALG_H
6#define DUMPEVENTDATATOJSONALG_H
7
8// Core
10#include "GaudiKernel/ToolHandle.h"
12//EDM
23//Tools
25// PRDs
35// ACTS
39// Misc
40#include <nlohmann/json.hpp>
41#include <string>
42#include <vector>
43#include <map>
44
45
49{
50public:
52 DumpEventDataToJsonAlg(const std::string &name, ISvcLocator *pService);
53
54 virtual ~DumpEventDataToJsonAlg() = default;
55
57 virtual StatusCode initialize() override;
58 virtual StatusCode execute() override;
59 virtual StatusCode finalize() override;
60
61protected:
63 void prependTestEvent();
64
65 template <class TYPE>
66 StatusCode getAndFillArrayOfContainers(nlohmann::json &event, const SG::ReadHandleKeyArray<TYPE> &keys, const std::string &jsonType);
67
68 template <class TYPE>
69 StatusCode getAndFillContainer(nlohmann::json &event,
70 const SG::ReadHandleKey<TYPE> &key,
71 const std::string &jsonType);
72 template <class TYPE>
73 nlohmann::json getData(const TYPE &object);
74
75 nlohmann::json getActsData(const typename ActsTrk::TrackContainer::ConstTrackProxy &track,
76 const Acts::GeometryContext& gctx);
77
78
79 template <class TYPE>
80 void addLink(const TYPE &link, nlohmann::json &data);
81
82 SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey{this, "EventInfoKey", "EventInfo", "Key for the Event Info"};
83
84 SG::ReadHandleKeyArray<xAOD::TrackParticleContainer> m_trackParticleKeys{this, "TrackParticleContainerKeys", {"InDetTrackParticles", "CombinedMuonTrackParticles"}, "Keys for TrackParticle Containers"};
85
86 SG::ReadHandleKeyArray<xAOD::JetContainer> m_jetKeys{this, "JetContainerKeys", {"AntiKt4EMTopoJets"}, "Keys for Jet Containers"};
87
88 SG::ReadHandleKeyArray<xAOD::MuonContainer> m_muonKeys{this, "MuonContainerKeys", {"Muons"}, "Keys for Muon Containers"};
89
90 SG::ReadHandleKeyArray<xAOD::TauJetContainer> m_tauJetKeys{this, "TauJetContainerKeys", {"TauJets"}, "Keys for Tau Containers"};
91
92 SG::ReadHandleKeyArray<xAOD::ElectronContainer> m_electronKeys{this, "ElectronContainerKeys", {"Electrons"}, "Keys for Electron Containers"};
93
94 SG::ReadHandleKeyArray<xAOD::PhotonContainer> m_photonKeys{this, "PhotonContainerKeys", {"Photons"}, "Keys for Photon Containers"};
95
96 SG::ReadHandleKeyArray<xAOD::CaloClusterContainer> m_caloClustersKeys{this, "CaloClusterContainerKeys", {"CaloCalTopoClusters"}, "Keys for CaloClusters Containers"};
97
98 SG::ReadHandleKeyArray<CaloCellContainer> m_caloCellKey{this, "CaloCellContainerKey", {"AllCalo"}, "Key for CaloCell Container"};
99
100 SG::ReadHandleKeyArray<TrackCollection> m_trackCollectionKeys{this, "TrackCollectionKeys", {"CombinedInDetTracks", "CombinedMuonTracks", "MuonSpectrometerTracks"}, "Keys for Track Containers"};
101
102 // ACTS TrackContainer keys
103 SG::ReadHandleKeyArray<ActsTrk::TrackContainer> m_trackContainerKeys{this, "TrackContainerKeys", {"ConvertedTracks"}, "Location of the converted Acts TrackContainer"};
104
105 SG::ReadHandleKey<Muon::CscPrepDataContainer> m_cscPrepRawDataKey{this, "CscPrepRawDataKey", "CSC_Clusters", "Key for CSC PRD Container"};
106 SG::ReadHandleKey<Muon::MdtPrepDataContainer> m_mdtPrepRawDataKey{this, "MdtPrepRawDataKey", "MDT_DriftCircles", "Key for MDT PRD Container"};
107 SG::ReadHandleKey<Muon::RpcPrepDataContainer> m_rpcPrepRawDataKey{this, "RpcPrepRawDataKey", "RPC_Measurements", "Key for RPC PRD Container"};
108 SG::ReadHandleKey<Muon::TgcPrepDataContainer> m_tgcPrepRawDataKey{this, "TgcPrepRawDataKey", "TGC_MeasurementsAllBCs", "Key for TGC PRD Container"};
109 SG::ReadHandleKey<Muon::MMPrepDataContainer> m_mmPrepRawDataKey{this, "MMPrepRawDataKey", "MM_Measurements", "Key for MM PRD Container"};
110 SG::ReadHandleKey<Muon::sTgcPrepDataContainer> m_stgcPrepRawDataKey{this, "sTgcPrepRawDataKey", "STGC_Measurements", "Key for sTGC PRD Container"};
111 SG::ReadHandleKey<InDet::PixelClusterContainer> m_pixelPrepRawDataKey{this, "PixelPrepRawDataKey", "PixelClusters", "Key for Pixel PRD Container"};
112 SG::ReadHandleKey<InDet::SCT_ClusterContainer> m_sctPrepRawDataKey{this, "SctPrepRawDataKey", "SCT_Clusters", "Key for SCT PRD Container"};
113 SG::ReadHandleKey<InDet::TRT_DriftCircleContainer> m_trtPrepRawDataKey{this, "TrtPrepRawDataKey", "TRT_DriftCircles", "Key for TRT PRD Container"};
114
115 ToolHandle<Trk::IExtrapolationEngine> m_extrapolator{this, "Extrapolator", "Trk::ExtrapolationEngine/AtlasExtrapolation"};
116
118 this, "ActsAlignmentKey", "ActsAlignment", "cond read key for the alignment"};
119
120 Gaudi::Property<std::string> m_outputJSON_Name{this, "OutputLocation", "EventData.json", "Default filename for "};
121
122 Gaudi::Property<bool> m_dumpTestEvent{this, "DumpTestEvent", false, "If true, prepend a test event with some calibration data in it."};
123 Gaudi::Property<bool> m_physlite{this, "PHYSLITE", false, "If true, do not try to access data which is not available in PHYSLITE files."};
124
125 nlohmann::json m_eventData;
126};
127#endif
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
Property holding a SG store/key/clid from which a ReadHandle is made.
#define TYPE(CODE, TYP, IOTYP)
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
SG::ReadHandleKeyArray< xAOD::TauJetContainer > m_tauJetKeys
SG::ReadHandleKey< Muon::MdtPrepDataContainer > m_mdtPrepRawDataKey
SG::ReadHandleKey< ActsTrk::GeometryContext > m_geometryContextKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Gaudi::Property< bool > m_physlite
SG::ReadHandleKeyArray< xAOD::CaloClusterContainer > m_caloClustersKeys
SG::ReadHandleKeyArray< xAOD::TrackParticleContainer > m_trackParticleKeys
virtual StatusCode execute() override
SG::ReadHandleKey< Muon::MMPrepDataContainer > m_mmPrepRawDataKey
SG::ReadHandleKey< Muon::TgcPrepDataContainer > m_tgcPrepRawDataKey
ToolHandle< Trk::IExtrapolationEngine > m_extrapolator
Gaudi::Property< bool > m_dumpTestEvent
SG::ReadHandleKey< InDet::PixelClusterContainer > m_pixelPrepRawDataKey
SG::ReadHandleKeyArray< xAOD::PhotonContainer > m_photonKeys
virtual ~DumpEventDataToJsonAlg()=default
Gaudi::Property< std::string > m_outputJSON_Name
StatusCode getAndFillContainer(nlohmann::json &event, const SG::ReadHandleKey< TYPE > &key, const std::string &jsonType)
SG::ReadHandleKeyArray< xAOD::MuonContainer > m_muonKeys
SG::ReadHandleKeyArray< ActsTrk::TrackContainer > m_trackContainerKeys
SG::ReadHandleKeyArray< TrackCollection > m_trackCollectionKeys
SG::ReadHandleKeyArray< xAOD::ElectronContainer > m_electronKeys
void prependTestEvent()
Dumps a dummy event with some objects at specific eta/phi coordinates for calibration.
SG::ReadHandleKey< InDet::TRT_DriftCircleContainer > m_trtPrepRawDataKey
void addLink(const TYPE &link, nlohmann::json &data)
SG::ReadHandleKey< Muon::CscPrepDataContainer > m_cscPrepRawDataKey
StatusCode getAndFillArrayOfContainers(nlohmann::json &event, const SG::ReadHandleKeyArray< TYPE > &keys, const std::string &jsonType)
SG::ReadHandleKeyArray< CaloCellContainer > m_caloCellKey
SG::ReadHandleKeyArray< xAOD::JetContainer > m_jetKeys
nlohmann::json getActsData(const typename ActsTrk::TrackContainer::ConstTrackProxy &track, const Acts::GeometryContext &gctx)
nlohmann::json getData(const TYPE &object)
virtual StatusCode initialize() override
inherited from Algorithm
virtual StatusCode finalize() override
DumpEventDataToJsonAlg(const std::string &name, ISvcLocator *pService)
Algorithm constructor.
SG::ReadHandleKey< Muon::sTgcPrepDataContainer > m_stgcPrepRawDataKey
SG::ReadHandleKey< Muon::RpcPrepDataContainer > m_rpcPrepRawDataKey
SG::ReadHandleKey< InDet::SCT_ClusterContainer > m_sctPrepRawDataKey
Property holding a SG store/key/clid from which a ReadHandle is made.
HandleKeyArray< ReadHandle< T >, ReadHandleKey< T >, Gaudi::DataHandle::Reader > ReadHandleKeyArray