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 gener->SetBoostLHC(0);
102 // tell hijing to keep the full parent child chain
103 gener->KeepFullEvent();
104 // enable jet quenching
105 gener->SetJetQuenching(0);
107 gener->SetShadowing(0);
108 // neutral pion and heavy particle decays switched off
109 gener->SetDecaysOff(1);
110 // Don't track spectators
111 gener->SetSpectators(0);
112 // The particle stack
113 stack = new AliStack(1000);
114 gener->SetStack(stack);
122 Int_t npart = stack->GetNprimary();
124 Float_t za = 4000. * gRandom->Rndm() -2000.;
126 // Float_t dir = (za < 0.) ? 1. : -1.;
127 Float_t dir = (gRandom->Rndm() < 0.5)? 1. : -1;
129 for (Int_t part=0; part<npart; part++) {
130 particle = stack->Particle(part);
131 Int_t ic = particle->GetFirstDaughter();
132 if (ic != -1) continue;
133 Int_t pdg = particle->GetPdgCode();
134 Int_t intfluka = mcihad(pdg);
135 Int_t ifl = GetFlukaKPTOIP(intfluka);
136 TVector3 polarisation;
137 particle->GetPolarisation(polarisation);
141 printf("Particle %5d %5d %5d %10s %10.3f %10.3f %10.3f \n", STACK.lstack, pdg, ifl,
142 particle->GetName(), particle->Px(), particle->Py(), particle->Pz());
146 /* Wt is the weight of the particle*/
147 STACK.wt[STACK.lstack] = oneone;
148 STARS.weipri += STACK.wt[STACK.lstack];
150 STACK.ilo[STACK.lstack] = ifl;
151 /* From this point .....
152 * Particle generation (1 for primaries)
154 STACK.lo[STACK.lstack] = 1;
156 /* User dependent flag:*/
157 STACK.louse[STACK.lstack] = 0;
159 /* User dependent spare variables:*/
161 for (ispr = 0; ispr < mkbmx1; ispr++)
162 STACK.sparek[STACK.lstack][ispr] = zerzer;
164 /* User dependent spare flags:*/
165 for (ispr = 0; ispr < mkbmx2; ispr++)
166 STACK.ispark[STACK.lstack][ispr] = 0;
168 /* Save the track number of the stack particle:*/
169 STACK.ispark[STACK.lstack][mkbmx2-1] = itrack;
171 STACK.numpar[STACK.lstack] = STACK.nparma;
172 STACK.nevent[STACK.lstack] = 0;
173 STACK.dfnear[STACK.lstack] = +zerzer;
175 /* Particle age (s)*/
176 STACK.agestk[STACK.lstack] = +zerzer;
177 STACK.aknshr[STACK.lstack] = -twotwo;
179 /* Group number for "low" energy neutrons, set to 0 anyway*/
180 STACK.igroup[STACK.lstack] = 0;
183 STACK.tke[STACK.lstack] = particle->Energy() - particle->GetMass();
186 /* Particle momentum*/
187 STACK.pmom [STACK.lstack] = particle->P();
189 /* Cosines (tx,ty,tz)*/
190 Double_t cosx = particle->Px()/particle->P();
191 Double_t cosy = particle->Py()/particle->P();
192 Double_t cosz = TMath::Sqrt(oneone - cosx*cosx - cosy*cosy);
193 if (particle->Pz() < 0.) cosz = -cosz;
196 STACK.tx [STACK.lstack] = cosx;
197 STACK.ty [STACK.lstack] = cosy;
198 STACK.tz [STACK.lstack] = cosz;
200 /* Polarization cosines:*/
201 if (polarisation.Mag()) {
202 Double_t cospolx = polarisation.Px()/polarisation.Mag();
203 Double_t cospoly = polarisation.Py()/polarisation.Mag();
204 Double_t cospolz = sqrt(oneone - cospolx*cospolx - cospoly*cospoly);
205 STACK.tx [STACK.lstack] = cospolx;
206 STACK.ty [STACK.lstack] = cospoly;
207 STACK.tz [STACK.lstack] = cospolz;
210 STACK.txpol [STACK.lstack] = -twotwo;
211 STACK.typol [STACK.lstack] = +zerzer;
212 STACK.tzpol [STACK.lstack] = +zerzer;
215 /* Particle coordinates*/
216 STACK.xa [STACK.lstack] = particle->Vx();
217 STACK.ya [STACK.lstack] = particle->Vy();
218 STACK.za [STACK.lstack] = za;
220 printf("Particle Vertex %10.3f %10.3f %10.3f %10.3f \n",
221 STACK.xa [STACK.lstack], STACK.ya [STACK.lstack], STACK.za [STACK.lstack], dir);
225 /* Calculate the total kinetic energy of the primaries: don't change*/
226 Int_t st_ilo = STACK.ilo[STACK.lstack];
229 ((STACK.tke[STACK.lstack] + PAPROP.amdisc[st_ilo+6])
230 * STACK.wt[STACK.lstack]);
232 EPISOR.tkesum += (STACK.tke[STACK.lstack] * STACK.wt[STACK.lstack]);
234 /* Here we ask for the region number of the hitting point.
235 * NREG (LSTACK) = ...
236 * The following line makes the starting region search much more
237 * robust if particles are starting very close to a boundary:
239 geocrs( STACK.tx[STACK.lstack],
240 STACK.ty[STACK.lstack],
241 STACK.tz[STACK.lstack] );
245 georeg ( STACK.xa[STACK.lstack],
246 STACK.ya[STACK.lstack],
247 STACK.za[STACK.lstack],
248 STACK.nreg[STACK.lstack],
249 idisc);//<-- dummy return variable not used
250 /* Do not change these cards:*/
252 Int_t igeohsm2 = -11;
253 geohsm ( STACK.nhspnt[STACK.lstack], igeohsm1, igeohsm2, LTCLCM.mlattc );
254 STACK.nlattc[STACK.lstack] = LTCLCM.mlattc;