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
22 #include "TVirtualMCStack.h"
23 #include "TVirtualMCApplication.h"
24 #include "TParticle.h"
28 void stuprf(Int_t& /*ij*/, Int_t& /*mreg*/,
29 Double_t& xx, Double_t& yy, Double_t& zz,
30 Int_t& numsec, Int_t& npprmr)
32 //*----------------------------------------------------------------------*
34 //* SeT User PRoperties for Fluka particles *
36 //*----------------------------------------------------------------------*
38 // FLKSTK.npflka = stack pointer
39 // FLKSTK.louse = user flag
40 // TRACKR.llouse = user defined flag for the current particle
41 FLKSTK.louse[FLKSTK.npflka] = TRACKR.llouse;
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 // FLKSTK.sparek = spare real variables available for k.w.burn
46 // FLKSTK.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
50 for (ispr = 0; ispr <= mkbmx1 - 1; ispr++) {
51 FLKSTK.sparek[FLKSTK.npflka][ispr] = TRACKR.spausr[ispr];
53 for (ispr = 0; ispr <= mkbmx2 - 1; ispr++) {
54 FLKSTK.ispark[FLKSTK.npflka][ispr] = TRACKR.ispusr[ispr];
58 FLKSTK.ispark[FLKSTK.npflka][mkbmx2 - 3] = TRACKR.jtrack; // fluka particle id
59 FLKSTK.ispark[FLKSTK.npflka][mkbmx2 - 4] = TRACKR.ispusr[mkbmx2 - 1]; // current track number
60 FLKSTK.ispark[FLKSTK.npflka][mkbmx2 - 5] = npprmr; // flag special case when npprmr>0
62 // Get the pointer to the VMC
63 TFluka* fluka = (TFluka*) gMC;
64 Int_t verbosityLevel = fluka->GetVerbosityLevel();
65 Bool_t debug = (verbosityLevel>=3)?kTRUE:kFALSE;
66 fluka->SetTrackIsNew(kTRUE);
67 // TVirtualMC* fluka = TFluka::GetMC();
68 // Get the stack produced from the generator
69 TVirtualMCStack* cppstack = fluka->GetStack();
71 // EVTFLG.ntrcks = track number
72 // Increment the track number and put it into the last flag
74 // clarify with Alberto
76 // npprmr > 0, the secondary being loaded is actually still the interacting
77 // particle (it can happen in some biasing situations)
79 if (numsec > npprmr || npprmr > 0) {
80 // Now call the PushTrack(...)
83 Int_t parent = TRACKR.ispusr[mkbmx2-1];
84 Int_t kpart = GENSTK.kpart[numsec-1];
85 if (kpart < -6) return;
87 Int_t pdg = fluka->PDGFromId(kpart);
89 Double_t px = GENSTK.plr[numsec-1] * GENSTK.cxr[numsec-1];
90 Double_t py = GENSTK.plr[numsec-1] * GENSTK.cyr[numsec-1];
91 Double_t pz = GENSTK.plr[numsec-1] * GENSTK.czr[numsec-1];
92 Double_t e = GENSTK.tki[numsec-1] + PAPROP.am[GENSTK.kpart[numsec-1]+6];
98 Double_t tof = TRACKR.atrack;
99 Double_t polx = GENSTK.cxrpol[numsec-1];
100 Double_t poly = GENSTK.cyrpol[numsec-1];
101 Double_t polz = GENSTK.czrpol[numsec-1];
104 TMCProcess mech = kPHadronic;
106 if (EVTFLG.ldecay == 1) {
108 if (debug) cout << endl << "Decay" << endl;
109 } else if (EVTFLG.ldltry == 1) {
111 if( fluka->GetIcode() == kKASHEA ) {
112 // For all interactions secondaries are put on GENSTK common (kp=1,np)
113 // but for KASHEA delta ray generation where only the secondary elec-
114 // tron is present and stacked on FLKSTK common for kp=lstack
115 pdg = fluka->PDGFromId( FLKSTK.iloflk[FLKSTK.npflka] );
116 px = FLKSTK.pmoflk[FLKSTK.npflka] * FLKSTK.txflk[FLKSTK.npflka];
117 py = FLKSTK.pmoflk[FLKSTK.npflka] * FLKSTK.tyflk[FLKSTK.npflka];
118 pz = FLKSTK.pmoflk[FLKSTK.npflka] * FLKSTK.tzflk[FLKSTK.npflka];
119 e = FLKSTK.tkeflk[FLKSTK.npflka] + PAPROP.am[FLKSTK.iloflk[FLKSTK.npflka]+6];
120 polx = FLKSTK.txpol[FLKSTK.npflka];
121 poly = FLKSTK.typol[FLKSTK.npflka];
122 polz = FLKSTK.tzpol[FLKSTK.npflka];
123 if (debug) cout << endl << "Delta Ray from KASHEA...." << " pdg from FLKSTK=" << pdg << endl;
125 if (debug) cout << endl << "Delta Ray" << endl;
126 } else if (EVTFLG.lpairp == 1) {
128 if (debug) cout << endl << "Pair Production" << endl;
129 } else if (EVTFLG.lbrmsp == 1) {
131 if (debug) cout << endl << "Bremsstrahlung" << endl;
134 Double_t weight = GENSTK.wei[numsec-1];
138 // Save particle in VMC stack
139 cppstack->PushTrack(done, parent, pdg,
143 mech, ntr, weight, is);
145 cout << endl << " !!! stuprf: ntr=" << ntr << " pdg " << pdg << " parent=" << parent
146 << " parent_pdg="<< fluka->PDGFromId(TRACKR.jtrack) << " numsec "
147 << numsec << " npprmr " << npprmr << " icode=" << fluka->GetIcode()
151 // Save current track number
152 FLKSTK.ispark[FLKSTK.npflka][mkbmx2-1] = ntr;
153 FLKSTK.ispark[FLKSTK.npflka][mkbmx2-2] = 0;
154 } // end of if (numsec > npprmr)
157 // cout << endl << " !!! stuprf: skipping pushtrack track=" << TRACKR.ispusr[mkbmx2-1]
158 // << " pdg " << fluka->PDGFromId(TRACKR.jtrack) << " numsec=" << numsec<< " npprmr=" << npprmr
159 // << " GENSTK pdg=" << fluka->PDGFromId(GENSTK.kpart[numsec-1]) << endl;
163 } // end of extern "C"