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;
56 (TVirtualMCApplication::Instance())->Stepping();
57 fluka->SetTrackIsNew(kFALSE);
60 // Tracking is being resumed after secondary tracking
62 if (verbosityLevel >= 3) {
63 cout << endl << " !!! I am in mgdraw - resuming Stepping(): " << trackId << endl;
66 fluka->SetTrackIsNew(kTRUE);
68 (TVirtualMCApplication::Instance())->Stepping();
70 // Reset flag and stored values
71 TRACKR.ispusr[mkbmx2 - 2] = 0;
72 for (Int_t i = 0; i < 9; i++) TRACKR.spausr[i] = -1.;
75 if (verbosityLevel >= 3) {
76 cout << endl << " !!! I am in mgdraw - first Stepping() after resume: " << icode << endl;
77 cout << endl << " Track Id = " << trackId << " region = " << mreg << endl;
80 fluka->SetTrackIsNew(kFALSE);
82 (TVirtualMCApplication::Instance())->Stepping();
87 } // end of extern "C"