]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TFluka/stupre.cxx
Parent id and current track id handling corrected.
[u/mrichter/AliRoot.git] / TFluka / stupre.cxx
index d4a582f60a8e22f11407b5ac8a6f84e90671ddfa..aec4c01c91649ce0d7b021b089f949c117a7b29d 100644 (file)
@@ -67,13 +67,13 @@ void stupre()
 // Increment the track number and put it into the last flag
 
   Int_t kp;
-  for (kp=EMFSTK.npstrt-1; npnw<=EMFSTK.np-1; kp++) {
+  for (kp = EMFSTK.npstrt-1; npnw <= EMFSTK.np-1; kp++) {
 
 //* save the parent track number and reset it at each loop
-    Int_t ncrtrk = EVTFLG.ntrcks;
+    Int_t done = 1;
+
+    Int_t parent =  TRACKR.ispusr[mkbmx2-1];
     
-    Int_t done = 0;
-    Int_t parent = ncrtrk;
     Int_t flukaid = 0;
     if (EMFSTK.iq[kp] == -1) flukaid = 3;
     else if (EMFSTK.iq[kp] == 0)  flukaid = 7;
@@ -100,71 +100,71 @@ void stupre()
 //* all secondaries are true
     if ((EVTFLG.lpairp == 1) || (EVTFLG.lphoel == 1) ||
         (EVTFLG.lannfl == 1) || (EVTFLG.lannrs == 1)) {
-
-      if (EVTFLG.lpairp == 1) mech = kPPair;
-      else if (EVTFLG.lphoel == 1) mech = kPPhotoelectric;
-      else mech = kPAnnihilation;
+       
+       if (EVTFLG.lpairp == 1) mech = kPPair;
+       else if (EVTFLG.lphoel == 1) mech = kPPhotoelectric;
+       else mech = kPAnnihilation;
         cppstack->SetTrack(done, parent, pdg,
-           px, py, pz, e, vx, vy, vz, tof,
-           polx, poly, polz, mech, ntr, weight, is);
-
-cout << endl << " !!! stupre: ntr=" << ntr << endl;
-      EMFSTK.iespak[kp][mkbmx2-1] = ntr;
+                          px, py, pz, e, vx, vy, vz, tof,
+                          polx, poly, polz, mech, ntr, weight, is);
+       
+       cout << endl << " !!! stupre: ntr=" << ntr  << " parent=" << parent << endl;
+       EMFSTK.iespak[kp][mkbmx2-1] = ntr;
     } // end of lpairp, lphoel, lannfl, lannrs
     
 //* Compton: secondary is true only if charged (e+, e-)
     else if ((EVTFLG.lcmptn == 1)) {
-      if (EMFSTK.iq[kp] != 0) {
-        mech = kPCompton;
-        cppstack->SetTrack(done, parent, pdg,
-           px, py, pz, e, vx, vy, vz, tof,
-           polx, poly, polz, mech, ntr, weight, is);
-cout << endl << " !!! stupre: ntr=" << ntr << endl;
-        EMFSTK.iespak[kp][mkbmx2-1] = ntr;
-      }
+       if (EMFSTK.iq[kp] != 0) {
+           mech = kPCompton;
+           cppstack->SetTrack(done, parent, pdg,
+                              px, py, pz, e, vx, vy, vz, tof,
+                              polx, poly, polz, mech, ntr, weight, is);
+           cout << endl << " !!! stupre: ntr=" << ntr  << " parent=" << parent << endl;
+           EMFSTK.iespak[kp][mkbmx2-1] = ntr;
+       }
     } // end of lcmptn
-
+    
 //* Bremsstrahlung: true secondary only if charge = 0 (photon)
     else if ((EVTFLG.lbrmsp == 1)) {
-      if (EMFSTK.iq[kp] == 0) {
-        mech = kPBrem;
-        cppstack->SetTrack(done, parent, pdg,
-           px, py, pz, e, vx, vy, vz, tof,
-           polx, poly, polz, mech, ntr, weight, is);
-cout << endl << " !!! stupre: ntr=" << ntr << endl;
-        EMFSTK.iespak[kp][mkbmx2-1] = ntr;
-      }
+       if (EMFSTK.iq[kp] == 0) {
+           mech = kPBrem;
+           cppstack->SetTrack(done, parent, pdg,
+                              px, py, pz, e, vx, vy, vz, tof,
+                              polx, poly, polz, mech, ntr, weight, is);
+           cout << endl << " !!! stupre: ntr=" << ntr  << " parent=" << parent << endl;
+           EMFSTK.iespak[kp][mkbmx2-1] = ntr;
+       }
     } // end of lbrmsp
-
+    
 //* Delta ray: If Bhabha, true secondary only if negative (electron)
     else if ((EVTFLG.ldltry == 1)) {
-      if (lbhabh == 1) {
-        if (EMFSTK.iq[kp] == 0) {
-          mech = kPDeltaRay;
-          cppstack->SetTrack(done, parent, pdg,
-            px, py, pz, e, vx, vy, vz, tof,
-            polx, poly, polz, mech, ntr, weight, is);
-          EMFSTK.iespak[kp][mkbmx2-1] = ntr;
-        } // end of Bhabha
-      }
-
+       if (lbhabh == 1) {
+           if (EMFSTK.iq[kp] == 0) {
+               mech = kPDeltaRay;
+               cppstack->SetTrack(done, parent, pdg,
+                                  px, py, pz, e, vx, vy, vz, tof,
+                                  polx, poly, polz, mech, ntr, weight, is);
+               EMFSTK.iespak[kp][mkbmx2-1] = ntr;
+           } // end of Bhabha
+       }
+       
 //* Delta ray: Otherwise Moller: true secondary is the electron with
 //*            lower energy, which has been put higher in the stack
-      else if (kp == EMFSTK.np) {
-        mech = kPDeltaRay;
-        cppstack->SetTrack(done, parent, pdg,
-          px, py, pz, e, vx, vy, vz, tof,
-          polx, poly, polz, mech, ntr, weight, is);
-cout << endl << " !!! stupre: ntr=" << ntr << endl;
-        EMFSTK.iespak[kp][mkbmx2-1] = ntr;
-      } // end of Delta ray
+       else if (kp == EMFSTK.np) {
+           mech = kPDeltaRay;
+           cppstack->SetTrack(done, parent, pdg,
+                              px, py, pz, e, vx, vy, vz, tof,
+                              polx, poly, polz, mech, ntr, weight, is);
+           cout << endl << " !!! stupre: ntr=" << ntr << " parent=" << parent << endl;
+           EMFSTK.iespak[kp][mkbmx2-1] = ntr;
+       } // end of Delta ray
     } // end of ldltry
-
+    
   } // end of loop
-
+  
 // !!! TO BE CONFIRMED !!!
   EVTFLG.ntrcks = EMFSTK.iespak[EMFSTK.np-1][mkbmx2-1];
-
+  
 } // end of stupre
 } // end of extern "C"