added parent functionality
[u/mrichter/AliRoot.git] / TFluka / mgdraw.cxx
1 #include <Riostream.h>
2 #include "TVirtualMCApplication.h"
3 #include "TVirtualMCStack.h"
4
5 #include "TFluka.h"
6
7 // Fluka include
8 #include "Fdimpar.h"  //(DIMPAR) fluka include
9 #include "Fdblprc.h"  //(DBLPRC) fluka common
10 #include "Ftrackr.h"  //(TRACKR) fluka common
11
12 #ifndef WIN32
13 # define mgdraw mgdraw_
14 #else
15 # define mgdraw MGDRAW
16 #endif
17
18 extern "C" {
19 void mgdraw(Int_t& icode, Int_t& mreg)
20 {
21     TFluka* fluka =  (TFluka*) gMC;
22 //    Int_t verbosityLevel = fluka->GetVerbosityLevel();
23 //
24 //  Make sure that stack has currrent track Id
25     Int_t trackId = TRACKR.ispusr[mkbmx2-1];
26     TVirtualMCStack* cppstack = fluka->GetStack();
27     cppstack->SetCurrentTrack(trackId);
28 //
29 //    
30     fluka->SetMreg(mreg);
31     fluka->SetNewreg(mreg);
32     fluka->SetIcode(icode);
33     fluka->SetCaller(4);
34     
35 //    if (verbosityLevel >= 3) {
36 //      cout << endl << " !!! I am in mgdraw - calling Stepping()" << endl;
37 //      cout << endl << " Track Id =" << trackId << endl;
38 //    }
39     if (TRACKR.jtrack == -1)
40     printf("Cerenkov photon: region# %6d icode %6d \n", mreg, icode);
41
42     
43     (TVirtualMCApplication::Instance())->Stepping();
44     fluka->SetTrackIsNew(kFALSE);
45 } // end of mgdraw
46 } // end of extern "C"
47