Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:10:08

0001 #!/usr/bin/env python3
0002 
0003 from pathlib import Path
0004 
0005 import acts
0006 import acts.examples
0007 from acts.examples.simulation import addParticleGun, addGeant4, EtaConfig
0008 from acts.examples.odd import getOpenDataDetector
0009 
0010 u = acts.UnitConstants
0011 
0012 
0013 def runGeant4(
0014     detector,
0015     trackingGeometry,
0016     field,
0017     outputDir,
0018     s: acts.examples.Sequencer = None,
0019 ):
0020     s = s or acts.examples.Sequencer(events=100, numThreads=1)
0021     s.config.logLevel = acts.logging.INFO
0022     rnd = acts.examples.RandomNumbers()
0023     addParticleGun(
0024         s,
0025         EtaConfig(-2.0, 2.0),
0026         rnd=rnd,
0027     )
0028     outputDir = Path(outputDir)
0029     addGeant4(
0030         s,
0031         detector,
0032         trackingGeometry,
0033         field,
0034         outputDirCsv=outputDir / "csv",
0035         outputDirRoot=outputDir,
0036         rnd=rnd,
0037     )
0038     return s
0039 
0040 
0041 if "__main__" == __name__:
0042     detector, trackingGeometry, decorators = getOpenDataDetector()
0043 
0044     field = acts.ConstantBField(acts.Vector3(0, 0, 2 * u.T))
0045 
0046     runGeant4(detector, trackingGeometry, field, Path.cwd()).run()