<div dir="ltr">Dear colleagues,<div><br></div><div>At some point during the past year you may have run into the problem of mcsmear crashing when trying to run over simulated data files from hdgeant. Sean Dobbs reported a change he made a few weeks back that seemed to decrease the frequency of this problem, but did not claim to resolve it. He did this by changing the way the bcalSiPMSpectrum sequence strings were being recorded, so as to compress out long sections of 0's. There was some evidence that very long strings might have been problematic in hddm files.</div><div><br></div><div>I have recently been able to reproduce the problem and diagnose it. The problem is that the old c-style library used to write hddm files from hdgeant required that the event buffer be large enough to hold the largest event created in the simulation. Up until now that maximum size was set to 1MB, which is about 10 times the average event size. However sometimes there can be super-long events created in the simulation, caused by long strings of 0's recorded in the bcalSiPMSpectrum tags, and these can be larger than 1MB. The way the code was written was it was supposed to detect the buffer overflow in hdgeant and terminate with an error message. However, I found this was not happening, because the XDR output library automatically truncates the output at the end of the buffer and reports the error through the return value from the library call. I was ignoring the return value, and looking for the overflow. The result was that hdgeant would output truncated events and happily continue to the end, but then when mcsmear came along to read it, there would be an unhappy end as soon as it hit the lobotomized event.</div><div><br></div><div>I just submitted a set of fixes that implements the following changes:</div><div><ol><li>increase the output buffer size in hdgeant by a factor 25 from 1MB to 25MB</li><li>check the return values from all attempts to write to the output buffer, and terminate hdgeant with an error in case of output buffer overflow.</li></ol><div>All of this will coexist fine with the change made earlier by Sean to implement compression of repeated zeros in the bcalSiPMSpectrum strings. Please update your codebase and rebuild. To make sure that new hddm libraries are built in an existing install, remove all of the contents of $HALLD_HOME/src/.<osname>/libraries/HDDM and do a top-level scons update.</div></div><div><br></div><div>-Richard Jones</div></div>