8d2cd130 |
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 | |
7cdba479 |
16 | /* $Id$ */ |
8d2cd130 |
17 | |
18 | // |
19 | // Generator using the TPythia interface (via AliPythia) |
20 | // to generate pp collisions. |
21 | // Using SetNuclei() also nuclear modifications to the structure functions |
22 | // can be taken into account. This makes, of course, only sense for the |
23 | // generation of the products of hard processes (heavy flavor, jets ...) |
24 | // |
25 | // andreas.morsch@cern.ch |
26 | // |
27 | |
28 | #include <TDatabasePDG.h> |
29 | #include <TParticle.h> |
30 | #include <TPDGCode.h> |
31 | #include <TSystem.h> |
32 | #include <TTree.h> |
8d2cd130 |
33 | #include "AliConst.h" |
34 | #include "AliDecayerPythia.h" |
35 | #include "AliGenPythia.h" |
5fa4b20b |
36 | #include "AliHeader.h" |
8d2cd130 |
37 | #include "AliGenPythiaEventHeader.h" |
38 | #include "AliPythia.h" |
7cdba479 |
39 | #include "AliPythiaRndm.h" |
8d2cd130 |
40 | #include "AliRun.h" |
7ea3ea5b |
41 | #include "AliStack.h" |
42 | #include "AliRunLoader.h" |
5d12ce38 |
43 | #include "AliMC.h" |
7c21f297 |
44 | #include "pyquenCommon.h" |
8d2cd130 |
45 | |
014a9521 |
46 | ClassImp(AliGenPythia) |
8d2cd130 |
47 | |
48 | AliGenPythia::AliGenPythia() |
49 | :AliGenMC() |
50 | { |
51 | // Default Constructor |
52 | fParticles = 0; |
53 | fPythia = 0; |
e5c87a3d |
54 | fHeader = 0; |
5fffd0fe |
55 | fReadFromFile = 0; |
f913ec4f |
56 | fEventTime = 0.; |
8ec89232 |
57 | fInteractionRate = 0.; |
9d7108a7 |
58 | fTimeWindow = 0.; |
59 | fEventsTime = 0; |
60 | fCurSubEvent = 0; |
8d2cd130 |
61 | fDecayer = new AliDecayerPythia(); |
62 | SetEventListRange(); |
63 | SetJetPhiRange(); |
64 | SetJetEtaRange(); |
65 | SetJetEtRange(); |
66 | SetGammaPhiRange(); |
67 | SetGammaEtaRange(); |
68 | SetPtKick(); |
7ea3ea5b |
69 | SetQuench(); |
5fa4b20b |
70 | SetHadronisation(); |
1d568bc2 |
71 | fSetNuclei = kFALSE; |
7cdba479 |
72 | if (!AliPythiaRndm::GetPythiaRandom()) |
73 | AliPythiaRndm::SetPythiaRandom(GetRandom()); |
8d2cd130 |
74 | } |
75 | |
76 | AliGenPythia::AliGenPythia(Int_t npart) |
77 | :AliGenMC(npart) |
78 | { |
79 | // default charm production at 5. 5 TeV |
80 | // semimuonic decay |
81 | // structure function GRVHO |
82 | // |
83 | fName = "Pythia"; |
84 | fTitle= "Particle Generator using PYTHIA"; |
85 | fXsection = 0.; |
5fffd0fe |
86 | fReadFromFile = 0; |
f913ec4f |
87 | fEventTime = 0.; |
8ec89232 |
88 | fInteractionRate = 0.; |
9d7108a7 |
89 | fTimeWindow = 0.; |
90 | fEventsTime = 0; |
91 | fCurSubEvent = 0; |
8d2cd130 |
92 | SetProcess(); |
93 | SetStrucFunc(); |
94 | SetForceDecay(); |
95 | SetPtHard(); |
96 | SetYHard(); |
97 | SetEnergyCMS(); |
98 | fDecayer = new AliDecayerPythia(); |
99 | // Set random number generator |
7cdba479 |
100 | if (!AliPythiaRndm::GetPythiaRandom()) |
101 | AliPythiaRndm::SetPythiaRandom(GetRandom()); |
8d2cd130 |
102 | fFlavorSelect = 0; |
103 | // Produced particles |
104 | fParticles = new TClonesArray("TParticle",1000); |
e5c87a3d |
105 | fHeader = 0; |
8d2cd130 |
106 | SetEventListRange(); |
107 | SetJetPhiRange(); |
108 | SetJetEtaRange(); |
109 | SetJetEtRange(); |
110 | SetGammaPhiRange(); |
111 | SetGammaEtaRange(); |
112 | SetJetReconstructionMode(); |
7ea3ea5b |
113 | SetQuench(); |
5fa4b20b |
114 | SetHadronisation(); |
8d2cd130 |
115 | SetPtKick(); |
116 | // Options determining what to keep in the stack (Heavy flavour generation) |
117 | fStackFillOpt = kFlavorSelection; // Keep particle with selected flavor |
118 | fFeedDownOpt = kTRUE; // allow feed down from higher family |
119 | // Fragmentation on/off |
120 | fFragmentation = kTRUE; |
121 | // Default counting mode |
122 | fCountMode = kCountAll; |
592f8307 |
123 | // Pycel |
124 | SetPycellParameters(); |
1d568bc2 |
125 | fSetNuclei = kFALSE; |
8d2cd130 |
126 | } |
127 | |
128 | AliGenPythia::AliGenPythia(const AliGenPythia & Pythia) |
f936b8ea |
129 | :AliGenMC(Pythia) |
8d2cd130 |
130 | { |
131 | // copy constructor |
132 | Pythia.Copy(*this); |
133 | } |
134 | |
135 | AliGenPythia::~AliGenPythia() |
136 | { |
137 | // Destructor |
9d7108a7 |
138 | if(fEventsTime) delete fEventsTime; |
139 | } |
140 | |
141 | void AliGenPythia::SetInteractionRate(Float_t rate,Float_t timewindow) |
142 | { |
143 | // Generate pileup using user specified rate |
144 | fInteractionRate = rate; |
145 | fTimeWindow = timewindow; |
146 | GeneratePileup(); |
147 | } |
148 | |
149 | void AliGenPythia::GeneratePileup() |
150 | { |
151 | // Generate sub events time for pileup |
152 | fEventsTime = 0; |
153 | if(fInteractionRate == 0.) { |
154 | Warning("GeneratePileup","Zero interaction specified. Skipping pileup generation.\n"); |
155 | return; |
156 | } |
157 | |
158 | Int_t npart = NumberParticles(); |
159 | if(npart < 0) { |
160 | Warning("GeneratePileup","Negative number of particles. Skipping pileup generation.\n"); |
161 | return; |
162 | } |
163 | |
164 | if(fEventsTime) delete fEventsTime; |
165 | fEventsTime = new TArrayF(npart); |
166 | TArrayF &array = *fEventsTime; |
167 | for(Int_t ipart = 0; ipart < npart; ipart++) |
168 | array[ipart] = 0.; |
169 | |
170 | Float_t eventtime = 0.; |
171 | while(1) |
172 | { |
173 | eventtime += (AliPythiaRndm::GetPythiaRandom())->Exp(1./fInteractionRate); |
174 | if(eventtime > fTimeWindow) break; |
175 | array.Set(array.GetSize()+1); |
176 | array[array.GetSize()-1] = eventtime; |
177 | } |
178 | |
179 | eventtime = 0.; |
180 | while(1) |
181 | { |
182 | eventtime -= (AliPythiaRndm::GetPythiaRandom())->Exp(1./fInteractionRate); |
183 | if(TMath::Abs(eventtime) > fTimeWindow) break; |
184 | array.Set(array.GetSize()+1); |
185 | array[array.GetSize()-1] = eventtime; |
186 | } |
187 | |
188 | SetNumberParticles(fEventsTime->GetSize()); |
8d2cd130 |
189 | } |
190 | |
592f8307 |
191 | void AliGenPythia::SetPycellParameters(Float_t etamax, Int_t neta, Int_t nphi, |
192 | Float_t thresh, Float_t etseed, Float_t minet, Float_t r) |
193 | { |
194 | // Set pycell parameters |
195 | fPycellEtaMax = etamax; |
196 | fPycellNEta = neta; |
197 | fPycellNPhi = nphi; |
198 | fPycellThreshold = thresh; |
199 | fPycellEtSeed = etseed; |
200 | fPycellMinEtJet = minet; |
201 | fPycellMaxRadius = r; |
202 | } |
203 | |
204 | |
205 | |
8d2cd130 |
206 | void AliGenPythia::SetEventListRange(Int_t eventFirst, Int_t eventLast) |
207 | { |
208 | // Set a range of event numbers, for which a table |
209 | // of generated particle will be printed |
210 | fDebugEventFirst = eventFirst; |
211 | fDebugEventLast = eventLast; |
212 | if (fDebugEventLast==-1) fDebugEventLast=fDebugEventFirst; |
213 | } |
214 | |
215 | void AliGenPythia::Init() |
216 | { |
217 | // Initialisation |
218 | |
219 | SetMC(AliPythia::Instance()); |
b88f5cea |
220 | fPythia=(AliPythia*) fMCEvGen; |
e2bddf81 |
221 | |
8d2cd130 |
222 | // |
223 | fParentWeight=1./Float_t(fNpart); |
224 | // |
225 | // Forward Paramters to the AliPythia object |
226 | fDecayer->SetForceDecay(fForceDecay); |
227 | fDecayer->Init(); |
228 | |
229 | |
230 | fPythia->SetCKIN(3,fPtHardMin); |
231 | fPythia->SetCKIN(4,fPtHardMax); |
232 | fPythia->SetCKIN(7,fYHardMin); |
233 | fPythia->SetCKIN(8,fYHardMax); |
234 | |
1a626d4e |
235 | if (fAProjectile > 0 && fATarget > 0) fPythia->SetNuclei(fAProjectile, fATarget); |
8d2cd130 |
236 | // Fragmentation? |
237 | if (fFragmentation) { |
238 | fPythia->SetMSTP(111,1); |
239 | } else { |
240 | fPythia->SetMSTP(111,0); |
241 | } |
242 | |
243 | |
244 | // initial state radiation |
245 | fPythia->SetMSTP(61,fGinit); |
246 | // final state radiation |
247 | fPythia->SetMSTP(71,fGfinal); |
248 | // pt - kick |
249 | if (fPtKick > 0.) { |
250 | fPythia->SetMSTP(91,1); |
251 | fPythia->SetPARP(91,fPtKick); |
252 | } else { |
253 | fPythia->SetMSTP(91,0); |
254 | } |
255 | |
5fa4b20b |
256 | |
257 | if (fReadFromFile) { |
258 | fRL = AliRunLoader::Open(fFileName, "Partons"); |
259 | fRL->LoadKinematics(); |
260 | fRL->LoadHeader(); |
261 | } else { |
262 | fRL = 0x0; |
263 | } |
264 | |
265 | |
8d2cd130 |
266 | // |
267 | fPythia->ProcInit(fProcess,fEnergyCMS,fStrucFunc); |
268 | |
269 | // Parent and Children Selection |
270 | switch (fProcess) |
271 | { |
65f2626c |
272 | case kPyOldUEQ2ordered: |
273 | case kPyOldUEQ2ordered2: |
274 | case kPyOldPopcorn: |
275 | break; |
8d2cd130 |
276 | case kPyCharm: |
277 | case kPyCharmUnforced: |
adf4d898 |
278 | case kPyCharmPbPbMNR: |
aabc7187 |
279 | case kPyCharmppMNR: |
280 | case kPyCharmpPbMNR: |
8d2cd130 |
281 | fParentSelect[0] = 411; |
282 | fParentSelect[1] = 421; |
283 | fParentSelect[2] = 431; |
284 | fParentSelect[3] = 4122; |
285 | fFlavorSelect = 4; |
286 | break; |
adf4d898 |
287 | case kPyD0PbPbMNR: |
288 | case kPyD0pPbMNR: |
289 | case kPyD0ppMNR: |
8d2cd130 |
290 | fParentSelect[0] = 421; |
291 | fFlavorSelect = 4; |
292 | break; |
90d7b703 |
293 | case kPyDPlusPbPbMNR: |
294 | case kPyDPluspPbMNR: |
295 | case kPyDPlusppMNR: |
296 | fParentSelect[0] = 411; |
297 | fFlavorSelect = 4; |
298 | break; |
8d2cd130 |
299 | case kPyBeauty: |
adf4d898 |
300 | case kPyBeautyPbPbMNR: |
301 | case kPyBeautypPbMNR: |
302 | case kPyBeautyppMNR: |
8d2cd130 |
303 | fParentSelect[0]= 511; |
304 | fParentSelect[1]= 521; |
305 | fParentSelect[2]= 531; |
306 | fParentSelect[3]= 5122; |
307 | fParentSelect[4]= 5132; |
308 | fParentSelect[5]= 5232; |
309 | fParentSelect[6]= 5332; |
310 | fFlavorSelect = 5; |
311 | break; |
312 | case kPyBeautyUnforced: |
313 | fParentSelect[0] = 511; |
314 | fParentSelect[1] = 521; |
315 | fParentSelect[2] = 531; |
316 | fParentSelect[3] = 5122; |
317 | fParentSelect[4] = 5132; |
318 | fParentSelect[5] = 5232; |
319 | fParentSelect[6] = 5332; |
320 | fFlavorSelect = 5; |
321 | break; |
322 | case kPyJpsiChi: |
323 | case kPyJpsi: |
324 | fParentSelect[0] = 443; |
325 | break; |
326 | case kPyMb: |
327 | case kPyMbNonDiffr: |
328 | case kPyJets: |
329 | case kPyDirectGamma: |
330 | break; |
589380c6 |
331 | case kPyW: |
0f6ee828 |
332 | case kPyZ: |
589380c6 |
333 | break; |
8d2cd130 |
334 | } |
335 | // |
592f8307 |
336 | // |
337 | // JetFinder for Trigger |
338 | // |
339 | // Configure detector (EMCAL like) |
340 | // |
341 | fPythia->SetPARU(51, fPycellEtaMax); |
342 | fPythia->SetMSTU(51, fPycellNEta); |
343 | fPythia->SetMSTU(52, fPycellNPhi); |
344 | // |
345 | // Configure Jet Finder |
346 | // |
347 | fPythia->SetPARU(58, fPycellThreshold); |
348 | fPythia->SetPARU(52, fPycellEtSeed); |
349 | fPythia->SetPARU(53, fPycellMinEtJet); |
350 | fPythia->SetPARU(54, fPycellMaxRadius); |
351 | fPythia->SetMSTU(54, 2); |
352 | // |
8d2cd130 |
353 | // This counts the total number of calls to Pyevnt() per run. |
354 | fTrialsRun = 0; |
355 | fQ = 0.; |
356 | fX1 = 0.; |
357 | fX2 = 0.; |
358 | fNev = 0 ; |
359 | // |
1d568bc2 |
360 | // |
361 | // |
8d2cd130 |
362 | AliGenMC::Init(); |
1d568bc2 |
363 | // |
364 | // |
365 | // |
366 | if (fSetNuclei) { |
367 | fDyBoost = 0; |
368 | Warning("Init","SetNuclei used. Use SetProjectile + SetTarget instead. fDyBoost has been reset to 0\n"); |
369 | } |
32d6ef7d |
370 | |
371 | if (fQuench) { |
5fa4b20b |
372 | fPythia->InitQuenching(0., 0.1, 0.6e6, 0); |
32d6ef7d |
373 | } |
374 | |
8d2cd130 |
375 | } |
376 | |
377 | void AliGenPythia::Generate() |
378 | { |
379 | // Generate one event |
e5c87a3d |
380 | |
8d2cd130 |
381 | fDecayer->ForceDecay(); |
382 | |
383 | Float_t polar[3] = {0,0,0}; |
384 | Float_t origin[3] = {0,0,0}; |
a920faf9 |
385 | Float_t p[4]; |
8d2cd130 |
386 | // converts from mm/c to s |
387 | const Float_t kconv=0.001/2.999792458e8; |
388 | // |
389 | Int_t nt=0; |
390 | Int_t jev=0; |
391 | Int_t j, kf; |
392 | fTrials=0; |
f913ec4f |
393 | fEventTime = 0.; |
394 | |
2590ccf9 |
395 | |
8d2cd130 |
396 | |
397 | // Set collision vertex position |
2590ccf9 |
398 | if (fVertexSmear == kPerEvent) Vertex(); |
399 | |
8d2cd130 |
400 | // event loop |
401 | while(1) |
402 | { |
32d6ef7d |
403 | // |
5fa4b20b |
404 | // Produce event |
32d6ef7d |
405 | // |
32d6ef7d |
406 | // |
5fa4b20b |
407 | // Switch hadronisation off |
408 | // |
409 | fPythia->SetMSTJ(1, 0); |
32d6ef7d |
410 | // |
5fa4b20b |
411 | // Either produce new event or read partons from file |
412 | // |
413 | if (!fReadFromFile) { |
414 | fPythia->Pyevnt(); |
415 | fNpartons = fPythia->GetN(); |
416 | } else { |
417 | printf("Loading Event %d\n",AliRunLoader::GetRunLoader()->GetEventNumber()); |
418 | fRL->GetEvent(AliRunLoader::GetRunLoader()->GetEventNumber()); |
419 | fPythia->SetN(0); |
420 | LoadEvent(fRL->Stack(), 0 , 1); |
421 | fPythia->Pyedit(21); |
422 | } |
423 | |
32d6ef7d |
424 | // |
425 | // Run quenching routine |
426 | // |
5fa4b20b |
427 | if (fQuench == 1) { |
428 | fPythia->Quench(); |
429 | } else if (fQuench == 2){ |
430 | fPythia->Pyquen(208., 0, 0.); |
431 | } |
32d6ef7d |
432 | // |
5fa4b20b |
433 | // Switch hadronisation on |
32d6ef7d |
434 | // |
aea21c57 |
435 | fPythia->SetMSTJ(1, 1); |
5fa4b20b |
436 | // |
437 | // .. and perform hadronisation |
aea21c57 |
438 | // printf("Calling hadronisation %d\n", fPythia->GetN()); |
5fa4b20b |
439 | fPythia->Pyexec(); |
8d2cd130 |
440 | fTrials++; |
8d2cd130 |
441 | fPythia->ImportParticles(fParticles,"All"); |
1d568bc2 |
442 | Boost(); |
8d2cd130 |
443 | // |
444 | // |
445 | // |
446 | Int_t i; |
447 | |
5fa4b20b |
448 | |
8d2cd130 |
449 | Int_t np = fParticles->GetEntriesFast(); |
5fa4b20b |
450 | |
7c21f297 |
451 | if (np == 0) continue; |
8d2cd130 |
452 | // |
2590ccf9 |
453 | |
8d2cd130 |
454 | // |
455 | Int_t* pParent = new Int_t[np]; |
456 | Int_t* pSelected = new Int_t[np]; |
457 | Int_t* trackIt = new Int_t[np]; |
5fa4b20b |
458 | for (i = 0; i < np; i++) { |
8d2cd130 |
459 | pParent[i] = -1; |
460 | pSelected[i] = 0; |
461 | trackIt[i] = 0; |
462 | } |
463 | |
464 | Int_t nc = 0; // Total n. of selected particles |
465 | Int_t nParents = 0; // Selected parents |
466 | Int_t nTkbles = 0; // Trackable particles |
467 | if (fProcess != kPyMb && fProcess != kPyJets && |
468 | fProcess != kPyDirectGamma && |
589380c6 |
469 | fProcess != kPyMbNonDiffr && |
0f6ee828 |
470 | fProcess != kPyW && fProcess != kPyZ ) { |
8d2cd130 |
471 | |
5fa4b20b |
472 | for (i = 0; i < np; i++) { |
2590ccf9 |
473 | TParticle* iparticle = (TParticle *) fParticles->At(i); |
8d2cd130 |
474 | Int_t ks = iparticle->GetStatusCode(); |
475 | kf = CheckPDGCode(iparticle->GetPdgCode()); |
476 | // No initial state partons |
477 | if (ks==21) continue; |
478 | // |
479 | // Heavy Flavor Selection |
480 | // |
481 | // quark ? |
482 | kf = TMath::Abs(kf); |
483 | Int_t kfl = kf; |
9ff6c04c |
484 | // Resonance |
f913ec4f |
485 | |
9ff6c04c |
486 | if (kfl > 100000) kfl %= 100000; |
183a5ca9 |
487 | if (kfl > 10000) kfl %= 10000; |
8d2cd130 |
488 | // meson ? |
489 | if (kfl > 10) kfl/=100; |
490 | // baryon |
491 | if (kfl > 10) kfl/=10; |
8d2cd130 |
492 | Int_t ipa = iparticle->GetFirstMother()-1; |
493 | Int_t kfMo = 0; |
f913ec4f |
494 | // |
495 | // Establish mother daughter relation between heavy quarks and mesons |
496 | // |
497 | if (kf >= fFlavorSelect && kf <= 6) { |
498 | Int_t idau = iparticle->GetFirstDaughter() - 1; |
499 | if (idau > -1) { |
500 | TParticle* daughter = (TParticle *) fParticles->At(idau); |
501 | Int_t pdgD = daughter->GetPdgCode(); |
502 | if (pdgD == 91 || pdgD == 92) { |
503 | Int_t jmin = daughter->GetFirstDaughter() - 1; |
504 | Int_t jmax = daughter->GetLastDaughter() - 1; |
505 | for (Int_t j = jmin; j <= jmax; j++) |
506 | ((TParticle *) fParticles->At(j))->SetFirstMother(i+1); |
507 | } // is string or cluster |
508 | } // has daughter |
509 | } // heavy quark |
8d2cd130 |
510 | |
f913ec4f |
511 | |
8d2cd130 |
512 | if (ipa > -1) { |
513 | TParticle * mother = (TParticle *) fParticles->At(ipa); |
514 | kfMo = TMath::Abs(mother->GetPdgCode()); |
515 | } |
f913ec4f |
516 | |
8d2cd130 |
517 | // What to keep in Stack? |
518 | Bool_t flavorOK = kFALSE; |
519 | Bool_t selectOK = kFALSE; |
520 | if (fFeedDownOpt) { |
32d6ef7d |
521 | if (kfl >= fFlavorSelect) flavorOK = kTRUE; |
8d2cd130 |
522 | } else { |
32d6ef7d |
523 | if (kfl > fFlavorSelect) { |
524 | nc = -1; |
525 | break; |
526 | } |
527 | if (kfl == fFlavorSelect) flavorOK = kTRUE; |
8d2cd130 |
528 | } |
529 | switch (fStackFillOpt) { |
530 | case kFlavorSelection: |
32d6ef7d |
531 | selectOK = kTRUE; |
532 | break; |
8d2cd130 |
533 | case kParentSelection: |
32d6ef7d |
534 | if (ParentSelected(kf) || kf <= 10) selectOK = kTRUE; |
535 | break; |
8d2cd130 |
536 | } |
537 | if (flavorOK && selectOK) { |
538 | // |
539 | // Heavy flavor hadron or quark |
540 | // |
541 | // Kinematic seletion on final state heavy flavor mesons |
542 | if (ParentSelected(kf) && !KinematicSelection(iparticle, 0)) |
543 | { |
9ff6c04c |
544 | continue; |
8d2cd130 |
545 | } |
546 | pSelected[i] = 1; |
547 | if (ParentSelected(kf)) ++nParents; // Update parent count |
548 | // printf("\n particle (HF) %d %d %d", i, pSelected[i], kf); |
549 | } else { |
550 | // Kinematic seletion on decay products |
551 | if (fCutOnChild && ParentSelected(kfMo) && ChildSelected(kf) |
9ff6c04c |
552 | && !KinematicSelection(iparticle, 1)) |
8d2cd130 |
553 | { |
9ff6c04c |
554 | continue; |
8d2cd130 |
555 | } |
556 | // |
557 | // Decay products |
558 | // Select if mother was selected and is not tracked |
559 | |
560 | if (pSelected[ipa] && |
561 | !trackIt[ipa] && // mother will be tracked ? |
562 | kfMo != 5 && // mother is b-quark, don't store fragments |
563 | kfMo != 4 && // mother is c-quark, don't store fragments |
564 | kf != 92) // don't store string |
565 | { |
566 | // |
567 | // Semi-stable or de-selected: diselect decay products: |
568 | // |
569 | // |
570 | if (pSelected[i] == -1 || fDecayer->GetLifetime(kf) > fMaxLifeTime) |
571 | { |
572 | Int_t ipF = iparticle->GetFirstDaughter(); |
573 | Int_t ipL = iparticle->GetLastDaughter(); |
574 | if (ipF > 0) for (j = ipF-1; j < ipL; j++) pSelected[j] = -1; |
575 | } |
576 | // printf("\n particle (decay) %d %d %d", i, pSelected[i], kf); |
577 | pSelected[i] = (pSelected[i] == -1) ? 0 : 1; |
578 | } |
579 | } |
580 | if (pSelected[i] == -1) pSelected[i] = 0; |
581 | if (!pSelected[i]) continue; |
582 | // Count quarks only if you did not include fragmentation |
583 | if (fFragmentation && kf <= 10) continue; |
9ff6c04c |
584 | |
8d2cd130 |
585 | nc++; |
586 | // Decision on tracking |
587 | trackIt[i] = 0; |
588 | // |
589 | // Track final state particle |
590 | if (ks == 1) trackIt[i] = 1; |
591 | // Track semi-stable particles |
d25cfd65 |
592 | if ((ks == 1) || (fDecayer->GetLifetime(kf) > fMaxLifeTime)) trackIt[i] = 1; |
8d2cd130 |
593 | // Track particles selected by process if undecayed. |
594 | if (fForceDecay == kNoDecay) { |
595 | if (ParentSelected(kf)) trackIt[i] = 1; |
596 | } else { |
597 | if (ParentSelected(kf)) trackIt[i] = 0; |
598 | } |
599 | if (trackIt[i] == 1) ++nTkbles; // Update trackable counter |
600 | // |
601 | // |
602 | |
603 | } // particle selection loop |
604 | if (nc > 0) { |
605 | for (i = 0; i<np; i++) { |
606 | if (!pSelected[i]) continue; |
607 | TParticle * iparticle = (TParticle *) fParticles->At(i); |
608 | kf = CheckPDGCode(iparticle->GetPdgCode()); |
609 | Int_t ks = iparticle->GetStatusCode(); |
610 | p[0] = iparticle->Px(); |
611 | p[1] = iparticle->Py(); |
612 | p[2] = iparticle->Pz(); |
a920faf9 |
613 | p[3] = iparticle->Energy(); |
614 | |
2590ccf9 |
615 | origin[0] = fVertex[0]+iparticle->Vx()/10; // [cm] |
616 | origin[1] = fVertex[1]+iparticle->Vy()/10; // [cm] |
617 | origin[2] = fVertex[2]+iparticle->Vz()/10; // [cm] |
618 | |
8d2cd130 |
619 | Float_t tof = kconv*iparticle->T(); |
620 | Int_t ipa = iparticle->GetFirstMother()-1; |
621 | Int_t iparent = (ipa > -1) ? pParent[ipa] : -1; |
a920faf9 |
622 | |
623 | PushTrack(fTrackIt*trackIt[i], iparent, kf, |
624 | p[0], p[1], p[2], p[3], |
625 | origin[0], origin[1], origin[2], tof, |
626 | polar[0], polar[1], polar[2], |
627 | kPPrimary, nt, 1., ks); |
8d2cd130 |
628 | pParent[i] = nt; |
629 | KeepTrack(nt); |
642f15cf |
630 | } // PushTrack loop |
8d2cd130 |
631 | } |
632 | } else { |
633 | nc = GenerateMB(); |
634 | } // mb ? |
f913ec4f |
635 | |
636 | GetSubEventTime(); |
8d2cd130 |
637 | |
638 | if (pParent) delete[] pParent; |
639 | if (pSelected) delete[] pSelected; |
640 | if (trackIt) delete[] trackIt; |
641 | |
642 | if (nc > 0) { |
643 | switch (fCountMode) { |
644 | case kCountAll: |
645 | // printf(" Count all \n"); |
646 | jev += nc; |
647 | break; |
648 | case kCountParents: |
649 | // printf(" Count parents \n"); |
650 | jev += nParents; |
651 | break; |
652 | case kCountTrackables: |
653 | // printf(" Count trackable \n"); |
654 | jev += nTkbles; |
655 | break; |
656 | } |
657 | if (jev >= fNpart || fNpart == -1) { |
658 | fKineBias=Float_t(fNpart)/Float_t(fTrials); |
659 | printf("\n Trials: %i %i %i\n",fTrials, fNpart, jev); |
660 | |
661 | fQ += fPythia->GetVINT(51); |
662 | fX1 += fPythia->GetVINT(41); |
663 | fX2 += fPythia->GetVINT(42); |
664 | fTrialsRun += fTrials; |
665 | fNev++; |
666 | MakeHeader(); |
667 | break; |
668 | } |
669 | } |
670 | } // event loop |
671 | SetHighWaterMark(nt); |
672 | // adjust weight due to kinematic selection |
b88f5cea |
673 | // AdjustWeights(); |
8d2cd130 |
674 | // get cross-section |
675 | fXsection=fPythia->GetPARI(1); |
676 | } |
677 | |
678 | Int_t AliGenPythia::GenerateMB() |
679 | { |
680 | // |
681 | // Min Bias selection and other global selections |
682 | // |
683 | Int_t i, kf, nt, iparent; |
684 | Int_t nc = 0; |
bf950da8 |
685 | Float_t p[4]; |
8d2cd130 |
686 | Float_t polar[3] = {0,0,0}; |
687 | Float_t origin[3] = {0,0,0}; |
688 | // converts from mm/c to s |
689 | const Float_t kconv=0.001/2.999792458e8; |
690 | |
5fa4b20b |
691 | |
692 | |
693 | Int_t np = (fHadronisation) ? fParticles->GetEntriesFast() : fNpartons; |
aea21c57 |
694 | |
5fa4b20b |
695 | |
8d2cd130 |
696 | Int_t* pParent = new Int_t[np]; |
697 | for (i=0; i< np; i++) pParent[i] = -1; |
698 | if (fProcess == kPyJets || fProcess == kPyDirectGamma) { |
699 | TParticle* jet1 = (TParticle *) fParticles->At(6); |
700 | TParticle* jet2 = (TParticle *) fParticles->At(7); |
aea21c57 |
701 | if (!CheckTrigger(jet1, jet2)) return 0; |
8d2cd130 |
702 | } |
703 | |
aea21c57 |
704 | |
0f6ee828 |
705 | //Introducing child cuts in case kPyW, kPyZ, kPyMb, and kPyMbNonDiff |
706 | if ( (fProcess == kPyW || fProcess == kPyZ || fProcess == kPyMb || fProcess == kPyMbNonDiffr) |
707 | && (fCutOnChild == 1) ) { |
708 | if ( !CheckKinematicsOnChild() ) { |
709 | if (pParent) delete[] pParent; |
710 | return 0; |
711 | } |
aea21c57 |
712 | } |
713 | |
714 | |
f913ec4f |
715 | for (i = 0; i < np; i++) { |
8d2cd130 |
716 | Int_t trackIt = 0; |
717 | TParticle * iparticle = (TParticle *) fParticles->At(i); |
718 | kf = CheckPDGCode(iparticle->GetPdgCode()); |
719 | Int_t ks = iparticle->GetStatusCode(); |
720 | Int_t km = iparticle->GetFirstMother(); |
721 | if ((ks == 1 && kf!=0 && KinematicSelection(iparticle, 0)) || |
722 | (ks != 1) || |
723 | (fProcess == kPyJets && ks == 21 && km == 0 && i>1)) { |
724 | nc++; |
725 | if (ks == 1) trackIt = 1; |
726 | Int_t ipa = iparticle->GetFirstMother()-1; |
727 | |
728 | iparent = (ipa > -1) ? pParent[ipa] : -1; |
729 | |
730 | // |
731 | // store track information |
732 | p[0] = iparticle->Px(); |
733 | p[1] = iparticle->Py(); |
734 | p[2] = iparticle->Pz(); |
a920faf9 |
735 | p[3] = iparticle->Energy(); |
1406f599 |
736 | |
a920faf9 |
737 | |
2590ccf9 |
738 | origin[0] = fVertex[0]+iparticle->Vx()/10; // [cm] |
739 | origin[1] = fVertex[1]+iparticle->Vy()/10; // [cm] |
740 | origin[2] = fVertex[2]+iparticle->Vz()/10; // [cm] |
741 | |
f913ec4f |
742 | Float_t tof = fEventTime + kconv * iparticle->T(); |
a920faf9 |
743 | |
744 | PushTrack(fTrackIt*trackIt, iparent, kf, |
745 | p[0], p[1], p[2], p[3], |
746 | origin[0], origin[1], origin[2], tof, |
747 | polar[0], polar[1], polar[2], |
748 | kPPrimary, nt, 1., ks); |
5fa4b20b |
749 | // |
750 | // Special Treatment to store color-flow |
751 | // |
752 | if (ks == 3 || ks == 13 || ks == 14) { |
753 | TParticle* particle = 0; |
754 | if (fStack) { |
755 | particle = fStack->Particle(nt); |
756 | } else { |
757 | particle = gAlice->Stack()->Particle(nt); |
758 | } |
759 | particle->SetFirstDaughter(fPythia->GetK(2, i)); |
760 | particle->SetLastDaughter(fPythia->GetK(3, i)); |
761 | } |
762 | |
8d2cd130 |
763 | KeepTrack(nt); |
764 | pParent[i] = nt; |
f913ec4f |
765 | SetHighWaterMark(nt); |
766 | |
8d2cd130 |
767 | } // select particle |
768 | } // particle loop |
769 | |
770 | if (pParent) delete[] pParent; |
771 | |
772 | printf("\n I've put %i particles on the stack \n",nc); |
f913ec4f |
773 | return 1; |
8d2cd130 |
774 | } |
775 | |
776 | |
777 | void AliGenPythia::FinishRun() |
778 | { |
779 | // Print x-section summary |
780 | fPythia->Pystat(1); |
2779fc64 |
781 | |
782 | if (fNev > 0.) { |
783 | fQ /= fNev; |
784 | fX1 /= fNev; |
785 | fX2 /= fNev; |
786 | } |
787 | |
8d2cd130 |
788 | printf("\nTotal number of Pyevnt() calls %d\n", fTrialsRun); |
789 | printf("\nMean Q, x1, x2: %f %f %f\n", fQ, fX1, fX2); |
8d2cd130 |
790 | } |
791 | |
792 | void AliGenPythia::AdjustWeights() |
793 | { |
794 | // Adjust the weights after generation of all events |
795 | // |
e2bddf81 |
796 | if (gAlice) { |
797 | TParticle *part; |
798 | Int_t ntrack=gAlice->GetMCApp()->GetNtrack(); |
799 | for (Int_t i=0; i<ntrack; i++) { |
800 | part= gAlice->GetMCApp()->Particle(i); |
801 | part->SetWeight(part->GetWeight()*fKineBias); |
802 | } |
8d2cd130 |
803 | } |
804 | } |
805 | |
806 | void AliGenPythia::SetNuclei(Int_t a1, Int_t a2) |
807 | { |
808 | // Treat protons as inside nuclei with mass numbers a1 and a2 |
1d568bc2 |
809 | |
1a626d4e |
810 | fAProjectile = a1; |
811 | fATarget = a2; |
1d568bc2 |
812 | fSetNuclei = kTRUE; |
8d2cd130 |
813 | } |
814 | |
815 | |
816 | void AliGenPythia::MakeHeader() |
817 | { |
183a5ca9 |
818 | if (gAlice) { |
819 | if (gAlice->GetEvNumber()>=fDebugEventFirst && |
f913ec4f |
820 | gAlice->GetEvNumber()<=fDebugEventLast) fPythia->Pylist(2); |
183a5ca9 |
821 | } |
822 | |
8d2cd130 |
823 | // Builds the event header, to be called after each event |
e5c87a3d |
824 | if (fHeader) delete fHeader; |
825 | fHeader = new AliGenPythiaEventHeader("Pythia"); |
8d2cd130 |
826 | // |
827 | // Event type |
e5c87a3d |
828 | ((AliGenPythiaEventHeader*) fHeader)->SetProcessType(fPythia->GetMSTI(1)); |
8d2cd130 |
829 | // |
830 | // Number of trials |
e5c87a3d |
831 | ((AliGenPythiaEventHeader*) fHeader)->SetTrials(fTrials); |
8d2cd130 |
832 | // |
833 | // Event Vertex |
d25cfd65 |
834 | fHeader->SetPrimaryVertex(fVertex); |
8d2cd130 |
835 | // |
836 | // Jets that have triggered |
f913ec4f |
837 | |
8d2cd130 |
838 | if (fProcess == kPyJets) |
839 | { |
840 | Int_t ntrig, njet; |
841 | Float_t jets[4][10]; |
842 | GetJets(njet, ntrig, jets); |
9ff6c04c |
843 | |
8d2cd130 |
844 | |
845 | for (Int_t i = 0; i < ntrig; i++) { |
e5c87a3d |
846 | ((AliGenPythiaEventHeader*) fHeader)->AddJet(jets[0][i], jets[1][i], jets[2][i], |
8d2cd130 |
847 | jets[3][i]); |
848 | } |
849 | } |
5fa4b20b |
850 | // |
851 | // Copy relevant information from external header, if present. |
852 | // |
853 | Float_t uqJet[4]; |
854 | |
855 | if (fRL) { |
856 | AliGenPythiaEventHeader* exHeader = (AliGenPythiaEventHeader*) (fRL->GetHeader()->GenEventHeader()); |
857 | for (Int_t i = 0; i < exHeader->NTriggerJets(); i++) |
858 | { |
859 | printf("Adding Jet %d %d \n", i, exHeader->NTriggerJets()); |
860 | |
861 | |
862 | exHeader->TriggerJet(i, uqJet); |
863 | ((AliGenPythiaEventHeader*) fHeader)->AddUQJet(uqJet[0], uqJet[1], uqJet[2], uqJet[3]); |
864 | } |
865 | } |
866 | // |
867 | // Store quenching parameters |
868 | // |
869 | if (fQuench){ |
870 | Double_t z[4]; |
871 | Double_t xp, yp; |
7c21f297 |
872 | if (fQuench == 1) { |
873 | // Pythia::Quench() |
874 | fPythia->GetQuenchingParameters(xp, yp, z); |
875 | } else { |
876 | // Pyquen |
877 | Double_t r1 = PARIMP.rb1; |
878 | Double_t r2 = PARIMP.rb2; |
879 | Double_t b = PARIMP.b1; |
880 | Double_t r = 0.5 * TMath::Sqrt(2. * (r1 * r1 + r2 * r2) - b * b); |
881 | Double_t phi = PARIMP.psib1; |
882 | xp = r * TMath::Cos(phi); |
883 | yp = r * TMath::Sin(phi); |
884 | |
885 | } |
886 | ((AliGenPythiaEventHeader*) fHeader)->SetXYJet(xp, yp); |
887 | ((AliGenPythiaEventHeader*) fHeader)->SetZQuench(z); |
888 | } |
5fa4b20b |
889 | |
890 | // |
cf57b268 |
891 | // Pass header |
5fa4b20b |
892 | // |
cf57b268 |
893 | AddHeader(fHeader); |
8d2cd130 |
894 | } |
cf57b268 |
895 | |
896 | void AliGenPythia::AddHeader(AliGenEventHeader* header) |
897 | { |
898 | // Add header to container or runloader |
899 | if (fContainer) { |
900 | fContainer->AddHeader(header); |
901 | } else { |
902 | AliRunLoader::GetRunLoader()->GetHeader()->SetGenEventHeader(header); |
903 | } |
904 | } |
905 | |
8d2cd130 |
906 | |
907 | Bool_t AliGenPythia::CheckTrigger(TParticle* jet1, TParticle* jet2) |
908 | { |
909 | // Check the kinematic trigger condition |
910 | // |
911 | Double_t eta[2]; |
912 | eta[0] = jet1->Eta(); |
913 | eta[1] = jet2->Eta(); |
914 | Double_t phi[2]; |
915 | phi[0] = jet1->Phi(); |
916 | phi[1] = jet2->Phi(); |
917 | Int_t pdg[2]; |
918 | pdg[0] = jet1->GetPdgCode(); |
919 | pdg[1] = jet2->GetPdgCode(); |
920 | Bool_t triggered = kFALSE; |
921 | |
922 | if (fProcess == kPyJets) { |
923 | Int_t njets = 0; |
924 | Int_t ntrig = 0; |
925 | Float_t jets[4][10]; |
926 | // |
927 | // Use Pythia clustering on parton level to determine jet axis |
928 | // |
929 | GetJets(njets, ntrig, jets); |
930 | |
931 | if (ntrig) triggered = kTRUE; |
932 | // |
933 | } else { |
934 | Int_t ij = 0; |
935 | Int_t ig = 1; |
936 | if (pdg[0] == kGamma) { |
937 | ij = 1; |
938 | ig = 0; |
939 | } |
940 | //Check eta range first... |
941 | if ((eta[ij] < fEtaMaxJet && eta[ij] > fEtaMinJet) && |
942 | (eta[ig] < fEtaMaxGamma && eta[ig] > fEtaMinGamma)) |
943 | { |
944 | //Eta is okay, now check phi range |
945 | if ((phi[ij] < fPhiMaxJet && phi[ij] > fPhiMinJet) && |
946 | (phi[ig] < fPhiMaxGamma && phi[ig] > fPhiMinGamma)) |
947 | { |
948 | triggered = kTRUE; |
949 | } |
950 | } |
951 | } |
952 | return triggered; |
953 | } |
aea21c57 |
954 | |
955 | |
956 | //Checking Kinematics on Child (status code 1, particle code ?, kin cuts |
957 | Bool_t AliGenPythia::CheckKinematicsOnChild(){ |
958 | |
959 | Bool_t checking = kFALSE; |
960 | Int_t j, kcode, ks, km; |
961 | Int_t nPartAcc = 0; //number of particles in the acceptance range |
962 | Int_t numberOfAcceptedParticles = 1; |
963 | if (fNumberOfAcceptedParticles != 0) { numberOfAcceptedParticles = fNumberOfAcceptedParticles; } |
964 | Int_t npart = fParticles->GetEntriesFast(); |
965 | |
0f6ee828 |
966 | for (j = 0; j<npart; j++) { |
aea21c57 |
967 | TParticle * jparticle = (TParticle *) fParticles->At(j); |
968 | kcode = TMath::Abs( CheckPDGCode(jparticle->GetPdgCode()) ); |
969 | ks = jparticle->GetStatusCode(); |
970 | km = jparticle->GetFirstMother(); |
971 | |
972 | if( (ks == 1) && (kcode == fPdgCodeParticleforAcceptanceCut) && (KinematicSelection(jparticle,1)) ){ |
973 | nPartAcc++; |
974 | } |
0f6ee828 |
975 | if( numberOfAcceptedParticles <= nPartAcc){ |
976 | checking = kTRUE; |
977 | break; |
978 | } |
aea21c57 |
979 | } |
0f6ee828 |
980 | |
aea21c57 |
981 | return checking; |
aea21c57 |
982 | } |
983 | |
8d2cd130 |
984 | |
985 | AliGenPythia& AliGenPythia::operator=(const AliGenPythia& rhs) |
986 | { |
987 | // Assignment operator |
014a9521 |
988 | rhs.Copy(*this); |
8d2cd130 |
989 | return *this; |
990 | } |
991 | |
5fa4b20b |
992 | void AliGenPythia::LoadEvent(AliStack* stack, Int_t flag, Int_t reHadr) |
8d2cd130 |
993 | { |
994 | // |
995 | // Load event into Pythia Common Block |
996 | // |
5fa4b20b |
997 | |
32d6ef7d |
998 | Int_t npart = stack -> GetNprimary(); |
999 | Int_t n0 = 0; |
1000 | |
1001 | if (!flag) { |
1002 | (fPythia->GetPyjets())->N = npart; |
1003 | } else { |
1004 | n0 = (fPythia->GetPyjets())->N; |
1005 | (fPythia->GetPyjets())->N = n0 + npart; |
1006 | } |
1007 | |
1008 | |
8d2cd130 |
1009 | for (Int_t part = 0; part < npart; part++) { |
32d6ef7d |
1010 | TParticle *MPart = stack->Particle(part); |
1011 | |
5fa4b20b |
1012 | Int_t kf = MPart->GetPdgCode(); |
1013 | Int_t ks = MPart->GetStatusCode(); |
1014 | Int_t idf = MPart->GetFirstDaughter(); |
1015 | Int_t idl = MPart->GetLastDaughter(); |
1016 | |
1017 | if (reHadr) { |
1018 | if (ks == 11 || ks == 12) { |
1019 | ks -= 10; |
1020 | idf = -1; |
1021 | idl = -1; |
1022 | } |
1023 | } |
32d6ef7d |
1024 | |
8d2cd130 |
1025 | Float_t px = MPart->Px(); |
1026 | Float_t py = MPart->Py(); |
1027 | Float_t pz = MPart->Pz(); |
1028 | Float_t e = MPart->Energy(); |
a920faf9 |
1029 | Float_t m = MPart->GetCalcMass(); |
8d2cd130 |
1030 | |
1031 | |
32d6ef7d |
1032 | (fPythia->GetPyjets())->P[0][part+n0] = px; |
1033 | (fPythia->GetPyjets())->P[1][part+n0] = py; |
1034 | (fPythia->GetPyjets())->P[2][part+n0] = pz; |
1035 | (fPythia->GetPyjets())->P[3][part+n0] = e; |
1036 | (fPythia->GetPyjets())->P[4][part+n0] = m; |
8d2cd130 |
1037 | |
32d6ef7d |
1038 | (fPythia->GetPyjets())->K[1][part+n0] = kf; |
1039 | (fPythia->GetPyjets())->K[0][part+n0] = ks; |
5fa4b20b |
1040 | (fPythia->GetPyjets())->K[3][part+n0] = idf + 1; |
1041 | (fPythia->GetPyjets())->K[4][part+n0] = idl + 1; |
1042 | (fPythia->GetPyjets())->K[2][part+n0] = MPart->GetFirstMother() + 1; |
8d2cd130 |
1043 | } |
1044 | } |
1045 | |
5fa4b20b |
1046 | |
014a9521 |
1047 | void AliGenPythia::RecJetsUA1(Int_t& njets, Float_t jets [4][50]) |
8d2cd130 |
1048 | { |
1049 | // |
1050 | // Calls the Pythia jet finding algorithm to find jets in the current event |
1051 | // |
1052 | // |
8d2cd130 |
1053 | // |
1054 | // Save jets |
1055 | Int_t n = fPythia->GetN(); |
1056 | |
1057 | // |
1058 | // Run Jet Finder |
1059 | fPythia->Pycell(njets); |
1060 | Int_t i; |
1061 | for (i = 0; i < njets; i++) { |
1062 | Float_t px = (fPythia->GetPyjets())->P[0][n+i]; |
1063 | Float_t py = (fPythia->GetPyjets())->P[1][n+i]; |
1064 | Float_t pz = (fPythia->GetPyjets())->P[2][n+i]; |
1065 | Float_t e = (fPythia->GetPyjets())->P[3][n+i]; |
1066 | |
1067 | jets[0][i] = px; |
1068 | jets[1][i] = py; |
1069 | jets[2][i] = pz; |
1070 | jets[3][i] = e; |
1071 | } |
1072 | } |
1073 | |
1074 | |
1075 | |
1076 | void AliGenPythia::GetJets(Int_t& nJets, Int_t& nJetsTrig, Float_t jets[4][10]) |
1077 | { |
1078 | // |
1079 | // Calls the Pythia clustering algorithm to find jets in the current event |
1080 | // |
1081 | Int_t n = fPythia->GetN(); |
1082 | nJets = 0; |
1083 | nJetsTrig = 0; |
1084 | if (fJetReconstruction == kCluster) { |
1085 | // |
1086 | // Configure cluster algorithm |
1087 | // |
1088 | fPythia->SetPARU(43, 2.); |
1089 | fPythia->SetMSTU(41, 1); |
1090 | // |
1091 | // Call cluster algorithm |
1092 | // |
1093 | fPythia->Pyclus(nJets); |
1094 | // |
1095 | // Loading jets from common block |
1096 | // |
1097 | } else { |
592f8307 |
1098 | |
8d2cd130 |
1099 | // |
1100 | // Run Jet Finder |
1101 | fPythia->Pycell(nJets); |
1102 | } |
1103 | |
1104 | Int_t i; |
1105 | for (i = 0; i < nJets; i++) { |
1106 | Float_t px = (fPythia->GetPyjets())->P[0][n+i]; |
1107 | Float_t py = (fPythia->GetPyjets())->P[1][n+i]; |
1108 | Float_t pz = (fPythia->GetPyjets())->P[2][n+i]; |
1109 | Float_t e = (fPythia->GetPyjets())->P[3][n+i]; |
1110 | Float_t pt = TMath::Sqrt(px * px + py * py); |
a920faf9 |
1111 | Float_t phi = TMath::Pi() + TMath::ATan2(-py, -px); |
8d2cd130 |
1112 | Float_t theta = TMath::ATan2(pt,pz); |
1113 | Float_t et = e * TMath::Sin(theta); |
1114 | Float_t eta = -TMath::Log(TMath::Tan(theta / 2.)); |
8d2cd130 |
1115 | if ( |
1116 | eta > fEtaMinJet && eta < fEtaMaxJet && |
675eb105 |
1117 | phi > fPhiMinJet && phi < fPhiMaxJet && |
8d2cd130 |
1118 | et > fEtMinJet && et < fEtMaxJet |
1119 | ) |
1120 | { |
1121 | jets[0][nJetsTrig] = px; |
1122 | jets[1][nJetsTrig] = py; |
1123 | jets[2][nJetsTrig] = pz; |
1124 | jets[3][nJetsTrig] = e; |
1125 | nJetsTrig++; |
5fa4b20b |
1126 | // printf("\n........-Jet #%d: %10.3f %10.3f %10.3f %10.3f \n", i, pt, et, eta, phi * kRaddeg); |
8d2cd130 |
1127 | } else { |
1128 | // printf("\n........-Jet #%d: %10.3f %10.3f %10.3f %10.3f \n", i, pt, et, eta, phi * kRaddeg); |
1129 | } |
1130 | } |
1131 | } |
1132 | |
f913ec4f |
1133 | void AliGenPythia::GetSubEventTime() |
1134 | { |
1135 | // Calculates time of the next subevent |
9d7108a7 |
1136 | fEventTime = 0.; |
1137 | if (fEventsTime) { |
1138 | TArrayF &array = *fEventsTime; |
1139 | fEventTime = array[fCurSubEvent++]; |
1140 | } |
1141 | // printf(" Event time: %d %f %p",fCurSubEvent,fEventTime,fEventsTime); |
1142 | return; |
f913ec4f |
1143 | } |
8d2cd130 |
1144 | |
1145 | #ifdef never |
1146 | void AliGenPythia::Streamer(TBuffer &R__b) |
1147 | { |
1148 | // Stream an object of class AliGenPythia. |
1149 | |
1150 | if (R__b.IsReading()) { |
1151 | Version_t R__v = R__b.ReadVersion(); if (R__v) { } |
1152 | AliGenerator::Streamer(R__b); |
1153 | R__b >> (Int_t&)fProcess; |
1154 | R__b >> (Int_t&)fStrucFunc; |
1155 | R__b >> (Int_t&)fForceDecay; |
1156 | R__b >> fEnergyCMS; |
1157 | R__b >> fKineBias; |
1158 | R__b >> fTrials; |
1159 | fParentSelect.Streamer(R__b); |
1160 | fChildSelect.Streamer(R__b); |
1161 | R__b >> fXsection; |
1162 | // (AliPythia::Instance())->Streamer(R__b); |
1163 | R__b >> fPtHardMin; |
1164 | R__b >> fPtHardMax; |
1165 | // if (fDecayer) fDecayer->Streamer(R__b); |
1166 | } else { |
1167 | R__b.WriteVersion(AliGenPythia::IsA()); |
1168 | AliGenerator::Streamer(R__b); |
1169 | R__b << (Int_t)fProcess; |
1170 | R__b << (Int_t)fStrucFunc; |
1171 | R__b << (Int_t)fForceDecay; |
1172 | R__b << fEnergyCMS; |
1173 | R__b << fKineBias; |
1174 | R__b << fTrials; |
1175 | fParentSelect.Streamer(R__b); |
1176 | fChildSelect.Streamer(R__b); |
1177 | R__b << fXsection; |
1178 | // R__b << fPythia; |
1179 | R__b << fPtHardMin; |
1180 | R__b << fPtHardMax; |
1181 | // fDecayer->Streamer(R__b); |
1182 | } |
1183 | } |
1184 | #endif |
1185 | |
90d7b703 |
1186 | |
589380c6 |
1187 | |