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