]>
Commit | Line | Data |
---|---|---|
f827183d | 1 | #include <Riostream.h> |
f827183d | 2 | #ifndef WIN32 |
3 | # define stuprf stuprf_ | |
4 | #else | |
5 | # define stuprf STUPRF | |
6 | #endif | |
7 | // | |
8 | // Fluka include | |
9 | #include "Fdimpar.h" //(DIMPAR) fluka include | |
10 | // Fluka commons | |
11 | #include "Fdblprc.h" //(DBLPRC) fluka common | |
12 | #include "Fevtflg.h" //(EVTFLG) fluka common | |
13 | #include "Fpaprop.h" //(PAPROP) fluka common | |
81f1d030 | 14 | #include "Fflkstk.h" //(FLKSTK) fluka common |
f827183d | 15 | #include "Ftrackr.h" //(TRACKR) fluka common |
81f1d030 | 16 | #include "Fgenstk.h" //(GENSTK) fluka common |
f827183d | 17 | |
18 | //Virtual MC | |
19 | #include "TFluka.h" | |
fbf08100 | 20 | |
f827183d | 21 | #include "TVirtualMCStack.h" |
22 | #include "TVirtualMCApplication.h" | |
23 | #include "TParticle.h" | |
24 | #include "TVector3.h" | |
25 | ||
26 | extern "C" { | |
70541a80 | 27 | void stuprf(Int_t& /*ij*/, Int_t& /*mreg*/, |
28 | Double_t& xx, Double_t& yy, Double_t& zz, | |
29 | Int_t& numsec, Int_t& npprmr) | |
f827183d | 30 | { |
31 | //*----------------------------------------------------------------------* | |
32 | //* * | |
33 | //* SeT User PRoperties for Fluka particles * | |
34 | //* * | |
35 | //*----------------------------------------------------------------------* | |
36 | ||
81f1d030 | 37 | // FLKSTK.npflka = stack pointer |
38 | // FLKSTK.louse = user flag | |
f827183d | 39 | // TRACKR.llouse = user defined flag for the current particle |
81f1d030 | 40 | FLKSTK.louse[FLKSTK.npflka] = TRACKR.llouse; |
f827183d | 41 | |
42 | // mkbmx1 = dimension for kwb real spare array in fluka stack in DIMPAR | |
43 | // mkbmx2 = dimension for kwb int. spare array in fluka stack in DIMPAR | |
81f1d030 | 44 | // FLKSTK.sparek = spare real variables available for k.w.burn |
45 | // FLKSTK.ispark = spare integer variables available for k.w.burn | |
f827183d | 46 | // TRACKR.spausr = user defined spare variables for the current particle |
47 | // TRACKR.ispusr = user defined spare flags for the current particle | |
48 | Int_t ispr; | |
81ee7392 | 49 | for (ispr = 0; ispr <= mkbmx1 - 1; ispr++) { |
81f1d030 | 50 | FLKSTK.sparek[FLKSTK.npflka][ispr] = TRACKR.spausr[ispr]; |
f827183d | 51 | } |
81ee7392 | 52 | for (ispr = 0; ispr <= mkbmx2 - 1; ispr++) { |
81f1d030 | 53 | FLKSTK.ispark[FLKSTK.npflka][ispr] = TRACKR.ispusr[ispr]; |
f827183d | 54 | } |
55 | ||
56 | // Get the pointer to the VMC | |
fbf08100 | 57 | TFluka* fluka = (TFluka*) gMC; |
2bc4c610 | 58 | Int_t verbosityLevel = fluka->GetVerbosityLevel(); |
59 | Bool_t debug = (verbosityLevel>=3)?kTRUE:kFALSE; | |
fbf08100 | 60 | fluka->SetTrackIsNew(kTRUE); |
61 | // TVirtualMC* fluka = TFluka::GetMC(); | |
f827183d | 62 | // Get the stack produced from the generator |
63 | TVirtualMCStack* cppstack = fluka->GetStack(); | |
64 | ||
65 | // EVTFLG.ntrcks = track number | |
66 | // Increment the track number and put it into the last flag | |
81ee7392 | 67 | // was numsec -1 |
68 | // clarify with Alberto | |
69 | if (numsec > npprmr) { | |
642f15cf | 70 | // Now call the PushTrack(...) |
70541a80 | 71 | Int_t done = 0; |
81ee7392 | 72 | |
73 | Int_t parent = TRACKR.ispusr[mkbmx2-1]; | |
81f1d030 | 74 | Int_t kpart = GENSTK.kpart[numsec-1]; |
9c20a817 | 75 | if (kpart < -6) return; |
81ee7392 | 76 | |
9c20a817 | 77 | Int_t pdg = fluka->PDGFromId(kpart); |
78 | ||
79 | ||
81f1d030 | 80 | Double_t px = GENSTK.plr[numsec-1] * GENSTK.cxr[numsec-1]; |
81 | Double_t py = GENSTK.plr[numsec-1] * GENSTK.cyr[numsec-1]; | |
82 | Double_t pz = GENSTK.plr[numsec-1] * GENSTK.czr[numsec-1]; | |
83 | Double_t e = GENSTK.tki[numsec-1] + PAPROP.am[GENSTK.kpart[numsec-1]+6]; | |
9c20a817 | 84 | |
f827183d | 85 | Double_t vx = xx; |
86 | Double_t vy = yy; | |
87 | Double_t vz = zz; | |
81ee7392 | 88 | |
89 | Double_t tof = TRACKR.atrack; | |
81f1d030 | 90 | Double_t polx = GENSTK.cxrpol[numsec-1]; |
91 | Double_t poly = GENSTK.cyrpol[numsec-1]; | |
92 | Double_t polz = GENSTK.czrpol[numsec-1]; | |
81ee7392 | 93 | |
f827183d | 94 | |
95 | TMCProcess mech = kPHadronic; | |
81ee7392 | 96 | |
97 | if (EVTFLG.ldecay == 1) { | |
98 | mech = kPDecay; | |
2bc4c610 | 99 | if (debug) cout << endl << "Decay" << endl; |
81ee7392 | 100 | |
101 | } else if (EVTFLG.ldltry == 1) { | |
102 | mech = kPDeltaRay; | |
2bc4c610 | 103 | if (debug) cout << endl << "Delta Ray" << endl; |
81ee7392 | 104 | |
105 | } else if (EVTFLG.lpairp == 1) { | |
106 | mech = kPPair; | |
2bc4c610 | 107 | if (debug) cout << endl << "Pair Production" << endl; |
81ee7392 | 108 | |
109 | } else if (EVTFLG.lbrmsp == 1) { | |
110 | mech = kPBrem; | |
2bc4c610 | 111 | if (debug) cout << endl << "Bremsstrahlung" << endl; |
81ee7392 | 112 | |
113 | } | |
114 | ||
115 | ||
81f1d030 | 116 | Double_t weight = GENSTK.wei[numsec-1]; |
f827183d | 117 | Int_t is = 0; |
118 | Int_t ntr; | |
81ee7392 | 119 | // |
120 | // Save particle in VMC stack | |
642f15cf | 121 | cppstack->PushTrack(done, parent, pdg, |
81ee7392 | 122 | px, py, pz, e, |
123 | vx, vy, vz, tof, | |
124 | polx, poly, polz, | |
125 | mech, ntr, weight, is); | |
2bc4c610 | 126 | if (debug) cout << endl << " !!! stuprf: ntr=" << ntr << "pdg " << pdg << " parent=" << parent << "numsec " |
81ee7392 | 127 | << numsec << "npprmr " << npprmr << endl; |
128 | // | |
129 | // Save current track number | |
81f1d030 | 130 | FLKSTK.ispark[FLKSTK.npflka][mkbmx2-1] = ntr; |
131 | FLKSTK.ispark[FLKSTK.npflka][mkbmx2-2] = 0; | |
f827183d | 132 | } // end of if (numsec-1 > npprmr) |
f827183d | 133 | } // end of stuprf |
134 | } // end of extern "C" | |
135 |