Dear Blast coders,
There is a serious error in the TBLRecon class wich causes a segfault:
void TBLRecon::WCclus2stubs(RawData raw){
...
i1 = first.Cluster[i].HitList[0];
w1 = raw.WCwire[i1];
d1 = float(raw.WCtdc[i1])*driftVelocity/cosGamma;
i2 = first.Cluster[i].HitList[1];
w2 = raw.WCwire[i2];
d2 = float(raw.WCtdc[i2])*driftVelocity/cosGamma;
i3 = first.Cluster[i].HitList[2];
w3 = raw.WCwire[i3];
d3 = float(raw.WCtdc[i3])*driftVelocity/cosGamma;
...
This begs for segfaults, and it does. When i1 or i2 returned is outside
of declared space for raw.WCwire causing a segfault. That is fortunate
because we found the error this way.
What I would suggest is that "RawData" is turned into a class. Then we
can define methods which are safe to retreive or store data by including
consistency checks. At least then we don't get segfaults.
Ideally we'd find a way to turn that whole part of the code into more
"wrapped", safer C++ code. Right now it is mostly using C style
programming. We'd need to decise whether to use Array classes or stick
with C arrays etc.
Cheers,
Maurik
This archive was generated by hypermail 2.1.2 : Mon Feb 24 2014 - 14:07:28 EST