]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TFluka/endraw.cxx
Adding FindPCBIndexByMotifPositionID method (Laurent)
[u/mrichter/AliRoot.git] / TFluka / endraw.cxx
index 81213d1a85d51dd7d70a3b83e5b8128f7ffad45e..e4e55d25e2092806e3fee6b6a65d57270a4d906f 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
@@ -74,21 +80,19 @@ void endraw(Int_t& icode, Int_t& mreg, Double_t& rull, Double_t& xsco, Double_t&
         if( mlttc == crtlttc ) cout << "   *************************************************************" << endl;
     }
     // *****************************************************
-
-
   if (icode != kEMFSCOstopping1 && icode != kEMFSCOstopping2) {
       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();
+      
   } else {
   //
   // For icode 21,22 the particle has fallen below thresshold.
@@ -99,11 +103,9 @@ void endraw(Int_t& icode, Int_t& mreg, Double_t& rull, Double_t& xsco, Double_t&
       fluka->SetIcode((FlukaProcessCode_t) icode);
       (TVirtualMCApplication::Instance())->Stepping();
       fluka->SetTrackIsNew(kFALSE);
-      fluka->SetIcode((FlukaProcessCode_t)icode);
-      fluka->SetRull(0.);
-      (TVirtualMCApplication::Instance())->Stepping();
-//      cppstack->SetCurrentTrack( saveTrackId );
-
+//      fluka->SetIcode((FlukaProcessCode_t)icode);
+//      fluka->SetRull(0.);
+//      (TVirtualMCApplication::Instance())->Stepping();
   }
 } // end of endraw
 } // end of extern "C"