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