5 #include "Fdblprc.h" //(DBLPRC) fluka common
6 #include "Fdimpar.h" //(DIMPAR) fluka parameters
7 #include "Fepisor.h" //(EPISOR) fluka common
8 #include "Fstack.h" //(STACK) fluka common
9 #include "Fstars.h" //(STARS) fluka common
10 #include "Fbeam.h" //(BEAM) fluka common
11 #include "Fpaprop.h" //(PAPROP) fluka common
12 #include "Fltclcm.h" //(LTCLCM) fluka common
14 //#include "Fcaslim.h" //(CASLIM) fluka common
18 #include "TParticle.h"
19 #include "../EVGEN/AliGenScan.h"
23 #include <Riostream.h>
26 # define source source_
27 # define geocrs geocrs_
28 # define georeg georeg_
29 # define geohsm geohsm_
30 # define soevsv soevsv_
31 # define mcihad mcihad_
32 # define source_ray source_ray__
34 # define source SOURCE
35 # define geocrs GEOCRS
36 # define georeg GEOREG
37 # define geohsm GEOHSM
38 # define soevsv SOEVSV
39 # define mcihad MCIHAD
40 # define source_ray SOURCE_RAY
45 // Prototypes for FLUKA functions
47 void type_of_call geocrs(Double_t &, Double_t &, Double_t &);
48 void type_of_call georeg(Double_t &, Double_t &, Double_t &,
50 void type_of_call geohsm(Int_t &, Int_t &, Int_t &, Int_t &);
51 void type_of_call soevsv();
52 int type_of_call mcihad(const int&);
54 *----------------------------------------------------------------------*
56 * Created on 07 january 1990 by Alfredo Ferrari & Paola Sala *
59 * Last change on 21-jun-98 by Alfredo Ferrari *
61 * C++ version on 27-sep-02 by Isidro Gonzalez *
63 * This is just an example of a possible user written source routine. *
64 * note that the beam card still has some meaning - in the scoring the *
65 * maximum momentum used in deciding the binning is taken from the *
66 * beam momentum. Other beam card parameters are obsolete. *
68 *----------------------------------------------------------------------*/
70 void source_ray(Int_t& nomore) {
72 static Bool_t lfirst = true;
73 static AliGenScan* gener = 0;
74 static AliStack* stack = 0;
77 TParticle* particle = 0;
80 EPISOR.tkesum = zerzer;
86 gener = new AliGenScan(0);
87 gener->SetRange(40, -200., 200., 40, -200., 200., 1, -700., -699.);
89 gener->SetThetaRange(180., 180.);
90 gener->SetPhiRange(0.,0.);
94 stack = new AliStack(10000);
95 gener->SetStack(stack);
103 Int_t npart = stack->GetNprimary();
104 for (Int_t part = 0; part < npart; part++) {
106 particle = stack->Particle(part);
108 printf("Particle %5d %10s %10.3f %10.3f %10.3f \n",
109 STACK.lstack, particle->GetName(),
110 particle->Px(), particle->Py(), particle->Pz());
114 /* Wt is the weight of the particle*/
115 STACK.wt[STACK.lstack] = oneone;
116 STARS.weipri += STACK.wt[STACK.lstack];
119 STACK.ilo[STACK.lstack] = 0;
120 /* From this point .....
121 * Particle generation (1 for primaries)
123 STACK.lo[STACK.lstack] = 1;
125 /* User dependent flag:*/
126 STACK.louse[STACK.lstack] = 0;
128 /* User dependent spare variables:*/
130 for (ispr = 0; ispr < mkbmx1; ispr++)
131 STACK.sparek[STACK.lstack][ispr] = zerzer;
133 /* User dependent spare flags:*/
134 for (ispr = 0; ispr < mkbmx2; ispr++)
135 STACK.ispark[STACK.lstack][ispr] = 0;
137 /* Save the track number of the stack particle:*/
138 STACK.ispark[STACK.lstack][mkbmx2-1] = itrack;
140 STACK.numpar[STACK.lstack] = STACK.nparma;
141 STACK.nevent[STACK.lstack] = 0;
142 STACK.dfnear[STACK.lstack] = +zerzer;
144 /* Particle age (s)*/
145 STACK.agestk[STACK.lstack] = +zerzer;
146 STACK.aknshr[STACK.lstack] = -twotwo;
148 /* Group number for "low" energy neutrons, set to 0 anyway*/
149 STACK.igroup[STACK.lstack] = 0;
152 STACK.tke[STACK.lstack] = particle->Energy() - particle->GetMass();
155 /* Particle momentum*/
156 STACK.pmom [STACK.lstack] = particle->P();
158 /* Cosines (tx,ty,tz)*/
159 Double_t cosx = particle->Px()/particle->P();
160 Double_t cosy = particle->Py()/particle->P();
161 Double_t cosz = TMath::Sqrt(oneone - cosx*cosx - cosy*cosy);
162 if (particle->Pz() < 0.) cosz = -cosz;
164 STACK.tx [STACK.lstack] = cosx;
165 STACK.ty [STACK.lstack] = cosy;
166 STACK.tz [STACK.lstack] = cosz;
168 /* Polarization cosines:*/
169 STACK.txpol [STACK.lstack] = -twotwo;
170 STACK.typol [STACK.lstack] = +zerzer;
171 STACK.tzpol [STACK.lstack] = +zerzer;
173 /* Particle coordinates*/
174 STACK.xa [STACK.lstack] = particle->Vx();
175 STACK.ya [STACK.lstack] = particle->Vy();
176 STACK.za [STACK.lstack] = particle->Vz();
178 printf("Particle Vertex %10.3f %10.3f %10.3f \n",
179 STACK.xa [STACK.lstack], STACK.ya [STACK.lstack], STACK.za [STACK.lstack]);
183 /* Calculate the total kinetic energy of the primaries: don't change*/
184 Int_t st_ilo = STACK.ilo[STACK.lstack];
187 ((STACK.tke[STACK.lstack] + PAPROP.amdisc[st_ilo+6])
188 * STACK.wt[STACK.lstack]);
190 EPISOR.tkesum += (STACK.tke[STACK.lstack] * STACK.wt[STACK.lstack]);
192 /* Here we ask for the region number of the hitting point.
193 * NREG (LSTACK) = ...
194 * The following line makes the starting region search much more
195 * robust if particles are starting very close to a boundary:
197 geocrs( STACK.tx[STACK.lstack],
198 STACK.ty[STACK.lstack],
199 STACK.tz[STACK.lstack] );
203 georeg ( STACK.xa[STACK.lstack],
204 STACK.ya[STACK.lstack],
205 STACK.za[STACK.lstack],
206 STACK.nreg[STACK.lstack],
207 idisc);//<-- dummy return variable not used
208 /* Do not change these cards:*/
210 Int_t igeohsm2 = -11;
211 geohsm ( STACK.nhspnt[STACK.lstack], igeohsm1, igeohsm2, LTCLCM.mlattc );
212 STACK.nlattc[STACK.lstack] = LTCLCM.mlattc;