Re: Error in TBLRecon

From: Timothy Smith (tim_smith@mit.edu)
Date: Mon Oct 01 2001 - 10:29:06 EDT


Hello Maurik. Tong and all BLASTers,

        As Tong pointed out, TBLRecon was written when I was just learning
about C++. I do think that the entire class should be replaced.
perhapes this should start out with the creation of TBLRaw. At present
the raw structure is part of TBLEvent.

        TBLRecon is also overloaded. They is also now all of Tongs
code. Perhapes we need some reconstruction class naming convention
to use these multiple developements, something like

        TBLWcRecon, etc. ...

Tong has used,

        TBLHit, TBLHitContainer, TBLCluster, TBLClusterContainer
        TBLStub, TBLStubContainer, TBLSegment, TBLSegmentContainer

already the scintillators and cerenkov have been split off into,

        TBLScRecon & TBLCerenkovRecon

        If left to myself I would migrate the best parts of TBLRecon
into TBLWcRecon, with the raw data in a class TBLRaw.

        In Tong's design there is a TBLHit for every hit, and
TBLHitContainer is a collection of the hits, plus the methods to
find the hits. The same is true for Clusters, Stubs and Segments.

        Any ideas for a convention to deal with this multiple
developement tracks?

                                        Tim

On 28 Sep 2001, Maurik Holtrop wrote:

> 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
>
>
>
>
>

-- 
____________________________________________________________________
 Timothy Paul Smith                               Research Scientist
 MIT Bates Lab                                     tim_smith@mit.edu
 21 Manning Rd.                                 tel:  (617) 253-9207
 Middleton, MA 01949                            fax:  (617) 253-9599



This archive was generated by hypermail 2.1.2 : Mon Feb 24 2014 - 14:07:28 EST