File indexing completed on 2026-05-27 07:24:18
0001
0002
0003
0004
0005
0006
0007
0008
0009 """Schema of a geometry file"""
0010
0011 geometry_schema = {
0012 "type": "object",
0013 "properties": {
0014 "header": {
0015 "type": "object",
0016 "description": "File header section with important IO metadata",
0017 "properties": {
0018 "common": {
0019 "type": "object",
0020 "description": "General metadata",
0021 "properties": {
0022 "version": {
0023 "type": "string",
0024 "description": "detray version this file was created with",
0025 },
0026 "detector": {
0027 "type": "string",
0028 "description": "Name of the detector",
0029 },
0030 "date": {
0031 "type": "string",
0032 "description": "Time stamp (file creation)",
0033 },
0034 "tag": {
0035 "type": "string",
0036 "description": "Type of data",
0037 "enum": ["geometry"],
0038 },
0039 },
0040 "required": ["version", "detector", "tag"],
0041 },
0042 "volume_count": {
0043 "type": "integer",
0044 "description": "Number of volumes in the detector",
0045 "minimum": 0,
0046 },
0047 "surface_count": {
0048 "type": "integer",
0049 "description": "Number of surfaces in the detector",
0050 "minimum": 0,
0051 },
0052 },
0053 "required": ["common"],
0054 },
0055 "data": {
0056 "type": "object",
0057 "description": "Geometry data section (volume-by-volume)",
0058 "properties": {
0059 "volumes": {
0060 "type": "array",
0061 "minitems": 1,
0062 "items": {
0063 "type": "object",
0064 "description": "Data of a single volume",
0065 "properties": {
0066 "name": {
0067 "type": "string",
0068 "description": "The volume name",
0069 },
0070 "index": {
0071 "type": "integer",
0072 "description": "The volume index",
0073 "minimum": 0,
0074 },
0075 "type": {
0076 "type": "integer",
0077 "description": "The volume type id (e.g. cylinder)",
0078 "minimum": 0,
0079 "maximum": 4,
0080 },
0081 "transform": {
0082 "type": "object",
0083 "description": "Data of the volume placement matrix",
0084 "properties": {
0085 "translation": {
0086 "type": "array",
0087 "description": "Translation vector",
0088 "minitems": 3,
0089 "maxItems": 3,
0090 "items": {"type": "number"},
0091 },
0092 "rotation": {
0093 "type": "array",
0094 "description": "Rotation matrix",
0095 "minitems": 9,
0096 "maxItems": 9,
0097 "items": {"type": "number"},
0098 },
0099 },
0100 "required": ["translation", "rotation"],
0101 },
0102 "acc_links": {
0103 "type": "array",
0104 "description": "Typed indices for the acceleration structures",
0105 "minitems": 0,
0106 "maxItems": 5,
0107 "uniqueItems": True,
0108 "items": {
0109 "type": "object",
0110 "properties": {
0111 "type": {
0112 "type": "integer",
0113 "description": "Type ID of the acceleration structure",
0114 "minimum": 1,
0115 "maximum": 5,
0116 },
0117 "index": {
0118 "type": "integer",
0119 "description": "Global index of the acceleration structure",
0120 "minimum": 0,
0121 },
0122 },
0123 "required": ["type", "index"],
0124 },
0125 },
0126 "surfaces": {
0127 "type": "array",
0128 "description": "The contained surfaces",
0129 "minitems": 1,
0130 "uniqueItems": True,
0131 "items": {
0132 "type": "object",
0133 "properties": {
0134 "identifier": {
0135 "type": "integer",
0136 "description": "detray internal surface hash",
0137 "minimum": 0,
0138 },
0139 "type": {
0140 "type": "integer",
0141 "description": "Surface type (portal: 0, sensitive: 1, passive: 2)",
0142 "minimum": 0,
0143 "maximum": 2,
0144 },
0145 "source": {
0146 "type": "integer",
0147 "description": "bits that link the detray surface to its source",
0148 "minimum": 0,
0149 },
0150 "index_in_coll": {
0151 "type": "integer",
0152 "description": "Volume-local sorting index",
0153 "minimum": 0,
0154 },
0155 "transform": {
0156 "type": "object",
0157 "description": "Data of the surface placement matrix",
0158 "properties": {
0159 "translation": {
0160 "type": "array",
0161 "description": "Translation vector",
0162 "minitems": 3,
0163 "maxItems": 3,
0164 "items": {"type": "number"},
0165 },
0166 "rotation": {
0167 "type": "array",
0168 "description": "Rotation matrix",
0169 "minitems": 9,
0170 "maxItems": 9,
0171 "items": {"type": "number"},
0172 },
0173 },
0174 "required": ["translation", "rotation"],
0175 },
0176 "mask": {
0177 "type": "object",
0178 "description": "Surface mask data",
0179 "properties": {
0180 "shape": {
0181 "type": "integer",
0182 "description": "Shape ID",
0183 "minimum": 0,
0184 "maximum": 12,
0185 },
0186 "volume_link": {
0187 "type": "integer",
0188 "description": "Navigation link",
0189 "minimum": 0,
0190 },
0191 "boundaries": {
0192 "type": "array",
0193 "description": "Mask boundary values",
0194 "minitems": 1,
0195 "maxItems": 7,
0196 "items": {"type": "number"},
0197 },
0198 },
0199 "required": [
0200 "shape",
0201 "volume_link",
0202 "boundaries",
0203 ],
0204 },
0205 "material": {
0206 "type": "object",
0207 "description": "Surface material link",
0208 "properties": {
0209 "type": {
0210 "type": "integer",
0211 "description": "Material type ID",
0212 "minimum": 0,
0213 "maximum": 10,
0214 },
0215 "index": {
0216 "type": "integer",
0217 "description": "Index of material instance",
0218 "minimum": 0,
0219 },
0220 },
0221 "required": ["type", "index"],
0222 },
0223 },
0224 "required": ["type", "source", "transform", "mask"],
0225 },
0226 },
0227 },
0228 "required": ["name", "index", "type", "transform", "surfaces"],
0229 },
0230 },
0231 "volume_grid": {
0232 "type": "object",
0233 "description": "Data for the volume grid (temporary placeholder)",
0234 "properties": {
0235 "volume_link": {
0236 "type": "integer",
0237 "description": "Volume link",
0238 "minimum": 0,
0239 },
0240 "acc_link": {
0241 "type": "object",
0242 "description": "Typed index for the grids",
0243 "properties": {
0244 "type": {
0245 "type": "integer",
0246 "description": "Type ID of the acceleration structure",
0247 },
0248 "index": {
0249 "type": "integer",
0250 "description": "Global index of the acceleration structure",
0251 "minimum": 0,
0252 },
0253 },
0254 "required": ["type", "index"],
0255 },
0256 "axes": {"type": ["null", "array"]},
0257 "bins": {"type": ["null", "array"]},
0258 },
0259 "required": ["volume_link", "acc_link", "axes", "bins"],
0260 },
0261 },
0262 "required": ["volumes"],
0263 },
0264 },
0265 "required": ["header", "data"],
0266 }