Cerenkov photon update.
[u/mrichter/AliRoot.git] / TFluka / endraw.cxx
index 507dc2a..5c68002 100644 (file)
@@ -12,6 +12,7 @@
 #include "Ftrackr.h"  //(TRACKR) fluka common
 #include "Fltclcm.h"  //(LTCLCM) fluka common
 #include "Fpaprop.h"  //(PAPROP) fluka common
+#include "Fopphst.h"  //(OPPHST) fluka common
 
 #ifndef WIN32
 # define endraw endraw_
@@ -41,7 +42,6 @@ void endraw(Int_t& icode, Int_t& mreg, Double_t& rull, Double_t& xsco, Double_t&
       return;
   }
   
-  
   if (TRACKR.jtrack == -1) {
   // Handle quantum efficiency the G3 way
       if (debug) printf("endraw: Cerenkov photon depositing energy: %d %e\n", mreg, rull);
@@ -87,6 +87,8 @@ void endraw(Int_t& icode, Int_t& mreg, Double_t& rull, Double_t& xsco, Double_t&
          //  Elastic recoil and in stuprf npprmr > 0,
          //  the secondary being loaded is actually still the interacting particle
          cppstack->SetCurrentTrack( TRACKR.ispusr[mkbmx2-4] );
+      } else if (TRACKR.jtrack == -1) {
+         cppstack->SetCurrentTrack(OPPHST.louopp[OPPHST.lstopp]);
       } else {
           cppstack->SetCurrentTrack(TRACKR.ispusr[mkbmx2-1] );
       }
@@ -99,13 +101,14 @@ void endraw(Int_t& icode, Int_t& mreg, Double_t& rull, Double_t& xsco, Double_t&
   // This has to be signalled to the StepManager() 
   //
       cppstack->SetCurrentTrack( TRACKR.ispusr[mkbmx2-1] );
+      
       fluka->SetRull(edep);
       fluka->SetIcode((FlukaProcessCode_t) icode);
       (TVirtualMCApplication::Instance())->Stepping();
       fluka->SetTrackIsNew(kFALSE);
-      fluka->SetIcode((FlukaProcessCode_t)icode);
-      fluka->SetRull(0.);
-      (TVirtualMCApplication::Instance())->Stepping();
+//      fluka->SetIcode((FlukaProcessCode_t)icode);
+//      fluka->SetRull(0.);
+//      (TVirtualMCApplication::Instance())->Stepping();
   }
 } // end of endraw
 } // end of extern "C"