52 def read_metadata(filenames, file_type = None, mode = 'lite', promote = None, meta_key_filter = None,
53 unique_tag_info_values = True, ignoreNonExistingLocalFiles=False):
55 This tool is independent of Athena framework and returns the metadata from a given file.
56 :param filenames: the input file from which metadata needs to be extracted.
57 :param file_type: the type of file. POOL or BS (bytestream: RAW, DRAW) files.
58 :param mode: if true, will return all metadata associated with the filename. By default, is false and this will
59 return a "tiny" version which have only the following keys: 'file_guid', 'file_size', 'file_type', 'nentries'.
60 :return: a dictionary of metadata for the given input file.
67 from RootUtils
import PyROOTFixes
70 if isinstance(filenames, str):
71 filenames = [filenames]
74 if file_type
is not None:
75 if file_type
not in (
'POOL',
'BS'):
76 raise NameError(
'Allowed values for \'file_type\' parameter are: "POOL" or "BS": you provided "' + file_type +
'"')
78 msg.info(
'Forced file_type: {0}'.
format(file_type))
81 if mode
not in (
'tiny',
'lite',
'full',
'peeker',
'iov'):
82 raise NameError(
'Allowed values for "mode" parameter are: "tiny", "lite", "peeker", "iov" or "full"')
84 if meta_key_filter
is None:
89 if mode
in (
'full',
'iov'):
90 raise NameError(
'The following modes are not available in AnalysisBase: "iov" and "full"')
92 msg.info(
'Current mode used: {0}'.
format(mode))
93 msg.info(
'Current filenames: {0}'.
format(filenames))
95 if mode !=
'full' and mode !=
'iov' and len(meta_key_filter) > 0:
96 raise NameError(
'It is possible to use the meta_key_filter option only for full mode')
98 msg.info(
'Filter used: {0}'.
format(meta_key_filter))
104 for filename
in filenames:
105 meta_dict[filename] = {}
106 current_file_type =
None
109 if os.path.isfile(filename):
111 if ignoreNonExistingLocalFiles
and not regex_URI_scheme.match(filename)
and gSystem.AccessPathName(filename):
112 msg.warn(
'Ignoring not accessible file: {}'.
format(filename))
115 with open(filename,
'rb')
as binary_file:
116 magic_file = binary_file.read(4)
118 if magic_file ==
'root' or magic_file == b
'root':
119 current_file_type =
'POOL'
120 meta_dict[filename][
'file_type'] =
'POOL'
123 current_file_type =
'BS'
124 meta_dict[filename][
'file_type'] =
'BS'
127 meta_dict[filename][
'file_size'] = os.path.getsize(filename)
131 if regex_BS_files.match(filename):
132 current_file_type =
'BS'
133 meta_dict[filename][
'file_type'] =
'BS'
135 current_file_type =
'POOL'
136 meta_dict[filename][
'file_type'] =
'POOL'
139 meta_dict[filename][
'file_size'] =
None
142 current_file_type = file_type
145 if current_file_type ==
'POOL':
147 if ignoreNonExistingLocalFiles
and not regex_URI_scheme.match(filename)
and gSystem.AccessPathName(filename):
148 msg.warn(
'Ignoring not accessible file: {}'.
format(filename))
153 current_file = ROOT.TFile.Open(
_get_pfn(filename) )
156 from PyUtils.PoolFile
import PoolOpts
157 collectionTree = current_file.Get(PoolOpts.TTreeNames.EventData)
158 if isinstance(collectionTree, ROOT.TTree):
159 meta_dict[filename][
'auto_flush'] = collectionTree.GetAutoFlush()
162 meta_dict[filename][
'file_guid'] =
_read_guid(filename)
165 meta_dict[filename][
'file_comp_alg'] = current_file.GetCompressionAlgorithm()
166 meta_dict[filename][
'file_comp_level'] = current_file.GetCompressionLevel()
171 metadata_tree = current_file.Get(
'MetaData')
173 metadata_branches = metadata_tree.GetListOfBranches()
174 nr_of_branches = metadata_branches.GetEntriesFast()
177 meta_dict[filename][
'metadata_items'] = {}
186 '/TagInfo':
'IOVMetaDataContainer_p1',
187 'IOVMetaDataContainer_p1__TagInfo':
'IOVMetaDataContainer_p1',
188 '*':
'EventStreamInfo_p*'
193 'FileMetaDataAux.':
'xAOD::FileMetaDataAuxInfo_v1',
199 'TriggerMenu':
'DataVector<xAOD::TriggerMenu_v1>',
200 'TriggerMenuAux.':
'xAOD::TriggerMenuAuxContainer_v1',
201 'DataVector<xAOD::TriggerMenu_v1>_TriggerMenu':
'DataVector<xAOD::TriggerMenu_v1>',
202 'xAOD::TriggerMenuAuxContainer_v1_TriggerMenuAux.':
'xAOD::TriggerMenuAuxContainer_v1',
203 'TriggerMenuJson_HLT':
'DataVector<xAOD::TriggerMenuJson_v1>',
204 'TriggerMenuJson_HLTAux.':
'xAOD::TriggerMenuJsonAuxContainer_v1',
205 'TriggerMenuJson_HLTMonitoring':
'DataVector<xAOD::TriggerMenuJson_v1>',
206 'TriggerMenuJson_HLTMonitoringAux.':
'xAOD::TriggerMenuJsonAuxContainer_v1',
207 'TriggerMenuJson_HLTPS':
'DataVector<xAOD::TriggerMenuJson_v1>',
208 'TriggerMenuJson_HLTPSAux.':
'xAOD::TriggerMenuJsonAuxContainer_v1',
209 'TriggerMenuJson_L1':
'DataVector<xAOD::TriggerMenuJson_v1>',
210 'TriggerMenuJson_L1Aux.':
'xAOD::TriggerMenuJsonAuxContainer_v1',
211 'TriggerMenuJson_L1PS':
'DataVector<xAOD::TriggerMenuJson_v1>',
212 'TriggerMenuJson_L1PSAux.':
'xAOD::TriggerMenuJsonAuxContainer_v1',
213 'CutBookkeepers':
'xAOD::CutBookkeeperContainer_v1',
214 'CutBookkeepersAux.':
'xAOD::CutBookkeeperAuxContainer_v1',
216 'FileMetaDataAux.':
'xAOD::FileMetaDataAuxInfo_v1',
217 'TruthMetaData':
'*',
218 'TruthMetaDataAux.':
'xAOD::TruthMetaDataAuxContainer_v1',
219 'DataVector<xAOD::TriggerMenuJson_v1>_TriggerMenuJson_HLT':
'DataVector<xAOD::TriggerMenuJson_v1>',
220 'xAOD::TriggerMenuJsonAuxContainer_v1_TriggerMenuJson_HLTAux.':
'xAOD::TriggerMenuJsonAuxContainer_v1',
221 'DataVector<xAOD::TriggerMenuJson_v1>_TriggerMenuJson_HLTMonitoring':
'DataVector<xAOD::TriggerMenuJson_v1>',
222 'xAOD::TriggerMenuJsonAuxContainer_v1_TriggerMenuJson_HLTMonitoringAux.':
'xAOD::TriggerMenuJsonAuxContainer_v1',
223 'DataVector<xAOD::TriggerMenuJson_v1>_TriggerMenuJson_HLTPS':
'DataVector<xAOD::TriggerMenuJson_v1>',
224 'xAOD::TriggerMenuJsonAuxContainer_v1_TriggerMenuJson_HLTPSAux.':
'xAOD::TriggerMenuJsonAuxContainer_v1',
225 'DataVector<xAOD::TriggerMenuJson_v1>_TriggerMenuJson_L1':
'DataVector<xAOD::TriggerMenuJson_v1>',
226 'xAOD::TriggerMenuJsonAuxContainer_v1_TriggerMenuJson_L1Aux.':
'xAOD::TriggerMenuJsonAuxContainer_v1',
227 'DataVector<xAOD::TriggerMenuJson_v1>_TriggerMenuJson_L1PS':
'DataVector<xAOD::TriggerMenuJson_v1>',
228 'xAOD::TriggerMenuJsonAuxContainer_v1_TriggerMenuJson_L1PSAux.':
'xAOD::TriggerMenuJsonAuxContainer_v1'
233 '/TagInfo':
'IOVMetaDataContainer_p1',
234 'IOVMetaDataContainer_p1__TagInfo':
'IOVMetaDataContainer_p1',
235 '/Simulation/Parameters':
'IOVMetaDataContainer_p1',
236 '/Digitization/Parameters':
'IOVMetaDataContainer_p1',
237 '/EXT/DCS/MAGNETS/SENSORDATA':
'IOVMetaDataContainer_p1',
238 '*':
'EventStreamInfo_p*'
241 if (mode ==
'full' or mode ==
'iov')
and meta_key_filter:
242 meta_filter = {f:
'*' for f
in meta_key_filter}
244 persistent_instances = {}
245 dynamic_fmd_items = {}
249 metadata_tree.SetBranchStatus(
"*",
False)
251 for i
in range(0, nr_of_branches):
252 branch = metadata_branches.At(i)
253 name = branch.GetName()
254 if name ==
'index_ref':
258 class_name = branch.GetClassName()
260 if regexIOVMetaDataContainer.match(class_name):
261 name = name.replace(
'IOVMetaDataContainer_p1_',
'').
replace(
'_',
'/')
263 if regexIOVMetaDataContainer.match(class_name):
264 meta_dict[filename][
'metadata_items'][name] =
'IOVMetaDataContainer'
265 elif regexByteStreamMetadataContainer.match(class_name):
266 meta_dict[filename][
'metadata_items'][name] =
'ByteStreamMetadataContainer'
267 elif regexEventStreamInfo.match(class_name):
268 meta_dict[filename][
'metadata_items'][name] =
'EventStreamInfo'
269 elif regexXAODFileMetaData.match(class_name):
270 meta_dict[filename][
'metadata_items'][name] =
'FileMetaData'
271 elif regexXAODTruthMetaData.match(class_name):
272 meta_dict[filename][
'metadata_items'][name] =
'TruthMetaData'
274 type_name = class_name
277 type_name = branch.GetListOfLeaves()[0].GetTypeName()
280 meta_dict[filename][
'metadata_items'][name] = type_name
282 if len(meta_filter) > 0:
284 for filter_key, filter_class
in meta_filter.items():
285 if (filter_key.replace(
'/',
'_')
in name.replace(
'/',
'_')
or filter_key ==
'*')
and fnmatchcase(class_name, filter_class):
286 if 'CutBookkeepers' in filter_key:
287 keep = filter_key == name
298 if 'CutBookkeepers' in name
and name
not in [
'CutBookkeepers',
'CutBookkeepersAux.']:
302 metadata_tree.SetBranchStatus(f
"{name}*",
True)
305 if regexEventStreamInfo.match(class_name):
306 if class_name.endswith(
'_p1'):
307 persistent_instances[name] = ROOT.EventStreamInfo_p1()
308 elif class_name.endswith(
'_p2'):
309 persistent_instances[name] = ROOT.EventStreamInfo_p2()
311 persistent_instances[name] = ROOT.EventStreamInfo_p3()
312 elif regexIOVMetaDataContainer.match(class_name):
313 persistent_instances[name] = ROOT.IOVMetaDataContainer_p1()
314 elif regexXAODEventFormat.match(class_name):
315 persistent_instances[name] = ROOT.xAOD.EventFormat_v1()
316 elif regexXAODTriggerMenu.match(class_name)
and _check_project()
not in [
'AthGeneration']:
317 persistent_instances[name] = ROOT.xAOD.TriggerMenuContainer_v1()
318 elif regexXAODTriggerMenuAux.match(class_name)
and _check_project()
not in [
'AthGeneration']:
319 persistent_instances[name] = ROOT.xAOD.TriggerMenuAuxContainer_v1()
320 elif regexXAODTriggerMenuJson.match(class_name)
and _check_project()
not in [
'AthGeneration']:
321 persistent_instances[name] = ROOT.xAOD.TriggerMenuJsonContainer_v1()
322 elif regexXAODTriggerMenuJsonAux.match(class_name)
and _check_project()
not in [
'AthGeneration']:
323 persistent_instances[name] = ROOT.xAOD.TriggerMenuJsonAuxContainer_v1()
324 elif regexXAODCutBookkeeperContainer.match(class_name):
325 persistent_instances[name] = ROOT.xAOD.CutBookkeeperContainer_v1()
326 elif regexXAODCutBookkeeperContainerAux.match(class_name):
327 persistent_instances[name] = ROOT.xAOD.CutBookkeeperAuxContainer_v1()
328 elif regexXAODFileMetaData.match(class_name):
329 persistent_instances[name] = ROOT.xAOD.FileMetaData_v1()
330 elif regexXAODFileMetaDataAux.match(class_name):
331 persistent_instances[name] = ROOT.xAOD.FileMetaDataAuxInfo_v1()
332 elif regexXAODTruthMetaData.match(class_name):
333 persistent_instances[name] = ROOT.xAOD.TruthMetaDataContainer_v1()
334 elif regexXAODTruthMetaDataAux.match(class_name):
335 persistent_instances[name] = ROOT.xAOD.TruthMetaDataAuxContainer_v1()
337 if name
in persistent_instances:
338 branch.SetAddress(ROOT.AddressOf(persistent_instances[name]))
341 dynamicFMD = regexXAODFileMetaDataAuxDyn.match(name)
343 dynamicName = dynamicFMD.group().
split(
'.')[-1]
344 dynamicType = regex_cppname.match(class_name)
347 dynamic_fmd_items[dynamicName] = ROOT.std.string()
348 branch.SetAddress(ROOT.AddressOf(dynamic_fmd_items[dynamicName]))
350 dynamic_fmd_items[dynamicName] =
None
353 metadata_tree.GetEntry(0)
356 for key
in dynamic_fmd_items:
357 if dynamic_fmd_items[key]
is None:
359 if key.startswith(
"is"):
361 dynamic_fmd_items[key] = getattr(metadata_tree, key) !=
'\x00'
364 dynamic_fmd_items[key] = getattr(metadata_tree, key)
365 except AttributeError:
370 dynamic_fmd_items[key] =
str(dynamic_fmd_items[key])
374 meta_dict[filename] = {}
377 for name, content
in persistent_instances.items():
379 if hasattr(content,
'm_folderName'):
380 key = content.m_folderName
383 has_r3_trig_meta = (
'TriggerMenuJson_HLT' in persistent_instances
or 'DataVector<xAOD::TriggerMenuJson_v1>_TriggerMenuJson_HLT' in persistent_instances)
385 if key.startswith(
'TriggerMenuJson_')
and not key.endswith(
'Aux.'):
386 aux = persistent_instances[key+
'Aux.']
387 elif key.startswith(
'DataVector<xAOD::TriggerMenuJson_v1>_TriggerMenuJson_')
and not key.endswith(
'Aux.'):
388 menuPart = key.split(
'_')[-1]
389 aux = persistent_instances[
'xAOD::TriggerMenuJsonAuxContainer_v1_TriggerMenuJson_'+menuPart+
'Aux.']
390 elif key ==
'TriggerMenu' and 'TriggerMenuAux.' in persistent_instances
and not has_r3_trig_meta:
391 aux = persistent_instances[
'TriggerMenuAux.']
392 elif key ==
'DataVector<xAOD::TriggerMenu_v1>_TriggerMenu' and 'xAOD::TriggerMenuAuxContainer_v1_TriggerMenuAux.' in persistent_instances
and not has_r3_trig_meta:
393 aux = persistent_instances[
'xAOD::TriggerMenuAuxContainer_v1_TriggerMenuAux.']
394 elif (key ==
'CutBookkeepers'
395 and 'CutBookkeepersAux.' in persistent_instances):
396 aux = persistent_instances[
'CutBookkeepersAux.']
397 elif key ==
'CutBookkeepersAux.':
399 elif (key ==
'FileMetaData'
400 and 'FileMetaDataAux.' in persistent_instances):
401 aux = persistent_instances[
'FileMetaDataAux.']
402 elif (key ==
'xAOD::FileMetaData_v1_FileMetaData'
403 and 'xAOD::FileMetaDataAuxInfo_v1_FileMetaDataAux.' in persistent_instances):
404 aux = persistent_instances[
'xAOD::FileMetaDataAuxInfo_v1_FileMetaDataAux.']
405 elif (key ==
'TruthMetaData'
406 and 'TruthMetaDataAux.' in persistent_instances):
407 aux = persistent_instances[
'TruthMetaDataAux.']
408 elif key ==
'TruthMetaDataAux.':
410 elif 'Menu' in key
and key.endswith(
'Aux.'):
415 if 'TriggerMenuJson' in key
or (
'TriggerMenu' in key
and not has_r3_trig_meta):
416 if 'RAWTriggerMenuJson' in return_obj:
417 meta_dict[filename][key] = return_obj[
'RAWTriggerMenuJson']
418 del return_obj[
'RAWTriggerMenuJson']
419 if 'TriggerConfigInfo' not in meta_dict[filename]:
420 meta_dict[filename][
'TriggerConfigInfo'] = {}
421 if 'dbkey' in return_obj:
422 meta_dict[filename][
'TriggerConfigInfo'][key.split(
'_')[-1]] = {
423 'key' : return_obj[
'dbkey'],
424 'name': return_obj[
'name']
426 del return_obj[
'dbkey']
427 del return_obj[
'name']
428 if 'TriggerMenu' not in meta_dict[filename]:
429 meta_dict[filename][
'TriggerMenu'] = {}
430 meta_dict[filename][
'TriggerMenu'].
update(return_obj)
431 elif "FileMetaData" in key:
432 if "FileMetaData" not in meta_dict[filename]:
433 meta_dict[filename][
"FileMetaData"] = dynamic_fmd_items
434 meta_dict[filename][
"FileMetaData"].
update(return_obj)
436 meta_dict[filename][key] = return_obj
440 esi_dict =
next(key
for key, value
in meta_dict[filename].
items()
441 if isinstance(value, dict)
and "numberOfEvents" in value
and
442 meta_dict[filename][
"metadata_items"][key] ==
"EventStreamInfo")
443 msg.debug(f
"{esi_dict=}")
444 meta_dict[filename][
"nentries"] = meta_dict[filename][esi_dict][
"numberOfEvents"]
445 except StopIteration
as err:
446 msg.debug(f
"Caught {err=}, {type(err)=}, falling back on opening the DataHeader"
447 " Container to read the number of entries")
449 msg.debug(f
"{meta_dict[filename]['nentries']=}")
451 if unique_tag_info_values
and mode==
'iov':
452 unique_tag_info_values =
False
453 msg.info(
'disabling "unique_tag_info_values" option for "iov" mode')
460 if unique_tag_info_values:
461 msg.info(
'MetaReader is called with the parameter "unique_tag_info_values" set to True. '
462 'This is a workaround to remove all duplicate values from "/TagInfo" key')
463 if '/TagInfo' in meta_dict[filename]:
464 for key, value
in meta_dict[filename][
'/TagInfo'].
items():
465 if isinstance(value, list)
and value:
466 if len(unique_values :=
set(value)) > 1:
468 f
"Found multiple values for {key}: {value}. "
469 "Looking for possible duplicates."
474 unique_amitags =
set()
475 for amitags
in unique_values:
477 "_".
join({tag
for tag
in amitags.split(
"_")
if tag})
479 if len(unique_amitags) == 1:
481 elif key ==
"beam_energy":
483 unique_energies =
set()
484 for energy
in unique_values:
489 energy =
float(energy)
492 unique_energies.add(energy)
493 if len(unique_energies) == 1:
495 elif key
in [
"AtlasRelease",
"IOVDbGlobalTag",
"AODFixVersion"]:
499 f
"Multiple values for {key} may mean the same, or "
500 "the input file was produced in multi-step job. "
501 f
"Ignoring all but the first entry: {key} = {value[0]}"
505 f
"{key} from /TagInfo contains more than 1 unique value: {value}"
508 meta_dict[filename][
'/TagInfo'][key] = value[0]
511 promote = mode ==
'lite' or mode ==
'peeker'
525 if isinstance(collectionTree, ROOT.TTree):
526 meta_dict[filename][
'itemList'] = [ (b.GetClassName(), b.GetName())
for b
in collectionTree.GetListOfBranches() ]
529 elif current_file_type ==
'BS':
531 if ignoreNonExistingLocalFiles
and not regex_URI_scheme.match(filename)
and not os.path.isfile(filename):
532 msg.warn(
'Ignoring not accessible file: {}'.
format(filename))
538 bs = eformat.istream(filename)
539 meta_dict[filename][
'nentries'] = bs.total_events
542 data_reader = eformat.EventStorage.pickDataReader(filename)
543 assert data_reader,
'problem picking a data reader for file [%s]' % filename
546 meta_dict[filename][
'auto_flush'] = 1
548 if hasattr(data_reader,
'GUID'):
549 meta_dict[filename][
'file_guid'] = data_reader.GUID()
552 meta_dict[filename][
'file_comp_alg'] = 1
553 meta_dict[filename][
'file_comp_level'] = 1
561 for md
in data_reader.freeMetaDataStrings():
562 if md.startswith(
'Event type:'):
566 v.append(
'IS_SIMULATION')
573 v.append(
'IS_TESTBEAM')
575 if 'is physics' in md:
576 v.append(
'IS_PHYSICS')
578 v.append(
'IS_CALIBRATION')
580 bs_metadata[k] = tuple(v)
582 elif md.startswith(
'GeoAtlas:'):
584 v = md.split(
'GeoAtlas:')[1].strip()
587 elif md.startswith(
'IOVDbGlobalTag:'):
589 v = md.split(
'IOVDbGlobalTag:')[1].strip()
596 bs_metadata[
'detectorMask'] = data_reader.detectorMask()
597 bs_metadata[
'runNumbers'] = data_reader.runNumber()
598 bs_metadata[
'lumiBlockNumbers'] = data_reader.lumiblockNumber()
599 bs_metadata[
'projectTag'] = data_reader.projectTag()
600 bs_metadata[
'stream'] = data_reader.stream()
602 beamTypeNbr= data_reader.beamType()
607 if (beamTypeNbr==0): bs_metadata[
'beamType'] =
'cosmics'
608 elif (beamTypeNbr==1
or beamTypeNbr==2): bs_metadata[
'beamType'] =
'collisions'
609 else: bs_metadata[
'beamType'] =
'unknown'
611 bs_metadata[
'beamEnergy'] = data_reader.beamEnergy()
613 meta_dict[filename][
'eventTypes'] = bs_metadata.get(
'eventTypes', [])
614 meta_dict[filename][
'GeoAtlas'] = bs_metadata.get(
'geometry',
None)
615 meta_dict[filename][
'conditions_tag'] = bs_metadata.get(
'conditions_tag',
None)
616 meta_dict[filename][
'project_name'] = bs_metadata.get(
'projectTag',
None)
619 meta_dict[filename][
'detectorMask'] = [bs_metadata.get(
'detectorMask',
None)]
620 meta_dict[filename][
'runNumbers'] = [bs_metadata.get(
'runNumbers',
None)]
621 meta_dict[filename][
'lumiBlockNumbers'] = [bs_metadata.get(
'lumiBlockNumbers',
None)]
622 meta_dict[filename][
'beam_type'] = bs_metadata.get(
'beamType',
None)
623 meta_dict[filename][
'beam_energy'] = bs_metadata.get(
'beamEnergy',
None)
624 meta_dict[filename][
'stream'] = bs_metadata.get(
'stream',
None)
626 if not data_reader.good():
628 meta_dict[filename][
'runNumbers'].
append(bs_metadata.get(
'run_number', 0))
629 meta_dict[filename][
'lumiBlockNumbers'].
append(bs_metadata.get(
'LumiBlock', 0))
631 msg.debug(f
"{meta_dict[filename]=}")
632 msg.debug(f
"{len(bs)=}")
637 meta_dict[filename][
'processingTags'] = [tag.name
for tag
in evt.stream_tag()]
638 meta_dict[filename][
'evt_number'] = [evt.global_id()]
639 meta_dict[filename][
'run_type'] = [eformat.helper.run_type2string(evt.run_type())]
642 if meta_dict[filename][
'lumiBlockNumbers'] == [0]:
643 msg.debug(
'Taking the luminosity block info from the first event (%i)', evt.lumi_block())
644 meta_dict[filename][
'lumiBlockNumbers'] = [evt.lumi_block()]
647 if meta_dict[filename][
'runNumbers'] == [0]:
648 msg.debug(
'Taking the run number info from the first event (%i)', evt.run_no())
649 meta_dict[filename][
'runNumbers'] = [evt.run_no()]
650 except RuntimeError
as err:
651 msg.error(
"Issue while reading the first event of BS file %r: %r", filename, err)
653 msg.debug(f
"{meta_dict[filename]=}")
655 msg.warn(f
"Event-less BS {filename=}, will not read metadata information from the first event")
658 if len(bs_metadata.get(
'eventTypes',
'')) == 0:
659 evt_type = [
'IS_DATA',
'IS_ATLAS']
660 if bs_metadata.get(
'stream',
'').startswith(
'physics_'):
661 evt_type.append(
'IS_PHYSICS')
662 elif bs_metadata.get(
'stream',
'').startswith(
'calibration_'):
663 evt_type.append(
'IS_CALIBRATION')
664 elif bs_metadata.get(
'projectTag',
'').endswith(
'_calib'):
665 evt_type.append(
'IS_CALIBRATION')
667 evt_type.append(
'Unknown')
669 meta_dict[filename][
'eventTypes'] = evt_type
672 meta_dict[filename][
'bs_metadata'] = bs_metadata
676 msg.error(
'Unknown filetype for {0} - there is no metadata interface for type {1}'.
format(filename, current_file_type))