File indexing completed on 2025-07-12 07:54:17
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include <DD4hep/Segmentations.h>
0016 #include <DD4hep/InstanceCount.h>
0017 #include <DD4hep/Printout.h>
0018 #include <DD4hep/Plugins.h>
0019 #include <DD4hep/detail/Handle.inl>
0020 #include <DD4hep/detail/SegmentationsInterna.h>
0021
0022
0023
0024 using namespace dd4hep;
0025
0026 DD4HEP_INSTANTIATE_HANDLE_UNNAMED(SegmentationObject);
0027
0028
0029 Segmentation::Segmentation(const std::string& typ, const std::string& nam, const BitFieldCoder* dec) : Handle<Object>()
0030 {
0031 std::string seg_type = "segmentation_constructor__"+typ;
0032 SegmentationObject* obj = PluginService::Create<SegmentationObject*>(seg_type, dec);
0033 if ( obj != 0 ) {
0034 assign(obj, nam, typ);
0035 if ( !nam.empty() ) obj->setName(nam);
0036 return;
0037 }
0038
0039 except("Segmentation","FAILED to create segmentation: %s. [Missing factory]",typ.c_str());
0040 }
0041
0042
0043 const char* Segmentation::name() const {
0044 return access()->name().c_str();
0045 }
0046
0047
0048 std::string Segmentation::type() const {
0049 return access()->type();
0050 }
0051
0052 bool Segmentation::useForHitPosition() const {
0053 return access()->useForHitPosition != 0;
0054 }
0055
0056
0057 DDSegmentation::Parameters Segmentation::parameters() const {
0058 return access()->parameters();
0059 }
0060
0061
0062 DDSegmentation::Parameter Segmentation::parameter(const std::string& parameterName) const {
0063 return access()->parameter(parameterName);
0064 }
0065
0066
0067 Position Segmentation::position(const CellID& cell) const {
0068 return Position(access()->segmentation->position(cell));
0069 }
0070
0071
0072 CellID Segmentation::cellID(const Position& localPosition, const Position& globalPosition, const CellID & volID) const {
0073 return access()->segmentation->cellID(localPosition, globalPosition, volID);
0074 }
0075
0076
0077 VolumeID Segmentation::volumeID(const CellID& cell) const {
0078 return access()->segmentation->volumeID(cell);
0079 }
0080
0081
0082 void Segmentation::neighbours(const CellID& cell, std::set<CellID>& nb) const {
0083 access()->segmentation->neighbours(cell, nb);
0084 }
0085
0086
0087
0088
0089
0090
0091
0092 std::vector<double> Segmentation::cellDimensions(const CellID& cell) const {
0093 return access()->segmentation->cellDimensions(cell);
0094 }
0095
0096
0097
0098
0099 bool Segmentation::cellsSpanVolumes() const
0100 {
0101 return access()->segmentation->cellsSpanVolumes();
0102 }
0103
0104
0105 DDSegmentation::Segmentation* Segmentation::segmentation() const {
0106 return access()->segmentation;
0107 }
0108
0109
0110 const BitFieldCoder* Segmentation::decoder() const {
0111 return access()->segmentation->decoder();
0112 }
0113
0114
0115 void Segmentation::setDecoder(const BitFieldCoder* decode) const {
0116 access()->segmentation->setDecoder(decode);
0117 }
0118
0119
0120 Handle<DetElementObject> Segmentation::detector() const {
0121 return access()->detector;
0122 }
0123
0124
0125 Handle<SensitiveDetectorObject> Segmentation::sensitive() const {
0126 return access()->sensitive;
0127 }
0128
0129 #include <DDSegmentation/NoSegmentation.h>
0130 DD4HEP_INSTANTIATE_SEGMENTATION_HANDLE(DDSegmentation::NoSegmentation);
0131
0132 #include <DDSegmentation/CartesianGrid.h>
0133 DD4HEP_INSTANTIATE_SEGMENTATION_HANDLE(DDSegmentation::CartesianGrid);
0134
0135 #include <DDSegmentation/CartesianGridXY.h>
0136 DD4HEP_INSTANTIATE_SEGMENTATION_HANDLE(DDSegmentation::CartesianGridXY);
0137
0138 #include <DDSegmentation/CartesianGridXZ.h>
0139 DD4HEP_INSTANTIATE_SEGMENTATION_HANDLE(DDSegmentation::CartesianGridXZ);
0140
0141 #include <DDSegmentation/CartesianGridYZ.h>
0142 DD4HEP_INSTANTIATE_SEGMENTATION_HANDLE(DDSegmentation::CartesianGridYZ);
0143
0144 #include <DDSegmentation/CartesianGridUV.h>
0145 DD4HEP_INSTANTIATE_SEGMENTATION_HANDLE(DDSegmentation::CartesianGridUV);
0146
0147 #include <DDSegmentation/CartesianGridXYZ.h>
0148 DD4HEP_INSTANTIATE_SEGMENTATION_HANDLE(DDSegmentation::CartesianGridXYZ);
0149
0150 #include <DDSegmentation/CartesianStripX.h>
0151 DD4HEP_INSTANTIATE_SEGMENTATION_HANDLE(DDSegmentation::CartesianStripX);
0152
0153 #include <DDSegmentation/CartesianStripY.h>
0154 DD4HEP_INSTANTIATE_SEGMENTATION_HANDLE(DDSegmentation::CartesianStripY);
0155
0156 #include <DDSegmentation/CartesianStripZ.h>
0157 DD4HEP_INSTANTIATE_SEGMENTATION_HANDLE(DDSegmentation::CartesianStripZ);
0158
0159 #include <DDSegmentation/TiledLayerGridXY.h>
0160 DD4HEP_INSTANTIATE_SEGMENTATION_HANDLE(DDSegmentation::TiledLayerGridXY);
0161
0162 #include <DDSegmentation/MegatileLayerGridXY.h>
0163 DD4HEP_INSTANTIATE_SEGMENTATION_HANDLE(DDSegmentation::MegatileLayerGridXY);
0164
0165 #include <DDSegmentation/WaferGridXY.h>
0166 DD4HEP_INSTANTIATE_SEGMENTATION_HANDLE(DDSegmentation::WaferGridXY);
0167
0168 #include <DDSegmentation/PolarGridRPhi.h>
0169 DD4HEP_INSTANTIATE_SEGMENTATION_HANDLE(DDSegmentation::PolarGridRPhi);
0170
0171 #include <DDSegmentation/PolarGridRPhi2.h>
0172 DD4HEP_INSTANTIATE_SEGMENTATION_HANDLE(DDSegmentation::PolarGridRPhi2);
0173
0174 #include <DDSegmentation/GridPhiEta.h>
0175 DD4HEP_INSTANTIATE_SEGMENTATION_HANDLE(DDSegmentation::GridPhiEta);
0176
0177 #include <DDSegmentation/GridRPhiEta.h>
0178 DD4HEP_INSTANTIATE_SEGMENTATION_HANDLE(DDSegmentation::GridRPhiEta);
0179
0180 #include <DDSegmentation/ProjectiveCylinder.h>
0181 DD4HEP_INSTANTIATE_SEGMENTATION_HANDLE(DDSegmentation::ProjectiveCylinder);
0182
0183 #include <DDSegmentation/MultiSegmentation.h>
0184 DD4HEP_INSTANTIATE_SEGMENTATION_HANDLE(DDSegmentation::MultiSegmentation);
0185
0186 #include <DDSegmentation/CylindricalGridPhiZ.h>
0187 DD4HEP_INSTANTIATE_SEGMENTATION_HANDLE(DDSegmentation::CylindricalGridPhiZ);