Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
digitization_config.py
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file digitization_config.py
1 #!/usr/bin/env python3
2 import os
3 from pathlib import Path
4 
5 import acts
6 from acts.examples import (
7  readDigiConfigFromJson,
8  DigitizationConfigurator,
9  writeDigiConfigToJson,
10  GenericDetector,
11  GeometryHierarchyMap_DigiComponentsConfig,
12 )
13 
14 
15 u = acts.UnitConstants
16 
17 
19  trackingGeometry,
20  input: Path,
21  output: Path,
22 ):
23  inputConfig = readDigiConfigFromJson(str(input))
24 
25  digiConfigurator = DigitizationConfigurator()
26  digiConfigurator.compactify = True
27  digiConfigurator.inputDigiComponents = inputConfig
28 
29  trackingGeometry.visitSurfaces(digiConfigurator)
30 
31  outputConfig = GeometryHierarchyMap_DigiComponentsConfig(
32  digiConfigurator.outputDigiComponents
33  )
34 
35  writeDigiConfigToJson(outputConfig, str(output))
36 
37 
38 if "__main__" == __name__:
39  detector, trackingGeometry, _ = GenericDetector.create()
40 
42  trackingGeometry=trackingGeometry,
43  input=Path(__file__).parent
44  / "../../Algorithms/Digitization/share/default-smearing-config-generic.json",
45  output=Path.cwd() / "digi-config-out.json",
46  )