68 def cmpparticledata(self,pids,rpd):
69
70 f1=self.outputParticleDataFile
71 f2=self.outputParticleDataFile
72 if f1.endswith('xml'):
73 f1 = f1[:-3]
74 f1 += "orig.xml"
75 try:
76 doc1 = xml.dom.minidom.parse(f1)
77 except Exception:
78
79 self.ensure_toplevel(f1)
80 try:
81 doc1 = xml.dom.minidom.parse(f1)
82 except Exception:
83 self.msg.
error(
"Bad file, exiting")
84 return
85
86
87 try:
88 doc2 = xml.dom.minidom.parse(f2)
89 except Exception:
90
91 self.ensure_toplevel(f2)
92 try:
93 doc2 = xml.dom.minidom.parse(f2)
94 except Exception:
95 self.msg.
error(
"Bad file, exiting")
96 return
97
98
99 particles1 = doc1.getElementsByTagName("particle")
100 particles2 = doc2.getElementsByTagName("particle")
101 if (particles1.length == particles2.length):
102 self.msg.info("Number of particles before and after Pythia8 initialisation matches ( %d )", particles1.length)
103 else:
104 self.msg.warning("Mismatch in number of particles before and after Pythia8 initialisation. Before: %d , after: %d", particles1.length, particles2.length)
105 for part1 in particles1:
106 if ( part1.getAttribute("id") in pids):
107 for part2 in particles2:
108 if ( part2.getAttribute("id") == part1.getAttribute("id") ):
109 for attrk2, attrv2 in part2.attributes.items():
110 requested="none"
111 trypartprop = part2.getAttribute("id")+":"+attrk2
112 if ( trypartprop in rpd ):
113 requested = rpd[trypartprop]
114 if ( not ( attrk2 in part1.attributes.keys() ) ):
115 self.msg.info("You asked Pythia8 to modify properties for particle %s (%s). Attribute \"%s\" added after initialisation, check it. Requested: %s. After init: %s.", part2.getAttribute("name"), part2.getAttribute("id"), attrk2, requested, attrv2)
116 for attrk1, attrv1 in part1.attributes.items():
117 if (attrk1 == attrk2 and attrv1 != attrv2):
118 self.msg.warning("You asked Pythia8 to modify properties for particle %s (%s). Attribute \"%s\" modified after initialisation. Requested: %s. Before init: %s. After init: %s.", part1.getAttribute("name"), part1.getAttribute("id"), attrk1, requested, attrv1, attrv2)
119
120
121