File indexing completed on 2025-02-22 10:32:43
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef DD4HEP_DETAIL_SEGMENTATIONSINTERNA_H
0014 #define DD4HEP_DETAIL_SEGMENTATIONSINTERNA_H
0015
0016
0017 #include <DD4hep/Handle.h>
0018 #include <DD4hep/Objects.h>
0019 #include <DD4hep/BitFieldCoder.h>
0020
0021
0022
0023
0024 namespace dd4hep {
0025
0026
0027 class DetElementObject;
0028 class SegmentationObject;
0029 class SensitiveDetectorObject;
0030
0031 namespace DDSegmentation {
0032 class Segmentation;
0033 class SegmentationParameter;
0034 typedef SegmentationParameter* Parameter;
0035 typedef std::vector<Parameter> Parameters;
0036 }
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046 class SegmentationObject {
0047 public:
0048
0049 SegmentationObject(DDSegmentation::Segmentation* seg = 0);
0050
0051 virtual ~SegmentationObject();
0052
0053 std::string fieldDescription() const;
0054
0055 const std::string& name() const;
0056
0057 void setName(const std::string& value);
0058
0059
0060 const std::string& type() const;
0061
0062 const std::string& description() const;
0063
0064 const BitFieldCoder* decoder() const;
0065
0066 void setDecoder(const BitFieldCoder* decoder) const;
0067
0068 DDSegmentation::Parameter parameter(const std::string& parameterName) const;
0069
0070 DDSegmentation::Parameters parameters() const;
0071
0072 void setParameters(const DDSegmentation::Parameters& parameters);
0073
0074
0075
0076 Position position(const CellID& cellID) const;
0077
0078 CellID cellID(const Position& localPosition,
0079 const Position& globalPosition,
0080 const VolumeID& volumeID) const;
0081
0082 VolumeID volumeID(const CellID& cellID) const;
0083
0084 void neighbours(const CellID& cellID, std::set<CellID>& neighbours) const;
0085
0086
0087
0088 unsigned long magic;
0089
0090 unsigned char useForHitPosition;
0091
0092 Handle<DetElementObject> detector;
0093
0094 Handle<SensitiveDetectorObject> sensitive;
0095
0096 DDSegmentation::Segmentation* segmentation = 0;
0097 };
0098
0099
0100
0101
0102
0103
0104
0105 template <typename IMP> class SegmentationWrapper : public SegmentationObject {
0106 public:
0107
0108 IMP* implementation;
0109 public:
0110 #if defined(G__ROOT) || defined(__CLANG__) || defined(__ROOTCLING__)
0111
0112 SegmentationWrapper() : SegmentationObject(implementation=new IMP(0)) { }
0113 #endif
0114
0115 SegmentationWrapper(const BitFieldCoder* decoder);
0116
0117 virtual ~SegmentationWrapper();
0118 };
0119
0120
0121 template <typename IMP> inline
0122 SegmentationWrapper<IMP>::SegmentationWrapper(const BitFieldCoder* decode)
0123 : SegmentationObject(implementation=new IMP(decode))
0124 {
0125 }
0126
0127
0128 template <typename IMP> inline SegmentationWrapper<IMP>::~SegmentationWrapper() {
0129 }
0130
0131 namespace {
0132 template<typename T> SegmentationObject*
0133 create_segmentation(const BitFieldCoder* decoder) {
0134 return new SegmentationWrapper<T>(decoder);
0135 }
0136 }
0137
0138 }
0139 #endif