2 #include "TVirtualMCApplication.h"
3 #include "TVirtualMCStack.h"
8 #include "Fdimpar.h" //(DIMPAR) fluka include
9 #include "Fdblprc.h" //(DBLPRC) fluka common
10 #include "Ftrackr.h" //(TRACKR) fluka common
11 #include "Fopphst.h" //(OPPHST) fluka common
12 #include "Fflkstk.h" //(FLKSTK) fluka common
15 # define mgdraw mgdraw_
17 # define mgdraw MGDRAW
21 void mgdraw(Int_t& icode, Int_t& mreg)
23 TFluka* fluka = (TFluka*) gMC;
24 Int_t verbosityLevel = fluka->GetVerbosityLevel();
26 // Make sure that stack has currrent track Id
29 TVirtualMCStack* cppstack = fluka->GetStack();
31 if (TRACKR.jtrack == -1) {
32 trackId = OPPHST.louopp[OPPHST.lstopp];
34 trackId = FLKSTK.ispark[FLKSTK.npflka][mkbmx2-1];
37 trackId = TRACKR.ispusr[mkbmx2-1];
40 cppstack->SetCurrentTrack(trackId);
44 fluka->SetNewreg(mreg);
45 fluka->SetIcode(icode);
48 if (!TRACKR.ispusr[mkbmx2 - 2]) {
51 if (TRACKR.jtrack == -1 && trackId == 109340) {
52 cout << endl << " !!! I am in mgdraw - calling Stepping(): " << icode << endl;
53 cout << endl << " Track Id = " << trackId << " region = " << mreg << endl;
54 printf("Stepsize %13.5e \n", fluka->TrackStep());
60 (TVirtualMCApplication::Instance())->Stepping();
61 fluka->SetTrackIsNew(kFALSE);
64 // Tracking is being resumed after secondary tracking
66 if (verbosityLevel >= 3) {
67 cout << endl << " !!! I am in mgdraw - resuming Stepping(): " << trackId << endl;
70 fluka->SetTrackIsNew(kTRUE);
72 (TVirtualMCApplication::Instance())->Stepping();
74 // Reset flag and stored values
75 TRACKR.ispusr[mkbmx2 - 2] = 0;
76 for (Int_t i = 0; i < 9; i++) TRACKR.spausr[i] = -1.;
79 if (verbosityLevel >= 3) {
80 cout << endl << " !!! I am in mgdraw - first Stepping() after resume: " << icode << endl;
81 cout << endl << " Track Id = " << trackId << " region = " << mreg << endl;
84 fluka->SetTrackIsNew(kFALSE);
86 (TVirtualMCApplication::Instance())->Stepping();
91 } // end of extern "C"