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 import os
0003 import argparse
0004 
0005 import acts
0006 
0007 from acts.examples import CsvMuonSimHitReader, CsvDriftCircleReader, MuonHoughSeeder
0008 
0009 # from acts.examples.reconstruction import (
0010 #     addSeeding,
0011 #     addStandardSeeding,
0012 #     SeedingAlgorithm,
0013 # )
0014 
0015 # from acts.examples.itk import itkSeedingAlgConfig, InputSpacePointsType
0016 
0017 u = acts.UnitConstants
0018 rnd = acts.examples.RandomNumbers(seed=42)
0019 
0020 
0021 def runHoughFromCsv(inDir):
0022     # create temporary file with pixel SPs and run the seeding
0023 
0024     s = acts.examples.Sequencer(events=8, numThreads=1, logLevel=acts.logging.VERBOSE)
0025 
0026     # Read input space points from input csv files
0027     evReader = CsvMuonSimHitReader(
0028         inputStem="MuonSimHit",
0029         inputDir=os.path.dirname(inDir),
0030         outputSimHits="MuonSimHits",
0031         level=acts.logging.VERBOSE,
0032     )
0033     dcReader = CsvDriftCircleReader(
0034         inputStem="MuonDriftCircle",
0035         inputDir=os.path.dirname(inDir),
0036         outputDriftCircles="MuonDriftCircles",
0037         level=acts.logging.VERBOSE,
0038     )
0039     # add csv reader
0040     s.addReader(evReader)
0041     s.addReader(dcReader)
0042     seeder = MuonHoughSeeder(
0043         inSimHits=evReader.config.outputSimHits,
0044         inDriftCircles=dcReader.config.outputDriftCircles,
0045         level=acts.logging.VERBOSE,
0046     )
0047     s.addAlgorithm(seeder)
0048     s.run()
0049 
0050 
0051 if "__main__" == __name__:
0052     p = argparse.ArgumentParser(
0053         description="Example script to run ITk seed finding based on CSV spacepoints",
0054     )
0055     p.add_argument(
0056         "indir",
0057         help="Input directory containing the ITk standalone geometry. Get in touch if you don't have this.",
0058     )
0059 
0060     args = p.parse_args()
0061 
0062     runHoughFromCsv(args.indir)