Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:28:28

0001 #!/usr/bin/env python3
0002 # SPDX-License-Identifier: LGPL-3.0-or-later
0003 # Copyright (C) 2024 Shujie Li
0004 
0005 import os
0006 import argparse
0007 
0008 import acts
0009 import acts.examples.dd4hep
0010 from acts.examples import Sequencer
0011 
0012 import epic
0013 from material_validation import runMaterialValidation
0014 
0015 
0016 if "__main__" == __name__:
0017 
0018     p = argparse.ArgumentParser(
0019         description="Script to produce propogation validation for ePIC material mapping."
0020     )
0021     p.add_argument(
0022         "--xmlFile",
0023         default=os.environ.get("DETECTOR_PATH", "") + os.environ.get("DETECTOR_CONFIG", "") + ".xml",
0024         help="input xml file containing ePIC geometry",
0025     )
0026     p.add_argument(
0027         "--matFile",
0028         type=str,
0029         default="material-map.json",
0030         help="input material map file with extension, can be either xx.json or xx.cbor",
0031     )
0032     p.add_argument(
0033         "--outputName",
0034         type=str,
0035         default="propagation-material.root",
0036         help="customized name of the output rootfile",
0037     )
0038     p.add_argument(
0039         "-n","--nevents",
0040         type=int,
0041         default=1000,
0042         help="number of events to run",
0043     )
0044 
0045     p.add_argument(
0046         "-t","--ntracks",
0047         type=int,
0048         default=1000,
0049         help="number of tracks per event")
0050 
0051     args = p.parse_args()
0052 
0053     detector = epic.getDetector(args.xmlFile, args.matFile)
0054     trackingGeometry = detector.trackingGeometry()
0055     decorators = detector.contextDecorators()
0056 
0057     field = acts.ConstantBField(acts.Vector3(0, 0, 0))
0058 
0059     runMaterialValidation(args.nevents, args.ntracks,
0060         trackingGeometry, decorators, field,
0061         outputDir=os.getcwd(), outputName=args.outputName,
0062         s=Sequencer(events=args.nevents, numThreads=-1)
0063     ).run()