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