ATLAS Offline Software
Loading...
Searching...
No Matches
StateLessPT_TestFile_NewConfig.py
Go to the documentation of this file.
1#!/usr/bin/env python
2#
3# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
4#
5
6if __name__=='__main__':
7
8 import os,sys,getopt
9
10 if len(sys.argv)>1 and (sys.argv[1]=="-h" or sys.argv[1]=="--help"):
11 print("Usage:")
12 print(" ")
13 print("StateLessPT_TestFile_NewConfig.py {--input=<infile>} {--runnb=run} {--config=XXX} {--stream=YYY} {--noPost} {--postFreq=ZZ}")
14 print(" default input: /detwork/dqm/GlobalMonitoring_test_data/data25_13p6TeV.00502618.express_express.merge.RAW._lb0982._SFO-ALL._0001.1")
15 print(" default runnb: 502618")
16 print(" default XXX: LArMon")
17 print(" default YYY: ''")
18 print(" --noPost is switching off postProcessing")
19 print(" default ZZ: 10")
20
21 #some defaults
22 #INPUT = '/det/dqm/GlobalMonitoring/SMW_test/testpart_sample/data21_900GeV.00405543.physics_MinBias.daq.RAW._lb1977._SFO-6._0001.data'
23 # At P1 use:
24 INPUT = '/detwork/dqm/GlobalMonitoring_test_data/data25_13p6TeV.00502618.express_express.merge.RAW._lb0982._SFO-ALL._0001.1'
25 #INPUT = '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/RecExRecoTest/data18_13TeV/data18_13TeV.00357750.physics_Main.daq.RAW/data18_13TeV.00357750.physics_Main.daq.RAW._lb0083._SFO-1._0001.data'
26 CONFIG = 'LArMon'
27 STREAM = "NONE"
28 DOPOSTPROC = True
29 POSTFREQ = 10
30 RUNNB = 502618
31 if len(sys.argv)>1:
32 for ii in range(1,len(sys.argv)):
33 print(ii," ",sys.argv[ii])
34 try:
35 opts,args=getopt.getopt(sys.argv[1:],"t:",["config=","stream=","postFreq=","noPost"])
36 except getopt.GetoptError as e:
37 print("Failed to interpret arguments")
38 print(e)
39 sys.exit(-1)
40 pass
41
42 for o,a in opts:
43 if o=="--config": CONFIG=a
44 if o=="--stream": STREAM=a
45 if o=="--input": INPUT=a
46 if o=="--noPost": DOPOSTPROC=False
47 if o=="--postFreq": POSTFREQ=int(a)
48
49 # #####################################################
50 # Read jobOpt configuration options
51 # #####################################################
52
53
54 if 'CONFIG' not in dir():
55 CONFIG = 'LArMon'
56
57
58 if "STREAM" not in dir():
59 STREAM = "NONE"
60
61 from AthenaConfiguration.Enums import Format
62
63 # #####################################################
64 # Get environment variables
65 # #####################################################
66
67 partition = os.environ.get("TDAQ_PARTITION")
68
69 from ispy import IPCPartition, ISObject
70
71 # ################################
72 # To read run parameters from IS
73 # ################################
74
75 if partition is not None:
76 p = IPCPartition(partition)
77 if not p.isValid():
78 print("Partition:",p.name(),"is not valid")
79 sys.exit(1)
80
81
82 if partition == "ATLAS":
83 try:
84 y = ISObject(p, 'RunParams.SOR_RunParams', 'RunParams')
85 except:
86 print("Could not find Run Parameters in IS - Set default beam type to 'cosmics'")
87 beamType='cosmics'
88 runnumber = RUNNB
89 else:
90 y.checkout()
91 beamtype = y.beam_type
92 beamenergy = y.beam_energy
93 runnumber = y.run_number
94 project = y.T0_project_tag
95 print("RUN CONFIGURATION: beam type %i, beam energy %i, run number %i, project tag %s"%(beamtype,beamenergy,runnumber,project))
96 # define beam type based on project tag name
97 if project[7:10]=="cos":
98 beamType='cosmics'
99 else:
100 beamType='collisions'
101
102
103 else:
104 beamType='collisions'
105
106
107 try:
108 x = ISObject(p, 'LArParams.LAr.RunLogger.GlobalParams', 'GlobalParamsInfo')
109 except:
110 print("Couldn not find IS Parameters - Set default flag")
111 ReadDigits = False
112 FirstSample = 3
113 NSamples = 4
114 LArFormat = 1
115 else:
116 try:
117 x.checkout()
118 except:
119 print("Couldn not find IS Parameters - Set default flag")
120 ReadDigits = False
121 FirstSample = 3
122 NSamples = 4
123 LArFormat = 1
124 else:
125 RunType = x.runType
126 LArFormat = x.format
127 FirstSample = x.firstSample
128 NSamples = x.nbOfSamples
129 print("RUN CONFIGURATION: format %i,run type %i"%(RunType,LArFormat))
130 # Decide how to get cell energy: DSP or digits
131 if LArFormat==0:
132 ReadDigits = True
133 else:
134 ReadDigits = False
135 else: # defaults when reading from file
136 ReadDigits = False
137 FirstSample = 3
138 NSamples = 4
139 LArFormat = 1
140 ReadDigits = False
141 beamType='collisions'
142 runnumber = RUNNB
143
144 print("RUN CONFIGURATION: ReadDigits =", ReadDigits)
145
146
147 from AthenaConfiguration.AllConfigFlags import initConfigFlags
148 flags = initConfigFlags()
149 from AthenaMonitoring.DQConfigFlags import allSteeringFlagsOff
150 allSteeringFlagsOff(flags)
151
152
153 from AthenaConfiguration.Enums import BeamType
154 if beamType=='collisions':
155 flags.Beam.Type=BeamType.Collisions
156 elif beamType=='cosmics':
157 flags.Beam.Type=BeamType.Cosmics
158 else:
159 print('Setting default collisions beam type')
160 flags.Beam.Type=BeamType.Collisions
161 flags.Beam.BunchSpacing=25
162 print("RUN CONFIGURATION: Beamtype =",flags.Beam.Type)
163
164 flags.Common.isOnline=True
165 flags.Input.Format=Format.BS
166 flags.Input.isMC=False
167
168 flags.IOVDb.DatabaseInstance="CONDBR2"
169 flags.IOVDb.GlobalTag="CONDBR2-ES1PA-2016-03"
170
171 flags.GeoModel.Layout="alas"
172 from AthenaConfiguration.TestDefaults import defaultGeometryTags
173 flags.GeoModel.AtlasVersion=defaultGeometryTags.RUN2
174
175 #Run clustering w/o calibration
176 flags.Calo.TopoCluster.doTopoClusterLocalCalib=False
177
178 flags.Exec.MaxEvents=-1
179
180 from AthenaConfiguration.AutoConfigOnlineRecoFlags import setDefaultOnlineRecoFlags
181 setDefaultOnlineRecoFlags(flags)
182
183 from AthenaConfiguration.DetectorConfigFlags import setupDetectorFlags
184 setupDetectorFlags(flags, ['LAr'], toggle_geometry=True)
185
186 flags.Trigger.doID=False
187 flags.Trigger.doMuon=False
188 flags.Trigger.L1.doMuon=False
189 flags.Trigger.L1.doTopo=False
190 flags.Trigger.triggerConfig='COOL'
191
192 flags.DQ.doMonitoring=True
193 flags.DQ.disableAtlasReadyFilter=True
194 flags.DQ.enableLumiAccess=False
195 flags.DQ.useTrigger=True
196 # for P1
197 flags.DQ.FileKey=''
198
199 flags.LAr.doAlign=False
200 flags.LAr.doHVCorr=False
201
202 flags.Calo.TopoCluster.doTopoClusterLocalCalib=False
203
204 flags.Input.Files=[INPUT]
205 flags.Input.RunNumbers = [runnumber]
206
207 #test multithreads
208 #flags.Concurrency.NumThreads=4
209 #flags.Concurrency.NumConcurrentEvents=4
210
212 from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags
213 return createLArMonConfigFlags()
214
215 flags.addFlagsCategory("LArMon", __monflags)
216
217 if 'CaloMon' in CONFIG: # needs Lumi access
218 flags.DQ.enableLumiAccess=True
219
220 flags.lock()
221
222 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
223 acc = MainServicesCfg(flags)
224
225 from TileByteStream.TileByteStreamConfig import TileRawDataReadingCfg
226 acc.merge( TileRawDataReadingCfg(flags) )
227
228
229 #from RecoPT_NewConfig import LArMonitoringConfig
230 # include("RecoPT_NewConfig.py")
231 if CONFIG!="LArDTMon":
232 from LArMonitoring.RecoPT_NewConfig import LArMonitoringConfig
233 acc.merge(LArMonitoringConfig(flags,CONFIG,STREAM))
234 else:
235 from LArMonitoring.RecoPT_Phase1NewConfig import LArDTMonitoringConfig
236 acc.merge(LArDTMonitoringConfig(flags,STREAM))
237
238
239 # somehow needs to add postprocessing
240 if DOPOSTPROC:
241 from DataQualityUtils.DQPostProcessingAlg import DQPostProcessingAlg
242 ppa = DQPostProcessingAlg("DQPostProcessingAlg")
243 ppa.ExtraInputs = {( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' )}
244 ppa.Interval = POSTFREQ
245 if flags.Common.isOnline:
246 ppa.FileKey = ((flags.DQ.FileKey + '/') if not flags.DQ.FileKey.endswith('/')
247 else flags.DQ.FileKey)
248
249 acc.addEventAlgo(ppa, sequenceName='AthEndSeq')
250
251 acc.run()
void print(char *figname, TCanvas *c1)