]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TFluka/stuprf.cxx
Current track number correctly stored in stack.
[u/mrichter/AliRoot.git] / TFluka / stuprf.cxx
CommitLineData
f827183d 1#include <Riostream.h>
2#include "AliRun.h"
3#include "TFluka.h"
4#ifndef WIN32
5# define stuprf stuprf_
6#else
7# define stuprf STUPRF
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 "Fevtflg.h" //(EVTFLG) fluka common
15#include "Fpaprop.h" //(PAPROP) fluka common
16#include "Fstack.h" //(STACK) fluka common
17#include "Ftrackr.h" //(TRACKR) fluka common
18#include "Ffinuc.h" //(FINUC) fluka common
19
20//Virtual MC
21#include "TFluka.h"
22#include "TVirtualMCStack.h"
23#include "TVirtualMCApplication.h"
24#include "TParticle.h"
25#include "TVector3.h"
26
27extern "C" {
28void stuprf(Int_t& ij, Int_t& mreg,
29 Double_t& xx, Double_t& yy, Double_t& zz,
30 Int_t& numsec, Int_t& npprmr)
31{
32//*----------------------------------------------------------------------*
33//* *
34//* SeT User PRoperties for Fluka particles *
35//* *
36//*----------------------------------------------------------------------*
37
38// STACK.lstack = stack pointer
39// STACK.louse = user flag
40// TRACKR.llouse = user defined flag for the current particle
41 STACK.louse[STACK.lstack] = TRACKR.llouse;
42
43// mkbmx1 = dimension for kwb real spare array in fluka stack in DIMPAR
44// mkbmx2 = dimension for kwb int. spare array in fluka stack in DIMPAR
45// STACK.sparek = spare real variables available for k.w.burn
46// STACK.ispark = spare integer variables available for k.w.burn
47// TRACKR.spausr = user defined spare variables for the current particle
48// TRACKR.ispusr = user defined spare flags for the current particle
49 Int_t ispr;
50 for (ispr=0; ispr<=mkbmx1-1; ispr++) {
51 STACK.sparek[STACK.lstack][ispr] = TRACKR.spausr[ispr];
52 }
53 for (ispr=0; ispr<=mkbmx2-1; ispr++) {
54 STACK.ispark[STACK.lstack][ispr] = TRACKR.ispusr[ispr];
55 }
56
57// Get the pointer to the VMC
58 TVirtualMC* fluka = TFluka::GetMC();
59// Get the stack produced from the generator
60 TVirtualMCStack* cppstack = fluka->GetStack();
61
62// EVTFLG.ntrcks = track number
63// Increment the track number and put it into the last flag
64 if (numsec-1 > npprmr) {
65// Now call the SetTrack(...)
66 Int_t done = 0;
67 Int_t parent = TRACKR.ispusr[mkbmx2-1];
68 Int_t pdg = fluka->PDGFromId(ij);
69
70 Double_t px = FINUC.plr[numsec-1]*FINUC.cxr[numsec-1];
71 Double_t pz = FINUC.plr[numsec-1]*FINUC.cyr[numsec-1];
72 Double_t py = FINUC.plr[numsec-1]*FINUC.czr[numsec-1];
73 Double_t e = FINUC.tki[numsec-1] + PAPROP.am[FINUC.kpart[numsec-1]+6];
74 Double_t vx = xx;
75 Double_t vy = yy;
76 Double_t vz = zz;
77 Double_t tof = TRACKR.atrack;
78 Double_t polx = FINUC.cxrpol[numsec-1];
79 Double_t poly = FINUC.cyrpol[numsec-1];
80 Double_t polz = FINUC.czrpol[numsec-1];
81
82 TMCProcess mech = kPHadronic;
83 if (EVTFLG.ldecay == 1) mech = kPDecay;
84 else if (EVTFLG.ldltry == 1) mech = kPDeltaRay;
85 else if (EVTFLG.lpairp == 1) mech = kPPair;
86 else if (EVTFLG.lbrmsp == 1) mech = kPBrem;
87 Double_t weight = FINUC.wei[numsec-1];
88 Int_t is = 0;
89 Int_t ntr;
90
91//virtual void SetTrack(Int_t done, Int_t parent, Int_t pdg,
92//Double_t px, Double_t py, Double_t pz, Double_t e,
93//Double_t vx, Double_t vy, Double_t vz, Double_t tof,
94//Double_t polx, Double_t poly, Double_t polz,
95//TMCProcess mech, Int_t& ntr, Double_t weight,
96//Int_t is) = 0;
97
98
99 cppstack->SetTrack(done, parent, pdg,
100 px, py, pz, e,
101 vx, vy, vz, tof,
102 polx, poly, polz,
103 mech, ntr, weight, is);
104
105cout << endl << " !!! stuprf: ntr=" << ntr << endl;
106 EVTFLG.ntrcks = ntr;
107 STACK.ispark[STACK.lstack][mkbmx2-1] = EVTFLG.ntrcks;
108 } // end of if (numsec-1 > npprmr)
109
110} // end of stuprf
111} // end of extern "C"
112