cosz corrected (was always positive).
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 18 Feb 2003 16:11:22 +0000 (16:11 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 18 Feb 2003 16:11:22 +0000 (16:11 +0000)
TFluka/source.cxx

index 7b29e4b..118a4e1 100644 (file)
@@ -206,7 +206,8 @@ extern "C" {
     //STACK.tz [STACK.lstack] = BEAM.tinz;
     Double_t cosx = particle->Px()/particle->P();
     Double_t cosy = particle->Py()/particle->P();
-    Double_t cosz = sqrt(oneone - cosx*cosx - cosy*cosy);
+    Double_t cosz = TMath::Sqrt(oneone - cosx*cosx - cosy*cosy);
+    if (particle->Pz() < 0.) cosz = -cosz;
     STACK.tx [STACK.lstack] = cosx;
     STACK.ty [STACK.lstack] = cosy;
     STACK.tz [STACK.lstack] = cosz;