3 from common
import getOpenDataDetectorDirectory
11 CsvTrackingGeometryWriter,
12 ObjTrackingGeometryWriter,
20 from acts
import MaterialMapJsonConverter
34 for ievt
in range(events):
35 eventStore = WhiteBoard(name=f
"EventStore#{ievt}", level=acts.logging.INFO)
38 context = AlgorithmContext(ialg, ievt, eventStore)
40 for cdr
in decorators:
41 r = cdr.decorate(context)
42 if r != ProcessCode.SUCCESS:
43 raise RuntimeError(
"Failed to decorate event context")
46 writer = CsvTrackingGeometryWriter(
47 level=acts.logging.INFO,
48 trackingGeometry=trackingGeometry,
49 outputDir=os.path.join(outputDir,
"csv"),
55 writer = ObjTrackingGeometryWriter(
56 level=acts.logging.INFO, outputDir=os.path.join(outputDir,
"obj")
58 writer.write(context, trackingGeometry)
61 writer = JsonSurfacesWriter(
62 level=acts.logging.INFO,
63 trackingGeometry=trackingGeometry,
64 outputDir=os.path.join(outputDir,
"json"),
70 jmConverterCfg = MaterialMapJsonConverter.Config(
71 processSensitives=
True,
72 processApproaches=
True,
73 processRepresenting=
True,
74 processBoundaries=
True,
76 processNonMaterial=
True,
77 context=context.geoContext,
80 jmw = JsonMaterialWriter(
81 level=acts.logging.VERBOSE,
82 converterCfg=jmConverterCfg,
83 fileName=os.path.join(outputDir,
"geometry-map"),
84 writeFormat=JsonFormat.Json,
87 jmw.write(trackingGeometry)
90 if "__main__" == __name__:
91 detector, trackingGeometry, decorators = AlignedDetector.create()
95 runGeometry(trackingGeometry, decorators, outputDir=os.getcwd())