]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TFluka/mgdraw.cxx
Introduce verbosity level.
[u/mrichter/AliRoot.git] / TFluka / mgdraw.cxx
1 #include <Riostream.h>
2 #include "TVirtualMCApplication.h"
3 #include "TVirtualMCStack.h"
4 #include "TFluka.h"
5 // Fluka include
6 #include "Fdimpar.h"  //(DIMPAR) fluka include
7 #include "Fdblprc.h"  //(DBLPRC) fluka common
8 #include "Ftrackr.h"  //(TRACKR) fluka common
9
10 #ifndef WIN32
11 # define mgdraw mgdraw_
12 #else
13 # define mgdraw MGDRAW
14 #endif
15
16 extern "C" {
17 void mgdraw(Int_t& icode, Int_t& mreg)
18 {
19     TFluka* fluka =  (TFluka*) gMC;
20     Int_t verbosityLevel = fluka->GetVerbosityLevel();
21 //
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);
26 //
27 //    
28     Int_t oldreg = ((TFluka*) gMC)->GetMreg();
29     if (oldreg != mreg) {
30 //
31 //  Boundary Crossing
32 //
33         fluka->SetNewreg(mreg);
34         if (oldreg == -1) fluka->SetMreg(mreg);
35         if (verbosityLevel >= 3)
36             printf("Boundary Crossing %d %d \n", oldreg, mreg);
37     } else {
38         fluka->SetMreg(mreg);
39         fluka->SetNewreg(mreg);
40         if (verbosityLevel >= 3)
41             printf("Normal step %d %d \n", oldreg, mreg);
42     }
43     fluka->SetIcode(icode);
44     if (verbosityLevel >= 3) {
45         cout << endl << " !!! I am in mgdraw - calling Stepping()" << endl;
46         cout << endl << " Track Id =" << trackId << endl;
47     }
48     
49     fluka->FutoTest();
50
51     if (oldreg != mreg) {
52 //
53 //  Double step for boundary crossing
54 //
55         fluka->SetTrackIsExiting();
56         (TVirtualMCApplication::Instance())->Stepping();
57         fluka->SetMreg(mreg);
58         fluka->SetTrackIsEntering();
59         (TVirtualMCApplication::Instance())->Stepping();
60         fluka->SetTrackIsInside();
61     } else {
62         (TVirtualMCApplication::Instance())->Stepping();
63     }
64 } // end of mgdraw
65 } // end of extern "C"
66