3from ROOT
import TObjString
5from argparse
import ArgumentParser
10parser = ArgumentParser()
11parser.add_argument(
"-f",
"--inputFile", help=
"Input file")
12parser.add_argument(
"-g",
"--geoFile", help=
"geo file")
13parser.add_argument(
"-o",
"--outputFile", help=
"Output file")
14parser.add_argument(
"-i",
"--firstEvent", type=int, default=0, help=
"First event to process")
15parser.add_argument(
"-n",
"--nEvents", type=int, default=0, help=
"Number of events to process (0 = all)")
16parser.add_argument(
"--saveFirst25nsOnly", action=
"store_true", help=
"Only store the first 25-ns chunk of each event")
17options = parser.parse_args()
21lsOfGlobals = ROOT.gROOT.GetListOfGlobals()
22lsOfGlobals.Add(geo.modules[
'Scifi'])
23scifiDet = lsOfGlobals.FindObject(
'Scifi')
24scifiDet.SetConfPar(
"Scifi/signalSpeed", 15*u.cm/u.nanosecond)
25lsOfGlobals.Add(geo.modules[
'MuFilter'])
30inRootTFile = ROOT.TFile(options.inputFile)
31print(f
"Input file: {options.inputFile}")
35run = ROOT.FairRunAna()
38ioman = ROOT.FairRootManager.Instance()
39source = ROOT.FairFileSource(inRootTFile)
41outFile = ROOT.TMemFile(
'dummy',
'CREATE')
42sink = ROOT.FairRootFileSink(outFile)
45run.SetEventHeaderPersistence(
False)
48xrdb = ROOT.FairRuntimeDb.instance()
49xrdb.getContainer(
"FairBaseParSet").setStatic()
50xrdb.getContainer(
"FairGeoParSet").setStatic()
53eventBuilder = ROOT.MCEventBuilder(options.outputFile, options.saveFirst25nsOnly)
54run.AddTask(eventBuilder)
58run.Run(options.firstEvent, options.firstEvent+options.nEvents)
62print(f
"Elapsed time: {elapsed:.2f} seconds")