]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TFluka/stuprf.cxx
Monalisa configuration added: host and table name
[u/mrichter/AliRoot.git] / TFluka / stuprf.cxx
CommitLineData
f827183d 1#include <Riostream.h>
f827183d 2#ifndef WIN32
3# define stuprf stuprf_
4#else
5# define stuprf STUPRF
6#endif
7//
8// Fluka include
9#include "Fdimpar.h" //(DIMPAR) fluka include
10// Fluka commons
11#include "Fdblprc.h" //(DBLPRC) fluka common
12#include "Fevtflg.h" //(EVTFLG) fluka common
13#include "Fpaprop.h" //(PAPROP) fluka common
81f1d030 14#include "Fflkstk.h" //(FLKSTK) fluka common
f827183d 15#include "Ftrackr.h" //(TRACKR) fluka common
81f1d030 16#include "Fgenstk.h" //(GENSTK) fluka common
f827183d 17
18e0cabb 18
f827183d 19//Virtual MC
20#include "TFluka.h"
fbf08100 21
f827183d 22#include "TVirtualMCStack.h"
23#include "TVirtualMCApplication.h"
24#include "TParticle.h"
25#include "TVector3.h"
26
27extern "C" {
70541a80 28 void stuprf(Int_t& /*ij*/, Int_t& /*mreg*/,
18e0cabb 29 Double_t& xx, Double_t& yy, Double_t& zz,
30 Int_t& numsec, Int_t& npprmr)
f827183d 31{
32//*----------------------------------------------------------------------*
33//* *
34//* SeT User PRoperties for Fluka particles *
35//* *
36//*----------------------------------------------------------------------*
37
81f1d030 38// FLKSTK.npflka = stack pointer
39// FLKSTK.louse = user flag
f827183d 40// TRACKR.llouse = user defined flag for the current particle
5834fcef 41
42 FLKSTK.louse[FLKSTK.npflka] = TRACKR.llouse;
f827183d 43
44// mkbmx1 = dimension for kwb real spare array in fluka stack in DIMPAR
45// mkbmx2 = dimension for kwb int. spare array in fluka stack in DIMPAR
81f1d030 46// FLKSTK.sparek = spare real variables available for k.w.burn
47// FLKSTK.ispark = spare integer variables available for k.w.burn
f827183d 48// TRACKR.spausr = user defined spare variables for the current particle
49// TRACKR.ispusr = user defined spare flags for the current particle
50 Int_t ispr;
5834fcef 51 if (numsec <= npprmr) {
52 for (ispr = 0; ispr <= mkbmx1 - 1; ispr++) {
53 FLKSTK.sparek[FLKSTK.npflka][ispr] = TRACKR.spausr[ispr];
5834fcef 54 }
55 for (ispr = 0; ispr <= mkbmx2 - 1; ispr++) {
56 FLKSTK.ispark[FLKSTK.npflka][ispr] = TRACKR.ispusr[ispr];
5834fcef 57 }
58 }
59
18e0cabb 60 // save parent info
5834fcef 61 FLKSTK.ispark[FLKSTK.npflka][mkbmx2 - 3] = TRACKR.jtrack; // fluka particle id
18e0cabb 62 FLKSTK.ispark[FLKSTK.npflka][mkbmx2 - 4] = TRACKR.ispusr[mkbmx2 - 1]; // current track number
5834fcef 63 FLKSTK.ispark[FLKSTK.npflka][mkbmx2 - 5] = npprmr; // flag npprmr>0
18e0cabb 64
f827183d 65// Get the pointer to the VMC
fbf08100 66 TFluka* fluka = (TFluka*) gMC;
2bc4c610 67 Int_t verbosityLevel = fluka->GetVerbosityLevel();
5834fcef 68 Bool_t debug = (verbosityLevel>=3)? kTRUE:kFALSE;
15b1e45e 69
fbf08100 70 fluka->SetTrackIsNew(kTRUE);
71// TVirtualMC* fluka = TFluka::GetMC();
f827183d 72// Get the stack produced from the generator
73 TVirtualMCStack* cppstack = fluka->GetStack();
74
75// EVTFLG.ntrcks = track number
76// Increment the track number and put it into the last flag
81ee7392 77// was numsec -1
78// clarify with Alberto
18e0cabb 79
80// npprmr > 0, the secondary being loaded is actually still the interacting
81// particle (it can happen in some biasing situations)
82
15b1e45e 83 if (numsec > npprmr) {
642f15cf 84// Now call the PushTrack(...)
70541a80 85 Int_t done = 0;
81ee7392 86
41737358 87 Int_t parent = TRACKR.ispusr[mkbmx2-1];
5834fcef 88 Int_t kpart = GENSTK.kpart[numsec-1];
4aba9d66 89 if (kpart < -6) return; // -7 to -12 = "heavy" fragment
15b1e45e 90 Int_t pdg = fluka->PDGFromId(kpart);
91
81f1d030 92 Double_t px = GENSTK.plr[numsec-1] * GENSTK.cxr[numsec-1];
93 Double_t py = GENSTK.plr[numsec-1] * GENSTK.cyr[numsec-1];
94 Double_t pz = GENSTK.plr[numsec-1] * GENSTK.czr[numsec-1];
95 Double_t e = GENSTK.tki[numsec-1] + PAPROP.am[GENSTK.kpart[numsec-1]+6];
9c20a817 96
f827183d 97 Double_t vx = xx;
98 Double_t vy = yy;
99 Double_t vz = zz;
18e0cabb 100
81ee7392 101 Double_t tof = TRACKR.atrack;
81f1d030 102 Double_t polx = GENSTK.cxrpol[numsec-1];
103 Double_t poly = GENSTK.cyrpol[numsec-1];
104 Double_t polz = GENSTK.czrpol[numsec-1];
15b1e45e 105
f827183d 106
5834fcef 107
f827183d 108 TMCProcess mech = kPHadronic;
81ee7392 109 if (EVTFLG.ldecay == 1) {
18e0cabb 110 mech = kPDecay;
111 if (debug) cout << endl << "Decay" << endl;
4aba9d66 112 FLKSTK.nlattc[FLKSTK.npflka] = TRACKR.lt1trk;
81ee7392 113 } else if (EVTFLG.ldltry == 1) {
18e0cabb 114 mech = kPDeltaRay;
115 if( fluka->GetIcode() == kKASHEA ) {
116 // For all interactions secondaries are put on GENSTK common (kp=1,np)
117 // but for KASHEA delta ray generation where only the secondary elec-
118 // tron is present and stacked on FLKSTK common for kp=lstack
119 pdg = fluka->PDGFromId( FLKSTK.iloflk[FLKSTK.npflka] );
120 px = FLKSTK.pmoflk[FLKSTK.npflka] * FLKSTK.txflk[FLKSTK.npflka];
121 py = FLKSTK.pmoflk[FLKSTK.npflka] * FLKSTK.tyflk[FLKSTK.npflka];
122 pz = FLKSTK.pmoflk[FLKSTK.npflka] * FLKSTK.tzflk[FLKSTK.npflka];
123 e = FLKSTK.tkeflk[FLKSTK.npflka] + PAPROP.am[FLKSTK.iloflk[FLKSTK.npflka]+6];
124 polx = FLKSTK.txpol[FLKSTK.npflka];
125 poly = FLKSTK.typol[FLKSTK.npflka];
126 polz = FLKSTK.tzpol[FLKSTK.npflka];
127 if (debug) cout << endl << "Delta Ray from KASHEA...." << " pdg from FLKSTK=" << pdg << endl;
15b1e45e 128 } else {
129 if (debug) cout << endl << "Delta Ray" << endl;
130 }
81ee7392 131 } else if (EVTFLG.lpairp == 1) {
18e0cabb 132 mech = kPPair;
133 if (debug) cout << endl << "Pair Production" << endl;
81ee7392 134 } else if (EVTFLG.lbrmsp == 1) {
18e0cabb 135 mech = kPBrem;
136 if (debug) cout << endl << "Bremsstrahlung" << endl;
81ee7392 137 }
81ee7392 138
81f1d030 139 Double_t weight = GENSTK.wei[numsec-1];
f827183d 140 Int_t is = 0;
18e0cabb 141 Int_t ntr;
81ee7392 142 //
143 // Save particle in VMC stack
642f15cf 144 cppstack->PushTrack(done, parent, pdg,
15b1e45e 145 px, py, pz, e,
146 vx, vy, vz, tof,
147 polx, poly, polz,
148 mech, ntr, weight, is);
18e0cabb 149 if (debug)
15b1e45e 150 cout << endl << " !!! stuprf: ntr=" << ntr << " pdg " << pdg << " parent=" << parent
151 << " parent_pdg="<< fluka->PDGFromId(TRACKR.jtrack) << " numsec "
5834fcef 152 << numsec << " npprmr " << npprmr << " icode=" << fluka->GetIcode()
153 << "kin. energy [keV] = " << GENSTK.tki[numsec-1] * 1.e6 << endl << endl;
15b1e45e 154
18e0cabb 155
81ee7392 156//
157// Save current track number
81f1d030 158 FLKSTK.ispark[FLKSTK.npflka][mkbmx2-1] = ntr;
159 FLKSTK.ispark[FLKSTK.npflka][mkbmx2-2] = 0;
18e0cabb 160 } // end of if (numsec > npprmr)
161// else {
162// if(debug) {
163// cout << endl << " !!! stuprf: skipping pushtrack track=" << TRACKR.ispusr[mkbmx2-1]
164// << " pdg " << fluka->PDGFromId(TRACKR.jtrack) << " numsec=" << numsec<< " npprmr=" << npprmr
165// << " GENSTK pdg=" << fluka->PDGFromId(GENSTK.kpart[numsec-1]) << endl;
166// }
167// }
f827183d 168} // end of stuprf
169} // end of extern "C"
170