2 #include "TVirtualMCApplication.h"
3 #include "TVirtualMCStack.h"
6 #include "Fdimpar.h" //(DIMPAR) fluka include
7 #include "Fdblprc.h" //(DBLPRC) fluka common
8 #include "Ftrackr.h" //(TRACKR) fluka common
11 # define mgdraw mgdraw_
13 # define mgdraw MGDRAW
17 void mgdraw(Int_t& icode, Int_t& mreg)
19 TFluka* fluka = (TFluka*) gMC;
20 Int_t verbosityLevel = fluka->GetVerbosityLevel();
22 // Make sure that stack has currrent track Id
23 Int_t trackId = TRACKR.ispusr[mkbmx2-1];
24 TVirtualMCStack* cppstack = fluka->GetStack();
25 cppstack->SetCurrentTrack(trackId);
28 Int_t oldreg = ((TFluka*) gMC)->GetMreg();
33 fluka->SetNewreg(mreg);
34 if (oldreg == -1) fluka->SetMreg(mreg);
35 if (verbosityLevel >= 3)
36 printf("Boundary Crossing %d %d \n", oldreg, mreg);
39 fluka->SetNewreg(mreg);
40 if (verbosityLevel >= 3)
41 printf("Normal step %d %d \n", oldreg, mreg);
43 fluka->SetIcode(icode);
46 if (verbosityLevel >= 3) {
47 cout << endl << " !!! I am in mgdraw - calling Stepping()" << endl;
48 cout << endl << " Track Id =" << trackId << endl;
55 // Double step for boundary crossing
57 fluka->SetTrackIsExiting();
58 (TVirtualMCApplication::Instance())->Stepping();
60 fluka->SetTrackIsEntering();
61 (TVirtualMCApplication::Instance())->Stepping();
62 fluka->SetTrackIsInside();
64 (TVirtualMCApplication::Instance())->Stepping();
67 } // end of extern "C"