]>
Commit | Line | Data |
---|---|---|
f827183d | 1 | #include <Riostream.h> |
f827183d | 2 | #ifndef WIN32 |
3 | # define stupre stupre_ | |
4 | #else | |
5 | # define stupre STUPRE | |
6 | #endif | |
7 | // | |
8 | // Fluka include | |
9 | #include "Fdimpar.h" //(DIMPAR) fluka include | |
e3926667 | 10 | |
f827183d | 11 | // Fluka commons |
12 | #include "Fdblprc.h" //(DBLPRC) fluka common | |
13 | #include "Femfstk.h" //(EMFSTK) fluka common | |
14 | #include "Fevtflg.h" //(EVTFLG) fluka common | |
15 | #include "Fpaprop.h" //(PAPROP) fluka common | |
16 | #include "Ftrackr.h" //(TRACKR) fluka common | |
e3926667 | 17 | #include "Femfrgn.h" //(EFMRGN) fluka common |
f827183d | 18 | |
19 | //Virtual MC | |
20 | #include "TFluka.h" | |
21 | #include "TVirtualMCStack.h" | |
22 | #include "TVirtualMCApplication.h" | |
23 | #include "TParticle.h" | |
24 | #include "TVector3.h" | |
25 | ||
26 | extern "C" { | |
27 | void stupre() | |
28 | { | |
29 | //*----------------------------------------------------------------------* | |
30 | //* * | |
31 | //* SeT User PRoperties for Emf particles * | |
32 | //* * | |
33 | //*----------------------------------------------------------------------* | |
e3926667 | 34 | static Double_t emassmev = PAPROP.am[9] * 1000.; |
35 | ||
f827183d | 36 | Int_t lbhabh = 0; |
37 | if (EVTFLG.ldltry == 1) { | |
7dac99f1 | 38 | if (EMFSTK.ichemf[EMFSTK.npemf-1] * EMFSTK.ichemf[EMFSTK.npemf-2] < 0) lbhabh = 1; |
f827183d | 39 | } |
e3926667 | 40 | |
41 | // mkbmx1 = dimension for kwb real spare array in fluka stack in DIMPAR | |
42 | // mkbmx2 = dimension for kwb int. spare array in fluka stack in DIMPAR | |
f827183d | 43 | // EMFSTK.espark = spare real variables available for |
44 | // EMFSTK.iespak = spare integer variables available for | |
e3926667 | 45 | // TRACKR.spausr = user defined spare variables for the current particle |
46 | // TRACKR.ispusr = user defined spare flags for the current particle | |
47 | // EMFSTK.louemf = user flag | |
48 | // TRACKR.llouse = user defined flag for the current particle | |
f827183d | 49 | |
50 | Int_t npnw, ispr; | |
e3926667 | 51 | for (npnw = EMFSTK.npstrt-1; npnw <= EMFSTK.npemf-1; npnw++) { |
f827183d | 52 | |
e3926667 | 53 | for (ispr = 0; ispr <= mkbmx1-1; ispr++) |
f827183d | 54 | EMFSTK.espark[npnw][ispr] = TRACKR.spausr[ispr]; |
e3926667 | 55 | |
56 | for (ispr = 0; ispr <= mkbmx2-1; ispr++) | |
f827183d | 57 | EMFSTK.iespak[npnw][ispr] = TRACKR.ispusr[ispr]; |
e3926667 | 58 | |
f827183d | 59 | EMFSTK.louemf[npnw] = TRACKR.llouse; |
60 | } | |
61 | ||
62 | // Get the pointer to the VMC | |
fbf08100 | 63 | TFluka* fluka = (TFluka*) gMC; |
2bc4c610 | 64 | Int_t verbosityLevel = fluka->GetVerbosityLevel(); |
65 | Bool_t debug = (verbosityLevel>=3)?kTRUE:kFALSE; | |
fbf08100 | 66 | fluka->SetTrackIsNew(kTRUE); |
e3926667 | 67 | |
f827183d | 68 | // Get the stack produced from the generator |
69 | TVirtualMCStack* cppstack = fluka->GetStack(); | |
70 | ||
71 | // EVTFLG.ntrcks = track number | |
72 | // Increment the track number and put it into the last flag | |
73 | ||
74 | Int_t kp; | |
e3926667 | 75 | |
7dac99f1 | 76 | for (kp = EMFSTK.npstrt - 1; kp <= EMFSTK.npemf - 1; kp++) { |
e3926667 | 77 | |
78 | // Ckeck transport cut first | |
79 | Int_t ireg = EMFSTK.iremf[kp]; | |
11e28b34 | 80 | Double_t cut = (TMath::Abs(EMFSTK.ichemf[kp]) == 1) ? EMFRGN.elethr[ireg-1] : EMFRGN.phothr[ireg-1]; |
e3926667 | 81 | Double_t e = EMFSTK.etemf[kp]; |
b7940702 | 82 | |
e3926667 | 83 | if ((e < cut) |
84 | && ( | |
85 | (EMFSTK.ichemf[kp] == 0) || | |
86 | (EMFSTK.ichemf[kp] == -1) || | |
11e28b34 | 87 | (EMFSTK.ichemf[kp] == 1 && EMFRGN.phothr[ireg-1] > emassmev) |
e3926667 | 88 | ) |
89 | ) | |
90 | { | |
b7940702 | 91 | EMFSTK.iespak[kp][mkbmx2-1] = TRACKR.ispusr[mkbmx2-1]; |
e3926667 | 92 | EMFSTK.iespak[kp][mkbmx2-2] = 0; |
93 | continue; | |
94 | } | |
f827183d | 95 | |
96 | //* save the parent track number and reset it at each loop | |
610cd189 | 97 | Int_t done = 0; |
81ee7392 | 98 | Int_t parent = TRACKR.ispusr[mkbmx2-1]; |
f827183d | 99 | Int_t flukaid = 0; |
3b8c325d | 100 | |
e3926667 | 101 | // Identify particle type |
102 | if (EMFSTK.ichemf[kp] == -1) flukaid = 3; | |
103 | else if (EMFSTK.ichemf[kp] == 0) flukaid = 7; | |
104 | else if (EMFSTK.ichemf[kp] == 1) flukaid = 4; | |
105 | ||
106 | ||
107 | e *= emvgev; | |
108 | Int_t pdg = fluka->PDGFromId(flukaid); | |
d15554e0 | 109 | Double_t p = sqrt(e * e - PAPROP.am[flukaid+6] * PAPROP.am[flukaid+6]); |
81f1d030 | 110 | Double_t px = p * EMFSTK.uemf[kp]; |
b7940702 | 111 | Double_t py = p * EMFSTK.vemf[kp]; |
112 | Double_t pz = p * EMFSTK.wemf[kp]; | |
d15554e0 | 113 | Double_t tof = EMFSTK.agemf[kp]; |
114 | Double_t polx = EMFSTK.upol[kp]; | |
115 | Double_t poly = EMFSTK.vpol[kp]; | |
116 | Double_t polz = EMFSTK.wpol[kp]; | |
81f1d030 | 117 | Double_t vx = EMFSTK.xemf[kp]; |
118 | Double_t vy = EMFSTK.yemf[kp]; | |
119 | Double_t vz = EMFSTK.zemf[kp]; | |
7dac99f1 | 120 | Double_t weight = EMFSTK.wtemf[kp]; |
121 | ||
f827183d | 122 | Int_t ntr; |
123 | TMCProcess mech; | |
124 | Int_t is = 0; | |
125 | ||
126 | //* case of no parent left (pair, photoelectric, annihilation): | |
127 | //* all secondaries are true | |
128 | if ((EVTFLG.lpairp == 1) || (EVTFLG.lphoel == 1) || | |
129 | (EVTFLG.lannfl == 1) || (EVTFLG.lannrs == 1)) { | |
81ee7392 | 130 | |
131 | if (EVTFLG.lpairp == 1) mech = kPPair; | |
132 | else if (EVTFLG.lphoel == 1) mech = kPPhotoelectric; | |
133 | else mech = kPAnnihilation; | |
642f15cf | 134 | cppstack->PushTrack(done, parent, pdg, |
81ee7392 | 135 | px, py, pz, e, vx, vy, vz, tof, |
136 | polx, poly, polz, mech, ntr, weight, is); | |
e3926667 | 137 | if (debug) cout << endl << " !!! stupre (PAIR, ..) : ntr=" << ntr << "pdg " << pdg << " parent=" << parent << "energy " << e-PAPROP.am[flukaid+6] << endl; |
d15554e0 | 138 | |
81ee7392 | 139 | EMFSTK.iespak[kp][mkbmx2-1] = ntr; |
48aa0331 | 140 | EMFSTK.iespak[kp][mkbmx2-2] = 0; |
f827183d | 141 | } // end of lpairp, lphoel, lannfl, lannrs |
142 | ||
143 | //* Compton: secondary is true only if charged (e+, e-) | |
144 | else if ((EVTFLG.lcmptn == 1)) { | |
7dac99f1 | 145 | |
146 | if (EMFSTK.ichemf[kp] != 0) { | |
81ee7392 | 147 | mech = kPCompton; |
642f15cf | 148 | cppstack->PushTrack(done, parent, pdg, |
81ee7392 | 149 | px, py, pz, e, vx, vy, vz, tof, |
150 | polx, poly, polz, mech, ntr, weight, is); | |
2bc4c610 | 151 | if (debug) cout << endl << " !!! stupre (COMPTON) : ntr=" << ntr << "pdg " << pdg << " parent=" << parent << endl; |
81ee7392 | 152 | EMFSTK.iespak[kp][mkbmx2-1] = ntr; |
48aa0331 | 153 | EMFSTK.iespak[kp][mkbmx2-2] = 0; |
81ee7392 | 154 | } |
f827183d | 155 | } // end of lcmptn |
81ee7392 | 156 | |
f827183d | 157 | //* Bremsstrahlung: true secondary only if charge = 0 (photon) |
158 | else if ((EVTFLG.lbrmsp == 1)) { | |
7dac99f1 | 159 | if (EMFSTK.ichemf[kp] == 0) { |
81ee7392 | 160 | mech = kPBrem; |
642f15cf | 161 | cppstack->PushTrack(done, parent, pdg, |
81ee7392 | 162 | px, py, pz, e, vx, vy, vz, tof, |
163 | polx, poly, polz, mech, ntr, weight, is); | |
2bc4c610 | 164 | if (debug) cout << endl << " !!! stupre (BREMS) : ntr=" << ntr << "pdg " << pdg << " parent=" << parent << endl; |
81ee7392 | 165 | EMFSTK.iespak[kp][mkbmx2-1] = ntr; |
48aa0331 | 166 | EMFSTK.iespak[kp][mkbmx2-2] = 0; |
81ee7392 | 167 | } |
f827183d | 168 | } // end of lbrmsp |
81ee7392 | 169 | |
f827183d | 170 | //* Delta ray: If Bhabha, true secondary only if negative (electron) |
171 | else if ((EVTFLG.ldltry == 1)) { | |
81ee7392 | 172 | if (lbhabh == 1) { |
7dac99f1 | 173 | if (EMFSTK.ichemf[kp] == -1) { |
81ee7392 | 174 | mech = kPDeltaRay; |
642f15cf | 175 | cppstack->PushTrack(done, parent, pdg, |
81ee7392 | 176 | px, py, pz, e, vx, vy, vz, tof, |
177 | polx, poly, polz, mech, ntr, weight, is); | |
178 | EMFSTK.iespak[kp][mkbmx2-1] = ntr; | |
48aa0331 | 179 | EMFSTK.iespak[kp][mkbmx2-2] = 0; |
2bc4c610 | 180 | if (debug) cout << endl << " !!! stupre (BHABA) : ntr=" << ntr << "pdg " << pdg << " parent=" << parent << endl; |
81ee7392 | 181 | } // end of Bhabha |
d15554e0 | 182 | } // lbhabh == 1 |
81ee7392 | 183 | |
f827183d | 184 | //* Delta ray: Otherwise Moller: true secondary is the electron with |
185 | //* lower energy, which has been put higher in the stack | |
7dac99f1 | 186 | else if (kp == EMFSTK.npemf-1) { |
81ee7392 | 187 | mech = kPDeltaRay; |
642f15cf | 188 | cppstack->PushTrack(done, parent, pdg, |
81ee7392 | 189 | px, py, pz, e, vx, vy, vz, tof, |
190 | polx, poly, polz, mech, ntr, weight, is); | |
2bc4c610 | 191 | if (debug) cout << endl << " !!! stupre (Moller) : ntr=" << ntr << "pdg " << pdg << " parent=" << parent << endl; |
81ee7392 | 192 | EMFSTK.iespak[kp][mkbmx2-1] = ntr; |
48aa0331 | 193 | EMFSTK.iespak[kp][mkbmx2-2] = 0; |
81ee7392 | 194 | } // end of Delta ray |
f827183d | 195 | } // end of ldltry |
81ee7392 | 196 | |
f827183d | 197 | } // end of loop |
f827183d | 198 | } // end of stupre |
199 | } // end of extern "C" | |
200 |