Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:12:09

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 (
0008     addParticleGun,
0009     EtaConfig,
0010     PhiConfig,
0011     ParticleConfig,
0012     addFatras,
0013     addGeant4,
0014 )
0015 
0016 u = acts.UnitConstants
0017 
0018 if "__main__" == __name__:
0019     detector = acts.examples.TelescopeDetector(
0020         bounds=[200, 200],
0021         positions=[30, 60, 90, 120, 150, 180, 210, 240, 270],
0022         stereos=[0, 0, 0, 0, 0, 0, 0, 0, 0],
0023         binValue=2,
0024     )
0025     trackingGeometry = detector.trackingGeometry()
0026 
0027     field = acts.ConstantBField(acts.Vector3(0, 0, 2 * u.T))
0028 
0029     outputDir = Path.cwd() / "telescope_simulation"
0030     if not outputDir.exists():
0031         outputDir.mkdir()
0032 
0033     for geant, postfix in [(False, "fatras"), (True, "geant4")]:
0034         rnd = acts.examples.RandomNumbers(seed=42)
0035 
0036         s = acts.examples.Sequencer(events=1, numThreads=1, logLevel=acts.logging.INFO)
0037 
0038         addParticleGun(
0039             s,
0040             EtaConfig(-10.0, 10.0),
0041             PhiConfig(0.0, 360.0 * u.degree),
0042             ParticleConfig(1000, acts.PdgParticle.eMuon, False),
0043             multiplicity=1,
0044             rnd=rnd,
0045             outputDirRoot=outputDir / postfix,
0046         )
0047 
0048         if geant:
0049             addGeant4(
0050                 s,
0051                 detector,
0052                 trackingGeometry,
0053                 field,
0054                 rnd=rnd,
0055                 outputDirRoot=outputDir / postfix,
0056                 outputDirCsv=outputDir / postfix,
0057                 logLevel=acts.logging.VERBOSE,
0058             )
0059         else:
0060             addFatras(
0061                 s,
0062                 trackingGeometry,
0063                 field,
0064                 rnd=rnd,
0065                 outputDirRoot=outputDir / postfix,
0066             )
0067 
0068         s.run()