Ignore:
Timestamp:
07/26/02 14:49:58 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/WuerzburgSoft/Thomas/mphys/MParticle.cc

    r1430 r1448  
    198198
    199199MParticle::MParticle(ParticleType_t t, const char *name, const char *title)
    200     : fPType(t), fZ(0), fR(0), fPhi(0), fTheta(0), fPsi(0)
     200    : fPType(t), fZ(0), fR(0), fPhi(0), fTheta(0), fPsi(0), fX(0)
    201201{
    202202    //
     
    259259    x(2) = cos(fTheta);
    260260
    261     x *= dr;
    262 
    263261    // ------------------------------
    264262
    265263    const Double_t R = RofZ(&fZ);
    266264
    267     if (x(2) > R*cos(fTheta))
     265    const Double_t dx = R - dr*x(2);
     266
     267    if (dx < 0)
    268268    {
    269         x *= R/dr;
     269        dr = R/x(2); // R>0 --> x(2)>0
    270270        rc = kFALSE;
    271271    }
     272    else
     273        fX += dr*(1.-x(2));
     274
     275    x  *= dr;
    272276
    273277    // ------------------------------
     
    283287    r -= x;
    284288
    285     fR   = sqrt(r(0)*r(0)+r(1)*r(1));
    286     fPhi = atan2(r(1), r(0));
    287     fZ   = ZofR(&r(2));
     289    if (fR!=0)
     290        fPhi = atan2(r(1), r(0));
     291
     292    fR = sqrt(r(0)*r(0)+r(1)*r(1));
     293    fZ = ZofR(&r(2));
    288294
    289295    return rc;
Note: See TracChangeset for help on using the changeset viewer.