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