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 "../THijing/AliGenHijing.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_bg source_bg__
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_bg SOURCE_BG
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_bg(Int_t& nomore) {
78 static Bool_t lfirst = true;
79 static AliGenHijing* gener = 0;
80 static AliStack* stack = 0;
86 EPISOR.tkesum = zerzer;
92 gener = new AliGenHijing(-1);
94 gener->SetEnergyCMS(7000.);
96 gener->SetReferenceFrame("LAB");
98 gener->SetProjectile("P", 1, 1);
99 gener->SetTarget ("A", 16, 8);
100 // tell hijing to keep the full parent child chain
101 gener->KeepFullEvent();
102 // enable jet quenching
103 gener->SetJetQuenching(0);
105 gener->SetShadowing(0);
106 // neutral pion and heavy particle decays switched off
107 gener->SetDecaysOff(1);
108 // Don't track spectators
109 gener->SetSpectators(0);
110 // The particle stack
111 stack = new AliStack(1000);
112 gener->SetStack(stack);
120 Int_t npart = stack->GetNprimary();
122 Float_t za = 4000. * gRandom->Rndm() - 2000.;
124 Float_t dir = (gRandom->Rndm() < 0.5) ? 1. : -1.;
127 for (Int_t part=0; part<npart; part++) {
128 particle = stack->Particle(part);
129 Int_t ic = particle->GetFirstDaughter();
130 if (ic != -1) continue;
131 Int_t pdg = particle->GetPdgCode();
132 Int_t intfluka = mcihad(pdg);
133 Int_t ifl = GetFlukaKPTOIP(intfluka);
134 TVector3 polarisation;
135 particle->GetPolarisation(polarisation);
139 printf("Particle %5d %5d %5d %10s %10.3f %10.3f %10.3f \n", STACK.lstack, pdg, ifl,
140 particle->GetName(), particle->Px(), particle->Py(), particle->Pz());
144 /* Wt is the weight of the particle*/
145 STACK.wt[STACK.lstack] = oneone;
146 STARS.weipri += STACK.wt[STACK.lstack];
148 STACK.ilo[STACK.lstack] = ifl;
149 /* From this point .....
150 * Particle generation (1 for primaries)
152 STACK.lo[STACK.lstack] = 1;
154 /* User dependent flag:*/
155 STACK.louse[STACK.lstack] = 0;
157 /* User dependent spare variables:*/
159 for (ispr = 0; ispr < mkbmx1; ispr++)
160 STACK.sparek[STACK.lstack][ispr] = zerzer;
162 /* User dependent spare flags:*/
163 for (ispr = 0; ispr < mkbmx2; ispr++)
164 STACK.ispark[STACK.lstack][ispr] = 0;
166 /* Save the track number of the stack particle:*/
167 STACK.ispark[STACK.lstack][mkbmx2-1] = itrack;
169 STACK.numpar[STACK.lstack] = STACK.nparma;
170 STACK.nevent[STACK.lstack] = 0;
171 STACK.dfnear[STACK.lstack] = +zerzer;
173 /* Particle age (s)*/
174 STACK.agestk[STACK.lstack] = +zerzer;
175 STACK.aknshr[STACK.lstack] = -twotwo;
177 /* Group number for "low" energy neutrons, set to 0 anyway*/
178 STACK.igroup[STACK.lstack] = 0;
181 STACK.tke[STACK.lstack] = particle->Energy() - particle->GetMass();
184 /* Particle momentum*/
185 STACK.pmom [STACK.lstack] = particle->P();
187 /* Cosines (tx,ty,tz)*/
188 Double_t cosx = particle->Px()/particle->P();
189 Double_t cosy = particle->Py()/particle->P();
190 Double_t cosz = TMath::Sqrt(oneone - cosx*cosx - cosy*cosy);
191 if (particle->Pz() < 0.) cosz = -cosz;
194 STACK.tx [STACK.lstack] = cosx;
195 STACK.ty [STACK.lstack] = cosy;
196 STACK.tz [STACK.lstack] = cosz;
198 /* Polarization cosines:*/
199 if (polarisation.Mag()) {
200 Double_t cospolx = polarisation.Px()/polarisation.Mag();
201 Double_t cospoly = polarisation.Py()/polarisation.Mag();
202 Double_t cospolz = sqrt(oneone - cospolx*cospolx - cospoly*cospoly);
203 STACK.tx [STACK.lstack] = cospolx;
204 STACK.ty [STACK.lstack] = cospoly;
205 STACK.tz [STACK.lstack] = cospolz;
208 STACK.txpol [STACK.lstack] = -twotwo;
209 STACK.typol [STACK.lstack] = +zerzer;
210 STACK.tzpol [STACK.lstack] = +zerzer;
213 /* Particle coordinates*/
214 STACK.xa [STACK.lstack] = particle->Vx();
215 STACK.ya [STACK.lstack] = particle->Vy();
216 STACK.za [STACK.lstack] = za;
218 printf("Particle Vertex %10.3f %10.3f %10.3f %10.3f \n",
219 STACK.xa [STACK.lstack], STACK.ya [STACK.lstack], STACK.za [STACK.lstack], dir);
223 /* Calculate the total kinetic energy of the primaries: don't change*/
224 Int_t st_ilo = STACK.ilo[STACK.lstack];
227 ((STACK.tke[STACK.lstack] + PAPROP.amdisc[st_ilo+6])
228 * STACK.wt[STACK.lstack]);
230 EPISOR.tkesum += (STACK.tke[STACK.lstack] * STACK.wt[STACK.lstack]);
232 /* Here we ask for the region number of the hitting point.
233 * NREG (LSTACK) = ...
234 * The following line makes the starting region search much more
235 * robust if particles are starting very close to a boundary:
237 geocrs( STACK.tx[STACK.lstack],
238 STACK.ty[STACK.lstack],
239 STACK.tz[STACK.lstack] );
243 georeg ( STACK.xa[STACK.lstack],
244 STACK.ya[STACK.lstack],
245 STACK.za[STACK.lstack],
246 STACK.nreg[STACK.lstack],
247 idisc);//<-- dummy return variable not used
248 /* Do not change these cards:*/
250 Int_t igeohsm2 = -11;
251 geohsm ( STACK.nhspnt[STACK.lstack], igeohsm1, igeohsm2, LTCLCM.mlattc );
252 STACK.nlattc[STACK.lstack] = LTCLCM.mlattc;