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