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 "Fstack.h" //(STACK) 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 = STACK.ispark[STACK.lstack][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 (verbosityLevel >= 3) {
52 cout << endl << " !!! I am in mgdraw - calling Stepping(): " << icode << endl;
53 cout << endl << " Track Id = " << trackId << " region = " << mreg << endl;
55 (TVirtualMCApplication::Instance())->Stepping();
56 fluka->SetTrackIsNew(kFALSE);
59 // Tracking is being resumed after secondary tracking
62 TRACKR.ispusr[mkbmx2 - 2] = 0;
64 fluka->SetTrackIsNew(kTRUE);
66 if (verbosityLevel >= 3) {
67 cout << endl << " !!! I am in mgdraw - resuming Stepping(): " << trackId << endl;
70 (TVirtualMCApplication::Instance())->Stepping();
71 fluka->SetTrackIsNew(kFALSE);
73 if (verbosityLevel >= 3) {
74 cout << endl << " !!! I am in mgdraw - first Stepping() after resume: " << icode << endl;
75 cout << endl << " Track Id = " << trackId << " region = " << mreg << endl;
77 (TVirtualMCApplication::Instance())->Stepping();
82 } // end of extern "C"