]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TFluka/stupre.cxx
Remove obsolete macro
[u/mrichter/AliRoot.git] / TFluka / stupre.cxx
CommitLineData
f827183d 1#include <Riostream.h>
2#include "AliRun.h"
f827183d 3#ifndef WIN32
4# define stupre stupre_
5#else
6# define stupre STUPRE
7#endif
8//
9// Fluka include
10#include "Fdimpar.h" //(DIMPAR) fluka include
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
17
18//Virtual MC
fbf08100 19
f827183d 20#include "TFluka.h"
a7bb59a2 21
f827183d 22#include "TVirtualMCStack.h"
23#include "TVirtualMCApplication.h"
24#include "TParticle.h"
25#include "TVector3.h"
26
27extern "C" {
28void stupre()
29{
30//*----------------------------------------------------------------------*
31//* *
32//* SeT User PRoperties for Emf particles *
33//* *
34//*----------------------------------------------------------------------*
f827183d 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
fbf08100 62 TFluka* fluka = (TFluka*) gMC;
2bc4c610 63 Int_t verbosityLevel = fluka->GetVerbosityLevel();
64 Bool_t debug = (verbosityLevel>=3)?kTRUE:kFALSE;
fbf08100 65 fluka->SetTrackIsNew(kTRUE);
66// TVirtualMC* fluka = TFluka::GetMC();
f827183d 67// Get the stack produced from the generator
68 TVirtualMCStack* cppstack = fluka->GetStack();
69
70// EVTFLG.ntrcks = track number
71// Increment the track number and put it into the last flag
72
73 Int_t kp;
7dac99f1 74 for (kp = EMFSTK.npstrt - 1; kp <= EMFSTK.npemf - 1; kp++) {
f827183d 75
76//* save the parent track number and reset it at each loop
610cd189 77 Int_t done = 0;
81ee7392 78
79 Int_t parent = TRACKR.ispusr[mkbmx2-1];
f827183d 80
f827183d 81 Int_t flukaid = 0;
7dac99f1 82
83 if (EMFSTK.ichemf[kp] == -1) flukaid = 3;
84 else if (EMFSTK.ichemf[kp] == 0) flukaid = 7;
18f4b652 85 else if (EMFSTK.ichemf[kp] == 1) flukaid = 4;
d15554e0 86 Int_t pdg = fluka->PDGFromId(flukaid);
7dac99f1 87 Double_t e = EMFSTK.etemf[kp] * emvgev;
d15554e0 88 Double_t p = sqrt(e * e - PAPROP.am[flukaid+6] * PAPROP.am[flukaid+6]);
89 Double_t px = p * EMFSTK.u[kp];
90 Double_t pz = p * EMFSTK.v[kp];
91 Double_t py = p * EMFSTK.w[kp];
92 Double_t tof = EMFSTK.agemf[kp];
93 Double_t polx = EMFSTK.upol[kp];
94 Double_t poly = EMFSTK.vpol[kp];
95 Double_t polz = EMFSTK.wpol[kp];
96 Double_t vx = EMFSTK.x[kp];
97 Double_t vy = EMFSTK.y[kp];
98 Double_t vz = EMFSTK.z[kp];
7dac99f1 99 Double_t weight = EMFSTK.wtemf[kp];
100
f827183d 101 Int_t ntr;
102 TMCProcess mech;
103 Int_t is = 0;
104
105//* case of no parent left (pair, photoelectric, annihilation):
106//* all secondaries are true
107 if ((EVTFLG.lpairp == 1) || (EVTFLG.lphoel == 1) ||
108 (EVTFLG.lannfl == 1) || (EVTFLG.lannrs == 1)) {
81ee7392 109
110 if (EVTFLG.lpairp == 1) mech = kPPair;
111 else if (EVTFLG.lphoel == 1) mech = kPPhotoelectric;
112 else mech = kPAnnihilation;
642f15cf 113 cppstack->PushTrack(done, parent, pdg,
81ee7392 114 px, py, pz, e, vx, vy, vz, tof,
115 polx, poly, polz, mech, ntr, weight, is);
2bc4c610 116 if (debug) cout << endl << " !!! stupre (PAIR, ..) : ntr=" << ntr << "pdg " << pdg << " parent=" << parent << endl;
d15554e0 117
81ee7392 118 EMFSTK.iespak[kp][mkbmx2-1] = ntr;
48aa0331 119 EMFSTK.iespak[kp][mkbmx2-2] = 0;
f827183d 120 } // end of lpairp, lphoel, lannfl, lannrs
121
122//* Compton: secondary is true only if charged (e+, e-)
123 else if ((EVTFLG.lcmptn == 1)) {
7dac99f1 124
125 if (EMFSTK.ichemf[kp] != 0) {
81ee7392 126 mech = kPCompton;
642f15cf 127 cppstack->PushTrack(done, parent, pdg,
81ee7392 128 px, py, pz, e, vx, vy, vz, tof,
129 polx, poly, polz, mech, ntr, weight, is);
2bc4c610 130 if (debug) cout << endl << " !!! stupre (COMPTON) : ntr=" << ntr << "pdg " << pdg << " parent=" << parent << endl;
81ee7392 131 EMFSTK.iespak[kp][mkbmx2-1] = ntr;
48aa0331 132 EMFSTK.iespak[kp][mkbmx2-2] = 0;
81ee7392 133 }
f827183d 134 } // end of lcmptn
81ee7392 135
f827183d 136//* Bremsstrahlung: true secondary only if charge = 0 (photon)
137 else if ((EVTFLG.lbrmsp == 1)) {
7dac99f1 138 if (EMFSTK.ichemf[kp] == 0) {
81ee7392 139 mech = kPBrem;
642f15cf 140 cppstack->PushTrack(done, parent, pdg,
81ee7392 141 px, py, pz, e, vx, vy, vz, tof,
142 polx, poly, polz, mech, ntr, weight, is);
2bc4c610 143 if (debug) cout << endl << " !!! stupre (BREMS) : ntr=" << ntr << "pdg " << pdg << " parent=" << parent << endl;
81ee7392 144 EMFSTK.iespak[kp][mkbmx2-1] = ntr;
48aa0331 145 EMFSTK.iespak[kp][mkbmx2-2] = 0;
81ee7392 146 }
f827183d 147 } // end of lbrmsp
81ee7392 148
f827183d 149//* Delta ray: If Bhabha, true secondary only if negative (electron)
150 else if ((EVTFLG.ldltry == 1)) {
81ee7392 151 if (lbhabh == 1) {
7dac99f1 152 if (EMFSTK.ichemf[kp] == -1) {
81ee7392 153 mech = kPDeltaRay;
642f15cf 154 cppstack->PushTrack(done, parent, pdg,
81ee7392 155 px, py, pz, e, vx, vy, vz, tof,
156 polx, poly, polz, mech, ntr, weight, is);
157 EMFSTK.iespak[kp][mkbmx2-1] = ntr;
48aa0331 158 EMFSTK.iespak[kp][mkbmx2-2] = 0;
2bc4c610 159 if (debug) cout << endl << " !!! stupre (BHABA) : ntr=" << ntr << "pdg " << pdg << " parent=" << parent << endl;
81ee7392 160 } // end of Bhabha
d15554e0 161 } // lbhabh == 1
81ee7392 162
f827183d 163//* Delta ray: Otherwise Moller: true secondary is the electron with
164//* lower energy, which has been put higher in the stack
7dac99f1 165 else if (kp == EMFSTK.npemf-1) {
81ee7392 166 mech = kPDeltaRay;
642f15cf 167 cppstack->PushTrack(done, parent, pdg,
81ee7392 168 px, py, pz, e, vx, vy, vz, tof,
169 polx, poly, polz, mech, ntr, weight, is);
2bc4c610 170 if (debug) cout << endl << " !!! stupre (Moller) : ntr=" << ntr << "pdg " << pdg << " parent=" << parent << endl;
81ee7392 171 EMFSTK.iespak[kp][mkbmx2-1] = ntr;
48aa0331 172 EMFSTK.iespak[kp][mkbmx2-2] = 0;
81ee7392 173 } // end of Delta ray
f827183d 174 } // end of ldltry
81ee7392 175
f827183d 176 } // end of loop
81ee7392 177
f827183d 178// !!! TO BE CONFIRMED !!!
f827183d 179} // end of stupre
180} // end of extern "C"
181