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_pbpb source_pbpb__
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_pbpb SOURCE_PBPB
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_pbpb(Int_t& nomore) {
78 static Bool_t lfirst = true;
79 static Int_t part = 0;
80 static AliGenHijing* gener = 0;
81 static AliStack* stack = 0;
88 EPISOR.tkesum = zerzer;
94 gener = new AliGenHijing(-1);
96 gener->SetEnergyCMS(5500.);
98 gener->SetReferenceFrame("CMS");
100 gener->SetProjectile("A", 208, 82);
101 gener->SetTarget ("A", 208, 82);
102 gener->SetBoostLHC(0);
103 gener->SetImpactParameterRange(0., 0.1);
105 // tell hijing to keep the full parent child chain
106 gener->KeepFullEvent();
107 // enable jet quenching
108 gener->SetJetQuenching(1);
110 gener->SetShadowing(1);
111 // neutral pion and heavy particle decays switched off
112 gener->SetDecaysOff(1);
113 // Don't track spectators
114 gener->SetSpectators(0);
115 // The particle stack
116 stack = new AliStack(1000);
117 gener->SetStack(stack);
123 npart = stack->GetNprimary();
124 printf("source_pbpb generated %d particles \n", npart);
139 particle = stack->Particle(part++);
140 ic = particle->GetFirstDaughter();
144 Int_t pdg = particle->GetPdgCode();
145 Int_t intfluka = mcihad(pdg);
146 Int_t ifl = GetFlukaKPTOIP(intfluka);
147 TVector3 polarisation;
148 particle->GetPolarisation(polarisation);
152 // printf("Particle %5d %5d %5d %10s %10.3f %10.3f %10.3f \n", part, pdg, ifl,
153 // particle->GetName(), particle->Px(), particle->Py(), particle->Pz());
157 /* Wt is the weight of the particle*/
158 STACK.wt[STACK.lstack] = oneone;
159 STARS.weipri += STACK.wt[STACK.lstack];
161 STACK.ilo[STACK.lstack] = ifl;
162 /* From this point .....
163 * Particle generation (1 for primaries)
165 STACK.lo[STACK.lstack] = 1;
167 /* User dependent flag:*/
168 STACK.louse[STACK.lstack] = 0;
170 /* User dependent spare variables:*/
172 for (ispr = 0; ispr < mkbmx1; ispr++)
173 STACK.sparek[STACK.lstack][ispr] = zerzer;
175 /* User dependent spare flags:*/
176 for (ispr = 0; ispr < mkbmx2; ispr++)
177 STACK.ispark[STACK.lstack][ispr] = 0;
179 /* Save the track number of the stack particle:*/
180 STACK.ispark[STACK.lstack][mkbmx2-1] = itrack;
182 STACK.numpar[STACK.lstack] = STACK.nparma;
183 STACK.nevent[STACK.lstack] = 0;
184 STACK.dfnear[STACK.lstack] = +zerzer;
186 /* Particle age (s)*/
187 STACK.agestk[STACK.lstack] = +zerzer;
188 STACK.aknshr[STACK.lstack] = -twotwo;
190 /* Group number for "low" energy neutrons, set to 0 anyway*/
191 STACK.igroup[STACK.lstack] = 0;
194 STACK.tke[STACK.lstack] = particle->Energy() - particle->GetMass();
197 /* Particle momentum*/
198 STACK.pmom [STACK.lstack] = particle->P();
200 /* Cosines (tx,ty,tz)*/
201 Double_t cosx = particle->Px()/particle->P();
202 Double_t cosy = particle->Py()/particle->P();
203 Double_t cosz = TMath::Sqrt(oneone - cosx*cosx - cosy*cosy);
204 if (particle->Pz() < 0.) cosz = -cosz;
207 STACK.tx [STACK.lstack] = cosx;
208 STACK.ty [STACK.lstack] = cosy;
209 STACK.tz [STACK.lstack] = cosz;
211 /* Polarization cosines:*/
212 if (polarisation.Mag()) {
213 Double_t cospolx = polarisation.Px()/polarisation.Mag();
214 Double_t cospoly = polarisation.Py()/polarisation.Mag();
215 Double_t cospolz = sqrt(oneone - cospolx*cospolx - cospoly*cospoly);
216 STACK.tx [STACK.lstack] = cospolx;
217 STACK.ty [STACK.lstack] = cospoly;
218 STACK.tz [STACK.lstack] = cospolz;
221 STACK.txpol [STACK.lstack] = -twotwo;
222 STACK.typol [STACK.lstack] = +zerzer;
223 STACK.tzpol [STACK.lstack] = +zerzer;
226 /* Particle coordinates*/
227 STACK.xa [STACK.lstack] = particle->Vx();
228 STACK.ya [STACK.lstack] = particle->Vy();
229 STACK.za [STACK.lstack] = za;
231 // printf("Particle Vertex %10.3f %10.3f %10.3f %10.3f \n",
232 // STACK.xa [STACK.lstack], STACK.ya [STACK.lstack], STACK.za [STACK.lstack], dir);
236 /* Calculate the total kinetic energy of the primaries: don't change*/
237 Int_t st_ilo = STACK.ilo[STACK.lstack];
240 ((STACK.tke[STACK.lstack] + PAPROP.amdisc[st_ilo+6])
241 * STACK.wt[STACK.lstack]);
243 EPISOR.tkesum += (STACK.tke[STACK.lstack] * STACK.wt[STACK.lstack]);
245 /* Here we ask for the region number of the hitting point.
246 * NREG (LSTACK) = ...
247 * The following line makes the starting region search much more
248 * robust if particles are starting very close to a boundary:
250 geocrs( STACK.tx[STACK.lstack],
251 STACK.ty[STACK.lstack],
252 STACK.tz[STACK.lstack] );
256 georeg ( STACK.xa[STACK.lstack],
257 STACK.ya[STACK.lstack],
258 STACK.za[STACK.lstack],
259 STACK.nreg[STACK.lstack],
260 idisc);//<-- dummy return variable not used
261 /* Do not change these cards:*/
263 Int_t igeohsm2 = -11;
264 geohsm ( STACK.nhspnt[STACK.lstack], igeohsm1, igeohsm2, LTCLCM.mlattc );
265 STACK.nlattc[STACK.lstack] = LTCLCM.mlattc;