207def ZdcStreamDependentFlagSetting(flags):
208 '''Function that checks on data type from triggerstream tag
209 and sets run-type-and-year-dependent settings
210 Returns: a tuple of the following four values
211 isLED - bool, true if running on LED data
212 isInj - bool, true if running on Inj data
213 isCalib - bool, true if running on Calib data
214 pn - string, project name such as data24_hi
215 '''
216
217 isComm = (flags.Input.ProjectName == "data25_comm" and flags.Input.TriggerStream == "calibration_ZDCCalib")
218 isLED = (flags.Input.TriggerStream == "calibration_ZDCLEDCalib")
219 isInj = (flags.Input.TriggerStream == "calibration_ZDCInjCalib" or isComm)
220 isCalib = (flags.Input.TriggerStream in ["calibration_ZDCCalib","calibration_zdcCalib"] or "physics_" in flags.Input.TriggerStream or flags.Input.TriggerStream == "express_express" and not isComm)
221
222 if flags.Input.TriggerStream == "calibration_DcmDummyProcessor":
223 runInjForStandaloneDataArgValid = False
224
225 if flags.hasFlag("runInjForStandaloneData"):
226 if flags.runInjForStandaloneData.lower() == "inj":
227 isInj = True
228 runInjForStandaloneDataArgValid = True
229 elif flags.runInjForStandaloneData.lower() == "led":
230 isLED = True
231 runInjForStandaloneDataArgValid = True
232
233 if not runInjForStandaloneDataArgValid:
234 log.warning("runInjForStandaloneData is either not a defined flag or has invalid value (value must be Inj / LED, case insensitive).")
235 log.warning("Running nominal reconstruction (injector-pulse) by default for standalone data")
236 log.warning("Could lead to undesired behavior if pulsing LED in standalone mode")
237 isInj = True
238
239 if isLED:
240 log.info('ZdcRecConfig: Running LED data!')
241 if isInj:
242 log.info('ZdcRecConfig: Running Injected pulse data!')
243 if isCalib:
244 log.info('ZdcRecConfig: Running ZDC calibration data!')
245 if flags.Input.isMC:
246 log.info('ZdcRecConfig: Running over MC Samples')
247 flags.Input.ProjectName = "data23_hi"
248 flags.Reco.EnableTrigger = False
249
250
251 pn = flags.Input.ProjectName
252 if not pn:
253 raise ValueError('Unknown project name')
254
255 if isLED or isInj or pn == 'data_test':
256 flags.Trigger.EDMVersion=3
257 flags.GeoModel.Run = LHCPeriod.Run3
258 flags.IOVDb.GlobalTag=defaultConditionsTags.RUN3_DATA
259 else:
260 year = int(pn.split(
'_')[0].
split(
'data')[1])
261 if year < 20:
262 flags.Trigger.EDMVersion=2
263 flags.GeoModel.Run = LHCPeriod.Run2
264 flags.IOVDb.GlobalTag=defaultConditionsTags.RUN2_DATA
265 elif year > 20:
266 flags.Trigger.EDMVersion=3
267 flags.GeoModel.Run = LHCPeriod.Run3
268 flags.IOVDb.GlobalTag=defaultConditionsTags.RUN3_DATA
269
270 if flags.Input.isMC:
271 log.info('ZdcRecConfig: Overriding MC run to be Run 3!')
272 flags.GeoModel.Run = LHCPeriod.Run3
273
274 if (isInj
275 or flags.Input.TriggerStream == "calibration_DcmDummyProcessor"
276 or pn == "data22_13p6TeV"):
277 flags.Detector.EnableZDC_RPD = False
278
279 if flags.Input.TriggerStream == "calibration_DcmDummyProcessor":
280 flags.DQ.useTrigger = False
281 flags.DQ.triggerDataAvailable = False
282
283 flags.GeoModel.AtlasVersion=zdcGeometry(flags)
284
285 return isLED, isInj, isCalib, pn
286
287
std::vector< std::string > split(const std::string &s, const std::string &t=":")