k4SimGeant4
Loading...
Searching...
No Matches
RedoSegmentation.h
Go to the documentation of this file.
1#ifndef DETCOMPONENTS_REDOSEGMENTATION_H
2#define DETCOMPONENTS_REDOSEGMENTATION_H
3
4// GAUDI
5#include "Gaudi/Algorithm.h"
6#include "GaudiKernel/ToolHandle.h"
7
8// k4FWCore
9#include "k4FWCore/DataHandle.h"
10#include "k4FWCore/MetaDataHandle.h"
11#include "k4Interface/IGeoSvc.h"
12
13// DD4hep
14#include "DD4hep/Readout.h"
15#include "DD4hep/Segmentations.h"
16
17// EDM4hep
18#include "edm4hep/CalorimeterHitCollection.h"
19#include "edm4hep/Constants.h"
20#include "edm4hep/SimCalorimeterHitCollection.h"
21
37class RedoSegmentation : public Gaudi::Algorithm {
38public:
39 explicit RedoSegmentation(const std::string&, ISvcLocator*);
40 virtual ~RedoSegmentation();
44 virtual StatusCode initialize() final;
48 virtual StatusCode execute(const EventContext&) const final;
52 virtual StatusCode finalize() final;
53
54private:
59 uint64_t volumeID(uint64_t aCellId) const;
61 ServiceHandle<IGeoSvc> m_geoSvc;
63 mutable DataHandle<edm4hep::CalorimeterHitCollection> m_inHits{"hits/caloInHits", Gaudi::DataHandle::Reader, this};
65 mutable DataHandle<edm4hep::SimCalorimeterHitCollection> m_outHits{"hits/caloOutHits", Gaudi::DataHandle::Writer,
66 this};
68 MetaDataHandle<std::string> m_outHitsCellIDEncoding{m_outHits, edm4hep::labels::CellIDEncoding,
69 Gaudi::DataHandle::Writer};
71 dd4hep::DDSegmentation::Segmentation* m_segmentation;
72 int m_segmentationType; // use enum instead? defined in some namespace?
74 Gaudi::Property<std::string> m_oldReadoutName{this, "oldReadoutName", "",
75 "Name of the detector readout used in simulation"};
77 dd4hep::DDSegmentation::Segmentation* m_oldSegmentation;
78 int m_oldSegmentationType; // use enum instead? defined in some namespace?
80 Gaudi::Property<std::string> m_newReadoutName{this, "newReadoutName", "", "Name of the new detector readout"};
82 dd4hep::DDSegmentation::BitFieldCoder* m_oldDecoder;
84 Gaudi::Property<std::vector<std::string>> m_oldIdentifiers{
85 this, "oldSegmentationIds", {}, "Segmentation fields that are going to be replaced by the new segmentation"};
87 std::vector<std::string> m_detectorIdentifiers;
89 Gaudi::Property<uint> m_debugPrint{this, "debugPrint", 10, "Limit of debug printing"};
90};
91#endif /* DETCOMPONENTS_REDOSEGMENTATION_H */
Redo the segmentation after the simulation has ended.
Definition RedoSegmentation.h:37
dd4hep::DDSegmentation::Segmentation * m_segmentation
New segmentation.
Definition RedoSegmentation.h:71
virtual StatusCode initialize() final
Initialize.
Definition RedoSegmentation.cpp:16
Gaudi::Property< uint > m_debugPrint
Limit of debug printing.
Definition RedoSegmentation.h:89
virtual StatusCode finalize() final
Finalize.
Definition RedoSegmentation.cpp:141
uint64_t volumeID(uint64_t aCellId) const
Get ID of the volume that contains the cell.
Definition RedoSegmentation.cpp:146
virtual ~RedoSegmentation()
Definition RedoSegmentation.cpp:14
DataHandle< edm4hep::CalorimeterHitCollection > m_inHits
Handle for the EDM positioned hits to be read.
Definition RedoSegmentation.h:63
MetaDataHandle< std::string > m_outHitsCellIDEncoding
Handle for the output hits cell id encoding.
Definition RedoSegmentation.h:68
ServiceHandle< IGeoSvc > m_geoSvc
Pointer to the geometry service.
Definition RedoSegmentation.h:61
int m_segmentationType
Definition RedoSegmentation.h:72
Gaudi::Property< std::vector< std::string > > m_oldIdentifiers
Segmentation fields that are going to be replaced by the new segmentation.
Definition RedoSegmentation.h:84
Gaudi::Property< std::string > m_newReadoutName
Name of the new detector readout.
Definition RedoSegmentation.h:80
Gaudi::Property< std::string > m_oldReadoutName
Name of the detector readout used in simulation.
Definition RedoSegmentation.h:74
dd4hep::DDSegmentation::BitFieldCoder * m_oldDecoder
Old bitfield decoder.
Definition RedoSegmentation.h:82
RedoSegmentation(const std::string &, ISvcLocator *)
Definition RedoSegmentation.cpp:8
int m_oldSegmentationType
Definition RedoSegmentation.h:78
virtual StatusCode execute(const EventContext &) const final
Execute.
Definition RedoSegmentation.cpp:84
std::vector< std::string > m_detectorIdentifiers
Detector fields that are going to be rewritten.
Definition RedoSegmentation.h:87
dd4hep::DDSegmentation::Segmentation * m_oldSegmentation
Old segmentation.
Definition RedoSegmentation.h:77
DataHandle< edm4hep::SimCalorimeterHitCollection > m_outHits
Handle for the EDM hits to be written.
Definition RedoSegmentation.h:65