]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TFluka/endraw.cxx
Protection against special particle types.
[u/mrichter/AliRoot.git] / TFluka / endraw.cxx
index 81213d1a85d51dd7d70a3b83e5b8128f7ffad45e..3b07d5dae1cc876dd687f146f1c5b4915ecd66d2 100644 (file)
@@ -35,6 +35,12 @@ void endraw(Int_t& icode, Int_t& mreg, Double_t& rull, Double_t& xsco, Double_t&
   fluka->SetMreg(mreg, mlttc);
 
   Float_t edep = rull;
+  Int_t ipt = fluka->PDGFromId(TRACKR.jtrack);
+  if (ipt == -1) {
+      if (debug) printf("Unknown particle %5d %5d \n", TRACKR.jtrack, icode);
+      return;
+  }
+  
   
   if (TRACKR.jtrack == -1) {
   // Handle quantum efficiency the G3 way
@@ -80,15 +86,16 @@ void endraw(Int_t& icode, Int_t& mreg, Double_t& rull, Double_t& xsco, Double_t&
       fluka->SetIcode((FlukaProcessCode_t)icode);
       fluka->SetRull(edep);
       if (icode == kKASKADelarecoil && TRACKR.ispusr[mkbmx2-5]) {
-         //  Elastic recoil and in stuprf npprmr > 0,
-         //  the secondary being loaded is actually still the interacting particle
-         cppstack->SetCurrentTrack( TRACKR.ispusr[mkbmx2-4] );
-         //      cout << "endraw elastic recoil track=" << TRACKR.ispusr[mkbmx2-1] << " parent=" << TRACKR.ispusr[mkbmx2-4]
-         //           << endl;
-      }
-      else
+         //  Elastic recoil and in stuprf npprmr > 0,
+         //  the secondary being loaded is actually still the interacting particle
+         cppstack->SetCurrentTrack( TRACKR.ispusr[mkbmx2-4] );
+      } else {
           cppstack->SetCurrentTrack(TRACKR.ispusr[mkbmx2-1] );
-      (TVirtualMCApplication::Instance())->Stepping();
+      }
+
+      if (TRACKR.jtrack != 308 && TRACKR.jtrack != 211) (TVirtualMCApplication::Instance())->Stepping();
+    
+      
   } else {
   //
   // For icode 21,22 the particle has fallen below thresshold.
@@ -102,8 +109,6 @@ void endraw(Int_t& icode, Int_t& mreg, Double_t& rull, Double_t& xsco, Double_t&
       fluka->SetIcode((FlukaProcessCode_t)icode);
       fluka->SetRull(0.);
       (TVirtualMCApplication::Instance())->Stepping();
-//      cppstack->SetCurrentTrack( saveTrackId );
-
   }
 } // end of endraw
 } // end of extern "C"