File indexing completed on 2025-12-16 10:12:38
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef DDDIGI_NOISE_DIGISUBDETECTORSEQUENCE_H
0014 #define DDDIGI_NOISE_DIGISUBDETECTORSEQUENCE_H
0015
0016
0017 #include <DDDigi/DigiActionSequence.h>
0018 #include <DDDigi/DigiSegmentation.h>
0019 #include <DD4hep/DetElement.h>
0020 #include <DD4hep/Any.h>
0021
0022
0023 #include <functional>
0024 #include <map>
0025
0026 class TClass;
0027
0028
0029 namespace dd4hep {
0030
0031 class CartesianGridXY;
0032 class CartesianGridXYZ;
0033
0034
0035 namespace digi {
0036
0037
0038 class DigiCellData;
0039 class DigiCellScanner;
0040 class DigiEventAction;
0041 class DigiSubdetectorSequence;
0042
0043
0044
0045
0046
0047
0048
0049
0050 class DigiSubdetectorSequence : public DigiActionSequence {
0051 protected:
0052 class Context {
0053 public:
0054 DetElement detector;
0055 VolumeID detector_id;
0056 VolumeID reverse_id;
0057 VolumeID detector_mask;
0058 std::shared_ptr<DigiCellScanner> scanner;
0059 Context(DetElement de, VolumeID vid, VolumeID rid, VolumeID mask)
0060 : detector(de), detector_id(vid), reverse_id(rid), detector_mask(mask) {}
0061 Context() = delete;
0062 Context(Context&& copy) = default;
0063 Context(const Context& copy) = default;
0064 Context& operator=(Context&& copy) = default;
0065 Context& operator=(const Context& copy) = default;
0066 };
0067
0068 typedef std::map<std::pair<const TClass*,Segmentation>, std::shared_ptr<DigiCellScanner> > Scanners;
0069 std::string m_detectorName;
0070 std::string m_segmentName;
0071 SensitiveDetector m_sensDet;
0072 DetElement m_detector;
0073 IDDescriptor m_idDesc;
0074 Segmentation m_segmentation;
0075 std::map<DetElement, VolumeID> m_parallelDet;
0076 std::map<VolumeID, Context> m_parallelVid;
0077 Scanners m_scanners;
0078
0079 std::function<void(DigiContext& context, const DigiCellScanner&, const DigiCellData&)> m_cellHandler;
0080
0081 protected:
0082
0083 DDDIGI_DEFINE_ACTION_CONSTRUCTORS(DigiSubdetectorSequence);
0084
0085
0086 DetElement subdetector(const std::string& name) const;
0087
0088
0089 SensitiveDetector sensitiveDetector(const std::string& nam) const;
0090
0091 typedef PlacedVolume::VolIDs VolIDs;
0092
0093 void process_cell(DigiContext& context,
0094 const DigiCellScanner& scanner,
0095 const DigiCellData& data) const;
0096 void scan_detector(DetElement de, VolumeID vid, VolumeID mask);
0097 void scan_sensitive(PlacedVolume pv, VolumeID vid, VolumeID mask);
0098 void process_context(DigiContext& context, const Context& c, PlacedVolume pv, VolumeID vid, VolumeID mask) const;
0099
0100 public:
0101
0102 DigiSubdetectorSequence(const DigiKernel& kernel, const std::string& nam);
0103
0104 virtual ~DigiSubdetectorSequence();
0105
0106 virtual void initialize();
0107
0108 virtual void execute(DigiContext& context) const override;
0109 };
0110
0111 }
0112 }
0113 #endif