Loading [MathJax]/extensions/tex2jax.js
k4SimGeant4
All Classes Namespaces Files Functions Variables Typedefs Friends Modules Pages
SimG4SaveTrackerHits.h
Go to the documentation of this file.
1#ifndef SIMG4COMPONENTS_G4SAVETRACKERHITS_H
2#define SIMG4COMPONENTS_G4SAVETRACKERHITS_H
3
4// STL
5#include <vector>
6#include <string>
7
8// Gaudi
9#include "GaudiKernel/AlgTool.h"
10
11// k4FWCore
12#include "k4FWCore/DataHandle.h"
13#include "k4FWCore/MetaDataHandle.h"
14#include "k4Interface/IGeoSvc.h"
15#include "k4Interface/ISimG4SaveOutputTool.h"
16
17// EDM4hep
18#include "edm4hep/SimTrackerHitCollection.h"
19#include "edm4hep/Constants.h"
20
46class SimG4SaveTrackerHits : public AlgTool, virtual public ISimG4SaveOutputTool {
47public:
48 explicit SimG4SaveTrackerHits(const std::string& aType, const std::string& aName, const IInterface* aParent);
49 virtual ~SimG4SaveTrackerHits();
53 virtual StatusCode initialize();
57 virtual StatusCode finalize();
63 virtual StatusCode saveOutput(const G4Event& aEvent) final;
64
65private:
67 ServiceHandle<IGeoSvc> m_geoSvc;
69 mutable DataHandle<edm4hep::SimTrackerHitCollection> m_trackHits {
70 "TrackerHits", Gaudi::DataHandle::Writer, this};
72 MetaDataHandle<std::string> m_cellIDEncoding {
73 m_trackHits, edm4hep::labels::CellIDEncoding, Gaudi::DataHandle::Writer};
75 Gaudi::Property<std::vector<std::string>> m_readoutNames {
76 this, "readoutNames", {}, "[Deprecated] Name of the readouts (hits collections) to save"};
78 Gaudi::Property<std::string> m_readoutName {
79 this, "readoutName", {}, "Name of the readout (hit collection) to save"};
80};
81
82#endif /* SIMG4COMPONENTS_G4SAVETRACKERHITS_H */
Interface to the output saving tool.
Definition ISimG4SaveOutputTool.h:17
Save tracker hits tool.
Definition SimG4SaveTrackerHits.h:46
Gaudi::Property< std::string > m_readoutName
Name of the readout (hits collection) to save.
Definition SimG4SaveTrackerHits.h:78
Gaudi::Property< std::vector< std::string > > m_readoutNames
Names of the readouts (hits collections) to save, deprecated.
Definition SimG4SaveTrackerHits.h:75
virtual StatusCode saveOutput(const G4Event &aEvent) final
Save the data output.
Definition SimG4SaveTrackerHits.cpp:93
virtual ~SimG4SaveTrackerHits()
Definition SimG4SaveTrackerHits.cpp:26
SimG4SaveTrackerHits(const std::string &aType, const std::string &aName, const IInterface *aParent)
Definition SimG4SaveTrackerHits.cpp:16
MetaDataHandle< std::string > m_cellIDEncoding
Output handle for cell ID encoding string.
Definition SimG4SaveTrackerHits.h:72
ServiceHandle< IGeoSvc > m_geoSvc
Pointer to the geometry service.
Definition SimG4SaveTrackerHits.h:67
virtual StatusCode initialize()
Initialize.
Definition SimG4SaveTrackerHits.cpp:28
DataHandle< edm4hep::SimTrackerHitCollection > m_trackHits
Handle for output tracker hits.
Definition SimG4SaveTrackerHits.h:69
virtual StatusCode finalize()
Finalize.
Definition SimG4SaveTrackerHits.cpp:91