101 def RebuildHistoStore(self):
102 """
103 Rebuild the Histogram Store from the histos received by Receive()
104 If we have a histo which is not in the store,
105 book and fill it according to self.bookingDict
106 If we have a histo with a matching histo in the store,
107 add the two histos, remembering that aida2root must be used on
108 the Stored histo for compatibility.
109 """
110 errors = 0
111 for tup in self.histos:
112 workerID, histDict = tup
113 added = 0
114 booked = 0
115
116 for n in histDict.keys():
117 o = histDict[n]
118 obj = self.hvt.retrieve(n)
119
120 if obj:
121 try:
122 aida2root(obj).Add(o)
123 except Exception:
124 self.log.warning(f"FAILED TO ADD : {obj}")
125 errors += 1
126 added += 1
127 else:
128 if o.__class__.__name__ in self.bookingDict.keys():
129 try:
130 self.bookingDict[o.__class__.__name__](n, o)
131 except Exception:
132 self.log.warning(
133 f"FAILED TO REGISTER : {o.__class__.__name__}\tto{n}"
134 )
135 errors += 1
136 else:
137 self.log.warning(
138 f"No booking method for: {n}\t{type(o)}\t{o.__class__.__name__}"
139 )
140 errors += 1
141 booked += 1
142 hs = self.hvt.getHistoNames()
143 self.log.info("Histo Store Rebuilt : ")
144 self.log.info(f" Contains {len(hs)} objects.")
145 self.log.info(f" Errors in Rebuilding : {errors}")
146 return SUCCESS
147