ATLAS Offline Software
CondAlgsOpts.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 #
4 
5 
6 #
7 
9 from AthenaCommon.Logging import log as msg
10 
11 from AthenaCommon.ConcurrencyFlags import jobproperties as jp
12 nThreads = jp.ConcurrencyFlags.NumThreads()
13 if (nThreads < 1) :
14  msg.fatal('numThreads must be >0. Did you set the --threads=N option?')
15  sys.exit(AthenaCommon.ExitCodes.CONFIGURATION_ERROR)
16 
17 # setup the McEventSelector
18 import AthenaCommon.AtlasUnixGeneratorJob
19 svcMgr.EventSelector.FirstEvent=1
20 svcMgr.EventSelector.RunNumber=1
21 svcMgr.EventSelector.InitialTimeStamp=0
22 svcMgr.EventSelector.TimeStampInterval=1
23 svcMgr.EventSelector.FirstLB=1
24 
25 #
26 
28 
29 from AthenaServices.AthenaServicesConf import AthenaHiveEventLoopMgr
30 # svcMgr.AthenaHiveEventLoopMgr.OutputLevel = INFO
31 
32 from StoreGate.StoreGateConf import StoreGateSvc
33 # svcMgr.StoreGateSvc.Dump = True
34 # svcMgr += StoreGateSvc("ConditionStore", Dump=True)
35 
36 # from StoreGate.StoreGateConf import StoreGateSvc
37 # theApp.CreateSvc += ["StoreGateSvc/ConditionStore"]
38 
39 
40 from StoreGate.StoreGateConf import SG__HiveMgrSvc
41 # svcMgr.EventDataSvc.OutputLevel = INFO
42 
43 from GaudiHive.GaudiHiveConf import AlgResourcePool
44 # svcMgr += AlgResourcePool( OutputLevel = INFO );
45 
46 from AthenaCommon.AlgScheduler import AlgScheduler
47 AlgScheduler.OutputLevel( INFO )
48 AlgScheduler.ShowControlFlow( True )
49 AlgScheduler.ShowDataDependencies( True )
50 AlgScheduler.EnableConditions( True )
51 AlgScheduler.setDataLoaderAlg( "SGInputLoader" )
52 
53 from IOVSvc.IOVSvcConf import CondSvc
54 svcMgr += CondSvc( OutputLevel=VERBOSE )
55 
56 #-----------------------------------------------------------------------------#
57 
58 #
59 
64 
65 #-----------------------------------------------------------------------------#
66 
67 
68 # from StoreGate.StoreGateConf import StoreGateSvc
69 # theApp.CreateSvc += ["StoreGateSvc/ConditionStore"]
70 
71 #
72 
74 
75 from AthenaCommon.AlgSequence import AlgSequence
76 topSequence = AlgSequence()
77 
78 from AthExHive.AthExHiveConf import *
79 topSequence+=AlgA(OutputLevel=DEBUG)
80 topSequence+=AlgB(OutputLevel=DEBUG, Key_R1="a1", Key_W1="a3")
81 topSequence+=AlgC("AlgC1", OutputLevel=DEBUG, Key_R1="a2", Key_CH="X1")
82 topSequence+=AlgC("AlgC2", OutputLevel=DEBUG, Key_R1="a1", Key_CH="X2")
83 topSequence+=AlgD("AlgD1", OutputLevel=DEBUG, Key_R1="a3", Key_CH1="X1", Key_CH2="X2")
84 #topSequence+=AlgD("AlgD2", OutputLevel=DEBUG, Key_R1="a1", Key_CH1="Y1", Key_CH2="Y2")
85 
86 from AthenaCommon.AlgSequence import AthSequencer
87 condSeq = AthSequencer("AthCondSeq")
88 
89 condSeq+=CondAlgX("CondAlgX1", OutputLevel=DEBUG, Key_CH="X1", Key_DB="X1")
90 condSeq+=CondAlgX("CondAlgX2", OutputLevel=DEBUG, Key_CH="X2", Key_DB="X2")
91 
92 condSeq+=CondAlgY("CondAlgY1", OutputLevel=DEBUG, Key_CH1="Y1", Key_CH2="Y2", Key_DB1="Y1", Key_DB2="Y2")
93 
94 
95 condDbFile = "condDb.txt"
96 import os
97 import string
98 for dir in (".:"+os.environ.get('DATAPATH')).split (':'):
99  cdb = os.path.join(dir,condDbFile)
100  if (os.path.isfile( cdb ) ) :
101  found = 1
102  break
103 
104 if (found == 0):
105  msg.fatal('ASCII condDb file \"' + condDbFile + '\" not found')
106  sys.exit(AthenaCommon.ExitCodes.CONFIGURATION_ERROR)
107 else:
108  msg.info( "using ASCIICondDb file from " + cdb )
109 
110 svcMgr += ASCIICondDbSvc( OutputLevel=DEBUG, CondFile = cdb )
111 
112 
113 #--------------------------------------------------------------
114 # Event related parameters
115 #--------------------------------------------------------------
116 
117 theApp.EvtMax = 20
118 
119 nProc = jp.ConcurrencyFlags.NumProcs()
120 if (nProc > 0) :
121 
122  #
123 
125  import AthenaCommon.AtlasUnixGeneratorJob
126 
127  #
128 
130 
131  from AthenaCommon.Logging import log as msg
132  if (theApp.EvtMax == -1) :
133  msg.fatal('EvtMax must be >0 for hybrid configuration')
134  sys.exit(AthenaCommon.ExitCodes.CONFIGURATION_ERROR)
135 
136  if ( theApp.EvtMax % nProc != 0 ) :
137  msg.warning('EvtMax[%s] is not divisible by nProcs[%s]: MP Workers will not process all requested events',theApp.EvtMax,nProc)
138 
139  chunkSize = int (theApp.EvtMax / nProc)
140 
141  from AthenaMP.AthenaMPFlags import jobproperties as jps
142  jps.AthenaMPFlags.PreCountedEvents=theApp.EvtMax
143  jps.AthenaMPFlags.ChunkSize= chunkSize
144 
145  msg.info('AthenaMP workers will process %s events each',chunkSize)
146 
147 
148 
149 print ("==========================================================================================\n")
150 
151 #
152 
154 
155 # set algCardinality = 1 to disable cloning for all Algs
156 algCardinality = jp.ConcurrencyFlags.NumThreads()
157 
158 if (algCardinality != 1):
159  for alg in topSequence:
160  name = alg.name()
161  alg.Cardinality = algCardinality
162 
AlgC
Definition: AlgC.h:17
python.AlgSequence.AlgSequence
AlgSequence
Definition: PhysicsAnalysis/D3PDTools/AnaAlgorithm/python/AlgSequence.py:7
ASCIICondDbSvc
Definition: ASCIICondDbSvc.h:20
CondAlgY
Definition: CondAlgY.h:17
AthExHiveConf
CondAlgX
Definition: CondAlgX.h:20
python.AlgSequence.AthSequencer
AthSequencer
Definition: Control/AthenaCommon/python/AlgSequence.py:64
AlgB
Definition: AlgB.h:15
AlgD
Definition: AlgD.h:17
AlgA
Definition: AlgA.h:17