3 # define stuprf stuprf_
9 #include "Fdimpar.h" //(DIMPAR) fluka include
11 #include "Fdblprc.h" //(DBLPRC) fluka common
12 #include "Fevtflg.h" //(EVTFLG) fluka common
13 #include "Fpaprop.h" //(PAPROP) fluka common
14 #include "Fflkstk.h" //(FLKSTK) fluka common
15 #include "Ftrackr.h" //(TRACKR) fluka common
16 #include "Fgenstk.h" //(GENSTK) fluka common
17 #include "Ffheavy.h" //(FHEAVY) fluka common
23 #include "TVirtualMCStack.h"
24 #include "TVirtualMCApplication.h"
25 #include "TParticle.h"
29 void stuprf(Int_t& /*ij*/, Int_t& /*mreg*/,
30 Double_t& xx, Double_t& yy, Double_t& zz,
31 Int_t& numsec, Int_t& npprmr)
33 //*----------------------------------------------------------------------*
35 //* SeT User PRoperties for Fluka particles *
37 //*----------------------------------------------------------------------*
38 // Get the pointer to the VMC
39 TFluka* fluka = (TFluka*) gMC;
41 // FLKSTK.npflka = stack pointer
42 // FLKSTK.louse = user flag
43 // TRACKR.llouse = user defined flag for the current particle
45 FLKSTK.louse[FLKSTK.npflka] = TRACKR.llouse;
47 // mkbmx1 = dimension for kwb real spare array in fluka stack in DIMPAR
48 // mkbmx2 = dimension for kwb int. spare array in fluka stack in DIMPAR
49 // FLKSTK.sparek = spare real variables available for k.w.burn
50 // FLKSTK.ispark = spare integer variables available for k.w.burn
51 // TRACKR.spausr = user defined spare variables for the current particle
52 // TRACKR.ispusr = user defined spare flags for the current particle
54 if (numsec <= npprmr) {
55 for (ispr = 0; ispr <= mkbmx1 - 1; ispr++) {
56 FLKSTK.sparek[FLKSTK.npflka][ispr] = TRACKR.spausr[ispr];
58 for (ispr = 0; ispr <= mkbmx2 - 1; ispr++) {
59 FLKSTK.ispark[FLKSTK.npflka][ispr] = TRACKR.ispusr[ispr];
64 FLKSTK.ispark[FLKSTK.npflka][mkbmx2 - 3] = TRACKR.jtrack; // fluka particle id
65 FLKSTK.ispark[FLKSTK.npflka][mkbmx2 - 4] = TRACKR.ispusr[mkbmx2 - 1]; // current track number
66 FLKSTK.ispark[FLKSTK.npflka][mkbmx2 - 5] = npprmr; // flag npprmr>0
69 Int_t verbosityLevel = fluka->GetVerbosityLevel();
70 Bool_t debug = (verbosityLevel>=3)? kTRUE:kFALSE;
72 fluka->SetTrackIsNew(kTRUE);
73 // TVirtualMC* fluka = TFluka::GetMC();
74 // Get the stack produced from the generator
75 TVirtualMCStack* cppstack = fluka->GetStack();
77 // EVTFLG.ntrcks = track number
78 // Increment the track number and put it into the last flag
80 // clarify with Alberto
82 // npprmr > 0, the secondary being loaded is actually still the interacting
83 // particle (it can happen in some biasing situations)
85 if (numsec > npprmr) {
86 // Now call the PushTrack(...)
89 Int_t parent = TRACKR.ispusr[mkbmx2-1];
90 Int_t kpart = GENSTK.kpart[numsec-1];
97 a = kpart - z * 100000;
99 pdg = fluka->GetIonPdg(z, a);
102 pdg = fluka->PDGFromId(kpart);
105 Double_t px = GENSTK.plr[numsec-1] * GENSTK.cxr[numsec-1];
106 Double_t py = GENSTK.plr[numsec-1] * GENSTK.cyr[numsec-1];
107 Double_t pz = GENSTK.plr[numsec-1] * GENSTK.czr[numsec-1];
110 if (kpart < 100000) {
111 e = GENSTK.tki[numsec-1] + PAPROP.am[GENSTK.kpart[numsec-1]+6];
113 e = GENSTK.tki[numsec-1] + Double_t(a) * 0.93149 + 8.071e-3;
121 Double_t tof = TRACKR.atrack;
122 Double_t polx = GENSTK.cxrpol[numsec-1];
123 Double_t poly = GENSTK.cyrpol[numsec-1];
124 Double_t polz = GENSTK.czrpol[numsec-1];
126 TMCProcess mech = kPHadronic;
127 if (EVTFLG.ldecay == 1) {
129 if (debug) cout << endl << "Decay" << endl;
130 FLKSTK.nlattc[FLKSTK.npflka] = TRACKR.lt1trk;
131 } else if (EVTFLG.ldltry == 1) {
133 if( fluka->GetIcode() == kKASHEA ) {
134 // For all interactions secondaries are put on GENSTK common (kp=1,np)
135 // but for KASHEA delta ray generation where only the secondary elec-
136 // tron is present and stacked on FLKSTK common for kp=lstack
137 pdg = fluka->PDGFromId( FLKSTK.iloflk[FLKSTK.npflka] );
138 px = FLKSTK.pmoflk[FLKSTK.npflka] * FLKSTK.txflk[FLKSTK.npflka];
139 py = FLKSTK.pmoflk[FLKSTK.npflka] * FLKSTK.tyflk[FLKSTK.npflka];
140 pz = FLKSTK.pmoflk[FLKSTK.npflka] * FLKSTK.tzflk[FLKSTK.npflka];
141 e = FLKSTK.tkeflk[FLKSTK.npflka] + PAPROP.am[FLKSTK.iloflk[FLKSTK.npflka]+6];
142 polx = FLKSTK.txpol[FLKSTK.npflka];
143 poly = FLKSTK.typol[FLKSTK.npflka];
144 polz = FLKSTK.tzpol[FLKSTK.npflka];
145 if (debug) cout << endl << "Delta Ray from KASHEA...." << " pdg from FLKSTK=" << pdg << endl;
147 if (debug) cout << endl << "Delta Ray" << endl;
149 } else if (EVTFLG.lpairp == 1) {
151 if (debug) cout << endl << "Pair Production" << endl;
152 } else if (EVTFLG.lbrmsp == 1) {
154 if (debug) cout << endl << "Bremsstrahlung" << endl;
157 Double_t weight = GENSTK.wei[numsec-1];
161 // Save particle in VMC stack
162 cppstack->PushTrack(done, parent, pdg,
166 mech, ntr, weight, is);
169 cout << endl << " !!! stuprf: ntr=" << ntr << " pdg " << pdg << " parent=" << parent
170 << " parent_pdg="<< fluka->PDGFromId(TRACKR.jtrack) << " numsec "
171 << numsec << " npprmr " << npprmr << " icode=" << fluka->GetIcode()
172 << "kin. energy [keV] = " << GENSTK.tki[numsec-1] * 1.e6 << endl << endl;
178 // Save current track number
179 FLKSTK.ispark[FLKSTK.npflka][mkbmx2-1] = ntr;
180 FLKSTK.ispark[FLKSTK.npflka][mkbmx2-2] = 0;
181 } // end of if (numsec > npprmr)
184 // cout << endl << " !!! stuprf: skipping pushtrack track=" << TRACKR.ispusr[mkbmx2-1]
185 // << " pdg " << fluka->PDGFromId(TRACKR.jtrack) << " numsec=" << numsec<< " npprmr=" << npprmr
186 // << " GENSTK pdg=" << fluka->PDGFromId(GENSTK.kpart[numsec-1]) << endl;
190 } // end of extern "C"