- More comment lines
[u/mrichter/AliRoot.git] / PYTHIA8 / AliDecayerPythia8.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /* $Id$ */
17
18 // Implementation of AliDecayer using Pythia8
19 // Author: andreas.morsch@cern.ch
20 #include <TMath.h>
21 #include <TPDGCode.h>
22 #include <TPythia8.h>
23 #include "AliDecayerPythia8.h"
24 #include "ParticleData.h"
25
26 ClassImp(AliDecayerPythia8)
27
28 Bool_t AliDecayerPythia8::fgInit = kFALSE;
29
30 AliDecayerPythia8::AliDecayerPythia8():
31     TPythia8Decayer(),
32     fDecay(kAll),
33     fHeavyFlavour(kTRUE)
34 {
35     // Constructor
36 }
37
38 void AliDecayerPythia8::Init()
39 {
40 // Initialisation
41 //
42     if (!fgInit) {
43         fgInit = kTRUE;
44         // fPythia->SetDecayTable();
45     }
46
47 // Switch on heavy flavor decays
48     
49     Int_t j;
50     Int_t heavy[14] = {411, 421, 431, 4122, 4132, 4232, 4332, 511, 521, 531, 5122, 5132, 5232, 5332};
51 //    fPythia->ResetDecayTable();
52     for (j=0; j < 14; j++) {
53         if (fDecay == kNoDecayHeavy) {
54             TPythia8::Instance()->ReadString(Form("%d:onMode = off", heavy[j]));
55         } else {
56             TPythia8::Instance()->ReadString(Form("%d:onMode = on", heavy[j]));
57         }
58     }
59     
60
61 //...Switch off decay of pi0, K0S, Lambda, Sigma+-, Xi0-, Omega-.
62     
63     if (fDecay != kNeutralPion) {
64         TPythia8::Instance()->ReadString("111:onMode = off");
65     } else {
66         TPythia8::Instance()->ReadString("111:onMode = on");
67     }
68
69     TPythia8::Instance()->ReadString("310:onMode = off");
70     TPythia8::Instance()->ReadString("3122:onMode = off");
71     TPythia8::Instance()->ReadString("3112:onMode = off");
72     TPythia8::Instance()->ReadString("3212:onMode = off");
73     TPythia8::Instance()->ReadString("3222:onMode = off");
74     TPythia8::Instance()->ReadString("3312:onMode = off");
75     TPythia8::Instance()->ReadString("3322:onMode = off");
76     TPythia8::Instance()->ReadString("3334:onMode = off");
77 // .. Force decay channels
78     ForceDecay();
79 }
80
81 void AliDecayerPythia8::ForceDecay()
82 {
83 // 
84 // Force a particle decay mode
85 // Switch heavy flavour production off if requested
86     if (!fHeavyFlavour) SwitchOffHeavyFlavour();
87 //
88     Decay_t decay = fDecay;
89     TPythia8::Instance()->ReadString("HadronLevel:Decay = on");
90     
91     if (decay == kNoDecayHeavy) return;
92
93 //
94 // select mode    
95     switch (decay) 
96     {
97     case kHardMuons:
98 //      B0 -> mu X 
99         TPythia8::Instance()->ReadString("511:onMode = off");
100         TPythia8::Instance()->ReadString("511:onIfAny = 13 443 100443");
101 //      B+/- -> mu X 
102         TPythia8::Instance()->ReadString("521:onMode = off");
103         TPythia8::Instance()->ReadString("521:onIfAny = 13 443 100443");
104 //      Bs -> mu X 
105         TPythia8::Instance()->ReadString("531:onMode = off");
106         TPythia8::Instance()->ReadString("531:onIfAny = 13 443 100443");
107 //      Lambda_b -> mu X 
108         TPythia8::Instance()->ReadString("5122:onMode = off");
109         TPythia8::Instance()->ReadString("5122:onIfAny = 13 443 100443");
110 //      Sigma_b- -> mu X 
111         TPythia8::Instance()->ReadString("5132:onMode = off");
112         TPythia8::Instance()->ReadString("5132:onIfAny = 13 443 100443");
113 //      Sigma_b0 -> mu X
114         TPythia8::Instance()->ReadString("5232:onMode = off");
115         TPythia8::Instance()->ReadString("5232:onIfAny = 13 443 100443");
116 //      Omega_b  -> mu X
117         TPythia8::Instance()->ReadString("5332:onMode = off");
118         TPythia8::Instance()->ReadString("5332:onIfAny = 13 443 100443");
119 //      Psi' -> mu+ mu-
120         TPythia8::Instance()->ReadString("100443:onMode = off");
121         TPythia8::Instance()->ReadString("100443:onIfAny = 443");
122 //      Psi  -> mu+ mu-
123         TPythia8::Instance()->ReadString("443:onMode = off");
124         TPythia8::Instance()->ReadString("443:onIfAll = 13 13");
125 //      D+/- -> mu X
126         TPythia8::Instance()->ReadString("411:onMode = off");
127         TPythia8::Instance()->ReadString("411:onIfAll = 13");
128 //      D0   -> mu X
129         TPythia8::Instance()->ReadString("421:onMode = off");
130         TPythia8::Instance()->ReadString("421:onIfAll = 13");
131 //      D_s  -> mu X
132         TPythia8::Instance()->ReadString("431:onMode = off");
133         TPythia8::Instance()->ReadString("431:onIfAll = 13");
134 //      Lambda_c -> mu X
135         TPythia8::Instance()->ReadString("4122:onMode = off");
136         TPythia8::Instance()->ReadString("4122:onIfAll = 13");
137 //      Sigma_c  -> mu X
138         TPythia8::Instance()->ReadString("4132:onMode = off");
139         TPythia8::Instance()->ReadString("4132:onIfAll = 13");
140 //      Sigma_c+ -> mu X
141         TPythia8::Instance()->ReadString("4232:onMode = off");
142         TPythia8::Instance()->ReadString("4232:onIfAll = 13");
143 //      Omega_c  -> mu X
144         TPythia8::Instance()->ReadString("4332:onMode = off");
145         TPythia8::Instance()->ReadString("4332:onIfAll = 13");
146
147         break;
148    case kChiToJpsiGammaToMuonMuon:
149 // Chi_1c  -> J/Psi  Gamma
150         TPythia8::Instance()->ReadString("20443:onMode = off");
151         TPythia8::Instance()->ReadString("20443:onIfAll = 443 22");
152 // Chi_2c  -> J/Psi  Gamma
153         TPythia8::Instance()->ReadString("445:onMode = off");
154         TPythia8::Instance()->ReadString("445:onIfAll = 443 22");
155 // J/Psi -> mu+ mu-
156         TPythia8::Instance()->ReadString("443:onMode = off");
157         TPythia8::Instance()->ReadString("443:onIfAll = 13 13");
158         break;
159     case kChiToJpsiGammaToElectronElectron:
160 // Chi_1c  -> J/Psi  Gamma
161         TPythia8::Instance()->ReadString("20443:onMode = off");
162         TPythia8::Instance()->ReadString("20443:onIfAll = 443 22");
163 // Chi_2c  -> J/Psi  Gamma
164         TPythia8::Instance()->ReadString("445:onMode = off");
165         TPythia8::Instance()->ReadString("445:onIfAll = 443 22");
166 // J/Psi -> e+ e-
167         TPythia8::Instance()->ReadString("443:onMode = off");
168         TPythia8::Instance()->ReadString("443:onIfAll = 11 11");
169         break;
170
171     case kBSemiMuonic:
172 //      B0 -> mu X 
173         TPythia8::Instance()->ReadString("511:onMode = off");
174         TPythia8::Instance()->ReadString("511:onIfAny = 13");
175 //      B+/- -> mu X 
176         TPythia8::Instance()->ReadString("521:onMode = off");
177         TPythia8::Instance()->ReadString("521:onIfAny = 13");
178 //      B_s -> mu X 
179         TPythia8::Instance()->ReadString("531:onMode = off");
180         TPythia8::Instance()->ReadString("531:onIfAny = 13");
181 //      Lambda_b -> mu X 
182         TPythia8::Instance()->ReadString("5122:onMode = off");
183         TPythia8::Instance()->ReadString("5122:onIfAny = 13");
184 //      Sigma_b -> mu X 
185         TPythia8::Instance()->ReadString("5132:onMode = off");
186         TPythia8::Instance()->ReadString("5132:onIfAny = 13");
187 //      Sigma_b0 -> mu X 
188         TPythia8::Instance()->ReadString("5232:onMode = off");
189         TPythia8::Instance()->ReadString("5232:onIfAny = 13");
190 //      Omega_b  -> mu X 
191         TPythia8::Instance()->ReadString("5332:onMode = off");
192         TPythia8::Instance()->ReadString("5332:onIfAny = 13");
193         break;
194     case kSemiMuonic:
195 //      D+- -> mu X
196         TPythia8::Instance()->ReadString("411:onMode = off");
197         TPythia8::Instance()->ReadString("411:onIfAll = 13");
198 //      D0  -> mu X
199         TPythia8::Instance()->ReadString("421:onMode = off");
200         TPythia8::Instance()->ReadString("421:onIfAll = 13");
201 //      D_s  -> mu X
202         TPythia8::Instance()->ReadString("431:onMode = off");
203         TPythia8::Instance()->ReadString("431:onIfAll = 13");
204 //      Lambda_c -> mu X
205         TPythia8::Instance()->ReadString("4122:onMode = off");
206         TPythia8::Instance()->ReadString("4122:onIfAll = 13");
207 //      Sigma_c  -> mu X
208         TPythia8::Instance()->ReadString("4132:onMode = off");
209         TPythia8::Instance()->ReadString("4132:onIfAll = 13");
210 //      Sigma  -> mu X
211         TPythia8::Instance()->ReadString("4232:onMode = off");
212         TPythia8::Instance()->ReadString("4232:onIfAll = 13");
213 //      Omega_c  -> mu X
214         TPythia8::Instance()->ReadString("4332:onMode = off");
215         TPythia8::Instance()->ReadString("4332:onIfAll = 13");
216 //      B0       -> mu X
217         TPythia8::Instance()->ReadString("511:onMode = off");
218         TPythia8::Instance()->ReadString("511:onIfAny = 13");
219 //      B+/-     -> mu X
220         TPythia8::Instance()->ReadString("521:onMode = off");
221         TPythia8::Instance()->ReadString("521:onIfAny = 13");
222 //      B_s      -> mu X
223         TPythia8::Instance()->ReadString("531:onMode = off");
224         TPythia8::Instance()->ReadString("531:onIfAny = 13");
225 //      Lambda_c -> mu X
226         TPythia8::Instance()->ReadString("5122:onMode = off");
227         TPythia8::Instance()->ReadString("5122:onIfAny = 13");
228 //      Sigma_c  -> mu X
229         TPythia8::Instance()->ReadString("5132:onMode = off");
230         TPythia8::Instance()->ReadString("5132:onIfAny = 13");
231 //      Sigma_c  -> mu X
232         TPythia8::Instance()->ReadString("5232:onMode = off");
233         TPythia8::Instance()->ReadString("5232:onIfAny = 13");
234 //      Omega_c  -> mu X
235         TPythia8::Instance()->ReadString("5332:onMode = off");
236         TPythia8::Instance()->ReadString("5332:onIfAny = 13");
237
238         break;
239     case kDiMuon:
240 //      Rho -> mu+ mu-
241         TPythia8::Instance()->ReadString("113:onMode = off");
242         TPythia8::Instance()->ReadString("113:onIfAll = 13 13");
243 //      Eta-> mu+ mu-
244         TPythia8::Instance()->ReadString("221:onMode = off");
245         TPythia8::Instance()->ReadString("221:onIfAll = 13 13");
246 //      omega-> mu+ mu-
247         TPythia8::Instance()->ReadString("223:onMode = off");
248         TPythia8::Instance()->ReadString("223:onIfAll = 13 13");
249 //      phi-> mu+ mu-
250         TPythia8::Instance()->ReadString("333:onMode = off");
251         TPythia8::Instance()->ReadString("333:onIfAll = 13 13");
252 //      J/Psi-> mu+ mu-
253         TPythia8::Instance()->ReadString("443:onMode = off");
254         TPythia8::Instance()->ReadString("443:onIfAll = 13 13");
255 //      Psi'-> mu+ mu-
256         TPythia8::Instance()->ReadString("100443:onMode = off");
257         TPythia8::Instance()->ReadString("100443:onIfAll = 13 13");
258 //      Ups-> mu+ mu-
259         TPythia8::Instance()->ReadString("553:onMode = off");
260         TPythia8::Instance()->ReadString("553:onIfAll = 13 13");
261 //      Ups'-> mu+ mu-
262         TPythia8::Instance()->ReadString("100553:onMode = off");
263         TPythia8::Instance()->ReadString("100553:onIfAll = 13 13"); 
264 //      Ups''-> mu+ mu-
265         TPythia8::Instance()->ReadString("200553:onMode = off");
266         TPythia8::Instance()->ReadString("200553:onIfAll = 13 13");
267         break;
268     case kBSemiElectronic:
269 //      B0 - > e+ e-
270         TPythia8::Instance()->ReadString("511:onMode = off");
271         TPythia8::Instance()->ReadString("511:onIfAny = 11");
272 //      B+- -> e+ e-
273         TPythia8::Instance()->ReadString("521:onMode = off");
274         TPythia8::Instance()->ReadString("521:onIfAny = 11");
275 //      B_s -> e+ e-
276         TPythia8::Instance()->ReadString("531:onMode = off");
277         TPythia8::Instance()->ReadString("531:onIfAny = 11");
278 //      Lambda_b -> e+ e-
279         TPythia8::Instance()->ReadString("5122:onMode = off");
280         TPythia8::Instance()->ReadString("5122:onIfAny = 11");
281 //      Sigma_b -> e+ e-
282         TPythia8::Instance()->ReadString("5132:onMode = off");
283         TPythia8::Instance()->ReadString("5132:onIfAny = 11");
284 //      Sigma_b -> e+ e-
285         TPythia8::Instance()->ReadString("5232:onMode = off");
286         TPythia8::Instance()->ReadString("5232:onIfAny = 11");
287 //      Omega_b ->e+ e-
288         TPythia8::Instance()->ReadString("5332:onMode = off");
289         TPythia8::Instance()->ReadString("5332:onIfAny = 11");
290         break;
291     case kSemiElectronic:
292 //      D+/- -> e X
293         TPythia8::Instance()->ReadString("411:onMode = off");
294         TPythia8::Instance()->ReadString("411:onIfAll = 11");
295 //      D0 -> e X
296         TPythia8::Instance()->ReadString("421:onMode = off");
297         TPythia8::Instance()->ReadString("421:onIfAll = 11");
298 //      D_s ->e X
299         TPythia8::Instance()->ReadString("431:onMode = off");
300         TPythia8::Instance()->ReadString("431:onIfAll = 11");
301 //      Lambda_c -> e X
302         TPythia8::Instance()->ReadString("4122:onMode = off");
303         TPythia8::Instance()->ReadString("4122:onIfAll = 11");
304 //      Sigma_c -> e X
305         TPythia8::Instance()->ReadString("4132:onMode = off");
306         TPythia8::Instance()->ReadString("4132:onIfAll = 11");
307 //      Sigma_c -> e X
308         TPythia8::Instance()->ReadString("4232:onMode = off");
309         TPythia8::Instance()->ReadString("4232:onIfAll = 11");
310 //      Omega_c -> e X
311         TPythia8::Instance()->ReadString("4332:onMode = off");
312         TPythia8::Instance()->ReadString("4332:onIfAll = 11");
313 //      B0 -> e X
314         TPythia8::Instance()->ReadString("511:onMode = off");
315         TPythia8::Instance()->ReadString("511:onIfAny = 11");
316 //      B+/- -> e X
317         TPythia8::Instance()->ReadString("521:onMode = off");
318         TPythia8::Instance()->ReadString("521:onIfAny = 11");
319 //      B_s -> e X
320         TPythia8::Instance()->ReadString("531:onMode = off");
321         TPythia8::Instance()->ReadString("531:onIfAny = 11");
322 //      Lambda_b -> e X
323         TPythia8::Instance()->ReadString("5122:onMode = off");
324         TPythia8::Instance()->ReadString("5122:onIfAny = 11");
325 //      Sigma_b -> e X
326         TPythia8::Instance()->ReadString("5132:onMode = off");
327         TPythia8::Instance()->ReadString("5132:onIfAny = 11");
328 //      Sigma_b -> e X
329         TPythia8::Instance()->ReadString("5232:onMode = off");
330         TPythia8::Instance()->ReadString("5232:onIfAny = 11");
331 //      Omega_b -> e X
332         TPythia8::Instance()->ReadString("5332:onMode = off");
333         TPythia8::Instance()->ReadString("5332:onIfAny = 11");
334         break;
335     case kDiElectron:
336 //      Rho -> e+e-
337         TPythia8::Instance()->ReadString("113:onMode = off");
338         TPythia8::Instance()->ReadString("113:onIfAll = 11 11");
339 //      Eta -> e+e-
340         TPythia8::Instance()->ReadString("221:onMode = off");
341         TPythia8::Instance()->ReadString("221:onIfAll = 11 11");
342 //      omega -> e+e-
343         TPythia8::Instance()->ReadString("223:onMode = off");
344         TPythia8::Instance()->ReadString("223:onIfAll = 11 11");
345 //      phi -> e+e-
346         TPythia8::Instance()->ReadString("333:onMode = off");
347         TPythia8::Instance()->ReadString("333:onIfAll = 11 11");
348 //      J/Psi -> e+e-
349         TPythia8::Instance()->ReadString("443:onMode = off");
350         TPythia8::Instance()->ReadString("443:onIfAll = 11 11");
351 //      Psi' -> e+e-
352         TPythia8::Instance()->ReadString("100443:onMode = off");
353         TPythia8::Instance()->ReadString("100443:onIfAll = 11 11");
354 //      Ups -> e+e-
355         TPythia8::Instance()->ReadString("553:onMode = off");
356         TPythia8::Instance()->ReadString("553:onIfAll = 11 11");
357 //      Ups' -> e+e-
358         TPythia8::Instance()->ReadString("100553:onMode = off");
359         TPythia8::Instance()->ReadString("100553:onIfAll = 11 11");
360 //      Ups'' -> e+e-
361         TPythia8::Instance()->ReadString("200553:onMode = off");
362         TPythia8::Instance()->ReadString("200553:onIfAll = 11 11");
363         break;
364     case kBJpsiDiMuon:
365 //      B0   -> J/Psi (Psi') X   
366         TPythia8::Instance()->ReadString("511:onMode = off");
367         TPythia8::Instance()->ReadString("511:onIfAny = 443 100443");
368 //      B+/-   -> J/Psi (Psi') X   
369         TPythia8::Instance()->ReadString("521:onMode = off");
370         TPythia8::Instance()->ReadString("521:onIfAny = 443 100443");
371 //      B_s   -> J/Psi (Psi') X   
372         TPythia8::Instance()->ReadString("531:onMode = off");
373         TPythia8::Instance()->ReadString("531:onIfAny = 443 100443");
374 //      Lambda_b -> J/Psi (Psi') X   
375         TPythia8::Instance()->ReadString("5122:onMode = off");
376         TPythia8::Instance()->ReadString("5122:onIfAny = 443 100443");
377 //
378 //      J/Psi -> mu+ mu-
379         TPythia8::Instance()->ReadString("443:onMode = off");
380         TPythia8::Instance()->ReadString("443:onIfAll = 13 13");
381 //      Psi' -> mu+ mu-
382         TPythia8::Instance()->ReadString("100443:onMode = off");
383         TPythia8::Instance()->ReadString("100443:onIfAll = 13 13");
384         break;
385     case kBPsiPrimeDiMuon:
386 //      B0   -> Psi' X   
387         TPythia8::Instance()->ReadString("511:onMode = off");
388         TPythia8::Instance()->ReadString("511:onIfAny = 100443");
389 //      B+/-   -> Psi' X   
390         TPythia8::Instance()->ReadString("521:onMode = off");
391         TPythia8::Instance()->ReadString("521:onIfAny = 100443");
392 //      B_s   -> Psi'  X   
393         TPythia8::Instance()->ReadString("531:onMode = off");
394         TPythia8::Instance()->ReadString("531:onIfAny = 100443");
395 //      Lambda_b -> Psi' X   
396         TPythia8::Instance()->ReadString("5122:onMode = off");
397         TPythia8::Instance()->ReadString("5122:onIfAny = 100443");
398 //
399 //      Psi' -> mu+ mu-
400         TPythia8::Instance()->ReadString("100443:onMode = off");
401         TPythia8::Instance()->ReadString("100443:onIfAll = 13 13");
402         break;
403     case kBJpsiDiElectron:
404 //      B0   -> Psi X   
405         TPythia8::Instance()->ReadString("511:onMode = off");
406         TPythia8::Instance()->ReadString("511:onIfAny = 443");
407 //      B+/-   -> Psi X   
408         TPythia8::Instance()->ReadString("521:onMode = off");
409         TPythia8::Instance()->ReadString("521:onIfAny = 443");
410 //      B_s   -> Psi  X   
411         TPythia8::Instance()->ReadString("531:onMode = off");
412         TPythia8::Instance()->ReadString("531:onIfAny = 443");
413 //      Lambda_b -> Psi X   
414         TPythia8::Instance()->ReadString("5122:onMode = off");
415         TPythia8::Instance()->ReadString("5122:onIfAny = 443");
416 //
417 //      Psi -> mu+ mu-
418         TPythia8::Instance()->ReadString("443:onMode = off");
419         TPythia8::Instance()->ReadString("443:onIfAll = 11 11");
420
421         break;
422     case kBJpsi:
423 //      B0   -> Psi X   
424         TPythia8::Instance()->ReadString("511:onMode = off");
425         TPythia8::Instance()->ReadString("511:onIfAny = 443");
426 //      B+/-   -> Psi X   
427         TPythia8::Instance()->ReadString("521:onMode = off");
428         TPythia8::Instance()->ReadString("521:onIfAny = 443");
429 //      B_s   -> Psi  X   
430         TPythia8::Instance()->ReadString("531:onMode = off");
431         TPythia8::Instance()->ReadString("531:onIfAny = 443");
432 //      Lambda_b -> Psi X   
433         TPythia8::Instance()->ReadString("5122:onMode = off");
434         TPythia8::Instance()->ReadString("5122:onIfAny = 443");
435         break;
436     case kBPsiPrimeDiElectron:
437 //      B0   -> Psi' X   
438         TPythia8::Instance()->ReadString("511:onMode = off");
439         TPythia8::Instance()->ReadString("511:onIfAny = 100443");
440 //      B+/-   -> Psi' X   
441         TPythia8::Instance()->ReadString("521:onMode = off");
442         TPythia8::Instance()->ReadString("521:onIfAny = 100443");
443 //      B_s   -> Psi'  X   
444         TPythia8::Instance()->ReadString("531:onMode = off");
445         TPythia8::Instance()->ReadString("531:onIfAny = 100443");
446 //      Lambda_b -> Psi' X   
447         TPythia8::Instance()->ReadString("5122:onMode = off");
448         TPythia8::Instance()->ReadString("5122:onIfAny = 100443");
449 //
450 //      Psi' -> mu+ mu-
451         TPythia8::Instance()->ReadString("100443:onMode = off");
452         TPythia8::Instance()->ReadString("100443:onIfAll = 11 11");
453         break;
454     case kPiToMu:
455 //      pi -> mu nu
456         TPythia8::Instance()->ReadString("211:onMode = off");
457         TPythia8::Instance()->ReadString("211:onIfAny = 13");
458         break;
459     case kKaToMu:
460 //      K -> mu nu
461         TPythia8::Instance()->ReadString("321:onMode = off");
462         TPythia8::Instance()->ReadString("321:onIfAny = 13");
463         break;
464     case kAllMuonic:
465 //      pi/K -> mu
466         TPythia8::Instance()->ReadString("211:onMode = off");
467         TPythia8::Instance()->ReadString("211:onIfAny = 13");
468         TPythia8::Instance()->ReadString("321:onMode = off");
469         TPythia8::Instance()->ReadString("321:onIfAny = 13");
470         break;
471     case kWToMuon:
472 //      W -> mu X
473         TPythia8::Instance()->ReadString("24:onMode = off");
474         TPythia8::Instance()->ReadString("24:onIfAny = 13");
475         break;
476     case kWToCharm:
477 //      W -> c X
478         TPythia8::Instance()->ReadString("24:onMode = off");
479         TPythia8::Instance()->ReadString("24:onIfAny = 4");
480         break;
481     case kWToCharmToMuon:
482 //      W -> c X
483         TPythia8::Instance()->ReadString("24:onMode = off");
484         TPythia8::Instance()->ReadString("24:onIfAny = 4");
485 //      D+- -> mu X
486         TPythia8::Instance()->ReadString("411:onMode = off");
487         TPythia8::Instance()->ReadString("411:onIfAll = 13");
488 //      D0 -> mu X
489         TPythia8::Instance()->ReadString("421:onMode = off");
490         TPythia8::Instance()->ReadString("421:onIfAll = 13");
491 //      D_s -> mu X
492         TPythia8::Instance()->ReadString("431:onMode = off");
493         TPythia8::Instance()->ReadString("431:onIfAll = 13");
494 //      Lambda_c -> mu X
495         TPythia8::Instance()->ReadString("4122:onMode = off");
496         TPythia8::Instance()->ReadString("4122:onIfAll = 13");
497 //      Sigma_c -> mu X
498         TPythia8::Instance()->ReadString("4132:onMode = off");
499         TPythia8::Instance()->ReadString("4132:onIfAll = 13");
500 //      Sigma_c -> mu X
501         TPythia8::Instance()->ReadString("4232:onMode = off");
502         TPythia8::Instance()->ReadString("4232:onIfAll = 13");
503 //      Omega_c -> mu X
504         TPythia8::Instance()->ReadString("4332:onMode = off");
505         TPythia8::Instance()->ReadString("4332:onIfAll = 13");
506         break;
507     case kZDiMuon:
508 //      Z -> mu+ mu-
509         TPythia8::Instance()->ReadString("23:onMode = off");
510         TPythia8::Instance()->ReadString("23:onIfAll = 13 13");
511         break;
512     case kZDiElectron:
513 //      Z -> e+ e-
514         TPythia8::Instance()->ReadString("23:onMode = off");
515         TPythia8::Instance()->ReadString("23:onIfAll = 11 11");
516         break;
517     case kHadronicD:
518         ForceHadronicD(1);
519         break;
520     case kHadronicDWithout4Bodies:
521         ForceHadronicD(0);
522         break;
523     case kPhiKK:
524         // Phi-> K+ K-
525         TPythia8::Instance()->ReadString("333:onMode = off");
526         TPythia8::Instance()->ReadString("333:onIfAll = 321 321");
527         break;
528     case kOmega:
529         // Omega -> Lambda K
530         TPythia8::Instance()->ReadString("3334:onMode = off");
531         TPythia8::Instance()->ReadString("3334:onIfAll = 3122 321 ");
532     case kAll:
533         break;
534     case kNoDecay:
535         TPythia8::Instance()->ReadString("HadronLevel:Decay = off");
536         break;
537     case kNoDecayHeavy:
538     case kNeutralPion:
539         break;
540     }
541 }
542
543 Float_t AliDecayerPythia8::GetPartialBranchingRatio(Int_t ipart)
544 {
545     // Get the partial branching ration for the forced decay channels
546     
547     Pythia8::Pythia* thePythia       = TPythia8::Instance()->Pythia8();
548     Pythia8::ParticleDataTable table = thePythia->particleData;
549     Pythia8::ParticleDataEntry* pd   = table.particleDataPtr(ipart);
550     Pythia8::DecayTable  decays      = pd->decay;
551     
552     
553     Int_t nc = decays.size();
554     Float_t br = 0.;
555 //
556 //  Loop over decay channels
557     for (Int_t ic = 0; ic < nc; ic++) {
558         Pythia8::DecayChannel& decCh = decays[ic];
559         for (Int_t i = 0; i < decCh.multiplicity(); i++) {
560             br += decCh.bRatio();
561         }
562     }
563     return (br);
564 }
565
566
567 Float_t AliDecayerPythia8::GetLifetime(Int_t kf)
568 {
569     // Return lifetime of particle
570     Pythia8::Pythia* thePythia       = TPythia8::Instance()->Pythia8();
571     Pythia8::ParticleDataTable table = thePythia->particleData;
572     Float_t tau = table.tau0(kf);
573     return ( tau);
574 }
575
576 void  AliDecayerPythia8::SwitchOffHeavyFlavour()
577 {
578     // Switch off heavy flavour production
579     //
580 // Maximum number of quark flavours used in pdf 
581     TPythia8::Instance()->ReadString("PDFinProcess:nQuarkIn = 3");
582 // Maximum number of flavors that can be used in showers
583     TPythia8::Instance()->ReadString("SpaceShower:nQuarkIn = 3");
584     TPythia8::Instance()->ReadString("TimeShower:nGammaToQuark = 3");
585     TPythia8::Instance()->ReadString("TimeShower:nGluonToQuark = 3");
586 }
587
588
589 void AliDecayerPythia8::ForceHadronicD(Int_t optUse4Bodies)
590 {
591 //
592 // Force golden D decay modes
593 //
594     // K* -> K pi
595     TPythia8::Instance()->ReadString("313:onMode = off");
596     TPythia8::Instance()->ReadString("313:onIfAll = 321 211");
597     // for Ds -> Phi pi+
598     TPythia8::Instance()->ReadString("333:onMode = off");
599     TPythia8::Instance()->ReadString("333:onIfAll = 321 321");
600     // for D0 -> rho0 pi+ k-
601     TPythia8::Instance()->ReadString("113:onMode = off");
602     TPythia8::Instance()->ReadString("113:onIfAll = 211 211");
603     // for Lambda_c -> Delta++ K-
604     TPythia8::Instance()->ReadString("2224:onMode = off");
605     TPythia8::Instance()->ReadString("2224:onIfAll = 2212 211");
606
607
608     TPythia8::Instance()->ReadString("411:onMode = off");
609     TPythia8::Instance()->ReadString("421:onMode = off");
610     TPythia8::Instance()->ReadString("431:onMode = off");
611     TPythia8::Instance()->ReadString("4112:onMode = off");
612     TPythia8::Instance()->ReadString("4122:onMode = off");
613
614     // D+/- -> K pi pi 
615     TPythia8::Instance()->ReadString("411:onIfMatch = 321 211 211");
616     // D+/- -> K K* pi
617     TPythia8::Instance()->ReadString("411:onIfMatch = 313 211");
618     // D+/- -> K pi
619     TPythia8::Instance()->ReadString("421:onIfMatch = 321 211");
620
621     if (optUse4Bodies) {
622         // D0 -> K pi pi pi
623         TPythia8::Instance()->ReadString("421:onIfMatch = 321 211 211 211");
624         // D0 -> K pi rho
625         TPythia8::Instance()->ReadString("421:onIfMatch = 321 211 113");
626     }
627     
628     // D_s -> K K*
629     TPythia8::Instance()->ReadString("431:onIfMatch = 321 313");
630     // D_s -> Phi pi
631     TPythia8::Instance()->ReadString("431:onIfMatch = 333 211");
632
633     // Lambda_c -> p K*
634     TPythia8::Instance()->ReadString("4122:onIfMatch = 2212 313");
635     // Lambda_c -> Delta K
636     TPythia8::Instance()->ReadString("4122:onIfMatch = 2224 321");
637     // Lambda_c -> p K pi
638     TPythia8::Instance()->ReadString("4122:onIfMatch = 2212 321 211");
639
640 }
641