]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVGEN/AliPythia.cxx
Tracking flag functionality increased. By A.Morsch.
[u/mrichter/AliRoot.git] / EVGEN / AliPythia.cxx
CommitLineData
75c6d54e 1
fe4da5cc 2#include "AliPythia.h"
3#include "AliMC.h"
4ClassImp(AliPythia)
5
6#ifndef WIN32
7# define lu1ent lu1ent_
8# define type_of_call
9#else
10# define lu1ent LU1ENT
11# define type_of_call _stdcall
12#endif
13
14extern "C" void type_of_call
15 lu1ent(Int_t&, Int_t&, Float_t&, Float_t&, Float_t&);
16
17
18
19//_____________________________________________________________________________
20
21Int_t AliPythia::fgInit=0;
22
75c6d54e 23AliPythia::AliPythia()
24{
25 for (Int_t i=0; i<501; i++) {
26 fGPCode[i][0]=0;
27 fGPCode[i][1]=0;
28 }
29}
30
fe4da5cc 31void AliPythia::Lu1Ent(Int_t flag, Int_t idpart,
32 Float_t mom, Float_t theta,Float_t phi)
33{
34 printf("%d %d %f %f %f\n",flag, idpart, mom, theta, phi);
35 lu1ent(flag, idpart, mom, theta, phi);
36
37}
38void AliPythia::DecayParticle(Int_t idpart,
39 Float_t mom, Float_t theta,Float_t phi)
40{
41 Lu1Ent(0, idpart, mom, theta, phi);
42 GetPrimaries();
43}
44
45void AliPythia::ProcInit(Process_t process, Float_t energy, StrucFunc_t strucfunc)
46{
47 fProcess = process;
48 fEcms = energy;
49 fStrucFunc = strucfunc;
50// don't decay p0
51 SetMDCY(LuComp(111),1,0);
52// select structure function
53 SetMSTP(52,2);
54 SetMSTP(51,strucfunc);
55//
56// Pythia initialisation for selected processes//
57//
58// Make MSEL clean
59//
60 for (Int_t i=1; i<= 200; i++) {
61 SetMSUB(i,0);
62 }
63// select charm production
64 switch (process)
65 {
66 case charm:
67 SetMSEL(4);
68//
69// heavy quark masses
70
71 SetPMAS(4,1,1.2);
72
73//
74// primordial pT
75 SetMSTP(91,1);
76 SetPARP(91,1);
77 SetPARP(93,3);
78//
79 break;
80 case beauty:
81 SetMSEL(5);
82 SetPMAS(5,1,4.75);
83 break;
84 case jpsi:
85 SetMSEL(0);
86// gg->J/Psi g
87 SetMSUB(86,1);
88 break;
89 case jpsi_chi:
90 SetMSEL(0);
91// gg->J/Psi g
92 SetMSUB(86,1);
93// gg-> chi_0c g
94 SetMSUB(87,1);
95// gg-> chi_1c g
96 SetMSUB(88,1);
97// gg-> chi_2c g
98 SetMSUB(89,1);
99 case charm_unforced:
100 SetMSEL(0);
101// gq->qg
102 SetMSUB(28,1);
103// gg->qq
104 SetMSUB(53,1);
105// gg->gg
106 SetMSUB(68,1);
107 case beauty_unforced:
108 SetMSEL(0);
109// gq->qg
110 SetMSUB(28,1);
111// gg->qq
112 SetMSUB(53,1);
113// gg->gg
114 SetMSUB(68,1);
115 break;
75c6d54e 116 case mb:
117// Minimum Bias pp-Collisions
118//
119// Tuning of parameters descibed in G. Ciapetti and A. Di Ciaccio
120// Proc. of the LHC Workshop, Aachen 1990, Vol. II p. 155
121//
122// select Pythia min. bias model
123 SetMSEL(2);
124 SetMSUB(92,1);
125 SetMSUB(93,1);
126 SetMSUB(94,1);
127 SetMSUB(95,1);
128// Multiple interactions switched on
129 SetMSTP(81,1);
130 SetMSTP(82,1);
131// Low-pT cut-off for hard scattering
132 SetPARP(81,1.9);
133// model for subsequent non-hardest interaction
134// 90% gg->gg 10% gg->qq
135 SetPARP(86,0.9);
136// 90% of gluon interactions have minimum string length
137 SetPARP(85,0.9);
fe4da5cc 138 }
139//
140// Initialize PYTHIA
141 Initialize("CMS","p","p",fEcms);
142}
143
144Int_t AliPythia::CountProducts(Int_t channel, Int_t particle)
145{
146 Int_t np=0;
147 for (Int_t i=1; i<=5; i++) {
148 if (TMath::Abs(GetKFDP(channel,i)) == particle) np++;
149 }
150 return np;
151}
152
153void AliPythia::AllowAllDecays()
154{
155 Int_t i;
156 for (i=1; i<= 2000; i++) {
157 SetMDME(i,1,1);
158 }
159//
160 for (i=0; i<501; i++){
161 fBraPart[i]=1;
162 }
163}
164
165void AliPythia::ForceParticleDecay(Int_t particle, Int_t product, Int_t mult)
166{
167//
168// force decay of particle into products with multiplicity mult
75c6d54e 169
fe4da5cc 170 Int_t kc=LuComp(particle);
75c6d54e 171 SetMDCY(kc,1,1);
fe4da5cc 172 Int_t ifirst=GetMDCY(kc,2);
173 Int_t ilast=ifirst+GetMDCY(kc,3)-1;
174 fBraPart[kc] = 1;
175//
176// Loop over decay channels
177 for (Int_t channel=ifirst; channel<=ilast;channel++) {
178 if (CountProducts(channel,product) >= mult) {
179 SetMDME(channel,1,1);
180 } else {
181 SetMDME(channel,1,0);
182 fBraPart[kc]-=GetBRAT(channel);
183 }
184 }
185}
186
187void AliPythia::ForceDecay(Decay_t decay)
188{
189 fDecay=decay;
190//
191// Make clean
192// AllowAllDecays();
193//
194// select mode
195
196 switch (decay)
197 {
198 case semimuonic:
75c6d54e 199 if (fProcess==charm || fProcess == charm_unforced) {
200 ForceParticleDecay( 411,13,1); // D+/-
201 ForceParticleDecay( 421,13,1); // D0
202 ForceParticleDecay( 431,13,1); // D_s
203 ForceParticleDecay( 4122,13,1); // Lambda_c
204 }
205 if (fProcess==beauty || fProcess == beauty_unforced) {
206 ForceParticleDecay( 511,13,1); // B0
207 ForceParticleDecay( 521,13,1); // B+/-
208 ForceParticleDecay( 531,13,1); // B_s
209 ForceParticleDecay( 5122,13,1); // Lambda_b
210 }
fe4da5cc 211 break;
212 case dimuon:
213 ForceParticleDecay( 41,13,2); // phi
214 ForceParticleDecay( 443,13,2); // J/Psi
215 ForceParticleDecay(30443,13,2); // Psi'
216 ForceParticleDecay( 553,13,2); // Upsilon
217 ForceParticleDecay(30553,13,2); // Upsilon'
218 break;
219 case semielectronic:
220
221 ForceParticleDecay( 411,11,1); // D+/-
222 ForceParticleDecay( 421,11,1); // D0
223 ForceParticleDecay( 431,11,1); // D_s
224 ForceParticleDecay( 4122,11,1); // Lambda_c
225
226 ForceParticleDecay( 511,11,1); // B0
227 ForceParticleDecay( 521,11,1); // B+/-
228 ForceParticleDecay( 531,11,1); // B_s
229 ForceParticleDecay( 5122,11,1); // Lambda_b
230 break;
231 case dielectron:
232
233 ForceParticleDecay( 41,11,2); // phi
234 ForceParticleDecay( 443,11,2); // J/Psi
235 ForceParticleDecay(30443,11,2); // Psi'
236 ForceParticleDecay( 553,11,2); // Upsilon
237 ForceParticleDecay(30553,11,2); // Upsilon'
238 break;
239 case b_jpsi_dimuon:
240 ForceParticleDecay( 511,443,1); // B0
241 ForceParticleDecay( 521,443,1); // B+/-
242 ForceParticleDecay( 531,443,1); // B_s
243 ForceParticleDecay( 5122,443,1); // Lambda_b
244 ForceParticleDecay( 443,13,2); // J/Psi
245 break;
246 case b_psip_dimuon:
247 ForceParticleDecay( 511,30443,1); // B0
248 ForceParticleDecay( 521,30443,1); // B+/-
249 ForceParticleDecay( 531,30443,1); // B_s
250 ForceParticleDecay( 5122,30443,1); // Lambda_b
251 ForceParticleDecay(30443,13,2); // Psi'
252 break;
253 case b_jpsi_dielectron:
254 ForceParticleDecay( 511,443,1); // B0
255 ForceParticleDecay( 521,443,1); // B+/-
256 ForceParticleDecay( 531,443,1); // B_s
257 ForceParticleDecay( 5122,443,1); // Lambda_b
258 ForceParticleDecay( 443,11,2); // J/Psi
259 break;
260 case b_psip_dielectron:
261 ForceParticleDecay( 511,30443,1); // B0
262 ForceParticleDecay( 521,30443,1); // B+/-
263 ForceParticleDecay( 531,30443,1); // B_s
264 ForceParticleDecay( 5122,30443,1); // Lambda_b
265 ForceParticleDecay(30443,11,2); // Psi'
266 break;
75c6d54e 267 case pitomu:
268 ForceParticleDecay(211,13,1); // pi->mu
269 break;
270 case katomu:
271 ForceParticleDecay(321,13,1); // K->mu
272 break;
fe4da5cc 273 }
274}
275
276
277 void AliPythia::DefineParticles()
278{
279 if (fgInit) return;
280 fgInit=1;
281 AliMC *pMC=AliMC::GetMC();
282
283 Float_t mass;
284 Float_t tlife;
285 Int_t kc, nkc, i;
286//
287//
288// Some particles cloned for rare decays
289//
290// phi-> mu+mu- and phi -> e+e-
291// clone the original phi
292 kc = LuComp(333);
293 nkc = 41;
294
295 for (i=1;i<=3;i++) {
296 SetKCHG(nkc,i,GetKCHG(kc,i));
297 }
298
299 for (i=1;i<=4;i++) {
300 SetPMAS(nkc,i,GetPMAS(kc,i));
301 }
302 SetCHAF(nkc,GetCHAF(kc));
303 fBraPart[kc]=1;
304//
305// decay
306 SetMDCY(nkc,1,1);
307 SetMDCY(nkc,2,993);
308 SetMDCY(nkc,3,2);
309//
310// phi-> e+e-
311 SetMDME(993,1,1);
312 SetMDME(993,2,0);
313 SetBRAT(993,2.99e-4);
314 SetKFDP(993,1,+11);
315 SetKFDP(993,2,-11);
316 SetKFDP(993,3,0);
317 SetKFDP(993,4,0);
318 SetKFDP(993,5,0);
319//
320// phi-> mu+mu-
321 SetMDME(994,1,1);
322 SetMDME(994,2,0);
323 SetBRAT(994,2.5e-4);
324 SetKFDP(994,1,+13);
325 SetKFDP(994,2,-13);
326 SetKFDP(994,3,0);
327 SetKFDP(994,4,0);
328 SetKFDP(994,5,0);
329//
330// Vector mesons
331//
75c6d54e 332// phi clone for dilepton decay-channel
fe4da5cc 333 kc=LuComp(41);
334 mass =GetPMAS(kc,1);
335 tlife=GetPMAS(kc,4);
336 pMC->Gspart(113,"Phi",3,mass,0,tlife);
337 fGPCode[kc][0]=113;
338 fGPCode[kc][1]=113;
339 // J/Psi
340 kc=LuComp(443);
341 mass =GetPMAS(kc,1);
342 tlife=GetPMAS(kc,4);
343 pMC->Gspart(114,"J/Psi",3,mass,0,tlife);
344 fGPCode[kc][0]=114;
345 fGPCode[kc][1]=114;
346 // psi prime
347 kc=LuComp(30443);
348 mass =GetPMAS(kc,1);
349 tlife=GetPMAS(kc,4);
350 pMC->Gspart(115,"Psi'",3,mass,0,tlife);
351 fGPCode[kc][0]=115;
352 fGPCode[kc][1]=115;
353 // upsilon(1s)
354 kc=LuComp(553);
355 mass =GetPMAS(kc,1);
356 tlife=GetPMAS(kc,4);
357 pMC->Gspart(116,"Upsilon",3,mass,0,tlife);
358 fGPCode[kc][0]=116;
359 fGPCode[kc][1]=116;
360 // upsilon(2s)
361 kc=LuComp(30553);
362 mass =GetPMAS(kc,1);
363 tlife=GetPMAS(kc,4);
364 pMC->Gspart(117,"Upsilon'",3,mass,0,tlife);
365 fGPCode[kc][0]=117;
366 fGPCode[kc][1]=117;
367 // upsilon(3s)
368 kc=LuComp(30553);
369 mass =GetPMAS(kc,1);
370 tlife=GetPMAS(kc,4);
371 pMC->Gspart(118,"Upsilon''",3,mass,0,tlife);
372 fGPCode[kc][0]=118;
373 fGPCode[kc][1]=118;
374//
375// charmed mesons
376//
377 // D^+/-
378 kc=LuComp(411);
379 mass =GetPMAS(kc,1);
380 tlife=GetPMAS(kc,4);
381 pMC->Gspart(119,"D^+",3,mass, 1,tlife);
382 pMC->Gspart(120,"D^-",3,mass,-1,tlife);
383 fGPCode[kc][0]=119;
384 fGPCode[kc][1]=120;
385 // D^0
386 kc=LuComp(421);
387 mass =GetPMAS(kc,1);
388 tlife=GetPMAS(kc,4);
389 pMC->Gspart(121,"D^0",3,mass,0,tlife);
390 pMC->Gspart(122,"D^0bar",3,mass,0,tlife);
391 fGPCode[kc][0]=121;
392 fGPCode[kc][1]=122;
393 // D_s
394 kc=LuComp(431);
395 mass =GetPMAS(kc,1);
396 tlife=GetPMAS(kc,4);
397 pMC->Gspart(123,"D_s^+",3,mass, 1,tlife);
398 pMC->Gspart(124,"D_s^-",3,mass,-1,tlife);
399 fGPCode[kc][0]=123;
400 fGPCode[kc][1]=124;
401 // Lambda_c
402 kc=LuComp(4122);
403 mass =GetPMAS(kc,1);
404 tlife=GetPMAS(kc,4);
405 pMC->Gspart(125,"Lambda_c+",3,mass, 1,tlife);
406 pMC->Gspart(126,"Lambda_c-",3,mass,-1,tlife);
407 fGPCode[kc][0]=125;
408 fGPCode[kc][1]=126;
409 //
410 // beauty mesons
411 // B_0
412 kc=LuComp(511);
413 mass =GetPMAS(kc,1);
414 tlife=GetPMAS(kc,4);
415 pMC->Gspart(127,"B^0",3,mass, 0,tlife);
416 pMC->Gspart(128,"B^0bar",3,mass, 0,tlife);
417 fGPCode[kc][0]=127;
418 fGPCode[kc][1]=128;
419 // B^+-
420 kc=LuComp(521);
421 mass =GetPMAS(kc,1);
422 tlife=GetPMAS(kc,4);
423 pMC->Gspart(129,"B^+",3,mass, 1,tlife);
424 pMC->Gspart(130,"B^-",3,mass,-1,tlife);
425 fGPCode[kc][0]=129;
426 fGPCode[kc][1]=130;
427 // B_s
428 kc=LuComp(531);
429 mass =GetPMAS(kc,1);
430 tlife=GetPMAS(kc,4);
431 pMC->Gspart(131,"B_s",3,mass, 0,tlife);
432 pMC->Gspart(132,"B_s^bar",3,mass,0,tlife);
433 fGPCode[kc][0]=131;
434 fGPCode[kc][1]=132;
435 // Lambda_b
436 kc=LuComp(5122);
437 mass =GetPMAS(kc,1);
438 tlife=GetPMAS(kc,4);
439 pMC->Gspart(133,"Lambda_b",3,mass, 0,tlife);
440 pMC->Gspart(134,"Lambda_b^bar",3,mass,0,tlife);
441 fGPCode[kc][0]=133;
442 fGPCode[kc][1]=134;
443//
444// set up correspondance between standard GEANT particle codes
445// and PYTHIA kf
446
447 kc=LuComp(22); // gamma
448 fGPCode[kc][0]=1;
449 fGPCode[kc][1]=1;
450
451 kc=LuComp(11); // positron
452 fGPCode[kc][0]=2;
453 fGPCode[kc][1]=3;
454
455 kc=LuComp(12); // neutrino
456 fGPCode[kc][0]=4;
457 fGPCode[kc][1]=4;
458
459 kc=LuComp(13); // muon
460 fGPCode[kc][0]=5;
461 fGPCode[kc][1]=6;
462
463 kc=LuComp(111); // pi0
464 fGPCode[kc][0]=7;
465 fGPCode[kc][1]=7;
466
467 kc=LuComp(211); // pi+
468 fGPCode[kc][0]=8;
469 fGPCode[kc][1]=9;
470
471 kc=LuComp(130); // K0 short
472 fGPCode[kc][0]=10;
473 fGPCode[kc][1]=10;
474
475 kc=LuComp(321); // K+/-
476 fGPCode[kc][0]=11;
477 fGPCode[kc][1]=12;
478
479 kc=LuComp(2112); // neutron/anti-neutron
480 fGPCode[kc][0]=13;
481 fGPCode[kc][1]=25;
482
483 kc=LuComp(2212); // proton/anti-proton
484 fGPCode[kc][0]=14;
485 fGPCode[kc][1]=15;
486
487 kc=LuComp(310); // K0 short
488 fGPCode[kc][0]=16;
489 fGPCode[kc][1]=16;
490
491 kc=LuComp(221); // eta
492 fGPCode[kc][0]=17;
493 fGPCode[kc][1]=17;
494
495 kc=LuComp(3122); // lambda
496 fGPCode[kc][0]=18;
497 fGPCode[kc][1]=18;
498
499 kc=LuComp(3222); // sigma+/antisigma+
500 fGPCode[kc][0]=19;
501 fGPCode[kc][1]=29;
502
503 kc=LuComp(3212); // sigma0/antisigma0
504 fGPCode[kc][0]=20;
505 fGPCode[kc][1]=28;
506
507 kc=LuComp(3112); // sigma-/antisigma-
508 fGPCode[kc][0]=21;
509 fGPCode[kc][1]=27;
510
511 kc=LuComp(3322); // xsi0-/antixsi0
512 fGPCode[kc][0]=22;
513 fGPCode[kc][1]=30;
514
515 kc=LuComp(3312); // xsi-/antixsi+
516 fGPCode[kc][0]=23;
517 fGPCode[kc][1]=31;
518
519 kc=LuComp(3334); // omega/antiomega
520 fGPCode[kc][0]=24;
521 fGPCode[kc][1]=32;
522}
523
524
525
526Int_t AliPythia::GetGeantCode(Int_t kf)
527{
528 Int_t kc=LuComp(TMath::Abs(kf));
529 return (kf > 0) ? fGPCode[kc][0] : fGPCode[kc][1];
530}
531
532Float_t AliPythia::GetBraPart(Int_t kf)
533{
534 Int_t kc=LuComp(TMath::Abs(kf));
535 return fBraPart[kc];
536}
537
538
539
540
541
542
543
544