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