Adding macros runSimulation.C, runReconstruction.C
[u/mrichter/AliRoot.git] / PYTHIA6 / AliPythia.cxx
CommitLineData
6b435cde 1
8d2cd130 2/**************************************************************************
3 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * *
5 * Author: The ALICE Off-line Project. *
6 * Contributors are mentioned in the code where appropriate. *
7 * *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
16
7cdba479 17/* $Id$ */
8d2cd130 18
19#include "AliPythia.h"
7cdba479 20#include "AliPythiaRndm.h"
0f482ae4 21#include "../FASTSIM/AliFastGlauber.h"
22#include "../FASTSIM/AliQuenchingWeights.h"
23#include "TVector3.h"
8d2cd130 24
25ClassImp(AliPythia)
26
27#ifndef WIN32
28# define pyclus pyclus_
29# define pycell pycell_
452af8c7 30# define pyshow pyshow_
31# define pyrobo pyrobo_
992f2843 32# define pyquen pyquen_
16a82508 33# define pyevnw pyevnw_
8d2cd130 34# define type_of_call
35#else
36# define pyclus PYCLUS
37# define pycell PYCELL
452af8c7 38# define pyrobo PYROBO
992f2843 39# define pyquen PYQUEN
16a82508 40# define pyevnw PYEVNW
8d2cd130 41# define type_of_call _stdcall
42#endif
43
44extern "C" void type_of_call pyclus(Int_t & );
45extern "C" void type_of_call pycell(Int_t & );
452af8c7 46extern "C" void type_of_call pyshow(Int_t &, Int_t &, Double_t &);
47extern "C" void type_of_call pyrobo(Int_t &, Int_t &, Double_t &, Double_t &, Double_t &, Double_t &, Double_t &);
992f2843 48extern "C" void type_of_call pyquen(Double_t &, Int_t &, Double_t &);
0a2cfc0a 49extern "C" void type_of_call pyevnw(){;}
8d2cd130 50
51//_____________________________________________________________________________
52
53AliPythia* AliPythia::fgAliPythia=NULL;
54
e8a8adcd 55AliPythia::AliPythia():
56 fProcess(kPyMb),
57 fEcms(0.),
58 fStrucFunc(kCTEQ5L),
59 fXJet(0.),
60 fYJet(0.),
61 fGlauber(0),
62 fQuenchingWeights(0)
8d2cd130 63{
64// Default Constructor
65//
66// Set random number
7cdba479 67 if (!AliPythiaRndm::GetPythiaRandom())
68 AliPythiaRndm::SetPythiaRandom(GetRandom());
0f482ae4 69 fGlauber = 0;
70 fQuenchingWeights = 0;
8d2cd130 71}
72
e8a8adcd 73AliPythia::AliPythia(const AliPythia& pythia):
6b435cde 74 TPythia6(pythia),
75 AliRndm(pythia),
e8a8adcd 76 fProcess(kPyMb),
77 fEcms(0.),
78 fStrucFunc(kCTEQ5L),
79 fXJet(0.),
80 fYJet(0.),
81 fGlauber(0),
82 fQuenchingWeights(0)
83{
84 // Copy Constructor
85 pythia.Copy(*this);
86}
87
8d2cd130 88void AliPythia::ProcInit(Process_t process, Float_t energy, StrucFunc_t strucfunc)
89{
90// Initialise the process to generate
7cdba479 91 if (!AliPythiaRndm::GetPythiaRandom())
92 AliPythiaRndm::SetPythiaRandom(GetRandom());
8d2cd130 93
94 fProcess = process;
95 fEcms = energy;
96 fStrucFunc = strucfunc;
1d5b1b20 97//...Switch off decay of pi0, K0S, Lambda, Sigma+-, Xi0-, Omega-.
98 SetMDCY(Pycomp(111) ,1,0);
99 SetMDCY(Pycomp(310) ,1,0);
100 SetMDCY(Pycomp(3122),1,0);
101 SetMDCY(Pycomp(3112),1,0);
102 SetMDCY(Pycomp(3212),1,0);
103 SetMDCY(Pycomp(3222),1,0);
104 SetMDCY(Pycomp(3312),1,0);
105 SetMDCY(Pycomp(3322),1,0);
106 SetMDCY(Pycomp(3334),1,0);
1c50ec12 107 // Select structure function
8d2cd130 108 SetMSTP(52,2);
109 SetMSTP(51,strucfunc);
1c50ec12 110 // Particles produced in string fragmentation point directly to either of the two endpoints
111 // of the string (depending in the side they were generated from).
112 SetMSTU(16,2);
113
8d2cd130 114//
115// Pythia initialisation for selected processes//
116//
117// Make MSEL clean
118//
119 for (Int_t i=1; i<= 200; i++) {
120 SetMSUB(i,0);
121 }
122// select charm production
123 switch (process)
124 {
65f2626c 125 case kPyOldUEQ2ordered: //Old underlying events with Q2 ordered QCD processes
126// Multiple interactions on.
127 SetMSTP(81,1);
128// Double Gaussian matter distribution.
129 SetMSTP(82,4);
130 SetPARP(83,0.5);
131 SetPARP(84,0.4);
132// pT0.
133 SetPARP(82,2.0);
134// Reference energy for pT0 and energy rescaling pace.
135 SetPARP(89,1800);
136 SetPARP(90,0.25);
137// String drawing almost completely minimizes string length.
138 SetPARP(85,0.9);
139 SetPARP(86,0.95);
140// ISR and FSR activity.
141 SetPARP(67,4);
142 SetPARP(71,4);
143// Lambda_FSR scale.
144 SetPARJ(81,0.29);
145 break;
146 case kPyOldUEQ2ordered2:
147// Old underlying events with Q2 ordered QCD processes
148// Multiple interactions on.
149 SetMSTP(81,1);
150// Double Gaussian matter distribution.
151 SetMSTP(82,4);
152 SetPARP(83,0.5);
153 SetPARP(84,0.4);
154// pT0.
155 SetPARP(82,2.0);
156// Reference energy for pT0 and energy rescaling pace.
157 SetPARP(89,1800);
158 SetPARP(90,0.16); // here is the difference with kPyOldUEQ2ordered
159// String drawing almost completely minimizes string length.
160 SetPARP(85,0.9);
161 SetPARP(86,0.95);
162// ISR and FSR activity.
163 SetPARP(67,4);
164 SetPARP(71,4);
165// Lambda_FSR scale.
166 SetPARJ(81,0.29);
167 break;
168 case kPyOldPopcorn:
169// Old production mechanism: Old Popcorn
170 SetMSEL(1);
171 SetMSTJ(12,3);
172// (D=2) Like MSTJ(12)=2 but added prod ofthe 1er rank baryon
173 SetMSTP(88,2);
174// (D=1)see can be used to form baryons (BARYON JUNCTION)
175 SetMSTJ(1,1);
e0e89f40 176 AtlasTuning();
65f2626c 177 break;
8d2cd130 178 case kPyCharm:
179 SetMSEL(4);
8d2cd130 180// heavy quark masses
181
182 SetPMAS(4,1,1.2);
8d2cd130 183//
184// primordial pT
185 SetMSTP(91,1);
186 SetPARP(91,1.);
187 SetPARP(93,5.);
188//
189 break;
190 case kPyBeauty:
191 SetMSEL(5);
192 SetPMAS(5,1,4.75);
8d2cd130 193 break;
194 case kPyJpsi:
195 SetMSEL(0);
196// gg->J/Psi g
197 SetMSUB(86,1);
198 break;
199 case kPyJpsiChi:
200 SetMSEL(0);
201// gg->J/Psi g
202 SetMSUB(86,1);
203// gg-> chi_0c g
204 SetMSUB(87,1);
205// gg-> chi_1c g
206 SetMSUB(88,1);
207// gg-> chi_2c g
208 SetMSUB(89,1);
209 break;
210 case kPyCharmUnforced:
211 SetMSEL(0);
212// gq->qg
213 SetMSUB(28,1);
214// gg->qq
215 SetMSUB(53,1);
216// gg->gg
217 SetMSUB(68,1);
218 break;
219 case kPyBeautyUnforced:
220 SetMSEL(0);
221// gq->qg
222 SetMSUB(28,1);
223// gg->qq
224 SetMSUB(53,1);
225// gg->gg
226 SetMSUB(68,1);
227 break;
228 case kPyMb:
229// Minimum Bias pp-Collisions
230//
231//
232// select Pythia min. bias model
233 SetMSEL(0);
511db649 234 SetMSUB(92,1); // single diffraction AB-->XB
235 SetMSUB(93,1); // single diffraction AB-->AX
236 SetMSUB(94,1); // double diffraction
237 SetMSUB(95,1); // low pt production
238
e0e89f40 239 AtlasTuning();
511db649 240 break;
f529e69b 241 case kPyMbDefault:
242// Minimum Bias pp-Collisions
243//
244//
245// select Pythia min. bias model
246 SetMSEL(0);
247 SetMSUB(92,1); // single diffraction AB-->XB
248 SetMSUB(93,1); // single diffraction AB-->AX
249 SetMSUB(94,1); // double diffraction
250 SetMSUB(95,1); // low pt production
251
252 break;
0a0cbcfd 253 case kPyLhwgMb:
254// Les Houches Working Group 05 Minimum Bias pp-Collisions: hep-ph/0604120
255// -> Pythia 6.3 or above is needed
256//
257 SetMSEL(0);
258 SetMSUB(92,1); // single diffraction AB-->XB
259 SetMSUB(93,1); // single diffraction AB-->AX
260 SetMSUB(94,1); // double diffraction
261 SetMSUB(95,1); // low pt production
262
263 SetMSTP(51,kCTEQ6ll); // CTEQ6ll pdf
264 SetMSTP(52,2);
265 SetMSTP(68,1);
266 SetMSTP(70,2);
267 SetMSTP(81,1); // Multiple Interactions ON
268 SetMSTP(82,4); // Double Gaussian Model
269 SetMSTP(88,1);
270
271 SetPARP(82,2.3); // [GeV] PT_min at Ref. energy
272 SetPARP(83,0.5); // Core density in proton matter distribution (def.value)
273 SetPARP(84,0.5); // Core radius
274 SetPARP(85,0.9); // Regulates gluon prod. mechanism
275 SetPARP(90,0.2); // 2*epsilon (exponent in power law)
276
277 break;
8d2cd130 278 case kPyMbNonDiffr:
279// Minimum Bias pp-Collisions
280//
281//
282// select Pythia min. bias model
283 SetMSEL(0);
511db649 284 SetMSUB(95,1); // low pt production
0f482ae4 285
e0e89f40 286 AtlasTuning();
8d2cd130 287 break;
d7de4a67 288 case kPyMbMSEL1:
289 ConfigHeavyFlavor();
290// Intrinsic <kT^2>
291 SetMSTP(91,1);// Width (1=gaussian) primordial kT dist. inside hadrons
292 SetPARP(91,1.); // <kT^2> = PARP(91,1.)^2
293 SetPARP(93,5.); // Upper cut-off
294// Set Q-quark mass
295 SetPMAS(4,1,1.2); // Charm quark mass
296 SetPMAS(5,1,4.78); // Beauty quark mass
297 SetPARP(71,4.); // Defaut value
298// Atlas Tuning
299 AtlasTuning();
300 break;
8d2cd130 301 case kPyJets:
302//
303// QCD Jets
304//
305 SetMSEL(1);
65f2626c 306 // Pythia Tune A (CDF)
307 //
308 SetPARP(67,4.); // Regulates Initial State Radiation
309 SetMSTP(82,4); // Double Gaussian Model
310 SetPARP(82,2.0); // [GeV] PT_min at Ref. energy
311 SetPARP(84,0.4); // Core radius
312 SetPARP(85,0.90) ; // Regulates gluon prod. mechanism
313 SetPARP(86,0.95); // Regulates gluon prod. mechanism
314 SetPARP(89,1800.); // [GeV] Ref. energy
315 SetPARP(90,0.25); // 2*epsilon (exponent in power law)
316 break;
8d2cd130 317 case kPyDirectGamma:
318 SetMSEL(10);
319 break;
adf4d898 320 case kPyCharmPbPbMNR:
321 case kPyD0PbPbMNR:
90d7b703 322 case kPyDPlusPbPbMNR:
e0e89f40 323 case kPyDPlusStrangePbPbMNR:
90d7b703 324 // Tuning of Pythia parameters aimed to get a resonable agreement
325 // between with the NLO calculation by Mangano, Nason, Ridolfi for the
326 // c-cbar single inclusive and double differential distributions.
327 // This parameter settings are meant to work with Pb-Pb collisions
328 // (AliGenPythia::SetNuclei) and with kCTEQ4L PDFs.
329 // To get a good agreement the minimum ptHard (AliGenPythia::SetPtHard)
330 // has to be set to 2.1GeV. Example in ConfigCharmPPR.C.
3dc3ec94 331 ConfigHeavyFlavor();
90d7b703 332 // Intrinsic <kT>
333 SetMSTP(91,1);
334 SetPARP(91,1.304);
335 SetPARP(93,6.52);
90d7b703 336 // Set c-quark mass
337 SetPMAS(4,1,1.2);
90d7b703 338 break;
adf4d898 339 case kPyCharmpPbMNR:
340 case kPyD0pPbMNR:
90d7b703 341 case kPyDPluspPbMNR:
e0e89f40 342 case kPyDPlusStrangepPbMNR:
90d7b703 343 // Tuning of Pythia parameters aimed to get a resonable agreement
344 // between with the NLO calculation by Mangano, Nason, Ridolfi for the
345 // c-cbar single inclusive and double differential distributions.
346 // This parameter settings are meant to work with p-Pb collisions
347 // (AliGenPythia::SetNuclei) and with kCTEQ4L PDFs.
348 // To get a good agreement the minimum ptHard (AliGenPythia::SetPtHard)
349 // has to be set to 2.1GeV. Example in ConfigCharmPPR.C.
3dc3ec94 350 ConfigHeavyFlavor();
90d7b703 351 // Intrinsic <kT>
3dc3ec94 352 SetMSTP(91,1);
353 SetPARP(91,1.16);
354 SetPARP(93,5.8);
355
90d7b703 356 // Set c-quark mass
3dc3ec94 357 SetPMAS(4,1,1.2);
90d7b703 358 break;
adf4d898 359 case kPyCharmppMNR:
360 case kPyD0ppMNR:
90d7b703 361 case kPyDPlusppMNR:
e0e89f40 362 case kPyDPlusStrangeppMNR:
90d7b703 363 // Tuning of Pythia parameters aimed to get a resonable agreement
364 // between with the NLO calculation by Mangano, Nason, Ridolfi for the
365 // c-cbar single inclusive and double differential distributions.
366 // This parameter settings are meant to work with pp collisions
367 // (AliGenPythia::SetNuclei) and with kCTEQ4L PDFs.
368 // To get a good agreement the minimum ptHard (AliGenPythia::SetPtHard)
369 // has to be set to 2.1GeV. Example in ConfigCharmPPR.C.
3dc3ec94 370 ConfigHeavyFlavor();
90d7b703 371 // Intrinsic <kT^2>
3dc3ec94 372 SetMSTP(91,1);
373 SetPARP(91,1.);
374 SetPARP(93,5.);
375
90d7b703 376 // Set c-quark mass
3dc3ec94 377 SetPMAS(4,1,1.2);
90d7b703 378 break;
e0e89f40 379 case kPyCharmppMNRwmi:
380 // Tuning of Pythia parameters aimed to get a resonable agreement
381 // between with the NLO calculation by Mangano, Nason, Ridolfi for the
382 // c-cbar single inclusive and double differential distributions.
383 // This parameter settings are meant to work with pp collisions
384 // and with kCTEQ5L PDFs.
385 // Added multiple interactions according to ATLAS tune settings.
386 // To get a "reasonable" agreement with MNR results, events have to be
387 // generated with the minimum ptHard (AliGenPythia::SetPtHard)
388 // set to 2.76 GeV.
389 // To get a "perfect" agreement with MNR results, events have to be
390 // generated in four ptHard bins with the following relative
391 // normalizations:
392 // 2.76-3 GeV: 25%
393 // 3-4 GeV: 40%
394 // 4-8 GeV: 29%
395 // >8 GeV: 6%
396 ConfigHeavyFlavor();
397 // Intrinsic <kT^2>
398 SetMSTP(91,1);
399 SetPARP(91,1.);
400 SetPARP(93,5.);
401
402 // Set c-quark mass
403 SetPMAS(4,1,1.2);
404 AtlasTuning();
405 break;
adf4d898 406 case kPyBeautyPbPbMNR:
8d2cd130 407 // Tuning of Pythia parameters aimed to get a resonable agreement
408 // between with the NLO calculation by Mangano, Nason, Ridolfi for the
409 // b-bbar single inclusive and double differential distributions.
410 // This parameter settings are meant to work with Pb-Pb collisions
411 // (AliGenPythia::SetNuclei) and with kCTEQ4L PDFs.
412 // To get a good agreement the minimum ptHard (AliGenPythia::SetPtHard)
413 // has to be set to 2.75GeV. Example in ConfigBeautyPPR.C.
3dc3ec94 414 ConfigHeavyFlavor();
8d2cd130 415 // QCD scales
3dc3ec94 416 SetPARP(67,1.0);
417 SetPARP(71,1.0);
adf4d898 418 // Intrinsic <kT>
3dc3ec94 419 SetMSTP(91,1);
420 SetPARP(91,2.035);
421 SetPARP(93,10.17);
8d2cd130 422 // Set b-quark mass
3dc3ec94 423 SetPMAS(5,1,4.75);
8d2cd130 424 break;
adf4d898 425 case kPyBeautypPbMNR:
426 // Tuning of Pythia parameters aimed to get a resonable agreement
427 // between with the NLO calculation by Mangano, Nason, Ridolfi for the
428 // b-bbar single inclusive and double differential distributions.
429 // This parameter settings are meant to work with p-Pb collisions
430 // (AliGenPythia::SetNuclei) and with kCTEQ4L PDFs.
431 // To get a good agreement the minimum ptHard (AliGenPythia::SetPtHard)
432 // has to be set to 2.75GeV. Example in ConfigBeautyPPR.C.
3dc3ec94 433 ConfigHeavyFlavor();
adf4d898 434 // QCD scales
3dc3ec94 435 SetPARP(67,1.0);
436 SetPARP(71,1.0);
adf4d898 437 // Intrinsic <kT>
3dc3ec94 438 SetMSTP(91,1);
439 SetPARP(91,1.60);
440 SetPARP(93,8.00);
adf4d898 441 // Set b-quark mass
3dc3ec94 442 SetPMAS(5,1,4.75);
adf4d898 443 break;
444 case kPyBeautyppMNR:
445 // Tuning of Pythia parameters aimed to get a resonable agreement
446 // between with the NLO calculation by Mangano, Nason, Ridolfi for the
447 // b-bbar single inclusive and double differential distributions.
448 // This parameter settings are meant to work with pp collisions
449 // (AliGenPythia::SetNuclei) and with kCTEQ4L PDFs.
450 // To get a good agreement the minimum ptHard (AliGenPythia::SetPtHard)
451 // has to be set to 2.75GeV. Example in ConfigBeautyPPR.C.
3dc3ec94 452 ConfigHeavyFlavor();
adf4d898 453 // QCD scales
3dc3ec94 454 SetPARP(67,1.0);
455 SetPARP(71,1.0);
456
457 // Intrinsic <kT>
458 SetMSTP(91,1);
459 SetPARP(91,1.);
460 SetPARP(93,5.);
461
462 // Set b-quark mass
463 SetPMAS(5,1,4.75);
adf4d898 464 break;
e0e89f40 465 case kPyBeautyppMNRwmi:
466 // Tuning of Pythia parameters aimed to get a resonable agreement
467 // between with the NLO calculation by Mangano, Nason, Ridolfi for the
468 // b-bbar single inclusive and double differential distributions.
469 // This parameter settings are meant to work with pp collisions
470 // and with kCTEQ5L PDFs.
471 // Added multiple interactions according to ATLAS tune settings.
472 // To get a "reasonable" agreement with MNR results, events have to be
473 // generated with the minimum ptHard (AliGenPythia::SetPtHard)
474 // set to 2.76 GeV.
475 // To get a "perfect" agreement with MNR results, events have to be
476 // generated in four ptHard bins with the following relative
477 // normalizations:
478 // 2.76-4 GeV: 5%
479 // 4-6 GeV: 31%
480 // 6-8 GeV: 28%
481 // >8 GeV: 36%
482 ConfigHeavyFlavor();
483 // QCD scales
484 SetPARP(67,1.0);
485 SetPARP(71,1.0);
486
487 // Intrinsic <kT>
488 SetMSTP(91,1);
489 SetPARP(91,1.);
490 SetPARP(93,5.);
491
492 // Set b-quark mass
493 SetPMAS(5,1,4.75);
494
495 AtlasTuning();
496 break;
589380c6 497 case kPyW:
498
499 //Inclusive production of W+/-
500 SetMSEL(0);
501 //f fbar -> W+
502 SetMSUB(2,1);
503 // //f fbar -> g W+
504 // SetMSUB(16,1);
505 // //f fbar -> gamma W+
506 // SetMSUB(20,1);
507 // //f g -> f W+
508 // SetMSUB(31,1);
509 // //f gamma -> f W+
510 // SetMSUB(36,1);
511
512 // Initial/final parton shower on (Pythia default)
513 // With parton showers on we are generating "W inclusive process"
514 SetMSTP(61,1); //Initial QCD & QED showers on
515 SetMSTP(71,1); //Final QCD & QED showers on
516
517 break;
0f6ee828 518
519 case kPyZ:
520
521 //Inclusive production of Z
522 SetMSEL(0);
523 //f fbar -> Z/gamma
524 SetMSUB(1,1);
525
526 // // f fbar -> g Z/gamma
527 // SetMSUB(15,1);
528 // // f fbar -> gamma Z/gamma
529 // SetMSUB(19,1);
530 // // f g -> f Z/gamma
531 // SetMSUB(30,1);
532 // // f gamma -> f Z/gamma
533 // SetMSUB(35,1);
534
535 //only Z included, not gamma
536 SetMSTP(43,2);
537
538 // Initial/final parton shower on (Pythia default)
539 // With parton showers on we are generating "Z inclusive process"
540 SetMSTP(61,1); //Initial QCD & QED showers on
541 SetMSTP(71,1); //Final QCD & QED showers on
542
543 break;
544
8d2cd130 545 }
546//
547// Initialize PYTHIA
548 SetMSTP(41,1); // all resonance decays switched on
549
550 Initialize("CMS","p","p",fEcms);
551
552}
553
554Int_t AliPythia::CheckedLuComp(Int_t kf)
555{
556// Check Lund particle code (for debugging)
557 Int_t kc=Pycomp(kf);
558 printf("\n Lucomp kf,kc %d %d",kf,kc);
559 return kc;
560}
561
562void AliPythia::SetNuclei(Int_t a1, Int_t a2)
563{
564// Treat protons as inside nuclei with mass numbers a1 and a2
565// The MSTP array in the PYPARS common block is used to enable and
566// select the nuclear structure functions.
567// MSTP(52) : (D=1) choice of proton and nuclear structure-function library
568// =1: internal PYTHIA acording to MSTP(51)
569// =2: PDFLIB proton s.f., with MSTP(51) = 1000xNGROUP+NSET
570// If the following mass number both not equal zero, nuclear corrections of the stf are used.
571// MSTP(192) : Mass number of nucleus side 1
572// MSTP(193) : Mass number of nucleus side 2
573 SetMSTP(52,2);
574 SetMSTP(192, a1);
575 SetMSTP(193, a2);
576}
577
578
579AliPythia* AliPythia::Instance()
580{
581// Set random number generator
582 if (fgAliPythia) {
583 return fgAliPythia;
584 } else {
585 fgAliPythia = new AliPythia();
586 return fgAliPythia;
587 }
588}
589
590void AliPythia::PrintParticles()
591{
592// Print list of particl properties
593 Int_t np = 0;
c31f1d37 594 char* name = new char[16];
8d2cd130 595 for (Int_t kf=0; kf<1000000; kf++) {
596 for (Int_t c = 1; c > -2; c-=2) {
8d2cd130 597 Int_t kc = Pycomp(c*kf);
598 if (kc) {
599 Float_t mass = GetPMAS(kc,1);
600 Float_t width = GetPMAS(kc,2);
601 Float_t tau = GetPMAS(kc,4);
c31f1d37 602
8d2cd130 603 Pyname(kf,name);
604
605 np++;
606
607 printf("\n mass, width, tau: %6d %s %10.3f %10.3e %10.3e",
608 c*kf, name, mass, width, tau);
609 }
610 }
611 }
612 printf("\n Number of particles %d \n \n", np);
613}
614
615void AliPythia::ResetDecayTable()
616{
617// Set default values for pythia decay switches
618 Int_t i;
619 for (i = 1; i < 501; i++) SetMDCY(i,1,fDefMDCY[i]);
620 for (i = 1; i < 2001; i++) SetMDME(i,1,fDefMDME[i]);
621}
622
623void AliPythia::SetDecayTable()
624{
625// Set default values for pythia decay switches
626//
627 Int_t i;
628 for (i = 1; i < 501; i++) fDefMDCY[i] = GetMDCY(i,1);
629 for (i = 1; i < 2001; i++) fDefMDME[i] = GetMDME(i,1);
630}
631
632void AliPythia::Pyclus(Int_t& njet)
633{
634// Call Pythia clustering algorithm
635//
636 pyclus(njet);
637}
638
639void AliPythia::Pycell(Int_t& njet)
640{
641// Call Pythia jet reconstruction algorithm
642//
643 pycell(njet);
644}
645
452af8c7 646void AliPythia::Pyshow(Int_t ip1, Int_t ip2, Double_t qmax)
647{
648// Call Pythia jet reconstruction algorithm
649//
452af8c7 650 pyshow(ip1, ip2, qmax);
651}
652
653void AliPythia::Pyrobo(Int_t imi, Int_t ima, Double_t the, Double_t phi, Double_t bex, Double_t bey, Double_t bez)
654{
655 pyrobo(imi, ima, the, phi, bex, bey, bez);
656}
657
658
659
86b6ad68 660void AliPythia::InitQuenching(Float_t cMin, Float_t cMax, Float_t k, Int_t iECMethod)
0f482ae4 661{
662// Initializes
663// (1) The quenching model using quenching weights according to C. Salgado and U. Wiedemann
664// (2) The nuclear geometry using the Glauber Model
665//
6b435cde 666
0f482ae4 667 fGlauber = new AliFastGlauber();
668 fGlauber->Init(2);
669 fGlauber->SetCentralityClass(cMin, cMax);
670
671 fQuenchingWeights = new AliQuenchingWeights();
672 fQuenchingWeights->InitMult();
86b6ad68 673 fQuenchingWeights->SetK(k);
0f482ae4 674 fQuenchingWeights->SetECMethod(AliQuenchingWeights::kECMethod(iECMethod));
0f482ae4 675}
676
677
452af8c7 678void AliPythia::Quench()
679{
680//
681//
682// Simple Jet Quenching routine:
683// =============================
684// The jet formed by all final state partons radiated by the parton created
0f482ae4 685// in the hard collisions is quenched by a factor (1-z) using light cone variables in
686// the initial parton reference frame:
452af8c7 687// (E + p_z)new = (1-z) (E + p_z)old
688//
0f482ae4 689//
690//
691//
452af8c7 692// The lost momentum is first balanced by one gluon with virtuality > 0.
693// Subsequently the gluon splits to yield two gluons with E = p.
694//
0f482ae4 695//
696//
4e383037 697 static Float_t eMean = 0.;
698 static Int_t icall = 0;
0f482ae4 699
c2c598a3 700 Double_t p0[4][5];
701 Double_t p1[4][5];
702 Double_t p2[4][5];
703 Int_t klast[4] = {-1, -1, -1, -1};
452af8c7 704
705 Int_t numpart = fPyjets->N;
86b6ad68 706 Double_t px = 0., py = 0., pz = 0., e = 0., m = 0., p = 0., pt = 0., theta = 0., phi = 0.;
c2c598a3 707 Double_t pxq[4], pyq[4], pzq[4], eq[4], yq[4], mq[4], pq[4], phiq[4], thetaq[4], ptq[4];
708 Bool_t quenched[4];
b280c4cc 709 Double_t wjtKick[4];
c2c598a3 710 Int_t nGluon[4];
86b6ad68 711 Int_t qPdg[4];
0f482ae4 712 Int_t imo, kst, pdg;
b280c4cc 713
511db649 714//
c2c598a3 715// Sore information about Primary partons
716//
717// j =
718// 0, 1 partons from hard scattering
719// 2, 3 partons from initial state radiation
720//
721 for (Int_t i = 2; i <= 7; i++) {
722 Int_t j = 0;
723 // Skip gluons that participate in hard scattering
724 if (i == 4 || i == 5) continue;
725 // Gluons from hard Scattering
726 if (i == 6 || i == 7) {
727 j = i - 6;
728 pxq[j] = fPyjets->P[0][i];
729 pyq[j] = fPyjets->P[1][i];
730 pzq[j] = fPyjets->P[2][i];
731 eq[j] = fPyjets->P[3][i];
732 mq[j] = fPyjets->P[4][i];
733 } else {
734 // Gluons from initial state radiation
735 //
736 // Obtain 4-momentum vector from difference between original parton and parton after gluon
737 // radiation. Energy is calculated independently because initial state radition does not
738 // conserve strictly momentum and energy for each partonic system independently.
739 //
740 // Not very clean. Should be improved !
741 //
742 //
743 j = i;
744 pxq[j] = fPyjets->P[0][i] - fPyjets->P[0][i+2];
745 pyq[j] = fPyjets->P[1][i] - fPyjets->P[1][i+2];
746 pzq[j] = fPyjets->P[2][i] - fPyjets->P[2][i+2];
747 mq[j] = fPyjets->P[4][i];
748 eq[j] = TMath::Sqrt(pxq[j] * pxq[j] + pyq[j] * pyq[j] + pzq[j] * pzq[j] + mq[j] * mq[j]);
749 }
750//
751// Calculate some kinematic variables
511db649 752//
4e383037 753 yq[j] = 0.5 * TMath::Log((eq[j] + pzq[j] + 1.e-14) / (eq[j] - pzq[j] + 1.e-14));
0f482ae4 754 pq[j] = TMath::Sqrt(pxq[j] * pxq[j] + pyq[j] * pyq[j] + pzq[j] * pzq[j]);
755 phiq[j] = TMath::Pi()+TMath::ATan2(-pyq[j], -pxq[j]);
756 ptq[j] = TMath::Sqrt(pxq[j] * pxq[j] + pyq[j] * pyq[j]);
757 thetaq[j] = TMath::ATan2(ptq[j], pzq[j]);
86b6ad68 758 qPdg[j] = fPyjets->K[1][i];
759 }
760
761 Double_t int0[4];
762 Double_t int1[4];
86b6ad68 763
b280c4cc 764 fGlauber->GetI0I1ForPythiaAndXY(4, phiq, int0, int1, fXJet, fYJet, 15.);
765
86b6ad68 766 for (Int_t j = 0; j < 4; j++) {
c2c598a3 767 //
768 // Quench only central jets and with E > 10.
769 //
86b6ad68 770
771
772 Int_t itype = (qPdg[j] == 21) ? 2 : 1;
773 Double_t eloss = fQuenchingWeights->GetELossRandomKFast(itype, int0[j], int1[j], eq[j]);
774
c2c598a3 775 if (TMath::Abs(yq[j]) > 2.5 || eq[j] < 10.) {
b280c4cc 776 fZQuench[j] = 0.;
0f482ae4 777 } else {
c2c598a3 778 if (eq[j] > 40. && TMath::Abs(yq[j]) < 0.5) {
4e383037 779 icall ++;
780 eMean += eloss;
781 }
0f482ae4 782 //
783 // Extra pt
86b6ad68 784 Double_t l = fQuenchingWeights->CalcLk(int0[j], int1[j]);
785 wjtKick[j] = TMath::Sqrt(l * fQuenchingWeights->CalcQk(int0[j], int1[j]));
0f482ae4 786 //
787 // Fractional energy loss
b280c4cc 788 fZQuench[j] = eloss / eq[j];
0f482ae4 789 //
790 // Avoid complete loss
791 //
6b435cde 792 if (fZQuench[j] == 1.) fZQuench[j] = 0.97;
0f482ae4 793 //
794 // Some debug printing
86b6ad68 795
796
bf9bb016 797// printf("Initial parton # %3d, Type %3d Energy %10.3f Phi %10.3f Length %10.3f Loss %10.3f Kick %10.3f Mean: %10.3f %10.3f\n",
798// j, itype, eq[j], phiq[j], l, eloss, wjtKick[j], eMean / Float_t(icall+1), yq[j]);
4e383037 799
b280c4cc 800// fZQuench[j] = 0.8;
801// while (fZQuench[j] >= 0.95) fZQuench[j] = gRandom->Exp(0.2);
0f482ae4 802 }
4e383037 803
b280c4cc 804 quenched[j] = (fZQuench[j] > 0.01);
4e383037 805 } // primary partons
c2c598a3 806
b280c4cc 807
808
6e90ad26 809 Double_t pNew[1000][4];
810 Int_t kNew[1000];
811 Int_t icount = 0;
b280c4cc 812 Double_t zquench[4];
813
6e90ad26 814//
4e383037 815// System Loop
c2c598a3 816 for (Int_t isys = 0; isys < 4; isys++) {
6e90ad26 817// Skip to next system if not quenched.
4e383037 818 if (!quenched[isys]) continue;
819
b280c4cc 820 nGluon[isys] = 1 + Int_t(fZQuench[isys] / (1. - fZQuench[isys]));
6b435cde 821 if (nGluon[isys] > 30) nGluon[isys] = 30;
b280c4cc 822 zquench[isys] = 1. - TMath::Power(1. - fZQuench[isys], 1./Double_t(nGluon[isys]));
4e383037 823 wjtKick[isys] = wjtKick[isys] / TMath::Sqrt(Double_t(nGluon[isys]));
0f482ae4 824
4e383037 825
826
827 Int_t igMin = -1;
828 Int_t igMax = -1;
829 Double_t pg[4] = {0., 0., 0., 0.};
830
831//
832// Loop on radiation events
833
834 for (Int_t iglu = 0; iglu < nGluon[isys]; iglu++) {
6e90ad26 835 while (1) {
836 icount = 0;
837 for (Int_t k = 0; k < 4; k++)
838 {
839 p0[isys][k] = 0.;
840 p1[isys][k] = 0.;
841 p2[isys][k] = 0.;
842 }
843// Loop over partons
844 for (Int_t i = 0; i < numpart; i++)
845 {
846 imo = fPyjets->K[2][i];
847 kst = fPyjets->K[0][i];
848 pdg = fPyjets->K[1][i];
849
850
851
0f482ae4 852// Quarks and gluons only
6e90ad26 853 if (pdg != 21 && TMath::Abs(pdg) > 6) continue;
0f482ae4 854// Particles from hard scattering only
c2c598a3 855
6e90ad26 856 if (imo > 8 && imo < 1000) imo = fPyjets->K[2][imo - 1];
c2c598a3 857 Int_t imom = imo % 1000;
858 if ((isys == 0 || isys == 1) && ((imom != (isys + 7)))) continue;
859 if ((isys == 2 || isys == 3) && ((imom != (isys + 1)))) continue;
860
6e90ad26 861
0f482ae4 862// Skip comment lines
6e90ad26 863 if (kst != 1 && kst != 2) continue;
0f482ae4 864//
865// Parton kinematic
6e90ad26 866 px = fPyjets->P[0][i];
867 py = fPyjets->P[1][i];
868 pz = fPyjets->P[2][i];
869 e = fPyjets->P[3][i];
870 m = fPyjets->P[4][i];
871 pt = TMath::Sqrt(px * px + py * py);
872 p = TMath::Sqrt(px * px + py * py + pz * pz);
873 phi = TMath::Pi() + TMath::ATan2(-py, -px);
874 theta = TMath::ATan2(pt, pz);
875
0f482ae4 876//
c2c598a3 877// Save 4-momentum sum for balancing
878 Int_t index = isys;
6e90ad26 879
880 p0[index][0] += px;
881 p0[index][1] += py;
882 p0[index][2] += pz;
883 p0[index][3] += e;
6e90ad26 884
885 klast[index] = i;
886
0f482ae4 887//
888// Fractional energy loss
b280c4cc 889 Double_t z = zquench[index];
4e383037 890
c2c598a3 891
4e383037 892// Don't fully quench radiated gluons
893//
894 if (imo > 1000) {
895// This small factor makes sure that the gluons are not too close in phase space to avoid recombination
896//
897
c2c598a3 898 z = 0.02;
4e383037 899 }
c2c598a3 900// printf("z: %d %f\n", imo, z);
901
4e383037 902
903//
6e90ad26 904
905 //
906 //
907 // Transform into frame in which initial parton is along z-axis
908 //
909 TVector3 v(px, py, pz);
910 v.RotateZ(-phiq[index]); v.RotateY(-thetaq[index]);
911 Double_t pxs = v.X(); Double_t pys = v.Y(); Double_t pl = v.Z();
912
913 Double_t jt = TMath::Sqrt(pxs * pxs + pys * pys);
914 Double_t mt2 = jt * jt + m * m;
915 Double_t zmax = 1.;
916 //
917 // Kinematic limit on z
918 //
4e383037 919 if (m > 0.) zmax = 1. - m / TMath::Sqrt(m * m + jt * jt);
6e90ad26 920 //
921 // Change light-cone kinematics rel. to initial parton
922 //
923 Double_t eppzOld = e + pl;
924 Double_t empzOld = e - pl;
925
926 Double_t eppzNew = (1. - z) * eppzOld;
927 Double_t empzNew = empzOld - mt2 * z / eppzOld;
928 Double_t eNew = 0.5 * (eppzNew + empzNew);
929 Double_t plNew = 0.5 * (eppzNew - empzNew);
930
931 Double_t jtNew;
932 //
933 // if mt very small (or sometimes even < 0 for numerical reasons) set it to 0
934 Double_t mt2New = eppzNew * empzNew;
935 if (mt2New < 1.e-8) mt2New = 0.;
4e383037 936 if (z < zmax) {
937 if (m * m > mt2New) {
938 //
939 // This should not happen
940 //
941 Fatal("Quench()", "This should never happen %e %e %e!", m, eppzNew, empzNew);
942 jtNew = 0;
943 } else {
944 jtNew = TMath::Sqrt(mt2New - m * m);
945 }
6e90ad26 946 } else {
4e383037 947 // If pT is to small (probably a leading massive particle) we scale only the energy
948 // This can cause negative masses of the radiated gluon
949 // Let's hope for the best ...
950 jtNew = jt;
951 eNew = TMath::Sqrt(plNew * plNew + mt2);
952
6e90ad26 953 }
6e90ad26 954 //
955 // Calculate new px, py
956 //
957 Double_t pxNew = jtNew / jt * pxs;
958 Double_t pyNew = jtNew / jt * pys;
959
960// Double_t dpx = pxs - pxNew;
961// Double_t dpy = pys - pyNew;
962// Double_t dpz = pl - plNew;
963// Double_t de = e - eNew;
964// Double_t dmass2 = de * de - dpx * dpx - dpy * dpy - dpz * dpz;
965// printf("New mass (1) %e %e %e %e %e %e %e \n", dmass2, jt, jtNew, pl, plNew, e, eNew);
966// printf("New mass (2) %e %e \n", pxNew, pyNew);
967 //
968 // Rotate back
969 //
970 TVector3 w(pxNew, pyNew, plNew);
971 w.RotateY(thetaq[index]); w.RotateZ(phiq[index]);
972 pxNew = w.X(); pyNew = w.Y(); plNew = w.Z();
973
974 p1[index][0] += pxNew;
975 p1[index][1] += pyNew;
976 p1[index][2] += plNew;
977 p1[index][3] += eNew;
978 //
979 // Updated 4-momentum vectors
980 //
981 pNew[icount][0] = pxNew;
982 pNew[icount][1] = pyNew;
983 pNew[icount][2] = plNew;
984 pNew[icount][3] = eNew;
985 kNew[icount] = i;
986 icount++;
987 } // parton loop
0f482ae4 988 //
6e90ad26 989 // Check if there was phase-space for quenching
0f482ae4 990 //
0f482ae4 991
6e90ad26 992 if (icount == 0) quenched[isys] = kFALSE;
993 if (!quenched[isys]) break;
994
995 for (Int_t j = 0; j < 4; j++)
996 {
997 p2[isys][j] = p0[isys][j] - p1[isys][j];
998 }
999 p2[isys][4] = p2[isys][3] * p2[isys][3] - p2[isys][0] * p2[isys][0] - p2[isys][1] * p2[isys][1] - p2[isys][2] * p2[isys][2];
6e90ad26 1000 if (p2[isys][4] > 0.) {
1001 p2[isys][4] = TMath::Sqrt(p2[isys][4]);
1002 break;
1003 } else {
b280c4cc 1004 printf("Warning negative mass squared in system %d %f ! \n", isys, zquench[isys]);
4e383037 1005 printf("4-Momentum: %10.3e %10.3e %10.3e %10.3e %10.3e \n", p2[isys][0], p2[isys][1], p2[isys][2], p2[isys][3], p2[isys][4]);
6e90ad26 1006 if (p2[isys][4] < -0.01) {
4e383037 1007 printf("Negative mass squared !\n");
1008 // Here we have to put the gluon back to mass shell
1009 // This will lead to a small energy imbalance
1010 p2[isys][4] = 0.;
1011 p2[isys][3] = TMath::Sqrt(p2[isys][0] * p2[isys][0] + p2[isys][1] * p2[isys][1] + p2[isys][2] * p2[isys][2]);
1012 break;
6e90ad26 1013 } else {
1014 p2[isys][4] = 0.;
1015 break;
1016 }
1017 }
6e90ad26 1018 /*
6e90ad26 1019 zHeavy *= 0.98;
1020 printf("zHeavy lowered to %f\n", zHeavy);
1021 if (zHeavy < 0.01) {
1022 printf("No success ! \n");
1023 icount = 0;
1024 quenched[isys] = kFALSE;
1025 break;
1026 }
4e383037 1027 */
1028 } // iteration on z (while)
1029
6e90ad26 1030// Update event record
1031 for (Int_t k = 0; k < icount; k++) {
1032// printf("%6d %6d %10.3e %10.3e %10.3e %10.3e\n", k, kNew[k], pNew[k][0],pNew[k][1], pNew[k][2], pNew[k][3] );
1033 fPyjets->P[0][kNew[k]] = pNew[k][0];
1034 fPyjets->P[1][kNew[k]] = pNew[k][1];
1035 fPyjets->P[2][kNew[k]] = pNew[k][2];
1036 fPyjets->P[3][kNew[k]] = pNew[k][3];
0f482ae4 1037 }
4e383037 1038 //
1039 // Add the gluons
1040 //
1041 Int_t ish = 0;
1837e95c 1042 Int_t iGlu;
4e383037 1043 if (!quenched[isys]) continue;
0f482ae4 1044//
1045// Last parton from shower i
4e383037 1046 Int_t in = klast[isys];
0f482ae4 1047//
1048// Continue if no parton in shower i selected
1049 if (in == -1) continue;
1050//
1051// If this is the second initial parton and it is behind the first move pointer by previous ish
4e383037 1052 if (isys == 1 && klast[1] > klast[0]) in += ish;
0f482ae4 1053//
1054// Starting index
452af8c7 1055
4e383037 1056// jmin = in - 1;
0f482ae4 1057// How many additional gluons will be generated
1058 ish = 1;
4e383037 1059 if (p2[isys][4] > 0.05) ish = 2;
0f482ae4 1060//
1061// Position of gluons
4e383037 1062 iGlu = numpart;
1063 if (iglu == 0) igMin = iGlu;
1064 igMax = iGlu;
0f482ae4 1065 numpart += ish;
1066 (fPyjets->N) += ish;
4e383037 1067
0f482ae4 1068 if (ish == 1) {
4e383037 1069 fPyjets->P[0][iGlu] = p2[isys][0];
1070 fPyjets->P[1][iGlu] = p2[isys][1];
1071 fPyjets->P[2][iGlu] = p2[isys][2];
1072 fPyjets->P[3][iGlu] = p2[isys][3];
1073 fPyjets->P[4][iGlu] = p2[isys][4];
0f482ae4 1074
4e383037 1075 fPyjets->K[0][iGlu] = 1;
1076 if (iglu == nGluon[isys] - 1) fPyjets->K[0][iGlu] = 1;
0f482ae4 1077 fPyjets->K[1][iGlu] = 21;
4e383037 1078 fPyjets->K[2][iGlu] = fPyjets->K[2][in] + 1000;
0f482ae4 1079 fPyjets->K[3][iGlu] = -1;
1080 fPyjets->K[4][iGlu] = -1;
4e383037 1081
1082 pg[0] += p2[isys][0];
1083 pg[1] += p2[isys][1];
1084 pg[2] += p2[isys][2];
1085 pg[3] += p2[isys][3];
0f482ae4 1086 } else {
1087 //
1088 // Split gluon in rest frame.
1089 //
4e383037 1090 Double_t bx = p2[isys][0] / p2[isys][3];
1091 Double_t by = p2[isys][1] / p2[isys][3];
1092 Double_t bz = p2[isys][2] / p2[isys][3];
1093 Double_t pst = p2[isys][4] / 2.;
0f482ae4 1094 //
1095 // Isotropic decay ????
1096 Double_t cost = 2. * gRandom->Rndm() - 1.;
1097 Double_t sint = TMath::Sqrt(1. - cost * cost);
1098 Double_t phi = 2. * TMath::Pi() * gRandom->Rndm();
1099
1100 Double_t pz1 = pst * cost;
1101 Double_t pz2 = -pst * cost;
1102 Double_t pt1 = pst * sint;
1103 Double_t pt2 = -pst * sint;
1104 Double_t px1 = pt1 * TMath::Cos(phi);
1105 Double_t py1 = pt1 * TMath::Sin(phi);
1106 Double_t px2 = pt2 * TMath::Cos(phi);
1107 Double_t py2 = pt2 * TMath::Sin(phi);
1108
1109 fPyjets->P[0][iGlu] = px1;
1110 fPyjets->P[1][iGlu] = py1;
1111 fPyjets->P[2][iGlu] = pz1;
1112 fPyjets->P[3][iGlu] = pst;
1113 fPyjets->P[4][iGlu] = 0.;
1114
4e383037 1115 fPyjets->K[0][iGlu] = 1 ;
0f482ae4 1116 fPyjets->K[1][iGlu] = 21;
4e383037 1117 fPyjets->K[2][iGlu] = fPyjets->K[2][in] + 1000;
0f482ae4 1118 fPyjets->K[3][iGlu] = -1;
1119 fPyjets->K[4][iGlu] = -1;
1120
1121 fPyjets->P[0][iGlu+1] = px2;
1122 fPyjets->P[1][iGlu+1] = py2;
1123 fPyjets->P[2][iGlu+1] = pz2;
1124 fPyjets->P[3][iGlu+1] = pst;
1125 fPyjets->P[4][iGlu+1] = 0.;
1126
4e383037 1127 fPyjets->K[0][iGlu+1] = 1;
1128 if (iglu == nGluon[isys] - 1) fPyjets->K[0][iGlu+1] = 1;
0f482ae4 1129 fPyjets->K[1][iGlu+1] = 21;
4e383037 1130 fPyjets->K[2][iGlu+1] = fPyjets->K[2][in] + 1000;
0f482ae4 1131 fPyjets->K[3][iGlu+1] = -1;
1132 fPyjets->K[4][iGlu+1] = -1;
1133 SetMSTU(1,0);
1134 SetMSTU(2,0);
1135 //
1136 // Boost back
1137 //
1138 Pyrobo(iGlu + 1, iGlu + 2, 0., 0., bx, by, bz);
1139 }
4e383037 1140/*
1141 for (Int_t ig = iGlu; ig < iGlu+ish; ig++) {
1142 Double_t px, py, pz;
1143 px = fPyjets->P[0][ig];
1144 py = fPyjets->P[1][ig];
1145 pz = fPyjets->P[2][ig];
1146 TVector3 v(px, py, pz);
1147 v.RotateZ(-phiq[isys]);
1148 v.RotateY(-thetaq[isys]);
1149 Double_t pxs = v.X(); Double_t pys = v.Y(); Double_t pzs = v.Z();
1150 Double_t r = AliPythiaRndm::GetPythiaRandom()->Rndm();
1151 Double_t jtKick = 0.3 * TMath::Sqrt(-TMath::Log(r));
1152 if (ish == 2) jtKick = wjtKick[i] * TMath::Sqrt(-TMath::Log(r)) / TMath::Sqrt(2.);
1153 Double_t phiKick = 2. * TMath::Pi() * AliPythiaRndm::GetPythiaRandom()->Rndm();
1154 pxs += jtKick * TMath::Cos(phiKick);
1155 pys += jtKick * TMath::Sin(phiKick);
1156 TVector3 w(pxs, pys, pzs);
1157 w.RotateY(thetaq[isys]);
1158 w.RotateZ(phiq[isys]);
1159 fPyjets->P[0][ig] = w.X();
1160 fPyjets->P[1][ig] = w.Y();
1161 fPyjets->P[2][ig] = w.Z();
1162 fPyjets->P[2][ig] = w.Mag();
1163 }
1164*/
1165 } // kGluon
1166
6e90ad26 1167
4e383037 1168 // Check energy conservation
0f482ae4 1169 Double_t pxs = 0.;
1170 Double_t pys = 0.;
1171 Double_t pzs = 0.;
1172 Double_t es = 14000.;
1173
1174 for (Int_t i = 0; i < numpart; i++)
1175 {
1176 kst = fPyjets->K[0][i];
1177 if (kst != 1 && kst != 2) continue;
1178 pxs += fPyjets->P[0][i];
1179 pys += fPyjets->P[1][i];
1180 pzs += fPyjets->P[2][i];
1181 es -= fPyjets->P[3][i];
1182 }
1183 if (TMath::Abs(pxs) > 1.e-2 ||
1184 TMath::Abs(pys) > 1.e-2 ||
1185 TMath::Abs(pzs) > 1.e-1) {
1186 printf("%e %e %e %e\n", pxs, pys, pzs, es);
4e383037 1187// Fatal("Quench()", "4-Momentum non-conservation");
452af8c7 1188 }
4e383037 1189
1190 } // end quenching loop (systems)
6e90ad26 1191// Clean-up
0f482ae4 1192 for (Int_t i = 0; i < numpart; i++)
1193 {
4e383037 1194 imo = fPyjets->K[2][i];
1195 if (imo > 1000) {
1196 fPyjets->K[2][i] = fPyjets->K[2][i] % 1000;
1197 }
0f482ae4 1198 }
4e383037 1199// this->Pylist(1);
0f482ae4 1200} // end quench
90d7b703 1201
992f2843 1202
1203void AliPythia::Pyquen(Double_t a, Int_t ibf, Double_t b)
1204{
1205 // Igor Lokthine's quenching routine
1206 pyquen(a, ibf, b);
1207}
b280c4cc 1208
16a82508 1209void AliPythia::Pyevnw()
1210{
1211 // New multiple interaction scenario
1212 pyevnw();
1213}
1214
b280c4cc 1215void AliPythia::GetQuenchingParameters(Double_t& xp, Double_t& yp, Double_t z[4])
1216{
1217 // Return event specific quenching parameters
1218 xp = fXJet;
1219 yp = fYJet;
1220 for (Int_t i = 0; i < 4; i++) z[i] = fZQuench[i];
1221
1222}
1223
3dc3ec94 1224void AliPythia::ConfigHeavyFlavor()
1225{
1226 //
1227 // Default configuration for Heavy Flavor production
1228 //
1229 // All QCD processes
1230 //
1231 SetMSEL(1);
1232
1233 // No multiple interactions
1234 SetMSTP(81,0);
39c2e610 1235 SetPARP(81, 0.);
1236 SetPARP(82, 0.);
3dc3ec94 1237 // Initial/final parton shower on (Pythia default)
1238 SetMSTP(61,1);
1239 SetMSTP(71,1);
1240
1241 // 2nd order alpha_s
1242 SetMSTP(2,2);
1243
1244 // QCD scales
1245 SetMSTP(32,2);
1246 SetPARP(34,1.0);
1247}
e0e89f40 1248
1249void AliPythia::AtlasTuning()
1250{
1251 //
1252 // Configuration for the ATLAS tuning
1253 SetMSTP(51, kCTEQ5L); // CTEQ5L pdf
1254 SetMSTP(81,1); // Multiple Interactions ON
1255 SetMSTP(82,4); // Double Gaussian Model
39c2e610 1256 SetPARP(81,1.9); // Min. pt for multiple interactions (default in 6.2-14)
e0e89f40 1257 SetPARP(82,1.8); // [GeV] PT_min at Ref. energy
1258 SetPARP(89,1000.); // [GeV] Ref. energy
1259 SetPARP(90,0.16); // 2*epsilon (exponent in power law)
1260 SetPARP(83,0.5); // Core density in proton matter distribution (def.value)
1261 SetPARP(84,0.5); // Core radius
1262 SetPARP(85,0.33); // Regulates gluon prod. mechanism
1263 SetPARP(86,0.66); // Regulates gluon prod. mechanism
1264 SetPARP(67,1); // Regulates Initial State Radiation
1265}
e8a8adcd 1266
1267AliPythia& AliPythia::operator=(const AliPythia& rhs)
1268{
1269// Assignment operator
1270 rhs.Copy(*this);
1271 return *this;
1272}
1273
1274 void AliPythia::Copy(TObject&) const
1275{
1276 //
1277 // Copy
1278 //
1279 Fatal("Copy","Not implemented!\n");
1280}