PrimaryElectronIndex corrected.
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 19 Oct 2006 16:09:04 +0000 (16:09 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 19 Oct 2006 16:09:04 +0000 (16:09 +0000)
TFluka/mgdraw.cxx

index 2a35fd8..fa6540b 100644 (file)
@@ -99,10 +99,20 @@ void mgdraw(Int_t& icode, Int_t& mreg)
        
        if ((nprim = ALLDLT.nalldl) > 0) {
            //
-           // Multiple steps (primary ionisation)         
+           // Multiple steps (primary ionisation)
+           if (nprim >= mxalld) {
+               nprim = mxalld;
+               Warning("mgdraw", "nprim > mxalld, nprim: %6d  pdg: %6d mreg %6d p %13.3f step %13.3f\n", 
+                      ALLDLT.nalldl, 
+                      fluka->PDGFromId(TRACKR.jtrack), 
+                      mreg, 
+                      TRACKR.ptrack, 
+                      TRACKR.ctrack);
+               
+           }
            for (Int_t i = 0; i < nprim; i++) {
-               (TVirtualMCApplication::Instance())->Stepping();
                fluka->SetCurrentPrimaryElectronIndex(i);
+               (TVirtualMCApplication::Instance())->Stepping();
                if (i == 0) fluka->SetTrackIsNew(kFALSE);
            }
            fluka->SetCurrentPrimaryElectronIndex(-1);