ATLAS Offline Software
Loading...
Searching...
No Matches
WriteTrackingGeometry.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
5
6// ATHENA
8
9// PACKAGE
10
11#include "ActsPlugins/Json/TrackingGeometryJsonConverter.hpp"
12
13// STL
14#include <fstream>
15#include <iostream>
16
17namespace ActsTrk{
18
20 ATH_MSG_INFO("initializing");
21
23 // ATH_CHECK(m_materialJsonWriterTool.retrieve() );
24
25
26 return StatusCode::SUCCESS;
27}
28
29StatusCode WriteTrackingGeometry::execute(const EventContext& ctx) {
30
31 if (m_dumped) {
32 return StatusCode::SUCCESS;
33 }
34 std::ofstream outFile{m_outFile};
35 if (!outFile.good()) {
36 ATH_MSG_FATAL("Failed to open "<<m_outFile);
37 return StatusCode::FAILURE;
38 }
39
40
41 m_dumped = true;
42
44 const Acts::GeometryContext tgContext = m_trackingGeometryTool->getGeometryContext(ctx).context();
45
46 using Config_t = Acts::TrackingGeometryJsonConverter::Config;
47
48 Config_t cfg = Config_t::defaultConfig();
49
50 Acts::TrackingGeometryJsonConverter converter{cfg, makeActsAthenaLogger(this, name())};
51
52
53 nlohmann::json trackGeo = converter.toJson(tgContext, *m_trackingGeometryTool->trackingGeometry());
54
55
56 outFile<<trackGeo.dump(4);
57
58 ATH_MSG_INFO("Dump tracking geometry JSON: "<<m_outFile);
59
60 return StatusCode::SUCCESS;
61}
62
63
64}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
std::unique_ptr< const Acts::Logger > makeActsAthenaLogger(IMessageSvc *svc, const std::string &name, int level, std::optional< std::string > parent_name)
PublicToolHandle< ActsTrk::ITrackingGeometryTool > m_trackingGeometryTool
Gaudi::Property< std::string > m_outFile
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
virtual StatusCode initialize() override
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...