9 RootMaterialTrackReader,
10 RootMaterialTrackWriter,
20 SurfaceMaterialMapper,
25 MaterialMapJsonConverter,
27 from common
import getOpenDataDetectorDirectory
36 mapName=
"material-map",
39 readCachedSurfaceInformation=
False,
43 s = s
or Sequencer(numThreads=1)
45 for decorator
in decorators:
46 s.addContextDecorator(decorator)
48 wb = WhiteBoard(acts.logging.INFO)
50 context = AlgorithmContext(0, 0, wb)
52 for decorator
in decorators:
53 assert decorator.decorate(context) == ProcessCode.SUCCESS
57 RootMaterialTrackReader(
58 level=acts.logging.INFO,
59 collection=
"material-tracks",
63 mapName +
"_tracks.root"
64 if readCachedSurfaceInformation
65 else "geant4_material_tracks.root",
68 readCachedSurfaceInformation=readCachedSurfaceInformation,
72 stepper = StraightLineStepper()
74 mmAlgCfg = MaterialMapping.Config(context.geoContext, context.magFieldContext)
75 mmAlgCfg.trackingGeometry = trackingGeometry
76 mmAlgCfg.collection =
"material-tracks"
79 navigator = Navigator(
80 trackingGeometry=trackingGeometry,
81 resolveSensitive=
True,
86 mapper = SurfaceMaterialMapper(level=acts.logging.INFO, propagator=propagator)
87 mmAlgCfg.materialSurfaceMapper = mapper
90 navigator = Navigator(
91 trackingGeometry=trackingGeometry,
94 mapper = VolumeMaterialMapper(
95 level=acts.logging.INFO, propagator=propagator, mappingStep=mappingStep
97 mmAlgCfg.materialVolumeMapper = mapper
99 jmConverterCfg = MaterialMapJsonConverter.Config(
100 processSensitives=
True,
101 processApproaches=
True,
102 processRepresenting=
True,
103 processBoundaries=
True,
105 context=context.geoContext,
108 jmw = JsonMaterialWriter(
109 level=acts.logging.VERBOSE,
110 converterCfg=jmConverterCfg,
111 fileName=os.path.join(outputDir, mapName),
112 writeFormat=JsonFormat.Json,
115 mmAlgCfg.materialWriters = [jmw]
117 s.addAlgorithm(MaterialMapping(level=acts.logging.INFO, config=mmAlgCfg))
120 RootMaterialTrackWriter(
121 level=acts.logging.INFO,
122 collection=mmAlgCfg.mappingMaterialCollection,
123 filePath=os.path.join(
125 mapName +
"_tracks.root",
135 if "__main__" == __name__:
136 matDeco = acts.IMaterialDecorator.fromFile(
"geometry-map.json")
144 outputDir=os.getcwd(),
145 inputDir=os.getcwd(),
146 readCachedSurfaceInformation=
False,