]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TFluka/stupre.cxx
Code causing warning messages during compilation corrected.
[u/mrichter/AliRoot.git] / TFluka / stupre.cxx
CommitLineData
f827183d 1#include <Riostream.h>
2#include "AliRun.h"
3#include "TFluka.h"
4#ifndef WIN32
5# define stupre stupre_
6#else
7# define stupre STUPRE
8#endif
9//
10// Fluka include
11#include "Fdimpar.h" //(DIMPAR) fluka include
12// Fluka commons
13#include "Fdblprc.h" //(DBLPRC) fluka common
14#include "Femfstk.h" //(EMFSTK) fluka common
15#include "Fevtflg.h" //(EVTFLG) fluka common
16#include "Fpaprop.h" //(PAPROP) fluka common
17#include "Ftrackr.h" //(TRACKR) fluka common
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
26extern "C" {
27void stupre()
28{
29//*----------------------------------------------------------------------*
30//* *
31//* SeT User PRoperties for Emf particles *
32//* *
33//*----------------------------------------------------------------------*
34
35 Int_t lbhabh = 0;
36 if (EVTFLG.ldltry == 1) {
7dac99f1 37 if (EMFSTK.ichemf[EMFSTK.npemf-1] * EMFSTK.ichemf[EMFSTK.npemf-2] < 0) lbhabh = 1;
f827183d 38 }
39
40// mkbmx1 = dimension for kwb real spare array in fluka stack in DIMPAR
41// mkbmx2 = dimension for kwb int. spare array in fluka stack in DIMPAR
42// EMFSTK.espark = spare real variables available for
43// EMFSTK.iespak = spare integer variables available for
44// TRACKR.spausr = user defined spare variables for the current particle
45// TRACKR.ispusr = user defined spare flags for the current particle
46// EMFSTK.louemf = user flag
47// TRACKR.llouse = user defined flag for the current particle
48
49 Int_t npnw, ispr;
7dac99f1 50 for (npnw=EMFSTK.npstrt-1; npnw<=EMFSTK.npemf-1; npnw++) {
f827183d 51
52 for (ispr=0; ispr<=mkbmx1-1; ispr++)
53 EMFSTK.espark[npnw][ispr] = TRACKR.spausr[ispr];
54
55 for (ispr=0; ispr<=mkbmx2-1; ispr++)
56 EMFSTK.iespak[npnw][ispr] = TRACKR.ispusr[ispr];
57
58 EMFSTK.louemf[npnw] = TRACKR.llouse;
59 }
60
61// Get the pointer to the VMC
62 TVirtualMC* fluka = TFluka::GetMC();
63// Get the stack produced from the generator
64 TVirtualMCStack* cppstack = fluka->GetStack();
65
66// EVTFLG.ntrcks = track number
67// Increment the track number and put it into the last flag
68
69 Int_t kp;
7dac99f1 70 for (kp = EMFSTK.npstrt - 1; kp <= EMFSTK.npemf - 1; kp++) {
f827183d 71
72//* save the parent track number and reset it at each loop
81ee7392 73 Int_t done = 1;
74
75 Int_t parent = TRACKR.ispusr[mkbmx2-1];
f827183d 76
f827183d 77 Int_t flukaid = 0;
7dac99f1 78
79 if (EMFSTK.ichemf[kp] == -1) flukaid = 3;
80 else if (EMFSTK.ichemf[kp] == 0) flukaid = 7;
81 else if (EMFSTK.ichemf[kp] == 0) flukaid = 4;
d15554e0 82 Int_t pdg = fluka->PDGFromId(flukaid);
7dac99f1 83 Double_t e = EMFSTK.etemf[kp] * emvgev;
d15554e0 84 Double_t p = sqrt(e * e - PAPROP.am[flukaid+6] * PAPROP.am[flukaid+6]);
85 Double_t px = p * EMFSTK.u[kp];
86 Double_t pz = p * EMFSTK.v[kp];
87 Double_t py = p * EMFSTK.w[kp];
88 Double_t tof = EMFSTK.agemf[kp];
89 Double_t polx = EMFSTK.upol[kp];
90 Double_t poly = EMFSTK.vpol[kp];
91 Double_t polz = EMFSTK.wpol[kp];
92 Double_t vx = EMFSTK.x[kp];
93 Double_t vy = EMFSTK.y[kp];
94 Double_t vz = EMFSTK.z[kp];
7dac99f1 95 Double_t weight = EMFSTK.wtemf[kp];
96
f827183d 97 Int_t ntr;
98 TMCProcess mech;
99 Int_t is = 0;
100
101//* case of no parent left (pair, photoelectric, annihilation):
102//* all secondaries are true
103 if ((EVTFLG.lpairp == 1) || (EVTFLG.lphoel == 1) ||
104 (EVTFLG.lannfl == 1) || (EVTFLG.lannrs == 1)) {
81ee7392 105
106 if (EVTFLG.lpairp == 1) mech = kPPair;
107 else if (EVTFLG.lphoel == 1) mech = kPPhotoelectric;
108 else mech = kPAnnihilation;
642f15cf 109 cppstack->PushTrack(done, parent, pdg,
81ee7392 110 px, py, pz, e, vx, vy, vz, tof,
111 polx, poly, polz, mech, ntr, weight, is);
d15554e0 112 cout << endl << " !!! stupre (PAIR, ..) : ntr=" << ntr << "pdg " << pdg << " parent=" << parent << endl;
113
81ee7392 114 EMFSTK.iespak[kp][mkbmx2-1] = ntr;
f827183d 115 } // end of lpairp, lphoel, lannfl, lannrs
116
117//* Compton: secondary is true only if charged (e+, e-)
118 else if ((EVTFLG.lcmptn == 1)) {
7dac99f1 119
120 if (EMFSTK.ichemf[kp] != 0) {
81ee7392 121 mech = kPCompton;
642f15cf 122 cppstack->PushTrack(done, parent, pdg,
81ee7392 123 px, py, pz, e, vx, vy, vz, tof,
124 polx, poly, polz, mech, ntr, weight, is);
d15554e0 125 cout << endl << " !!! stupre (COMPTON) : ntr=" << ntr << "pdg " << pdg << " parent=" << parent << endl;
81ee7392 126 EMFSTK.iespak[kp][mkbmx2-1] = ntr;
127 }
f827183d 128 } // end of lcmptn
81ee7392 129
f827183d 130//* Bremsstrahlung: true secondary only if charge = 0 (photon)
131 else if ((EVTFLG.lbrmsp == 1)) {
7dac99f1 132 if (EMFSTK.ichemf[kp] == 0) {
81ee7392 133 mech = kPBrem;
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);
d15554e0 137 cout << endl << " !!! stupre (BREMS) : ntr=" << ntr << "pdg " << pdg << " parent=" << parent << endl;
81ee7392 138 EMFSTK.iespak[kp][mkbmx2-1] = ntr;
139 }
f827183d 140 } // end of lbrmsp
81ee7392 141
f827183d 142//* Delta ray: If Bhabha, true secondary only if negative (electron)
143 else if ((EVTFLG.ldltry == 1)) {
81ee7392 144 if (lbhabh == 1) {
7dac99f1 145 if (EMFSTK.ichemf[kp] == -1) {
81ee7392 146 mech = kPDeltaRay;
642f15cf 147 cppstack->PushTrack(done, parent, pdg,
81ee7392 148 px, py, pz, e, vx, vy, vz, tof,
149 polx, poly, polz, mech, ntr, weight, is);
150 EMFSTK.iespak[kp][mkbmx2-1] = ntr;
d15554e0 151 cout << endl << " !!! stupre (BHABA) : ntr=" << ntr << "pdg " << pdg << " parent=" << parent << endl;
81ee7392 152 } // end of Bhabha
d15554e0 153 } // lbhabh == 1
81ee7392 154
f827183d 155//* Delta ray: Otherwise Moller: true secondary is the electron with
156//* lower energy, which has been put higher in the stack
7dac99f1 157 else if (kp == EMFSTK.npemf-1) {
81ee7392 158 mech = kPDeltaRay;
642f15cf 159 cppstack->PushTrack(done, parent, pdg,
81ee7392 160 px, py, pz, e, vx, vy, vz, tof,
161 polx, poly, polz, mech, ntr, weight, is);
d15554e0 162 cout << endl << " !!! stupre (Moller) : ntr=" << ntr << "pdg " << pdg << " parent=" << parent << endl;
81ee7392 163 EMFSTK.iespak[kp][mkbmx2-1] = ntr;
164 } // end of Delta ray
f827183d 165 } // end of ldltry
81ee7392 166
f827183d 167 } // end of loop
81ee7392 168
f827183d 169// !!! TO BE CONFIRMED !!!
f827183d 170} // end of stupre
171} // end of extern "C"
172