Re: [ROOT] TParticle : missing protection in the constructor

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Mar 23 2001 - 18:58:45 MET


Hi Pasha,

Hum!! I understand the point.
Your solution is fine with me. If nobody else objects, I will introduce
your suggested algorithm.

Rene Brun

Pasha Murat (630)840-8237@169G wrote:
> 
> 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