]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - TFluka/stuprf.cxx
Modifications for Mac
[u/mrichter/AliRoot.git] / TFluka / stuprf.cxx
... / ...
CommitLineData
1#include <Riostream.h>
2#include "AliRun.h"
3#include "AliStack.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#ifndef WITH_ROOT
22#include "TFluka.h"
23#else
24#include "TFlukaGeo.h"
25#endif
26
27#include "TVirtualMCStack.h"
28#include "TVirtualMCApplication.h"
29#include "TParticle.h"
30#include "TVector3.h"
31
32extern "C" {
33 void stuprf(Int_t& /*ij*/, Int_t& /*mreg*/,
34 Double_t& xx, Double_t& yy, Double_t& zz,
35 Int_t& numsec, Int_t& npprmr)
36{
37//*----------------------------------------------------------------------*
38//* *
39//* SeT User PRoperties for Fluka particles *
40//* *
41//*----------------------------------------------------------------------*
42
43// STACK.lstack = stack pointer
44// STACK.louse = user flag
45// TRACKR.llouse = user defined flag for the current particle
46 STACK.louse[STACK.lstack] = TRACKR.llouse;
47
48// mkbmx1 = dimension for kwb real spare array in fluka stack in DIMPAR
49// mkbmx2 = dimension for kwb int. spare array in fluka stack in DIMPAR
50// STACK.sparek = spare real variables available for k.w.burn
51// STACK.ispark = spare integer variables available for k.w.burn
52// TRACKR.spausr = user defined spare variables for the current particle
53// TRACKR.ispusr = user defined spare flags for the current particle
54 Int_t ispr;
55 for (ispr = 0; ispr <= mkbmx1 - 1; ispr++) {
56 STACK.sparek[STACK.lstack][ispr] = TRACKR.spausr[ispr];
57 }
58 for (ispr = 0; ispr <= mkbmx2 - 1; ispr++) {
59 STACK.ispark[STACK.lstack][ispr] = TRACKR.ispusr[ispr];
60 }
61
62// Get the pointer to the VMC
63 TFluka* fluka = (TFluka*) gMC;
64 fluka->SetTrackIsNew(kTRUE);
65// TVirtualMC* fluka = TFluka::GetMC();
66// Get the stack produced from the generator
67 TVirtualMCStack* cppstack = fluka->GetStack();
68
69// EVTFLG.ntrcks = track number
70// Increment the track number and put it into the last flag
71// was numsec -1
72// clarify with Alberto
73 if (numsec > npprmr) {
74// Now call the PushTrack(...)
75 Int_t done = 0;
76
77 Int_t parent = TRACKR.ispusr[mkbmx2-1];
78
79 Int_t pdg = fluka->PDGFromId(FINUC.kpart[numsec-1]);
80 Double_t px = FINUC.plr[numsec-1] * FINUC.cxr[numsec-1];
81 Double_t pz = FINUC.plr[numsec-1] * FINUC.cyr[numsec-1];
82 Double_t py = FINUC.plr[numsec-1] * FINUC.czr[numsec-1];
83 Double_t e = FINUC.tki[numsec-1] + PAPROP.am[FINUC.kpart[numsec-1]+6];
84 Double_t vx = xx;
85 Double_t vy = yy;
86 Double_t vz = zz;
87
88 Double_t tof = TRACKR.atrack;
89 Double_t polx = FINUC.cxrpol[numsec-1];
90 Double_t poly = FINUC.cyrpol[numsec-1];
91 Double_t polz = FINUC.czrpol[numsec-1];
92
93
94 TMCProcess mech = kPHadronic;
95
96 if (EVTFLG.ldecay == 1) {
97 mech = kPDecay;
98 cout << endl << "Decay" << endl;
99
100 } else if (EVTFLG.ldltry == 1) {
101 mech = kPDeltaRay;
102 cout << endl << "Delta Ray" << endl;
103
104 } else if (EVTFLG.lpairp == 1) {
105 mech = kPPair;
106 cout << endl << "Pair Production" << endl;
107
108 } else if (EVTFLG.lbrmsp == 1) {
109 mech = kPBrem;
110 cout << endl << "Bremsstrahlung" << endl;
111
112 }
113
114
115 Double_t weight = FINUC.wei[numsec-1];
116 Int_t is = 0;
117 Int_t ntr;
118 //
119 // Save particle in VMC stack
120 cppstack->PushTrack(done, parent, pdg,
121 px, py, pz, e,
122 vx, vy, vz, tof,
123 polx, poly, polz,
124 mech, ntr, weight, is);
125 cout << endl << " !!! stuprf: ntr=" << ntr << "pdg " << pdg << " parent=" << parent << "numsec "
126 << numsec << "npprmr " << npprmr << endl;
127//
128// Save current track number
129 STACK.ispark[STACK.lstack][mkbmx2-1] = ntr;
130 } // end of if (numsec-1 > npprmr)
131} // end of stuprf
132} // end of extern "C"
133