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