]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TFluka/mgdraw.cxx
Stopping introduced.
[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 #include "Fopphst.h"  //(OPPHST) fluka common
12 #include "Fstack.h"   //(STACK)  fluka common
13
14 #ifndef WIN32
15 # define mgdraw mgdraw_
16 #else
17 # define mgdraw MGDRAW
18 #endif
19
20 extern "C" {
21 void mgdraw(Int_t& icode, Int_t& mreg)
22 {
23     TFluka* fluka =  (TFluka*) gMC;
24 //    Int_t verbosityLevel = fluka->GetVerbosityLevel();
25 //
26 //  Make sure that stack has currrent track Id
27     Int_t trackId = -1;
28     TVirtualMCStack* cppstack = fluka->GetStack();
29     
30     if (TRACKR.jtrack == -1) {
31         // Optical photons
32         //
33         // Try first to get the track ID from the FLUKA stack for optical photons
34         trackId = OPPHST.LOUOPP[OPPHST.LSTOPP];
35         if (trackId == 0) {
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];
38         }
39     } else {
40         trackId = TRACKR.ispusr[mkbmx2-1];
41     }
42     
43     cppstack->SetCurrentTrack(trackId);
44 //
45 //    
46     fluka->SetMreg(mreg);
47     fluka->SetNewreg(mreg);
48     fluka->SetIcode(icode);
49     fluka->SetCaller(4);
50     
51 //    if (verbosityLevel >= 3) {
52 //      cout << endl << " !!! I am in mgdraw - calling Stepping()" << endl;
53 //      cout << endl << " Track Id =" << trackId << endl;
54 //    }
55     
56     
57     (TVirtualMCApplication::Instance())->Stepping();
58     fluka->SetTrackIsNew(kFALSE);
59 } // end of mgdraw
60 } // end of extern "C"
61