7 #include "Fdblprc.h" //(DBLPRC) fluka common
8 #include "Fdimpar.h" //(DIMPAR) fluka parameters
9 #include "Fepisor.h" //(EPISOR) fluka common
10 #include "Fstack.h" //(STACK) fluka common
11 #include "Fstars.h" //(STARS) fluka common
12 #include "Fbeam.h" //(BEAM) fluka common
13 #include "Fpaprop.h" //(PAPROP) fluka common
14 #include "Fltclcm.h" //(LTCLCM) fluka common
16 //#include "Fcaslim.h" //(CASLIM) fluka common
19 #include "AliGenerator.h"
21 #include "../EVGEN/AliGenHaloProtvino.h"
23 #include "TVirtualMCStack.h"
24 #include "TParticle.h"
29 #include <Riostream.h>
32 # define source source_
33 # define geocrs geocrs_
34 # define georeg georeg_
35 # define geohsm geohsm_
36 # define soevsv soevsv_
37 # define mcihad mcihad_
38 # define source_halo source_halo__
40 # define source SOURCE
41 # define geocrs GEOCRS
42 # define georeg GEOREG
43 # define geohsm GEOHSM
44 # define soevsv SOEVSV
45 # define mcihad MCIHAD
46 # define source_halo SOURCE_HALO
51 // Prototypes for FLUKA functions
53 void type_of_call geocrs(Double_t &, Double_t &, Double_t &);
54 void type_of_call georeg(Double_t &, Double_t &, Double_t &,
56 void type_of_call geohsm(Int_t &, Int_t &, Int_t &, Int_t &);
57 void type_of_call soevsv();
58 int type_of_call mcihad(const int&);
60 *----------------------------------------------------------------------*
62 * Created on 07 january 1990 by Alfredo Ferrari & Paola Sala *
65 * Last change on 21-jun-98 by Alfredo Ferrari *
67 * C++ version on 27-sep-02 by Isidro Gonzalez *
69 * This is just an example of a possible user written source routine. *
70 * note that the beam card still has some meaning - in the scoring the *
71 * maximum momentum used in deciding the binning is taken from the *
72 * beam momentum. Other beam card parameters are obsolete. *
74 *----------------------------------------------------------------------*/
76 void source_halo(Int_t& nomore) {
78 static Bool_t lfirst = true;
79 static AliGenHaloProtvino* gener = 0;
80 static AliStack* stack = 0;
86 EPISOR.tkesum = zerzer;
92 gener = new AliGenHaloProtvino(10);
93 gener->SetFileName("/home/morsch/AliRoot/newio/data/ir.2.ring.one.b.10.m");
95 gener->SetRunPeriod();
99 stack = new AliStack(1000);
100 gener->SetStack(stack);
108 Int_t npart = stack->GetNprimary();
109 for (Int_t part = 1; part < npart; part += 2) {
110 particle = stack->Particle(part);
112 Int_t pdg = particle->GetPdgCode();
113 Int_t intfluka = mcihad(pdg);
114 Int_t ifl = GetFlukaKPTOIP(intfluka);
115 Float_t wgt = particle->GetWeight();
117 printf("Particle %5d %10s %10.3f %10.3f %10.3f %10.3f\n",
120 particle->Px(), particle->Py(), particle->Pz(), wgt);
124 /* Wt is the weight of the particle*/
125 STACK.wt[STACK.lstack] = wgt;
126 STARS.weipri += STACK.wt[STACK.lstack];
128 STACK.ilo[STACK.lstack] = ifl;
129 /* From this point .....
130 * Particle generation (1 for primaries)
132 STACK.lo[STACK.lstack] = 1;
134 /* User dependent flag:*/
135 STACK.louse[STACK.lstack] = 0;
137 /* User dependent spare variables:*/
139 for (ispr = 0; ispr < mkbmx1; ispr++)
140 STACK.sparek[STACK.lstack][ispr] = zerzer;
142 /* User dependent spare flags:*/
143 for (ispr = 0; ispr < mkbmx2; ispr++)
144 STACK.ispark[STACK.lstack][ispr] = 0;
146 /* Save the track number of the stack particle:*/
147 STACK.ispark[STACK.lstack][mkbmx2-1] = itrack;
149 STACK.numpar[STACK.lstack] = STACK.nparma;
150 STACK.nevent[STACK.lstack] = 0;
151 STACK.dfnear[STACK.lstack] = +zerzer;
153 /* Particle age (s)*/
154 STACK.agestk[STACK.lstack] = +zerzer;
155 STACK.aknshr[STACK.lstack] = -twotwo;
157 /* Group number for "low" energy neutrons, set to 0 anyway*/
158 STACK.igroup[STACK.lstack] = 0;
161 STACK.tke[STACK.lstack] = particle->Energy() - particle->GetMass();
164 /* Particle momentum*/
165 STACK.pmom [STACK.lstack] = particle->P();
167 /* Cosines (tx,ty,tz)*/
168 Double_t cosx = particle->Px()/particle->P();
169 Double_t cosy = particle->Py()/particle->P();
170 Double_t cosz = TMath::Sqrt(oneone - cosx*cosx - cosy*cosy);
171 if (particle->Pz() < 0.) cosz = -cosz;
173 STACK.tx [STACK.lstack] = cosx;
174 STACK.ty [STACK.lstack] = cosy;
175 STACK.tz [STACK.lstack] = cosz;
177 /* Polarization cosines:*/
179 STACK.txpol [STACK.lstack] = -twotwo;
180 STACK.typol [STACK.lstack] = +zerzer;
181 STACK.tzpol [STACK.lstack] = +zerzer;
183 /* Particle coordinates*/
184 STACK.xa [STACK.lstack] = particle->Vx();
185 STACK.ya [STACK.lstack] = particle->Vy();
186 STACK.za [STACK.lstack] = particle->Vz();
190 /* Calculate the total kinetic energy of the primaries: don't change*/
191 Int_t st_ilo = STACK.ilo[STACK.lstack];
194 ((STACK.tke[STACK.lstack] + PAPROP.amdisc[st_ilo+6])
195 * STACK.wt[STACK.lstack]);
197 EPISOR.tkesum += (STACK.tke[STACK.lstack] * STACK.wt[STACK.lstack]);
199 /* Here we ask for the region number of the hitting point.
200 * NREG (LSTACK) = ...
201 * The following line makes the starting region search much more
202 * robust if particles are starting very close to a boundary:
204 geocrs( STACK.tx[STACK.lstack],
205 STACK.ty[STACK.lstack],
206 STACK.tz[STACK.lstack] );
211 georeg ( STACK.xa[STACK.lstack],
212 STACK.ya[STACK.lstack],
213 STACK.za[STACK.lstack],
214 STACK.nreg[STACK.lstack],
215 idisc);//<-- dummy return variable not used
216 printf("Particle Vertex %10.3f %10.3f %10.3f %5d\n",
217 STACK.xa [STACK.lstack], STACK.ya [STACK.lstack], STACK.za [STACK.lstack],
218 STACK.nreg[STACK.lstack]);
221 /* Do not change these cards:*/
223 Int_t igeohsm2 = -11;
224 geohsm ( STACK.nhspnt[STACK.lstack], igeohsm1, igeohsm2, LTCLCM.mlattc );
225 STACK.nlattc[STACK.lstack] = LTCLCM.mlattc;