]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TFluka/mgdraw.cxx
12-jan-2005 NvE Bug fix in AliAttrib::GetSlotIndex() by exiting as soon as matching...
[u/mrichter/AliRoot.git] / TFluka / mgdraw.cxx
CommitLineData
fa3d1cc7 1#include <Riostream.h>
8fd1d27e 2#include "TVirtualMCApplication.h"
b1b2005d 3#include "TVirtualMCStack.h"
a7bb59a2 4
fa3d1cc7 5#include "TFluka.h"
a7bb59a2 6
b1b2005d 7// Fluka include
8#include "Fdimpar.h" //(DIMPAR) fluka include
9#include "Fdblprc.h" //(DBLPRC) fluka common
10#include "Ftrackr.h" //(TRACKR) fluka common
3a625972 11#include "Fopphst.h" //(OPPHST) fluka common
3ad1c4d5 12#include "Fstack.h" //(STACK) fluka common
b1b2005d 13
fa3d1cc7 14#ifndef WIN32
15# define mgdraw mgdraw_
16#else
17# define mgdraw MGDRAW
18#endif
19
20extern "C" {
21void mgdraw(Int_t& icode, Int_t& mreg)
22{
b1b2005d 23 TFluka* fluka = (TFluka*) gMC;
57dc5a4a 24 Int_t verbosityLevel = fluka->GetVerbosityLevel();
b1b2005d 25//
26// Make sure that stack has currrent track Id
57dc5a4a 27//
3a625972 28 Int_t trackId = -1;
b1b2005d 29 TVirtualMCStack* cppstack = fluka->GetStack();
3a625972 30
31 if (TRACKR.jtrack == -1) {
e45bbee7 32 trackId = OPPHST.louopp[OPPHST.lstopp];
3ad1c4d5 33 if (trackId == 0) {
3ad1c4d5 34 trackId = STACK.ispark[STACK.lstack][mkbmx2-1];
35 }
3a625972 36 } else {
37 trackId = TRACKR.ispusr[mkbmx2-1];
38 }
39
b1b2005d 40 cppstack->SetCurrentTrack(trackId);
41//
42//
55d6cb0f 43 fluka->SetMreg(mreg);
44 fluka->SetNewreg(mreg);
b1b2005d 45 fluka->SetIcode(icode);
a1f42b9c 46 fluka->SetCaller(4);
57dc5a4a 47
48 if (!TRACKR.ispusr[mkbmx2 - 2]) {
49 //
50 // Single step
51 if (verbosityLevel >= 3) {
52 cout << endl << " !!! I am in mgdraw - calling Stepping(): " << icode << endl;
53 cout << endl << " Track Id = " << trackId << " region = " << mreg << endl;
54 }
55 (TVirtualMCApplication::Instance())->Stepping();
56 fluka->SetTrackIsNew(kFALSE);
57 } else {
58 //
59 // Tracking is being resumed after secondary tracking
60 //
61 // Reset flag
62 TRACKR.ispusr[mkbmx2 - 2] = 0;
63//
64 fluka->SetTrackIsNew(kTRUE);
65
66 if (verbosityLevel >= 3) {
67 cout << endl << " !!! I am in mgdraw - resuming Stepping(): " << trackId << endl;
68 }
69
70 (TVirtualMCApplication::Instance())->Stepping();
71 fluka->SetTrackIsNew(kFALSE);
72
73 if (verbosityLevel >= 3) {
74 cout << endl << " !!! I am in mgdraw - first Stepping() after resume: " << icode << endl;
75 cout << endl << " Track Id = " << trackId << " region = " << mreg << endl;
76 }
77 (TVirtualMCApplication::Instance())->Stepping();
78 }
3a625972 79
cad96957 80
fa3d1cc7 81} // end of mgdraw
82} // end of extern "C"
83