[ROOT] TParticle : missing protection in the constructor

From: Pasha Murat (630)840-8237@169G ((630)840-8237@169G)
Date: Fri Mar 23 2001 - 18:38:23 MET


Dear ROOTers,

I'm using TParticle class and I'm storing in an array of TParticles output
of various MC event generators. Output of some MC generators (HERWIG,
for example) contains off-shell particles with E^2 < P^2.

Several TParticle constructors which are trying to calculate particle 
mass as 

     fCalcMass    = TMath::Sqrt(fE*fE -fPx*fPx -fPy*fPy -fPz*fPz);

are crashing in this case. I'd think of putting in a protection against 
sqrt of negative number and, in order not to lose information, of 
making fCalcMass negative for off-shell particles with Q^2<0:

    a2 = fE*fE -fPx*fPx -fPy*fPy -fPz*fPz;
    if (a2 >= 0) {
      fCalcMass =  TMath::Sqrt(a2);
    }
    else {
      fCalcMass =  -TMath::Sqrt(-a2);
    }

				Other suggestions? -best, Pasha



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:40 MET