Calls to FinishPrimary, PostTrack and PreTrack added.
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 31 Jan 2003 14:03:07 +0000 (14:03 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 31 Jan 2003 14:03:07 +0000 (14:03 +0000)
TFluka/source.cxx

index 7c0038d9dc2f324c50f0fefe0bac8bc84a456904..7b29e4b0cf22a329a218ed3ea5fb881c427849f7 100644 (file)
@@ -17,6 +17,7 @@
 //Virutal MC
 #include "TFluka.h"
 #include "TVirtualMCStack.h"
+#include "TVirtualMCApplication.h"
 #include "TParticle.h"
 #include "TVector3.h"
 
@@ -37,7 +38,6 @@
 # define soevsv SOEVSV
 #endif
 
-
 extern "C" {
   //
   // Prototypes for FLUKA functions
@@ -101,6 +101,10 @@ extern "C" {
     // Get the stack produced from the generator
     TVirtualMCStack* cppstack = fluka->GetStack();
     //Get next particle
+    if (STACK.lstack != 1) {
+       TVirtualMCApplication::Instance()->PostTrack();
+       TVirtualMCApplication::Instance()->FinishPrimary();
+    }
     Int_t itrack = -1;
     TParticle* particle = cppstack->GetNextTrack(itrack);
 
@@ -144,6 +148,7 @@ extern "C" {
     /* Lstack is the stack counter: of course any time source is called it
      * must be =0
      */
+    
     STACK.lstack++;
     cout << "\t* Storing particle parameters in the stack, lstack = " 
         << STACK.lstack << endl;
@@ -270,7 +275,7 @@ extern "C" {
     
     cout << "\t* EPISOR.lsouit = " << (EPISOR.lsouit?'T':'F') << endl;
     cout << "\t* " << STACK.lstack << " particles in the event" << endl;
-      
+    TVirtualMCApplication::Instance()->PreTrack();
 #ifdef METHODDEBUG
     cout << "<== source(" << nomore << ")" << endl;
 #endif