Protection against div by 0 added.
[u/mrichter/AliRoot.git] / PYTHIA8 / AliDecayerPythia8.cxx
CommitLineData
948d10f4 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>
b584e2f5 22#include <TLorentzVector.h>
774ceaaf 23#include <TClonesArray.h>
24#include <TParticle.h>
b584e2f5 25#include "AliTPythia8.h"
948d10f4 26#include "AliDecayerPythia8.h"
27#include "ParticleData.h"
28
29ClassImp(AliDecayerPythia8)
30
ad720100 31Bool_t AliDecayerPythia8::fgInit = kFALSE;
32
948d10f4 33AliDecayerPythia8::AliDecayerPythia8():
b584e2f5 34 TVirtualMCDecayer(),
710f5272 35 fPythia8(AliTPythia8::Instance()),
b584e2f5 36 fDebug(0),
37 fDecay(kAll),
38 fHeavyFlavour(kTRUE)
948d10f4 39{
40 // Constructor
b584e2f5 41 fPythia8->Pythia8()->readString("SoftQCD:elastic = on");
42 fPythia8->Pythia8()->init();
948d10f4 43}
44
b584e2f5 45//___________________________________________________________________________
46void AliDecayerPythia8::Decay(Int_t pdg, TLorentzVector* p)
47{
48 // Decay a single particle
49 ClearEvent();
50 AppendParticle(pdg, p);
51 Int_t idPart = fPythia8->Pythia8()->event[0].id();
52 fPythia8->Pythia8()->particleData.mayDecay(idPart,kTRUE);
53 fPythia8->Pythia8()->moreDecays();
54 if (fDebug > 0) fPythia8->EventListing();
55}
56
57//___________________________________________________________________________
58Int_t AliDecayerPythia8::ImportParticles(TClonesArray *particles)
59{
774ceaaf 60 //import the decay products into particles array
61 const Float_t kconvT=0.001/2.999792458e8; // mm/c to seconds conversion
62 const Float_t kconvL=1./10; // mm to cm conversion
63 int np = fPythia8->ImportParticles(particles, "All");
64 // pythia assigns decay time in mm/c, convert to seconds
65 for (int ip=1;ip<np;ip++) {
66 TParticle* prod = (TParticle*)particles->At(ip);
67 if (!prod) continue;
68 prod->SetProductionVertex(prod->Vx()*kconvL,prod->Vy()*kconvL,prod->Vz()*kconvL,kconvT*prod->T());
69 }
70 return np;
b584e2f5 71}
72
73
ad720100 74void AliDecayerPythia8::Init()
75{
76// Initialisation
77//
78 if (!fgInit) {
79 fgInit = kTRUE;
80 // fPythia->SetDecayTable();
81 }
82
83// Switch on heavy flavor decays
84
85 Int_t j;
86 Int_t heavy[14] = {411, 421, 431, 4122, 4132, 4232, 4332, 511, 521, 531, 5122, 5132, 5232, 5332};
87// fPythia->ResetDecayTable();
88 for (j=0; j < 14; j++) {
89 if (fDecay == kNoDecayHeavy) {
710f5272 90 fPythia8->ReadString(Form("%d:onMode = off", heavy[j]));
ad720100 91 } else {
710f5272 92 fPythia8->ReadString(Form("%d:onMode = on", heavy[j]));
ad720100 93 }
94 }
95
96
97//...Switch off decay of pi0, K0S, Lambda, Sigma+-, Xi0-, Omega-.
98
99 if (fDecay != kNeutralPion) {
710f5272 100 fPythia8->ReadString("111:onMode = off");
ad720100 101 } else {
710f5272 102 fPythia8->ReadString("111:onMode = on");
ad720100 103 }
104
710f5272 105 fPythia8->ReadString("310:onMode = off");
106 fPythia8->ReadString("3112:onMode = off");
107 fPythia8->ReadString("3212:onMode = off");
108 fPythia8->ReadString("3222:onMode = off");
109 fPythia8->ReadString("3312:onMode = off");
110 fPythia8->ReadString("3322:onMode = off");
111 fPythia8->ReadString("3334:onMode = off");
ad720100 112// .. Force decay channels
113 ForceDecay();
114}
115
948d10f4 116void AliDecayerPythia8::ForceDecay()
117{
b7227478 118//
948d10f4 119// Force a particle decay mode
120// Switch heavy flavour production off if requested
121 if (!fHeavyFlavour) SwitchOffHeavyFlavour();
122//
123 Decay_t decay = fDecay;
710f5272 124 fPythia8->ReadString("HadronLevel:Decay = on");
948d10f4 125
126 if (decay == kNoDecayHeavy) return;
127
128//
129// select mode
948d10f4 130 switch (decay)
131 {
132 case kHardMuons:
ad720100 133// B0 -> mu X
710f5272 134 fPythia8->ReadString("511:onMode = off");
135 fPythia8->ReadString("511:onIfAny = 13 443 100443");
ad720100 136// B+/- -> mu X
710f5272 137 fPythia8->ReadString("521:onMode = off");
138 fPythia8->ReadString("521:onIfAny = 13 443 100443");
ad720100 139// Bs -> mu X
710f5272 140 fPythia8->ReadString("531:onMode = off");
141 fPythia8->ReadString("531:onIfAny = 13 443 100443");
ad720100 142// Lambda_b -> mu X
710f5272 143 fPythia8->ReadString("5122:onMode = off");
144 fPythia8->ReadString("5122:onIfAny = 13 443 100443");
ad720100 145// Sigma_b- -> mu X
710f5272 146 fPythia8->ReadString("5132:onMode = off");
147 fPythia8->ReadString("5132:onIfAny = 13 443 100443");
ad720100 148// Sigma_b0 -> mu X
710f5272 149 fPythia8->ReadString("5232:onMode = off");
150 fPythia8->ReadString("5232:onIfAny = 13 443 100443");
ad720100 151// Omega_b -> mu X
710f5272 152 fPythia8->ReadString("5332:onMode = off");
153 fPythia8->ReadString("5332:onIfAny = 13 443 100443");
ad720100 154// Psi' -> mu+ mu-
710f5272 155 fPythia8->ReadString("100443:onMode = off");
156 fPythia8->ReadString("100443:onIfAny = 443");
ad720100 157// Psi -> mu+ mu-
710f5272 158 fPythia8->ReadString("443:onMode = off");
159 fPythia8->ReadString("443:onIfAll = 13 13");
ad720100 160// D+/- -> mu X
710f5272 161 fPythia8->ReadString("411:onMode = off");
162 fPythia8->ReadString("411:onIfAll = 13");
ad720100 163// D0 -> mu X
710f5272 164 fPythia8->ReadString("421:onMode = off");
165 fPythia8->ReadString("421:onIfAll = 13");
ad720100 166// D_s -> mu X
710f5272 167 fPythia8->ReadString("431:onMode = off");
168 fPythia8->ReadString("431:onIfAll = 13");
ad720100 169// Lambda_c -> mu X
710f5272 170 fPythia8->ReadString("4122:onMode = off");
171 fPythia8->ReadString("4122:onIfAll = 13");
ad720100 172// Sigma_c -> mu X
710f5272 173 fPythia8->ReadString("4132:onMode = off");
174 fPythia8->ReadString("4132:onIfAll = 13");
ad720100 175// Sigma_c+ -> mu X
710f5272 176 fPythia8->ReadString("4232:onMode = off");
177 fPythia8->ReadString("4232:onIfAll = 13");
ad720100 178// Omega_c -> mu X
710f5272 179 fPythia8->ReadString("4332:onMode = off");
180 fPythia8->ReadString("4332:onIfAll = 13");
b7227478 181
948d10f4 182 break;
183 case kChiToJpsiGammaToMuonMuon:
b7227478 184// Chi_1c -> J/Psi Gamma
710f5272 185 fPythia8->ReadString("20443:onMode = off");
186 fPythia8->ReadString("20443:onIfAll = 443 22");
b7227478 187// Chi_2c -> J/Psi Gamma
710f5272 188 fPythia8->ReadString("445:onMode = off");
189 fPythia8->ReadString("445:onIfAll = 443 22");
b7227478 190// J/Psi -> mu+ mu-
710f5272 191 fPythia8->ReadString("443:onMode = off");
192 fPythia8->ReadString("443:onIfAll = 13 13");
948d10f4 193 break;
194 case kChiToJpsiGammaToElectronElectron:
b7227478 195// Chi_1c -> J/Psi Gamma
710f5272 196 fPythia8->ReadString("20443:onMode = off");
197 fPythia8->ReadString("20443:onIfAll = 443 22");
b7227478 198// Chi_2c -> J/Psi Gamma
710f5272 199 fPythia8->ReadString("445:onMode = off");
200 fPythia8->ReadString("445:onIfAll = 443 22");
b7227478 201// J/Psi -> e+ e-
710f5272 202 fPythia8->ReadString("443:onMode = off");
203 fPythia8->ReadString("443:onIfAll = 11 11");
948d10f4 204 break;
205
206 case kBSemiMuonic:
ad720100 207// B0 -> mu X
710f5272 208 fPythia8->ReadString("511:onMode = off");
209 fPythia8->ReadString("511:onIfAny = 13");
ad720100 210// B+/- -> mu X
710f5272 211 fPythia8->ReadString("521:onMode = off");
212 fPythia8->ReadString("521:onIfAny = 13");
ad720100 213// B_s -> mu X
710f5272 214 fPythia8->ReadString("531:onMode = off");
215 fPythia8->ReadString("531:onIfAny = 13");
ad720100 216// Lambda_b -> mu X
710f5272 217 fPythia8->ReadString("5122:onMode = off");
218 fPythia8->ReadString("5122:onIfAny = 13");
ad720100 219// Sigma_b -> mu X
710f5272 220 fPythia8->ReadString("5132:onMode = off");
221 fPythia8->ReadString("5132:onIfAny = 13");
ad720100 222// Sigma_b0 -> mu X
710f5272 223 fPythia8->ReadString("5232:onMode = off");
224 fPythia8->ReadString("5232:onIfAny = 13");
ad720100 225// Omega_b -> mu X
710f5272 226 fPythia8->ReadString("5332:onMode = off");
227 fPythia8->ReadString("5332:onIfAny = 13");
948d10f4 228 break;
229 case kSemiMuonic:
ad720100 230// D+- -> mu X
710f5272 231 fPythia8->ReadString("411:onMode = off");
232 fPythia8->ReadString("411:onIfAll = 13");
ad720100 233// D0 -> mu X
710f5272 234 fPythia8->ReadString("421:onMode = off");
235 fPythia8->ReadString("421:onIfAll = 13");
ad720100 236// D_s -> mu X
710f5272 237 fPythia8->ReadString("431:onMode = off");
238 fPythia8->ReadString("431:onIfAll = 13");
ad720100 239// Lambda_c -> mu X
710f5272 240 fPythia8->ReadString("4122:onMode = off");
241 fPythia8->ReadString("4122:onIfAll = 13");
ad720100 242// Sigma_c -> mu X
710f5272 243 fPythia8->ReadString("4132:onMode = off");
244 fPythia8->ReadString("4132:onIfAll = 13");
ad720100 245// Sigma -> mu X
710f5272 246 fPythia8->ReadString("4232:onMode = off");
247 fPythia8->ReadString("4232:onIfAll = 13");
ad720100 248// Omega_c -> mu X
710f5272 249 fPythia8->ReadString("4332:onMode = off");
250 fPythia8->ReadString("4332:onIfAll = 13");
ad720100 251// B0 -> mu X
710f5272 252 fPythia8->ReadString("511:onMode = off");
253 fPythia8->ReadString("511:onIfAny = 13");
ad720100 254// B+/- -> mu X
710f5272 255 fPythia8->ReadString("521:onMode = off");
256 fPythia8->ReadString("521:onIfAny = 13");
ad720100 257// B_s -> mu X
710f5272 258 fPythia8->ReadString("531:onMode = off");
259 fPythia8->ReadString("531:onIfAny = 13");
ad720100 260// Lambda_c -> mu X
710f5272 261 fPythia8->ReadString("5122:onMode = off");
262 fPythia8->ReadString("5122:onIfAny = 13");
ad720100 263// Sigma_c -> mu X
710f5272 264 fPythia8->ReadString("5132:onMode = off");
265 fPythia8->ReadString("5132:onIfAny = 13");
ad720100 266// Sigma_c -> mu X
710f5272 267 fPythia8->ReadString("5232:onMode = off");
268 fPythia8->ReadString("5232:onIfAny = 13");
ad720100 269// Omega_c -> mu X
710f5272 270 fPythia8->ReadString("5332:onMode = off");
271 fPythia8->ReadString("5332:onIfAny = 13");
b7227478 272
948d10f4 273 break;
38a19176 274 case kJpsiDiMuon:
275// J/Psi-> mu+ mu-
710f5272 276 fPythia8->ReadString("443:onMode = off");
277 fPythia8->ReadString("443:onIfAll = 13 13");
38a19176 278 break;
948d10f4 279 case kDiMuon:
ad720100 280// Rho -> mu+ mu-
710f5272 281 fPythia8->ReadString("113:onMode = off");
282 fPythia8->ReadString("113:onIfAll = 13 13");
ad720100 283// Eta-> mu+ mu-
710f5272 284 fPythia8->ReadString("221:onMode = off");
285 fPythia8->ReadString("221:onIfAll = 13 13");
ad720100 286// omega-> mu+ mu-
710f5272 287 fPythia8->ReadString("223:onMode = off");
288 fPythia8->ReadString("223:onIfAll = 13 13");
ad720100 289// phi-> mu+ mu-
710f5272 290 fPythia8->ReadString("333:onMode = off");
291 fPythia8->ReadString("333:onIfAll = 13 13");
ad720100 292// J/Psi-> mu+ mu-
710f5272 293 fPythia8->ReadString("443:onMode = off");
294 fPythia8->ReadString("443:onIfAll = 13 13");
ad720100 295// Psi'-> mu+ mu-
710f5272 296 fPythia8->ReadString("100443:onMode = off");
297 fPythia8->ReadString("100443:onIfAll = 13 13");
ad720100 298// Ups-> mu+ mu-
710f5272 299 fPythia8->ReadString("553:onMode = off");
300 fPythia8->ReadString("553:onIfAll = 13 13");
ad720100 301// Ups'-> mu+ mu-
710f5272 302 fPythia8->ReadString("100553:onMode = off");
303 fPythia8->ReadString("100553:onIfAll = 13 13");
ad720100 304// Ups''-> mu+ mu-
710f5272 305 fPythia8->ReadString("200553:onMode = off");
306 fPythia8->ReadString("200553:onIfAll = 13 13");
948d10f4 307 break;
308 case kBSemiElectronic:
ad720100 309// B0 - > e+ e-
710f5272 310 fPythia8->ReadString("511:onMode = off");
311 fPythia8->ReadString("511:onIfAny = 11");
ad720100 312// B+- -> e+ e-
710f5272 313 fPythia8->ReadString("521:onMode = off");
314 fPythia8->ReadString("521:onIfAny = 11");
ad720100 315// B_s -> e+ e-
710f5272 316 fPythia8->ReadString("531:onMode = off");
317 fPythia8->ReadString("531:onIfAny = 11");
ad720100 318// Lambda_b -> e+ e-
710f5272 319 fPythia8->ReadString("5122:onMode = off");
320 fPythia8->ReadString("5122:onIfAny = 11");
ad720100 321// Sigma_b -> e+ e-
710f5272 322 fPythia8->ReadString("5132:onMode = off");
323 fPythia8->ReadString("5132:onIfAny = 11");
ad720100 324// Sigma_b -> e+ e-
710f5272 325 fPythia8->ReadString("5232:onMode = off");
326 fPythia8->ReadString("5232:onIfAny = 11");
ad720100 327// Omega_b ->e+ e-
710f5272 328 fPythia8->ReadString("5332:onMode = off");
329 fPythia8->ReadString("5332:onIfAny = 11");
948d10f4 330 break;
331 case kSemiElectronic:
ad720100 332// D+/- -> e X
710f5272 333 fPythia8->ReadString("411:onMode = off");
334 fPythia8->ReadString("411:onIfAll = 11");
ad720100 335// D0 -> e X
710f5272 336 fPythia8->ReadString("421:onMode = off");
337 fPythia8->ReadString("421:onIfAll = 11");
ad720100 338// D_s ->e X
710f5272 339 fPythia8->ReadString("431:onMode = off");
340 fPythia8->ReadString("431:onIfAll = 11");
ad720100 341// Lambda_c -> e X
710f5272 342 fPythia8->ReadString("4122:onMode = off");
343 fPythia8->ReadString("4122:onIfAll = 11");
ad720100 344// Sigma_c -> e X
710f5272 345 fPythia8->ReadString("4132:onMode = off");
346 fPythia8->ReadString("4132:onIfAll = 11");
ad720100 347// Sigma_c -> e X
710f5272 348 fPythia8->ReadString("4232:onMode = off");
349 fPythia8->ReadString("4232:onIfAll = 11");
ad720100 350// Omega_c -> e X
710f5272 351 fPythia8->ReadString("4332:onMode = off");
352 fPythia8->ReadString("4332:onIfAll = 11");
ad720100 353// B0 -> e X
710f5272 354 fPythia8->ReadString("511:onMode = off");
355 fPythia8->ReadString("511:onIfAny = 11");
ad720100 356// B+/- -> e X
710f5272 357 fPythia8->ReadString("521:onMode = off");
358 fPythia8->ReadString("521:onIfAny = 11");
ad720100 359// B_s -> e X
710f5272 360 fPythia8->ReadString("531:onMode = off");
361 fPythia8->ReadString("531:onIfAny = 11");
ad720100 362// Lambda_b -> e X
710f5272 363 fPythia8->ReadString("5122:onMode = off");
364 fPythia8->ReadString("5122:onIfAny = 11");
ad720100 365// Sigma_b -> e X
710f5272 366 fPythia8->ReadString("5132:onMode = off");
367 fPythia8->ReadString("5132:onIfAny = 11");
ad720100 368// Sigma_b -> e X
710f5272 369 fPythia8->ReadString("5232:onMode = off");
370 fPythia8->ReadString("5232:onIfAny = 11");
ad720100 371// Omega_b -> e X
710f5272 372 fPythia8->ReadString("5332:onMode = off");
373 fPythia8->ReadString("5332:onIfAny = 11");
948d10f4 374 break;
375 case kDiElectron:
ad720100 376// Rho -> e+e-
710f5272 377 fPythia8->ReadString("113:onMode = off");
378 fPythia8->ReadString("113:onIfAll = 11 11");
ad720100 379// Eta -> e+e-
710f5272 380 fPythia8->ReadString("221:onMode = off");
381 fPythia8->ReadString("221:onIfAll = 11 11");
ad720100 382// omega -> e+e-
710f5272 383 fPythia8->ReadString("223:onMode = off");
384 fPythia8->ReadString("223:onIfAll = 11 11");
ad720100 385// phi -> e+e-
710f5272 386 fPythia8->ReadString("333:onMode = off");
387 fPythia8->ReadString("333:onIfAll = 11 11");
ad720100 388// J/Psi -> e+e-
710f5272 389 fPythia8->ReadString("443:onMode = off");
390 fPythia8->ReadString("443:onIfAll = 11 11");
ad720100 391// Psi' -> e+e-
710f5272 392 fPythia8->ReadString("100443:onMode = off");
393 fPythia8->ReadString("100443:onIfAll = 11 11");
ad720100 394// Ups -> e+e-
710f5272 395 fPythia8->ReadString("553:onMode = off");
396 fPythia8->ReadString("553:onIfAll = 11 11");
ad720100 397// Ups' -> e+e-
710f5272 398 fPythia8->ReadString("100553:onMode = off");
399 fPythia8->ReadString("100553:onIfAll = 11 11");
ad720100 400// Ups'' -> e+e-
710f5272 401 fPythia8->ReadString("200553:onMode = off");
402 fPythia8->ReadString("200553:onIfAll = 11 11");
948d10f4 403 break;
404 case kBJpsiDiMuon:
ad720100 405// B0 -> J/Psi (Psi') X
710f5272 406 fPythia8->ReadString("511:onMode = off");
407 fPythia8->ReadString("511:onIfAny = 443 100443");
ad720100 408// B+/- -> J/Psi (Psi') X
710f5272 409 fPythia8->ReadString("521:onMode = off");
410 fPythia8->ReadString("521:onIfAny = 443 100443");
ad720100 411// B_s -> J/Psi (Psi') X
710f5272 412 fPythia8->ReadString("531:onMode = off");
413 fPythia8->ReadString("531:onIfAny = 443 100443");
ad720100 414// Lambda_b -> J/Psi (Psi') X
710f5272 415 fPythia8->ReadString("5122:onMode = off");
416 fPythia8->ReadString("5122:onIfAny = 443 100443");
b7227478 417//
ad720100 418// J/Psi -> mu+ mu-
710f5272 419 fPythia8->ReadString("443:onMode = off");
420 fPythia8->ReadString("443:onIfAll = 13 13");
ad720100 421// Psi' -> mu+ mu-
710f5272 422 fPythia8->ReadString("100443:onMode = off");
423 fPythia8->ReadString("100443:onIfAll = 13 13");
948d10f4 424 break;
425 case kBPsiPrimeDiMuon:
ad720100 426// B0 -> Psi' X
710f5272 427 fPythia8->ReadString("511:onMode = off");
428 fPythia8->ReadString("511:onIfAny = 100443");
ad720100 429// B+/- -> Psi' X
710f5272 430 fPythia8->ReadString("521:onMode = off");
431 fPythia8->ReadString("521:onIfAny = 100443");
ad720100 432// B_s -> Psi' X
710f5272 433 fPythia8->ReadString("531:onMode = off");
434 fPythia8->ReadString("531:onIfAny = 100443");
ad720100 435// Lambda_b -> Psi' X
710f5272 436 fPythia8->ReadString("5122:onMode = off");
437 fPythia8->ReadString("5122:onIfAny = 100443");
b7227478 438//
ad720100 439// Psi' -> mu+ mu-
710f5272 440 fPythia8->ReadString("100443:onMode = off");
441 fPythia8->ReadString("100443:onIfAll = 13 13");
948d10f4 442 break;
443 case kBJpsiDiElectron:
ad720100 444// B0 -> Psi X
710f5272 445 fPythia8->ReadString("511:onMode = off");
446 fPythia8->ReadString("511:onIfAny = 443");
ad720100 447// B+/- -> Psi X
710f5272 448 fPythia8->ReadString("521:onMode = off");
449 fPythia8->ReadString("521:onIfAny = 443");
ad720100 450// B_s -> Psi X
710f5272 451 fPythia8->ReadString("531:onMode = off");
452 fPythia8->ReadString("531:onIfAny = 443");
ad720100 453// Lambda_b -> Psi X
710f5272 454 fPythia8->ReadString("5122:onMode = off");
455 fPythia8->ReadString("5122:onIfAny = 443");
b7227478 456//
ad720100 457// Psi -> mu+ mu-
710f5272 458 fPythia8->ReadString("443:onMode = off");
459 fPythia8->ReadString("443:onIfAll = 11 11");
b7227478 460
948d10f4 461 break;
462 case kBJpsi:
ad720100 463// B0 -> Psi X
710f5272 464 fPythia8->ReadString("511:onMode = off");
465 fPythia8->ReadString("511:onIfAny = 443");
ad720100 466// B+/- -> Psi X
710f5272 467 fPythia8->ReadString("521:onMode = off");
468 fPythia8->ReadString("521:onIfAny = 443");
ad720100 469// B_s -> Psi X
710f5272 470 fPythia8->ReadString("531:onMode = off");
471 fPythia8->ReadString("531:onIfAny = 443");
ad720100 472// Lambda_b -> Psi X
710f5272 473 fPythia8->ReadString("5122:onMode = off");
474 fPythia8->ReadString("5122:onIfAny = 443");
948d10f4 475 break;
476 case kBPsiPrimeDiElectron:
ad720100 477// B0 -> Psi' X
710f5272 478 fPythia8->ReadString("511:onMode = off");
479 fPythia8->ReadString("511:onIfAny = 100443");
ad720100 480// B+/- -> Psi' X
710f5272 481 fPythia8->ReadString("521:onMode = off");
482 fPythia8->ReadString("521:onIfAny = 100443");
ad720100 483// B_s -> Psi' X
710f5272 484 fPythia8->ReadString("531:onMode = off");
485 fPythia8->ReadString("531:onIfAny = 100443");
ad720100 486// Lambda_b -> Psi' X
710f5272 487 fPythia8->ReadString("5122:onMode = off");
488 fPythia8->ReadString("5122:onIfAny = 100443");
b7227478 489//
ad720100 490// Psi' -> mu+ mu-
710f5272 491 fPythia8->ReadString("100443:onMode = off");
492 fPythia8->ReadString("100443:onIfAll = 11 11");
948d10f4 493 break;
494 case kPiToMu:
ad720100 495// pi -> mu nu
710f5272 496 fPythia8->ReadString("211:onMode = off");
497 fPythia8->ReadString("211:onIfAny = 13");
948d10f4 498 break;
499 case kKaToMu:
ad720100 500// K -> mu nu
710f5272 501 fPythia8->ReadString("321:onMode = off");
502 fPythia8->ReadString("321:onIfAny = 13");
948d10f4 503 break;
504 case kAllMuonic:
ad720100 505// pi/K -> mu
710f5272 506 fPythia8->ReadString("211:onMode = off");
507 fPythia8->ReadString("211:onIfAny = 13");
508 fPythia8->ReadString("321:onMode = off");
509 fPythia8->ReadString("321:onIfAny = 13");
948d10f4 510 break;
511 case kWToMuon:
ad720100 512// W -> mu X
710f5272 513 fPythia8->ReadString("24:onMode = off");
514 fPythia8->ReadString("24:onIfAny = 13");
948d10f4 515 break;
516 case kWToCharm:
ad720100 517// W -> c X
710f5272 518 fPythia8->ReadString("24:onMode = off");
519 fPythia8->ReadString("24:onIfAny = 4");
948d10f4 520 break;
521 case kWToCharmToMuon:
ad720100 522// W -> c X
710f5272 523 fPythia8->ReadString("24:onMode = off");
524 fPythia8->ReadString("24:onIfAny = 4");
ad720100 525// D+- -> mu X
710f5272 526 fPythia8->ReadString("411:onMode = off");
527 fPythia8->ReadString("411:onIfAll = 13");
ad720100 528// D0 -> mu X
710f5272 529 fPythia8->ReadString("421:onMode = off");
530 fPythia8->ReadString("421:onIfAll = 13");
ad720100 531// D_s -> mu X
710f5272 532 fPythia8->ReadString("431:onMode = off");
533 fPythia8->ReadString("431:onIfAll = 13");
ad720100 534// Lambda_c -> mu X
710f5272 535 fPythia8->ReadString("4122:onMode = off");
536 fPythia8->ReadString("4122:onIfAll = 13");
ad720100 537// Sigma_c -> mu X
710f5272 538 fPythia8->ReadString("4132:onMode = off");
539 fPythia8->ReadString("4132:onIfAll = 13");
ad720100 540// Sigma_c -> mu X
710f5272 541 fPythia8->ReadString("4232:onMode = off");
542 fPythia8->ReadString("4232:onIfAll = 13");
ad720100 543// Omega_c -> mu X
710f5272 544 fPythia8->ReadString("4332:onMode = off");
545 fPythia8->ReadString("4332:onIfAll = 13");
948d10f4 546 break;
547 case kZDiMuon:
ad720100 548// Z -> mu+ mu-
710f5272 549 fPythia8->ReadString("23:onMode = off");
550 fPythia8->ReadString("23:onIfAll = 13 13");
948d10f4 551 break;
552 case kZDiElectron:
ad720100 553// Z -> e+ e-
710f5272 554 fPythia8->ReadString("23:onMode = off");
555 fPythia8->ReadString("23:onIfAll = 11 11");
948d10f4 556 break;
557 case kHadronicD:
558 ForceHadronicD(1);
559 break;
560 case kHadronicDWithout4Bodies:
561 ForceHadronicD(0);
562 break;
563 case kPhiKK:
ad720100 564 // Phi-> K+ K-
710f5272 565 fPythia8->ReadString("333:onMode = off");
566 fPythia8->ReadString("333:onIfAll = 321 321");
948d10f4 567 break;
568 case kOmega:
ad720100 569 // Omega -> Lambda K
710f5272 570 fPythia8->ReadString("3334:onMode = off");
571 fPythia8->ReadString("3334:onIfAll = 3122 321 ");
51da44a9 572 break;
d3553100 573 case kLambda:
574 // Lambda -> p pi-
710f5272 575 fPythia8->ReadString("3122:onMode = off");
576 fPythia8->ReadString("3122:onIfAll = 2212 211 ");
51da44a9 577 break;
482c0e0c 578 case kBeautyUpgrade:
710f5272 579 fPythia8->ReadString("5122:onMode = off");
580 fPythia8->ReadString("4122:onMode = off");
581 fPythia8->ReadString("5122:onIfAll = 4122");
582 fPythia8->ReadString("4122:onIfAll = 3122");
e549a63e 583 break;
948d10f4 584 case kAll:
585 break;
586 case kNoDecay:
710f5272 587 fPythia8->ReadString("HadronLevel:Decay = off");
948d10f4 588 break;
589 case kNoDecayHeavy:
1fefb2d4 590 case kNoDecayBeauty:
948d10f4 591 case kNeutralPion:
9610308a 592 case kPsiPrimeJpsiDiElectron:
7d09f746 593 case kElectronEM:
594 case kGammaEM:
595 case kDiElectronEM:
948d10f4 596 break;
597 }
598}
599
600Float_t AliDecayerPythia8::GetPartialBranchingRatio(Int_t ipart)
601{
602 // Get the partial branching ration for the forced decay channels
603
710f5272 604 Pythia8::Pythia* thePythia = fPythia8->Pythia8();
b584e2f5 605 Pythia8::ParticleData & table = thePythia->particleData;
606 Pythia8::ParticleDataEntry* pd = table.particleDataEntryPtr(ipart);
607
608 Int_t nc = pd->sizeChannels();
948d10f4 609 Float_t br = 0.;
610//
611// Loop over decay channels
612 for (Int_t ic = 0; ic < nc; ic++) {
b584e2f5 613 Pythia8::DecayChannel& decCh = pd->channel(ic);
b7227478 614 for (Int_t i = 0; i < decCh.multiplicity(); i++) {
948d10f4 615 br += decCh.bRatio();
616 }
617 }
618 return (br);
619}
620
621
948d10f4 622Float_t AliDecayerPythia8::GetLifetime(Int_t kf)
623{
624 // Return lifetime of particle
710f5272 625 Pythia8::Pythia* thePythia = fPythia8->Pythia8();
b584e2f5 626 Pythia8::ParticleData& table = thePythia->particleData;
948d10f4 627 Float_t tau = table.tau0(kf);
b584e2f5 628 return (tau);
948d10f4 629}
630
631void AliDecayerPythia8::SwitchOffHeavyFlavour()
632{
633 // Switch off heavy flavour production
634 //
635// Maximum number of quark flavours used in pdf
710f5272 636 fPythia8->ReadString("PDFinProcess:nQuarkIn = 3");
948d10f4 637// Maximum number of flavors that can be used in showers
710f5272 638 fPythia8->ReadString("SpaceShower:nQuarkIn = 3");
639 fPythia8->ReadString("TimeShower:nGammaToQuark = 3");
640 fPythia8->ReadString("TimeShower:nGluonToQuark = 3");
948d10f4 641}
642
643
644void AliDecayerPythia8::ForceHadronicD(Int_t optUse4Bodies)
645{
646//
647// Force golden D decay modes
648//
ad720100 649 // K* -> K pi
710f5272 650 fPythia8->ReadString("313:onMode = off");
651 fPythia8->ReadString("313:onIfAll = 321 211");
948d10f4 652 // for Ds -> Phi pi+
710f5272 653 fPythia8->ReadString("333:onMode = off");
654 fPythia8->ReadString("333:onIfAll = 321 321");
948d10f4 655 // for D0 -> rho0 pi+ k-
710f5272 656 fPythia8->ReadString("113:onMode = off");
657 fPythia8->ReadString("113:onIfAll = 211 211");
948d10f4 658 // for Lambda_c -> Delta++ K-
710f5272 659 fPythia8->ReadString("2224:onMode = off");
660 fPythia8->ReadString("2224:onIfAll = 2212 211");
00a8ca0b 661 // for Lambda_c -> Lambda(1520) K-
710f5272 662 fPythia8->ReadString("3124:onMode = off");
663 fPythia8->ReadString("3124:onIfAll = 2212 321");
948d10f4 664
665
710f5272 666 fPythia8->ReadString("411:onMode = off");
667 fPythia8->ReadString("421:onMode = off");
668 fPythia8->ReadString("431:onMode = off");
669 fPythia8->ReadString("4112:onMode = off");
670 fPythia8->ReadString("4122:onMode = off");
b7227478 671
ad720100 672 // D+/- -> K pi pi
710f5272 673 fPythia8->ReadString("411:onIfMatch = 321 211 211");
d3553100 674 // D+/- -> K* pi
710f5272 675 fPythia8->ReadString("411:onIfMatch = 313 211");
00a8ca0b 676 // D0 -> K pi
710f5272 677 fPythia8->ReadString("421:onIfMatch = 321 211");
ad720100 678
b7227478 679 if (optUse4Bodies) {
ad720100 680 // D0 -> K pi pi pi
710f5272 681 fPythia8->ReadString("421:onIfMatch = 321 211 211 211");
ad720100 682 // D0 -> K pi rho
710f5272 683 fPythia8->ReadString("421:onIfMatch = 321 211 113");
00a8ca0b 684 // D0 -> K*0 pi pi
710f5272 685 fPythia8->ReadString("421:onIfMatch = 313 211 211");
b7227478 686 }
948d10f4 687
ad720100 688 // D_s -> K K*
710f5272 689 fPythia8->ReadString("431:onIfMatch = 321 313");
ad720100 690 // D_s -> Phi pi
710f5272 691 fPythia8->ReadString("431:onIfMatch = 333 211");
b7227478 692
ad720100 693 // Lambda_c -> p K*
710f5272 694 fPythia8->ReadString("4122:onIfMatch = 2212 313");
ad720100 695 // Lambda_c -> Delta K
710f5272 696 fPythia8->ReadString("4122:onIfMatch = 2224 321");
00a8ca0b 697 // Lambda_c -> Lambda(1520) pi
710f5272 698 fPythia8->ReadString("4122:onIfMatch = 3124 211");
ad720100 699 // Lambda_c -> p K pi
710f5272 700 fPythia8->ReadString("4122:onIfMatch = 2212 321 211");
00a8ca0b 701 // Lambda_c -> Lambda pi
710f5272 702 fPythia8->ReadString("4122:onIfMatch = 3122 211");
b7227478 703
948d10f4 704}
705
b584e2f5 706//___________________________________________________________________________
707void AliDecayerPythia8::ReadDecayTable()
708{
709 //to read a decay table (not yet implemented)
710}
711
712
713//___________________________________________________________________________
714void AliDecayerPythia8::AppendParticle(Int_t pdg, TLorentzVector* p)
715{
716 // Append a particle to the stack
717 fPythia8->Pythia8()->event.append(pdg, 11, 0, 0, p->Px(), p->Py(), p->Pz(), p->E(), p->M());
718}
719
720
721//___________________________________________________________________________
722void AliDecayerPythia8::ClearEvent()
723{
724 // Clear the event stack
725 fPythia8->Pythia8()->event.clear();
726}
727