132 def getCommonChains(self):
133 print ("Searching for compatible TCT directories ..." )
134 allEvents=0
135
136 os.path.walk(self._rDir, self.hasLogfile, True)
137 os.path.walk(self._vDir, self.hasLogfile, False)
138
139 names = self._commonDirs.keys()
140 for tctname in names:
141 if (tctname.startswith("LatestRun") or tctname.endswith("_MP") or tctname.endswith("IDCosmic0") or tctname.endswith("_PHYSVAL") or tctname.endswith("Derived_Outputs")):
142 print ("skipping "+tctname)
143 self._commonDirs.pop(tctname)
144 continue
145
146 tcis = self._commonDirs[tctname]
147
148 if len(tcis) != 2:
149 self._commonDirs.pop(tctname)
150 continue
151
152 ref = tcis[0]
153 val = tcis[1]
154
155 formats = ["RDO", "ESD", "AOD", "TAG"]
156
157 refEvents = self.getTCTChainInfo(ref)
158 if refEvents is None or len(refEvents) == 0:
159 print ("No events found in",ref.logfile)
160 self._commonDirs.pop(tctname)
161 continue
162
163 valEvents = self.getTCTChainInfo(val)
164 if valEvents is None or len(valEvents) == 0:
165 print ("No events found in", val.logfile)
166 continue
167
168 if (valEvents == refEvents):
169 for file in refEvents:
170 allEvents += refEvents[file]
171 print ("TCT %s output seems compatible for ref and chk:" % (tctname))
172 for format in refEvents:
173 print ("%-70s: ref: %d events, val: %d events" % (format, refEvents[format], valEvents[format]))
174 else:
175
176 print ("The (names of the) output files differ in some way:")
177 print (refEvents)
178 print (valEvents)
179 print ("Will now attempt to match the files by type")
180 matchFound = False
181 for refFormat in refEvents:
182 if matchFound:
183 break
184 valFormat = "MOCK"
185 for vFormat in valEvents:
186
187 for f in formats:
188 if matchFound:
189 break
190 if f in refFormat and f in vFormat:
191 valFormat = vFormat
192 print ("Both are %s: %s, %s" % (f, refFormat, valFormat))
193 matchFound = True
194 print (" %s, ref: %d, val: %d" % (format, refEvents[refFormat], valEvents[valFormat]))
195 if not matchFound:
196
197 self._commonDirs.pop(tctname)
198 print ("TCT %s is NOT compatible, outputs different number of events for at least one format:" % tctname)
199 print ()
200
201 print ("Found %i compatible TCT chains with at total of %i events" % (len(self._commonDirs), allEvents))
202
203
204 return self._commonDirs
205
206