]>
Commit | Line | Data |
---|---|---|
fa3d1cc7 | 1 | #include <Riostream.h> |
8fd1d27e | 2 | #include "TVirtualMCApplication.h" |
b1b2005d | 3 | #include "TVirtualMCStack.h" |
a7bb59a2 | 4 | |
fa3d1cc7 | 5 | #include "TFluka.h" |
d566901f | 6 | #include "TFlukaCodes.h" |
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 |
81f1d030 | 12 | #include "Fflkstk.h" //(FLKSTK) fluka common |
d566901f | 13 | #include "Fltclcm.h" //(LTCLCM) fluka common |
14 | #include "Fpaprop.h" //(PAPROP) fluka common | |
b1b2005d | 15 | |
fa3d1cc7 | 16 | #ifndef WIN32 |
17 | # define mgdraw mgdraw_ | |
18 | #else | |
19 | # define mgdraw MGDRAW | |
20 | #endif | |
21 | ||
22 | extern "C" { | |
23 | void mgdraw(Int_t& icode, Int_t& mreg) | |
24 | { | |
b1b2005d | 25 | TFluka* fluka = (TFluka*) gMC; |
d566901f | 26 | if (mreg == fluka->GetDummyRegion()) return; |
b1b2005d | 27 | // |
28 | // Make sure that stack has currrent track Id | |
57dc5a4a | 29 | // |
3a625972 | 30 | Int_t trackId = -1; |
b1b2005d | 31 | TVirtualMCStack* cppstack = fluka->GetStack(); |
3a625972 | 32 | |
33 | if (TRACKR.jtrack == -1) { | |
18e0cabb | 34 | trackId = OPPHST.louopp[OPPHST.lstopp]; |
35 | if (trackId == 0) { | |
36 | trackId = FLKSTK.ispark[FLKSTK.npflka][mkbmx2-1]; | |
37 | } | |
3a625972 | 38 | } else { |
18e0cabb | 39 | trackId = TRACKR.ispusr[mkbmx2-1]; |
40 | } | |
41 | ||
42 | Int_t verbosityLevel = fluka->GetVerbosityLevel(); | |
43 | ||
44 | if (TRACKR.jtrack < -6) { | |
45 | // (Unknow heavy Ion???) | |
46 | // assing parent id ??? | |
47 | // id < -6 was skipped in stuprf => if (kpart < -6) return; | |
48 | if (verbosityLevel >= 3) { | |
49 | cout << "mgdraw: jtrack < -6 =" << TRACKR.jtrack | |
50 | << " assign parent pdg=" << fluka->PDGFromId(TRACKR.ispusr[mkbmx2 - 3]) << endl; | |
51 | } | |
52 | TRACKR.jtrack = TRACKR.ispusr[mkbmx2 - 3]; | |
3a625972 | 53 | } |
54 | ||
b1b2005d | 55 | cppstack->SetCurrentTrack(trackId); |
56 | // | |
57 | // | |
d566901f | 58 | Int_t mlttc = LTCLCM.mlatm1; |
59 | fluka->SetMreg(mreg, mlttc); | |
60 | fluka->SetNewreg(mreg, mlttc); | |
61 | fluka->SetIcode((FlukaProcessCode_t) icode); | |
62 | fluka->SetCaller(kMGDRAW); | |
57dc5a4a | 63 | |
64 | if (!TRACKR.ispusr[mkbmx2 - 2]) { | |
18e0cabb | 65 | // |
66 | // Single step | |
67 | if (verbosityLevel >= 3) { | |
68 | cout << endl << "mgdraw: energy deposition for:" << trackId | |
69 | << " icode=" << icode | |
70 | << " pdg=" << fluka->PDGFromId(TRACKR.jtrack) << " flukaid="<< TRACKR.jtrack << endl; | |
71 | } | |
72 | (TVirtualMCApplication::Instance())->Stepping(); | |
73 | fluka->SetTrackIsNew(kFALSE); | |
57dc5a4a | 74 | } else { |
18e0cabb | 75 | // |
76 | // Tracking is being resumed after secondary tracking | |
77 | // | |
78 | if (verbosityLevel >= 3) { | |
79 | cout << endl << "mgdraw: resuming Stepping(): " << trackId << endl; | |
80 | } | |
d566901f | 81 | |
18e0cabb | 82 | fluka->SetTrackIsNew(kTRUE); |
83 | fluka->SetCaller(kMGResumedTrack); | |
84 | (TVirtualMCApplication::Instance())->Stepping(); | |
5d80a015 | 85 | |
18e0cabb | 86 | // Reset flag and stored values |
87 | TRACKR.ispusr[mkbmx2 - 2] = 0; | |
88 | for (Int_t i = 0; i < 9; i++) TRACKR.spausr[i] = -1.; | |
5d80a015 | 89 | |
57dc5a4a | 90 | |
18e0cabb | 91 | if (verbosityLevel >= 3) { |
92 | cout << endl << " !!! I am in mgdraw - first Stepping() after resume: " << icode << endl; | |
93 | cout << " Track= " << trackId << " region = " << mreg << endl; | |
94 | } | |
5d80a015 | 95 | |
18e0cabb | 96 | fluka->SetTrackIsNew(kFALSE); |
97 | fluka->SetCaller(kMGDRAW); | |
98 | (TVirtualMCApplication::Instance())->Stepping(); | |
57dc5a4a | 99 | } |
fa3d1cc7 | 100 | } // end of mgdraw |
101 | } // end of extern "C" | |
102 |