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
28 TVirtualMCStack* cppstack = fluka->GetStack();
30 if (TRACKR.jtrack == -1) {
33 // Try first to get the track ID from the FLUKA stack for optical photons
34 trackId = OPPHST.LOUOPP[OPPHST.LSTOPP];
36 // This might be a feedback photon or similar that was put on the VMC stack first
37 trackId = STACK.ispark[STACK.lstack][mkbmx2-1];
40 trackId = TRACKR.ispusr[mkbmx2-1];
43 cppstack->SetCurrentTrack(trackId);
47 fluka->SetNewreg(mreg);
48 fluka->SetIcode(icode);
51 // if (verbosityLevel >= 3) {
52 // cout << endl << " !!! I am in mgdraw - calling Stepping()" << endl;
53 // cout << endl << " Track Id =" << trackId << endl;
57 (TVirtualMCApplication::Instance())->Stepping();
58 fluka->SetTrackIsNew(kFALSE);
60 } // end of extern "C"