701def testEDMList(edm_list, error_on_edmdetails = True):
702 """
703 Checks EDM list entries for serialization and configuration compliance.
704 """
705
706
707 _noAuxList = ["xAOD::" + contType for contType in ["TrigConfKeys", "BunchConfKey"]]
708
709 cgen = clidGenerator("", False)
710 return_code = 0
711 found_allow_truncation = False
712 serializable_names = []
713 serializable_names_no_label = []
714 serializable_names_no_properties = []
715
716 for i, edm in enumerate(edm_list):
717
718
719 if len(edm) < 3:
720 log.error("EDM entry too short for " + edm[0])
721 return_code = 1
722 continue
723
724 serializable_name = edm[0]
725 serializable_name_no_label = re.sub(r"\#.*", "", serializable_name)
726 serializable_name_no_properties = serializable_name.split('.')[0]
727
728 serializable_names.append(serializable_name)
729 serializable_names_no_label.append(serializable_name_no_label)
730 serializable_names_no_properties.append(serializable_name_no_properties)
731
732
733 if not isCLIDDefined(cgen,serializable_name_no_label):
734 log.error("no CLID for " + serializable_name)
735 return_code = 1
736
737
738 if "Aux" not in serializable_name and "." in serializable_name:
739 log.error("A '.' found in non-Aux container name " + serializable_name)
740 return_code = 1
741
742
743 if "Aux" in serializable_name and "Aux." not in serializable_name:
744 log.error("no final Aux. in label for " + serializable_name)
745 return_code = 1
746
747
748 if serializable_name.count("#") != 1:
749 log.error("Invalid naming structure for " + serializable_name)
750 return_code = 1
751 else:
752
753 if serializable_name.startswith("xAOD") and "Aux" not in serializable_name:
754 cont_type,cont_name = serializable_name.split("#")
755 if cont_type not in _noAuxList:
756 auxmismatch = False
757 if len(edm_list) == i+1:
758 auxmismatch = True
759 cont_to_test = "nothing"
760 else:
761 cont_to_test = edm_list[i+1][0].
split(
".")[0]+
"."
762 cont_type_short = cont_type.replace("Container","")
763 pattern = re.compile(cont_type_short+r".*Aux.*\#"+cont_name+"Aux.")
764 if not pattern.match(cont_to_test):
765
766 shallow_pattern = re.compile("xAOD::ShallowAuxContainer#"+cont_name+"Aux.")
767 if not shallow_pattern.match(cont_to_test):
768 auxmismatch = True
769 if auxmismatch:
770 log.error("Expected relevant Aux container following interface container %s, but found %s instead.",serializable_name,cont_to_test)
771 return_code = 1
772 else:
773
775 if len(edm_list[i+1]) > 1 and cont_to_test.count("#") == 1:
776 contname_to_test = cont_to_test.split("#")[1]
777 targets_to_test =
set(edm_list[i+1][1].
split())
778 if len(targets ^ targets_to_test) > 0:
779 log.error("Targets of %s (%s) and %s (%s) do not match",cont_name,targets,contname_to_test,targets_to_test)
780 return_code = 1
781
782
783 if i>0 and "Aux" in serializable_name and "Aux" in edm_list[i-1][0]:
784 log.error(f"Aux container {serializable_name} needs to folow the "
785 "associated interface container in the EDM list")
786 return_code = 1
787
788
789
790 file_types = edm[1].
split()
791 for file_type in file_types:
792 if file_type not in AllowedOutputFormats:
793 log.error("unknown file type " + file_type + " for " + serializable_name)
794 return_code = 1
795 for higher_level,required_lower_level in [('AOD','ESD'), ('SLIM','AODFULL')]:
796 if higher_level in file_type and required_lower_level not in file_types:
797 log.error("Target list for %s containing '%s' must also contain lower level target '%s'.",serializable_name,file_type,required_lower_level)
798 return_code = 1
799
800
801 tags = edm[3] if len(edm) > 3 else None
802 allow_truncation_flag = False
803 if tags:
804 allow_truncation_flag = allowTruncation in tags
805 if allow_truncation_flag:
806 found_allow_truncation = True
807
808 if found_allow_truncation and not allow_truncation_flag:
809 log.error("All instances of 'allowTruncation' need to be at the END of the EDM serialisation list")
810 return_code = 1
811
812
813
814
815
816 if len(
set(serializable_names_no_properties)) != len(serializable_names_no_properties):
817 log.error("Duplicates in EDM list! Duplicates found:")
819 for item, count in collections.Counter(serializable_names_no_properties).items():
820 if count > 1:
821 log.error(str(count) + "x: " + str(item))
822 return_code = 1
823
824
825 for EDMDetail in EDMDetailsRun3:
826 if EDMDetail not in serializable_names_no_label:
827 msg = "EDMDetail for " + EDMDetail + " does not correspond to any name in TriggerList"
828 if error_on_edmdetails:
829 log.error(msg)
830 return_code = 1
831 else:
832 log.warning(msg)
833
834 return return_code
835