ATLAS Offline Software
Loading...
Searching...
No Matches
RunGeantinoMaterialTrackProduction.py
Go to the documentation of this file.
1#!/usr/bin/env python
2# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3"""
4Run geantino processing for material track creation
5"""
6
7from argparse import ArgumentParser
8from AthenaCommon.Logging import log
9from AthenaConfiguration.AllConfigFlags import initConfigFlags
10from AthenaConfiguration.MainServicesConfig import MainServicesCfg
11
12# Argument parsing
13parser = ArgumentParser("RunGeantinoMaterialTrackProduction.py")
14parser.add_argument("detectors", metavar="detectors", type=str, nargs="*",
15 help="Specify the list of detectors")
16parser.add_argument("--simulate", default=True, action="store_true",
17 help="Run Simulation")
18parser.add_argument("--localgeo", default=False, action="store_true",
19 help="Use local geometry Xml files")
20parser.add_argument("--geoModelSqLiteFile", default = "", help="Read geometry from sqlite file")
21parser.add_argument("-V", "--verboseAccumulators", default=False,
22 action="store_true",
23 help="Print full details of the AlgSequence")
24parser.add_argument("-S", "--verboseStoreGate", default=False,
25 action="store_true",
26 help="Dump the StoreGate(s) each event iteration")
27parser.add_argument("--maxEvents",default=10, type=int,
28 help="The number of events to run. 0 skips execution")
29parser.add_argument("--skipEvents",default=0, type=int,
30 help="The number of events to skip")
31parser.add_argument("--geometrytag",default="ATLAS-P2-RUN4-03-00-00", type=str,
32 help="The geometry tag to use")
33parser.add_argument("--inputevntfile",
34 default="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/PhaseIIUpgrade/EVNT/mc15_14TeV.singlegeantino_E10GeV_etaFlatnp0_6.5M.evgen.EVNT.pool.root",
35 help="The input EVNT file to use")
36parser.add_argument("--outputhitsfile",default="myHITS.pool.root", type=str,
37 help="The output HITS filename")
38args = parser.parse_args()
39
40
41# Some info about the job
42print("----RunGeantinoMaterialTrackProduction for ITk geometry----")
43print()
44print("Using Geometry Tag: "+args.geometrytag)
45if args.localgeo:
46 print("...overridden by local Geometry Xml files")
47if(args.geoModelSqLiteFile):
48 print("... overridden by Geometry Sqlite file: "+args.geoModelSqLiteFile)
49print("Input EVNT File:"+args.inputevntfile)
50if not args.detectors:
51 print("Running complete detector")
52else:
53 print("Running with: {}".format(", ".join(args.detectors)))
54print()
55
56# Configure
57flags = initConfigFlags()
58if args.localgeo:
59 flags.ITk.Geometry.AllLocal = True
60
61flags.Input.Files = [args.inputevntfile]
62flags.Output.HITSFileName = args.outputhitsfile
63
64flags.GeoModel.AtlasVersion = args.geometrytag
65flags.IOVDb.GlobalTag = "OFLCOND-SIM-00-00-00"
66flags.GeoModel.Align.Dynamic = False
67
68from AthenaConfiguration.DetectorConfigFlags import getEnabledDetectors ,setupDetectorFlags
69from AthenaConfiguration.AutoConfigFlags import getDefaultDetectors
70
71
72if args.geoModelSqLiteFile:
73 flags.GeoModel.SQLiteDB = True
74 flags.GeoModel.SQLiteDBFullPath = args.geoModelSqLiteFile
75 # hack to set Run4 for running on muon dead material geometry
76 from AthenaConfiguration.Enums import LHCPeriod
77 flags.GeoModel.Run = LHCPeriod.Run4
78else:
79 defaultDetectors = ['ITkPixel', 'ITkStrip']
80 detectors = args.detectors if 'detectors' in args and args.detectors else defaultDetectors
81 detectors.append('Bpipe') # always run with beam pipe
82 setupDetectorFlags(flags, detectors, toggle_geometry=True)
83
84flags.Acts.TrackingGeometry.UseBlueprint = True
85
86flags.Exec.SkipEvents = args.skipEvents
87
88
89
90log.debug('Lock config flags now.')
91flags.lock()
92print (" ***\n".join(getEnabledDetectors(flags)))
93
94print(flags.dump(evaluate=True))
95
96# Construct our accumulator to run
97acc = MainServicesCfg(flags)
98
99if args.verboseStoreGate:
100 acc.getService("StoreGateSvc").Dump = True
101
102log.debug('Dumping of ConfigFlags now.')
103flags.dump()
104
105from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
106acc.merge(PoolReadCfg(flags))
107
108# add BeamEffectsAlg
109from BeamEffects.BeamEffectsAlgConfig import BeamEffectsAlgCfg
110acc.merge(BeamEffectsAlgCfg(flags))
111
112beamcond = acc.getCondAlgo("BeamSpotCondAlg")
113
114beamcond.useDB=False
115beamcond.posX=0.0
116beamcond.posY=0.0
117beamcond.posZ=0.0
118beamcond.sigmaX=0.0
119beamcond.sigmaY=0.0
120beamcond.sigmaZ=0.0
121beamcond.tiltX=0.0
122beamcond.tiltY=0.0
123
124kwargs = {}
125from ActsConfig.ActsMaterialConfig import MaterialTrackRecorderUserActionSvcCfg
126userAction = acc.getPrimaryAndMerge(MaterialTrackRecorderUserActionSvcCfg(flags,**kwargs))
127kwargs.update(UserActionSvc=userAction)
128
129if args.simulate:
130 from G4AtlasAlg.G4AtlasAlgConfig import G4AtlasAlgCfg
131 acc.merge(G4AtlasAlgCfg(flags, "ITkG4AtlasAlg", **kwargs))
132 from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
133 from SimuJobTransforms.SimOutputConfig import getStreamHITS_ItemList
134 acc.merge( OutputStreamCfg(flags,"HITS", ItemList=getStreamHITS_ItemList(flags), disableEventTag=True, AcceptAlgs=['ITkG4AtlasAlg']) )
135
136
137from ActsConfig.ActsMaterialConfig import MaterialTrackWriterCfg
138acc.merge(MaterialTrackWriterCfg(flags))
139
140acc.printConfig(withDetails = True, summariseProps = True)
141
142acc.run(maxEvents=args.maxEvents)
143
144
if(febId1==febId2)
void print(char *figname, TCanvas *c1)