ATLAS Offline Software
Loading...
Searching...
No Matches
RootVisualizationService.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef MUONVISUALIZATIONHELPERSR4_ROOVISUALIZATIONSERVICE_H
5#define MUONVISUALIZATIONHELPERSR4_ROOVISUALIZATIONSERVICE_H
7#include <GaudiKernel/EventContext.h>
9
10#include "DrawCanvasObject.h"
11
12#include <TFile.h>
13
14#include <mutex>
15
16namespace MuonValR4{
18 class RootVisualizationService: public extends<AthService, IRootVisualizationService>{
19 public:
20 using base_class::base_class;
21
22
23 virtual StatusCode registerClient(const ClientToken& token) override final;
24
25 virtual std::shared_ptr<ICanvasObject>
26 prepareCanvas(const EventContext& ctx, const ClientToken& token,
27 const std::string& canvasName) override final;
28 virtual StatusCode finalize() override final;
29 virtual StatusCode initialize() override final;
30
31 using PlotPtr_t = std::shared_ptr<detail::DrawCanvasObject>;
32 using PlotVec_t = std::vector<PlotPtr_t>;
33
34 private:
35 void paintObjects(const ClientToken& token,
36 PlotVec_t&& toDraw);
37
39 Gaudi::Property<double> m_canvasExtraScale{this, "CanvasExtraScale" , 1.5};
41 Gaudi::Property<bool> m_quadCanvas{this, "QuadraticCanas", true};
43 Gaudi::Property<unsigned> m_canvasWidth{this, "CanvasWidth", 800};
45 Gaudi::Property<unsigned> m_canvasHeight{this, "CanvasHeight", 600};
47 Gaudi::Property<std::string> m_outDir{this, "outputDir" , "./Displays/"};
50 Gaudi::Property<std::string> m_outRootFileName{this, "outputROOTFile", "AllDisplays.root"};
51
59 bool elementsDrawn{false};
60 };
61
62 using StorageMap_t = std::map<ClientToken, PlotsPerClient>;
65 std::unique_ptr<TFile> m_outFile{};
66
67 std::mutex m_storageMutex{};
68 std::mutex m_canvasMutex{};
69
70
71 };
72}
73#endif
Implementation of the IRootVisualization service.
Gaudi::Property< std::string > m_outDir
Directory into which all plots are written to.
Gaudi::Property< std::string > m_outRootFileName
Name of the ROOT file into which the output Canvases are written (needs root to be in the list of out...
std::unique_ptr< TFile > m_outFile
File into which all Canvases are saved if root is defined as extension.
virtual std::shared_ptr< ICanvasObject > prepareCanvas(const EventContext &ctx, const ClientToken &token, const std::string &canvasName) override final
void paintObjects(const ClientToken &token, PlotVec_t &&toDraw)
Gaudi::Property< unsigned > m_canvasHeight
Height of all drawn Canvases.
Gaudi::Property< bool > m_quadCanvas
Ensure that the canvas has the same interval sizes in x & y.
Gaudi::Property< unsigned > m_canvasWidth
Width of all drawn Canvases.
virtual StatusCode finalize() override final
Gaudi::Property< double > m_canvasExtraScale
Extra safety margin to zoom out from the Canvas.
virtual StatusCode initialize() override final
virtual StatusCode registerClient(const ClientToken &token) override final
std::shared_ptr< detail::DrawCanvasObject > PlotPtr_t
std::map< ClientToken, PlotsPerClient > StorageMap_t
Lightweight algorithm to read xAOD MDT sim hits and (fast-digitised) drift circles from SG and fill a...
Helper struct to group all plots that are belonging to a client of the service.
PlotVec_t toDraw
List of already registered Canvases.
bool elementsDrawn
Flag to indicate whether the plots were already dumped on disk.