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/SimCalorimeterHitCollection.h"
20#include "edm4hep/Constants.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{
64 "hits/caloInHits", Gaudi::DataHandle::Reader, this};
66 mutable DataHandle<edm4hep::SimCalorimeterHitCollection> m_outHits{
67 "hits/caloOutHits", Gaudi::DataHandle::Writer, this};
69 MetaDataHandle<std::string> m_outHitsCellIDEncoding{
70 m_outHits, edm4hep::labels::CellIDEncoding, Gaudi::DataHandle::Writer};
72 dd4hep::DDSegmentation::Segmentation* m_segmentation;
73 int m_segmentationType; // use enum instead? defined in some namespace?
75 Gaudi::Property<std::string> m_oldReadoutName{this, "oldReadoutName", "",
76 "Name of the detector readout used in simulation"};
78 dd4hep::DDSegmentation::Segmentation* m_oldSegmentation;
79 int m_oldSegmentationType; // use enum instead? defined in some namespace?
81 Gaudi::Property<std::string> m_newReadoutName{this, "newReadoutName", "", "Name of the new detector readout"};
83 dd4hep::DDSegmentation::BitFieldCoder* m_oldDecoder;
85 Gaudi::Property<std::vector<std::string>> m_oldIdentifiers{
86 this, "oldSegmentationIds", {}, "Segmentation fields that are going to be replaced by the new segmentation"};
88 std::vector<std::string> m_detectorIdentifiers;
90 Gaudi::Property<uint> m_debugPrint{this, "debugPrint", 10, "Limit of debug printing"};
91};
92#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:72
virtual StatusCode initialize() final
Initialize.
Definition RedoSegmentation.cpp:15
Gaudi::Property< uint > m_debugPrint
Limit of debug printing.
Definition RedoSegmentation.h:90
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:145
virtual ~RedoSegmentation()
Definition RedoSegmentation.cpp:13
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:69
ServiceHandle< IGeoSvc > m_geoSvc
Pointer to the geometry service.
Definition RedoSegmentation.h:61
int m_segmentationType
Definition RedoSegmentation.h:73
Gaudi::Property< std::vector< std::string > > m_oldIdentifiers
Segmentation fields that are going to be replaced by the new segmentation.
Definition RedoSegmentation.h:85
Gaudi::Property< std::string > m_newReadoutName
Name of the new detector readout.
Definition RedoSegmentation.h:81
Gaudi::Property< std::string > m_oldReadoutName
Name of the detector readout used in simulation.
Definition RedoSegmentation.h:75
dd4hep::DDSegmentation::BitFieldCoder * m_oldDecoder
Old bitfield decoder.
Definition RedoSegmentation.h:83
RedoSegmentation(const std::string &, ISvcLocator *)
Definition RedoSegmentation.cpp:8
int m_oldSegmentationType
Definition RedoSegmentation.h:79
virtual StatusCode execute(const EventContext &) const final
Execute.
Definition RedoSegmentation.cpp:82
std::vector< std::string > m_detectorIdentifiers
Detector fields that are going to be rewritten.
Definition RedoSegmentation.h:88
dd4hep::DDSegmentation::Segmentation * m_oldSegmentation
Old segmentation.
Definition RedoSegmentation.h:78
DataHandle< edm4hep::SimCalorimeterHitCollection > m_outHits
Handle for the EDM hits to be written.
Definition RedoSegmentation.h:66