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 import acts
0004 import argparse
0005 import acts.examples
0006 import acts.examples.odd_light as odd_light
0007 from acts.examples import geant4 as acts_g4
0008 
0009 from acts import GeometryContext, logging
0010 
0011 
0012 def volumeAssociationTest(sequencer, ntests, tdetector):
0013     rnd = acts.examples.RandomNumbers(seed=42)
0014 
0015     alg = acts.examples.VolumeAssociationTest(
0016         name="VolumeAssociation",
0017         ntests=ntests,
0018         detector=tdetector,
0019         randomNumbers=rnd,
0020         randomRange=[1100, 3100],
0021         level=logging.DEBUG,
0022     )
0023     # Add the algorithm to the sequenceer
0024     sequencer.addAlgorithm(alg)
0025     return sequencer
0026 
0027 
0028 def main():
0029     # Parse the command line arguments
0030     p = argparse.ArgumentParser()
0031     p.add_argument(
0032         "-i",
0033         "--input",
0034         type=str,
0035         default="odd-light.gdml",
0036         help="GDML input file (optional)",
0037     )
0038     p.add_argument(
0039         "-s",
0040         "--sensitives",
0041         type=str,
0042         default="phys_vol",
0043         help="Match string for sensitive surfaces",
0044     )
0045     p.add_argument(
0046         "-p",
0047         "--passives",
0048         type=str,
0049         default="pass_vol",
0050         help="Match string for passive surfaces",
0051     )
0052     p.add_argument(
0053         "-n", "--events", type=int, default=1000, help="Number of events to generate"
0054     )
0055     p.add_argument("-t", "--tests", type=int, default=10000, help="Tests per track")
0056 
0057     args = p.parse_args()
0058     geoContext = GeometryContext()
0059 
0060     # Convert the detector surfaces from GDML
0061     [_, ssurfaces, psurfaces] = acts_g4.convertSurfaces(
0062         args.input, [args.sensitives], [args.passives]
0063     )
0064     odd = odd_light.get_detector(geoContext, ssurfaces, psurfaces, logging.INFO)
0065     seq = acts.examples.Sequencer(events=args.events, numThreads=1)
0066     volumeAssociationTest(seq, args.tests, odd).run()
0067 
0068 
0069 if "__main__" == __name__:
0070     main()