k4SimGeant4
Loading...
Searching...
No Matches
SimG4SaveCalHits.h
Go to the documentation of this file.
1#ifndef SIMG4COMPONENTS_G4SAVECALHITS_H
2#define SIMG4COMPONENTS_G4SAVECALHITS_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/SimCalorimeterHitCollection.h"
19#include "edm4hep/Constants.h"
20
45class SimG4SaveCalHits : public AlgTool, virtual public ISimG4SaveOutputTool {
46public:
47 explicit SimG4SaveCalHits(const std::string& aType, const std::string& aName, const IInterface* aParent);
48 virtual ~SimG4SaveCalHits();
52 virtual StatusCode initialize();
56 virtual StatusCode finalize();
62 virtual StatusCode saveOutput(const G4Event& aEvent) final;
63
64private:
66 ServiceHandle<IGeoSvc> m_geoSvc;
68 mutable DataHandle<edm4hep::SimCalorimeterHitCollection> m_caloHits{
69 "CaloHits", Gaudi::DataHandle::Writer, this};
71 MetaDataHandle<std::string> m_cellIDEncoding{
72 m_caloHits, edm4hep::labels::CellIDEncoding, Gaudi::DataHandle::Writer};
74 Gaudi::Property<std::vector<std::string>> m_readoutNames{
75 this, "readoutNames", {}, "[Deprecated] Names of the readouts (hits collections) to save"};
77 Gaudi::Property<std::string> m_readoutName {
78 this, "readoutName", {}, "Name of the readout (hits collection) to save"};
79};
80
81#endif /* SIMG4COMPONENTS_G4SAVECALHITS_H */
Interface to the output saving tool.
Definition ISimG4SaveOutputTool.h:17
Save calorimeter hits tool.
Definition SimG4SaveCalHits.h:45
SimG4SaveCalHits(const std::string &aType, const std::string &aName, const IInterface *aParent)
Definition SimG4SaveCalHits.cpp:17
DataHandle< edm4hep::SimCalorimeterHitCollection > m_caloHits
Output handle for calo hits.
Definition SimG4SaveCalHits.h:68
Gaudi::Property< std::vector< std::string > > m_readoutNames
Name of the readouts (hits collections) to save, deprecated.
Definition SimG4SaveCalHits.h:74
virtual ~SimG4SaveCalHits()
Definition SimG4SaveCalHits.cpp:26
virtual StatusCode finalize()
Finalize.
Definition SimG4SaveCalHits.cpp:91
virtual StatusCode initialize()
Initialize.
Definition SimG4SaveCalHits.cpp:28
virtual StatusCode saveOutput(const G4Event &aEvent) final
Save the data output.
Definition SimG4SaveCalHits.cpp:93
ServiceHandle< IGeoSvc > m_geoSvc
Pointer to the geometry service.
Definition SimG4SaveCalHits.h:66
MetaDataHandle< std::string > m_cellIDEncoding
Output handle for cell ID encoding string.
Definition SimG4SaveCalHits.h:71
Gaudi::Property< std::string > m_readoutName
Name of the readout (hits collection) to save.
Definition SimG4SaveCalHits.h:77