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
23 #include "TFlukaGeo.h"
26 #include "TVirtualMCStack.h"
27 #include "TVirtualMCApplication.h"
28 #include "TParticle.h"
34 //*----------------------------------------------------------------------*
36 //* SeT User PRoperties for Emf particles *
38 //*----------------------------------------------------------------------*
41 if (EVTFLG.ldltry == 1) {
42 if (EMFSTK.ichemf[EMFSTK.npemf-1] * EMFSTK.ichemf[EMFSTK.npemf-2] < 0) lbhabh = 1;
45 // mkbmx1 = dimension for kwb real spare array in fluka stack in DIMPAR
46 // mkbmx2 = dimension for kwb int. spare array in fluka stack in DIMPAR
47 // EMFSTK.espark = spare real variables available for
48 // EMFSTK.iespak = spare integer variables available for
49 // TRACKR.spausr = user defined spare variables for the current particle
50 // TRACKR.ispusr = user defined spare flags for the current particle
51 // EMFSTK.louemf = user flag
52 // TRACKR.llouse = user defined flag for the current particle
55 for (npnw=EMFSTK.npstrt-1; npnw<=EMFSTK.npemf-1; npnw++) {
57 for (ispr=0; ispr<=mkbmx1-1; ispr++)
58 EMFSTK.espark[npnw][ispr] = TRACKR.spausr[ispr];
60 for (ispr=0; ispr<=mkbmx2-1; ispr++)
61 EMFSTK.iespak[npnw][ispr] = TRACKR.ispusr[ispr];
63 EMFSTK.louemf[npnw] = TRACKR.llouse;
66 // Get the pointer to the VMC
67 TFluka* fluka = (TFluka*) gMC;
68 Int_t verbosityLevel = fluka->GetVerbosityLevel();
69 Bool_t debug = (verbosityLevel>=3)?kTRUE:kFALSE;
70 fluka->SetTrackIsNew(kTRUE);
71 // TVirtualMC* fluka = TFluka::GetMC();
72 // Get the stack produced from the generator
73 TVirtualMCStack* cppstack = fluka->GetStack();
75 // EVTFLG.ntrcks = track number
76 // Increment the track number and put it into the last flag
79 for (kp = EMFSTK.npstrt - 1; kp <= EMFSTK.npemf - 1; kp++) {
81 //* save the parent track number and reset it at each loop
84 Int_t parent = TRACKR.ispusr[mkbmx2-1];
88 if (EMFSTK.ichemf[kp] == -1) flukaid = 3;
89 else if (EMFSTK.ichemf[kp] == 0) flukaid = 7;
90 else if (EMFSTK.ichemf[kp] == 0) flukaid = 4;
91 Int_t pdg = fluka->PDGFromId(flukaid);
92 Double_t e = EMFSTK.etemf[kp] * emvgev;
93 Double_t p = sqrt(e * e - PAPROP.am[flukaid+6] * PAPROP.am[flukaid+6]);
94 Double_t px = p * EMFSTK.u[kp];
95 Double_t pz = p * EMFSTK.v[kp];
96 Double_t py = p * EMFSTK.w[kp];
97 Double_t tof = EMFSTK.agemf[kp];
98 Double_t polx = EMFSTK.upol[kp];
99 Double_t poly = EMFSTK.vpol[kp];
100 Double_t polz = EMFSTK.wpol[kp];
101 Double_t vx = EMFSTK.x[kp];
102 Double_t vy = EMFSTK.y[kp];
103 Double_t vz = EMFSTK.z[kp];
104 Double_t weight = EMFSTK.wtemf[kp];
110 //* case of no parent left (pair, photoelectric, annihilation):
111 //* all secondaries are true
112 if ((EVTFLG.lpairp == 1) || (EVTFLG.lphoel == 1) ||
113 (EVTFLG.lannfl == 1) || (EVTFLG.lannrs == 1)) {
115 if (EVTFLG.lpairp == 1) mech = kPPair;
116 else if (EVTFLG.lphoel == 1) mech = kPPhotoelectric;
117 else mech = kPAnnihilation;
118 cppstack->PushTrack(done, parent, pdg,
119 px, py, pz, e, vx, vy, vz, tof,
120 polx, poly, polz, mech, ntr, weight, is);
121 if (debug) cout << endl << " !!! stupre (PAIR, ..) : ntr=" << ntr << "pdg " << pdg << " parent=" << parent << endl;
123 EMFSTK.iespak[kp][mkbmx2-1] = ntr;
124 } // end of lpairp, lphoel, lannfl, lannrs
126 //* Compton: secondary is true only if charged (e+, e-)
127 else if ((EVTFLG.lcmptn == 1)) {
129 if (EMFSTK.ichemf[kp] != 0) {
131 cppstack->PushTrack(done, parent, pdg,
132 px, py, pz, e, vx, vy, vz, tof,
133 polx, poly, polz, mech, ntr, weight, is);
134 if (debug) cout << endl << " !!! stupre (COMPTON) : ntr=" << ntr << "pdg " << pdg << " parent=" << parent << endl;
135 EMFSTK.iespak[kp][mkbmx2-1] = ntr;
139 //* Bremsstrahlung: true secondary only if charge = 0 (photon)
140 else if ((EVTFLG.lbrmsp == 1)) {
141 if (EMFSTK.ichemf[kp] == 0) {
143 cppstack->PushTrack(done, parent, pdg,
144 px, py, pz, e, vx, vy, vz, tof,
145 polx, poly, polz, mech, ntr, weight, is);
146 if (debug) cout << endl << " !!! stupre (BREMS) : ntr=" << ntr << "pdg " << pdg << " parent=" << parent << endl;
147 EMFSTK.iespak[kp][mkbmx2-1] = ntr;
151 //* Delta ray: If Bhabha, true secondary only if negative (electron)
152 else if ((EVTFLG.ldltry == 1)) {
154 if (EMFSTK.ichemf[kp] == -1) {
156 cppstack->PushTrack(done, parent, pdg,
157 px, py, pz, e, vx, vy, vz, tof,
158 polx, poly, polz, mech, ntr, weight, is);
159 EMFSTK.iespak[kp][mkbmx2-1] = ntr;
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 } // end of Delta ray
178 // !!! TO BE CONFIRMED !!!
180 } // end of extern "C"