4 # define stupre stupre_
10 #include "Fdimpar.h" //(DIMPAR) fluka include
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
22 #include "TVirtualMCStack.h"
23 #include "TVirtualMCApplication.h"
24 #include "TParticle.h"
30 //*----------------------------------------------------------------------*
32 //* SeT User PRoperties for Emf particles *
34 //*----------------------------------------------------------------------*
37 if (EVTFLG.ldltry == 1) {
38 if (EMFSTK.ichemf[EMFSTK.npemf-1] * EMFSTK.ichemf[EMFSTK.npemf-2] < 0) lbhabh = 1;
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
43 // EMFSTK.espark = spare real variables available for
44 // EMFSTK.iespak = spare integer variables available for
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
51 for (npnw=EMFSTK.npstrt-1; npnw<=EMFSTK.npemf-1; npnw++) {
53 for (ispr=0; ispr<=mkbmx1-1; ispr++)
54 EMFSTK.espark[npnw][ispr] = TRACKR.spausr[ispr];
56 for (ispr=0; ispr<=mkbmx2-1; ispr++)
57 EMFSTK.iespak[npnw][ispr] = TRACKR.ispusr[ispr];
59 EMFSTK.louemf[npnw] = TRACKR.llouse;
62 // Get the pointer to the VMC
63 TFluka* fluka = (TFluka*) gMC;
64 Int_t verbosityLevel = fluka->GetVerbosityLevel();
65 Bool_t debug = (verbosityLevel>=3)?kTRUE:kFALSE;
66 fluka->SetTrackIsNew(kTRUE);
67 // TVirtualMC* fluka = TFluka::GetMC();
68 // Get the stack produced from the generator
69 TVirtualMCStack* cppstack = fluka->GetStack();
71 // EVTFLG.ntrcks = track number
72 // Increment the track number and put it into the last flag
75 for (kp = EMFSTK.npstrt - 1; kp <= EMFSTK.npemf - 1; kp++) {
77 //* save the parent track number and reset it at each loop
80 Int_t parent = TRACKR.ispusr[mkbmx2-1];
84 if (EMFSTK.ichemf[kp] == -1) flukaid = 3;
85 else if (EMFSTK.ichemf[kp] == 0) flukaid = 7;
86 else if (EMFSTK.ichemf[kp] == 0) flukaid = 4;
87 Int_t pdg = fluka->PDGFromId(flukaid);
88 Double_t e = EMFSTK.etemf[kp] * emvgev;
89 Double_t p = sqrt(e * e - PAPROP.am[flukaid+6] * PAPROP.am[flukaid+6]);
90 Double_t px = p * EMFSTK.u[kp];
91 Double_t pz = p * EMFSTK.v[kp];
92 Double_t py = p * EMFSTK.w[kp];
93 Double_t tof = EMFSTK.agemf[kp];
94 Double_t polx = EMFSTK.upol[kp];
95 Double_t poly = EMFSTK.vpol[kp];
96 Double_t polz = EMFSTK.wpol[kp];
97 Double_t vx = EMFSTK.x[kp];
98 Double_t vy = EMFSTK.y[kp];
99 Double_t vz = EMFSTK.z[kp];
100 Double_t weight = EMFSTK.wtemf[kp];
106 //* case of no parent left (pair, photoelectric, annihilation):
107 //* all secondaries are true
108 if ((EVTFLG.lpairp == 1) || (EVTFLG.lphoel == 1) ||
109 (EVTFLG.lannfl == 1) || (EVTFLG.lannrs == 1)) {
111 if (EVTFLG.lpairp == 1) mech = kPPair;
112 else if (EVTFLG.lphoel == 1) mech = kPPhotoelectric;
113 else mech = kPAnnihilation;
114 cppstack->PushTrack(done, parent, pdg,
115 px, py, pz, e, vx, vy, vz, tof,
116 polx, poly, polz, mech, ntr, weight, is);
117 if (debug) cout << endl << " !!! stupre (PAIR, ..) : ntr=" << ntr << "pdg " << pdg << " parent=" << parent << endl;
119 EMFSTK.iespak[kp][mkbmx2-1] = ntr;
120 EMFSTK.iespak[kp][mkbmx2-2] = 0;
121 } // end of lpairp, lphoel, lannfl, lannrs
123 //* Compton: secondary is true only if charged (e+, e-)
124 else if ((EVTFLG.lcmptn == 1)) {
126 if (EMFSTK.ichemf[kp] != 0) {
128 cppstack->PushTrack(done, parent, pdg,
129 px, py, pz, e, vx, vy, vz, tof,
130 polx, poly, polz, mech, ntr, weight, is);
131 if (debug) cout << endl << " !!! stupre (COMPTON) : ntr=" << ntr << "pdg " << pdg << " parent=" << parent << endl;
132 EMFSTK.iespak[kp][mkbmx2-1] = ntr;
133 EMFSTK.iespak[kp][mkbmx2-2] = 0;
137 //* Bremsstrahlung: true secondary only if charge = 0 (photon)
138 else if ((EVTFLG.lbrmsp == 1)) {
139 if (EMFSTK.ichemf[kp] == 0) {
141 cppstack->PushTrack(done, parent, pdg,
142 px, py, pz, e, vx, vy, vz, tof,
143 polx, poly, polz, mech, ntr, weight, is);
144 if (debug) cout << endl << " !!! stupre (BREMS) : ntr=" << ntr << "pdg " << pdg << " parent=" << parent << endl;
145 EMFSTK.iespak[kp][mkbmx2-1] = ntr;
146 EMFSTK.iespak[kp][mkbmx2-2] = 0;
150 //* Delta ray: If Bhabha, true secondary only if negative (electron)
151 else if ((EVTFLG.ldltry == 1)) {
153 if (EMFSTK.ichemf[kp] == -1) {
155 cppstack->PushTrack(done, parent, pdg,
156 px, py, pz, e, vx, vy, vz, tof,
157 polx, poly, polz, mech, ntr, weight, is);
158 EMFSTK.iespak[kp][mkbmx2-1] = ntr;
159 EMFSTK.iespak[kp][mkbmx2-2] = 0;
160 if (debug) cout << endl << " !!! stupre (BHABA) : ntr=" << ntr << "pdg " << pdg << " parent=" << parent << endl;
164 //* Delta ray: Otherwise Moller: true secondary is the electron with
165 //* lower energy, which has been put higher in the stack
166 else if (kp == EMFSTK.npemf-1) {
168 cppstack->PushTrack(done, parent, pdg,
169 px, py, pz, e, vx, vy, vz, tof,
170 polx, poly, polz, mech, ntr, weight, is);
171 if (debug) cout << endl << " !!! stupre (Moller) : ntr=" << ntr << "pdg " << pdg << " parent=" << parent << endl;
172 EMFSTK.iespak[kp][mkbmx2-1] = ntr;
173 EMFSTK.iespak[kp][mkbmx2-2] = 0;
174 } // end of Delta ray
179 // !!! TO BE CONFIRMED !!!
181 } // end of extern "C"