ATLAS Offline Software
RunExEngineTestITk.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
4 from AthenaConfiguration.AllConfigFlags import initConfigFlags
5 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
6 from AthenaCommon.Logging import log
7 import sys
8 
9 if len(sys.argv[1:]):
10  cmdargs=dict(arg.split('=') for arg in sys.argv[1:])
11  if 'MisalignMode' not in cmdargs.keys():
12  MisalignMode = -1
13  else:
14  MisalignMode=int(cmdargs.get('MisalignMode',11))
15  print("Looking for misalignment files for mode "+str(MisalignMode))
16 else:
17  MisalignMode = -1
18 
19 flags = initConfigFlags()
20 
21 flags.Input.isMC = True
22 
23 flags.Input.Files = []
24 
25 from AthenaConfiguration.TestDefaults import defaultGeometryTags,defaultConditionsTags
26 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN4
27 
28 #Toggle this to use a local geometry input
29 flags.ITk.Geometry.AllLocal = False
30 
31 if flags.ITk.Geometry.AllLocal:
32 
33  detectors = [
34  "ITkPixel",
35  "ITkStrip",
36  "Bpipe"
37  ]
38  from AthenaConfiguration.DetectorConfigFlags import setupDetectorFlags
39  setupDetectorFlags(flags, detectors, toggle_geometry=True)
40 
41  flags.TrackingGeometry.MaterialSource = "Input"
42  flags.Detector.GeometryHGTD = False
43 
44 flags.IOVDb.GlobalTag = defaultConditionsTags.RUN4_MC
45 flags.GeoModel.Align.Dynamic = False
46 if(MisalignMode!=-1):
47  tag=""
48  BFile=""
49  DBFile="MisalignmentSet"+str(MisalignMode)+".db"
50  if(MisalignMode==0):
51  tag="InDetSi_MisalignmentMode_no Misalignment"
52  elif(MisalignMode==1):
53  tag="InDetSi_MisalignmentMode_misalignment by 6 parameters"
54  elif(MisalignMode==2):
55  tag="InDetSi_MisalignmentMode_random misalignment"
56  elif(MisalignMode==3):
57  tag="InDetSi_MisalignmentMode_IBL-stave temperature dependent bowing"
58  elif(MisalignMode==11):
59  tag="InDetSi_MisalignmentMode_R deltaR (radial expansion)"
60  elif(MisalignMode==21):
61  tag="InDetSi_MisalignmentMode_R deltaPhi (curl)"
62  elif(MisalignMode==31):
63  tag="InDetSi_MisalignmentMode_R deltaZ (telescope)"
64  elif(MisalignMode==99):
65  tag="InDetSi_MisalignmentMode_99"
66  DBFile="MisalignmentSet99.db"
67  DBName="OFLCOND"
68  flags.IOVDb.DBConnection ="sqlite://;schema="+DBFile+";dbname="+DBName
69 
70 flags.Detector.GeometryCalo = False
71 flags.Detector.GeometryMuon = False
72 
73 # This should run serially for the moment.
74 flags.Concurrency.NumThreads = 1
75 flags.Concurrency.NumConcurrentEvents = 1
76 
77 log.debug('Lock config flags now.')
78 flags.lock()
79 
80 log.debug('dumping config flags now.')
81 flags.dump()
82 
83 cfg=MainServicesCfg(flags)
84 if(MisalignMode!=-1):
85  from IOVDbSvc.IOVDbSvcConfig import addFolders
86  cfg.merge(addFolders(flags,"/Indet/AlignITk",db=DBName,detDb=DBFile,tag=tag))
87 
88 from TrkExUnitTests.TrkExUnitTestsConfig import ExtrapolationEngineTestCfg
90  NumberOfTestsPerEvent = 100,
91  # parameters mode: 0 - neutral tracks, 1 - charged particles
92  ParametersMode = 1,
93  # do the full test backwards as well
94  BackExtrapolation = False,
95  # Smear the production vertex - standard primary vertex paramters
96  SmearOrigin = True,
97  SimgaOriginD0 = 2./3.,
98  SimgaOriginZ0 = 50.,
99  # pT range for testing
100  PtMin = 1000,
101  PtMax = 1000,
102  # The test range in Eta
103  EtaMin = -5.,
104  EtaMax = 5.,
105  # Configure how you wanna run
106  CollectSensitive = True,
107  CollectPassive = True,
108  CollectBoundary = True,
109  CollectMaterial = True,
110  UseHGTD = flags.Detector.GeometryHGTD,
111  # the path limit to test
112  PathLimit = -1.,
113  )
114 
115 cfg.merge(topoAcc)
116 
117 cfg.printConfig()
118 if(MisalignMode!=-1):
119  cfg.getService("GeoModelSvc").DetectorTools["ITk::PixelDetectorTool"].Alignable=True
120  print("Pixel manager alignability has been set to: "+ str(cfg.getService("GeoModelSvc").DetectorTools["ITk::PixelDetectorTool"].Alignable))
121  cfg.getService("GeoModelSvc").DetectorTools["ITk::StripDetectorTool"].Alignable=True
122  print("Strip manager alignability has been set to:"+str(cfg.getService("GeoModelSvc").DetectorTools["ITk::StripDetectorTool"].Alignable))
123 
124 cfg.run(10)
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
python.IOVDbSvcConfig.addFolders
def addFolders(flags, folderStrings, detDb=None, className=None, extensible=False, tag=None, db=None, modifiers='')
Definition: IOVDbSvcConfig.py:72
TrkExUnitTestsConfig.ExtrapolationEngineTestCfg
def ExtrapolationEngineTestCfg(configFlags, name="ExtrapolationEngineTest", **kwargs)
Definition: TrkExUnitTestsConfig.py:17
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
python.DetectorConfigFlags.setupDetectorFlags
def setupDetectorFlags(flags, custom_list=None, use_metadata=False, toggle_geometry=False, validate_only=False, keep_beampipe=False)
Definition: DetectorConfigFlags.py:289
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567
str
Definition: BTagTrackIpAccessor.cxx:11