]>
Commit | Line | Data |
---|---|---|
36b81802 | 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$ */ |
36b81802 | 17 | |
18 | // Generator using HIJING as an external generator | |
19 | // The main HIJING options are accessable for the user through this interface. | |
20 | // Uses the THijing implementation of TGenerator. | |
14cae7e9 | 21 | // Author: |
22 | // Andreas Morsch (andreas.morsch@cern.ch) | |
36b81802 | 23 | // |
36b81802 | 24 | |
36b81802 | 25 | #include <TGraph.h> |
26 | #include <THijing.h> | |
27 | #include <TLorentzVector.h> | |
28 | #include <TPDGCode.h> | |
29 | #include <TParticle.h> | |
30 | ||
31 | #include "AliGenHijing.h" | |
32 | #include "AliGenHijingEventHeader.h" | |
33 | #include "AliRun.h" | |
7cdba479 | 34 | #include "AliHijingRndm.h" |
36b81802 | 35 | |
7cdba479 | 36 | ClassImp(AliGenHijing) |
36b81802 | 37 | |
38 | AliGenHijing::AliGenHijing() | |
9d89c88d | 39 | :AliGenMC(), |
40 | fFrame("CMS"), | |
41 | fMinImpactParam(0.), | |
42 | fMaxImpactParam(5.), | |
43 | fKeep(0), | |
44 | fQuench(1), | |
45 | fShadowing(1), | |
46 | fDecaysOff(1), | |
47 | fTrigger(0), | |
48 | fEvaluate(0), | |
49 | fSelectAll(0), | |
50 | fFlavor(0), | |
51 | fEnergyCMS(5500.), | |
52 | fKineBias(0.), | |
53 | fTrials(0), | |
54 | fXsection(0.), | |
55 | fHijing(0), | |
56 | fPtHardMin(0.), | |
57 | fPtHardMax(1.e4), | |
58 | fSpectators(1), | |
59 | fDsigmaDb(0), | |
60 | fDnDb(0), | |
61 | fPtMinJet(-2.5), | |
62 | fEtaMinJet(-20.), | |
63 | fEtaMaxJet(+20.), | |
64 | fPhiMinJet(0.), | |
65 | fPhiMaxJet(2. * TMath::Pi()), | |
66 | fRadiation(3), | |
67 | fSimpleJet(kFALSE), | |
68 | fNoGammas(kFALSE), | |
69 | fProjectileSpecn(0), | |
70 | fProjectileSpecp(0), | |
71 | fTargetSpecn(0), | |
72 | fTargetSpecp(0), | |
73 | fLHC(kFALSE), | |
74 | fRandomPz(kFALSE), | |
75 | fNoHeavyQuarks(kFALSE) | |
36b81802 | 76 | { |
77 | // Constructor | |
78 | fParticles = 0; | |
7cdba479 | 79 | AliHijingRndm::SetHijingRandom(GetRandom()); |
36b81802 | 80 | } |
81 | ||
82 | AliGenHijing::AliGenHijing(Int_t npart) | |
9d89c88d | 83 | :AliGenMC(npart), |
84 | fFrame("CMS"), | |
85 | fMinImpactParam(0.), | |
86 | fMaxImpactParam(5.), | |
87 | fKeep(0), | |
88 | fQuench(1), | |
89 | fShadowing(1), | |
90 | fDecaysOff(1), | |
91 | fTrigger(0), | |
92 | fEvaluate(0), | |
93 | fSelectAll(0), | |
94 | fFlavor(0), | |
95 | fEnergyCMS(5500.), | |
96 | fKineBias(0.), | |
97 | fTrials(0), | |
98 | fXsection(0.), | |
99 | fHijing(0), | |
100 | fPtHardMin(0.), | |
101 | fPtHardMax(1.e4), | |
102 | fSpectators(1), | |
103 | fDsigmaDb(0), | |
104 | fDnDb(0), | |
105 | fPtMinJet(-2.5), | |
106 | fEtaMinJet(-20.), | |
107 | fEtaMaxJet(+20.), | |
108 | fPhiMinJet(0.), | |
109 | fPhiMaxJet(2. * TMath::Pi()), | |
110 | fRadiation(3), | |
111 | fSimpleJet(kFALSE), | |
112 | fNoGammas(kFALSE), | |
113 | fProjectileSpecn(0), | |
114 | fProjectileSpecp(0), | |
115 | fTargetSpecn(0), | |
116 | fTargetSpecp(0), | |
117 | fLHC(kFALSE), | |
118 | fRandomPz(kFALSE), | |
119 | fNoHeavyQuarks(kFALSE) | |
36b81802 | 120 | { |
121 | // Default PbPb collisions at 5. 5 TeV | |
122 | // | |
123 | fName = "Hijing"; | |
124 | fTitle= "Particle Generator using HIJING"; | |
36b81802 | 125 | // |
126 | fParticles = new TClonesArray("TParticle",10000); | |
127 | // | |
128 | // Set random number generator | |
7cdba479 | 129 | AliHijingRndm::SetHijingRandom(GetRandom()); |
36b81802 | 130 | } |
131 | ||
9c63d20a | 132 | AliGenHijing::AliGenHijing(const AliGenHijing & hijing): |
9d89c88d | 133 | AliGenMC(hijing), |
134 | fFrame("CMS"), | |
135 | fMinImpactParam(0.), | |
136 | fMaxImpactParam(5.), | |
137 | fKeep(0), | |
138 | fQuench(1), | |
139 | fShadowing(1), | |
140 | fDecaysOff(1), | |
141 | fTrigger(0), | |
142 | fEvaluate(0), | |
143 | fSelectAll(0), | |
144 | fFlavor(0), | |
145 | fEnergyCMS(5500.), | |
146 | fKineBias(0.), | |
147 | fTrials(0), | |
148 | fXsection(0.), | |
149 | fHijing(0), | |
150 | fPtHardMin(0.), | |
151 | fPtHardMax(1.e4), | |
152 | fSpectators(1), | |
153 | fDsigmaDb(0), | |
154 | fDnDb(0), | |
155 | fPtMinJet(-2.5), | |
156 | fEtaMinJet(-20.), | |
157 | fEtaMaxJet(+20.), | |
158 | fPhiMinJet(0.), | |
159 | fPhiMaxJet(2. * TMath::Pi()), | |
160 | fRadiation(3), | |
161 | fSimpleJet(kFALSE), | |
162 | fNoGammas(kFALSE), | |
163 | fProjectileSpecn(0), | |
164 | fProjectileSpecp(0), | |
165 | fTargetSpecn(0), | |
166 | fTargetSpecp(0), | |
167 | fLHC(kFALSE), | |
168 | fRandomPz(kFALSE), | |
169 | fNoHeavyQuarks(kFALSE) | |
36b81802 | 170 | { |
171 | // copy constructor | |
172 | } | |
173 | ||
174 | ||
175 | AliGenHijing::~AliGenHijing() | |
176 | { | |
177 | // Destructor | |
178 | if ( fDsigmaDb) delete fDsigmaDb; | |
179 | if ( fDnDb) delete fDnDb; | |
180 | delete fParticles; | |
181 | } | |
182 | ||
183 | void AliGenHijing::Init() | |
184 | { | |
185 | // Initialisation | |
186 | fFrame.Resize(8); | |
187 | fTarget.Resize(8); | |
188 | fProjectile.Resize(8); | |
189 | ||
190 | SetMC(new THijing(fEnergyCMS, fFrame, fProjectile, fTarget, | |
191 | fAProjectile, fZProjectile, fATarget, fZTarget, | |
192 | fMinImpactParam, fMaxImpactParam)); | |
193 | ||
b88f5cea | 194 | fHijing=(THijing*) fMCEvGen; |
36b81802 | 195 | fHijing->SetIHPR2(2, fRadiation); |
196 | fHijing->SetIHPR2(3, fTrigger); | |
197 | fHijing->SetIHPR2(6, fShadowing); | |
198 | fHijing->SetIHPR2(12, fDecaysOff); | |
199 | fHijing->SetIHPR2(21, fKeep); | |
200 | fHijing->SetHIPR1(10, fPtMinJet); | |
201 | fHijing->SetHIPR1(50, fSimpleJet); | |
202 | // | |
203 | // Quenching | |
204 | // | |
205 | // | |
206 | // fQuench = 0: no quenching | |
207 | // fQuench = 1: hijing default | |
208 | // fQuench = 2: new LHC parameters for HIPR1(11) and HIPR1(14) | |
209 | // fQuench = 3: new RHIC parameters for HIPR1(11) and HIPR1(14) | |
210 | // fQuench = 4: new LHC parameters with log(e) dependence | |
211 | // fQuench = 5: new RHIC parameters with log(e) dependence | |
212 | fHijing->SetIHPR2(50, 0); | |
213 | if (fQuench > 0) | |
214 | fHijing->SetIHPR2(4, 1); | |
215 | else | |
216 | fHijing->SetIHPR2(4, 0); | |
217 | // New LHC parameters from Xin-Nian Wang | |
218 | if (fQuench == 2) { | |
219 | fHijing->SetHIPR1(14, 1.1); | |
220 | fHijing->SetHIPR1(11, 3.7); | |
221 | } else if (fQuench == 3) { | |
222 | fHijing->SetHIPR1(14, 0.20); | |
223 | fHijing->SetHIPR1(11, 2.5); | |
224 | } else if (fQuench == 4) { | |
225 | fHijing->SetIHPR2(50, 1); | |
226 | fHijing->SetHIPR1(14, 4.*0.34); | |
227 | fHijing->SetHIPR1(11, 3.7); | |
228 | } else if (fQuench == 5) { | |
229 | fHijing->SetIHPR2(50, 1); | |
230 | fHijing->SetHIPR1(14, 0.34); | |
231 | fHijing->SetHIPR1(11, 2.5); | |
232 | } | |
233 | ||
f82795ff | 234 | // |
235 | // Heavy quarks | |
236 | // | |
237 | if (fNoHeavyQuarks) { | |
238 | fHijing->SetIHPR2(49, 1); | |
239 | } else { | |
240 | fHijing->SetIHPR2(49, 0); | |
241 | } | |
242 | ||
36b81802 | 243 | |
cc463e4a | 244 | AliGenMC::Init(); |
36b81802 | 245 | |
246 | // | |
247 | // Initialize Hijing | |
248 | // | |
249 | fHijing->Initialize(); | |
250 | // | |
251 | if (fEvaluate) EvaluateCrossSections(); | |
252 | // | |
253 | } | |
254 | ||
255 | void AliGenHijing::Generate() | |
256 | { | |
257 | // Generate one event | |
258 | ||
259 | Float_t polar[3] = {0,0,0}; | |
260 | Float_t origin[3] = {0,0,0}; | |
261 | Float_t origin0[3] = {0,0,0}; | |
0c0c6204 | 262 | Float_t p[3]; |
36b81802 | 263 | Float_t tof; |
264 | ||
265 | // converts from mm/c to s | |
266 | const Float_t kconv = 0.001/2.999792458e8; | |
267 | // | |
268 | Int_t nt = 0; | |
269 | Int_t jev = 0; | |
2d677e30 | 270 | Int_t j, kf, ks, ksp, imo; |
36b81802 | 271 | kf = 0; |
272 | ||
273 | ||
274 | ||
275 | fTrials = 0; | |
276 | for (j = 0;j < 3; j++) origin0[j] = fOrigin[j]; | |
277 | if(fVertexSmear == kPerEvent) { | |
0c0c6204 | 278 | Vertex(); |
279 | for (j=0; j < 3; j++) origin0[j] = fVertex[j]; | |
280 | } | |
281 | ||
b25b821e | 282 | |
283 | Float_t sign = (fRandomPz && (Rndm() < 0.5))? -1. : 1.; | |
36b81802 | 284 | while(1) |
285 | { | |
286 | // Generate one event | |
287 | // -------------------------------------------------------------------------- | |
f0c86dd6 | 288 | fProjectileSpecn = 0; |
289 | fProjectileSpecp = 0; | |
b25b821e | 290 | fTargetSpecn = 0; |
291 | fTargetSpecp = 0; | |
36b81802 | 292 | // -------------------------------------------------------------------------- |
293 | fHijing->GenerateEvent(); | |
294 | fTrials++; | |
295 | fHijing->ImportParticles(fParticles,"All"); | |
296 | if (fTrigger != kNoTrigger) { | |
297 | if (!CheckTrigger()) continue; | |
298 | } | |
71ea527c | 299 | if (fLHC) Boost(); |
36b81802 | 300 | |
301 | ||
302 | Int_t np = fParticles->GetEntriesFast(); | |
303 | printf("\n **************************************************%d\n",np); | |
304 | Int_t nc = 0; | |
305 | if (np == 0 ) continue; | |
306 | Int_t i; | |
307 | Int_t* newPos = new Int_t[np]; | |
308 | Int_t* pSelected = new Int_t[np]; | |
309 | ||
310 | for (i = 0; i < np; i++) { | |
311 | newPos[i] = i; | |
312 | pSelected[i] = 0; | |
313 | } | |
314 | ||
315 | // Get event vertex | |
316 | // | |
317 | TParticle * iparticle = (TParticle *) fParticles->At(0); | |
0c0c6204 | 318 | fVertex[0] = origin0[0]; |
319 | fVertex[1] = origin0[1]; | |
320 | fVertex[2] = origin0[2]; | |
36b81802 | 321 | |
322 | // | |
323 | // First select parent particles | |
324 | // | |
325 | ||
326 | for (i = 0; i < np; i++) { | |
327 | iparticle = (TParticle *) fParticles->At(i); | |
328 | ||
329 | // Is this a parent particle ? | |
330 | if (Stable(iparticle)) continue; | |
331 | // | |
332 | Bool_t selected = kTRUE; | |
333 | Bool_t hasSelectedDaughters = kFALSE; | |
334 | ||
335 | ||
336 | kf = iparticle->GetPdgCode(); | |
337 | ks = iparticle->GetStatusCode(); | |
338 | if (kf == 92) continue; | |
339 | ||
340 | if (!fSelectAll) selected = KinematicSelection(iparticle, 0) && | |
341 | SelectFlavor(kf); | |
342 | hasSelectedDaughters = DaughtersSelection(iparticle); | |
343 | // | |
344 | // Put particle on the stack if it is either selected or | |
345 | // it is the mother of at least one seleted particle | |
346 | // | |
347 | if (selected || hasSelectedDaughters) { | |
348 | nc++; | |
349 | pSelected[i] = 1; | |
350 | } // selected | |
351 | } // particle loop parents | |
352 | // | |
353 | // Now select the final state particles | |
354 | // | |
355 | ||
356 | for (i = 0; i<np; i++) { | |
357 | TParticle * iparticle = (TParticle *) fParticles->At(i); | |
358 | // Is this a final state particle ? | |
359 | if (!Stable(iparticle)) continue; | |
360 | ||
361 | Bool_t selected = kTRUE; | |
362 | kf = iparticle->GetPdgCode(); | |
363 | ks = iparticle->GetStatusCode(); | |
2d677e30 | 364 | ksp = iparticle->GetUniqueID(); |
36b81802 | 365 | |
366 | // -------------------------------------------------------------------------- | |
367 | // Count spectator neutrons and protons | |
2d677e30 | 368 | if(ksp == 0 || ksp == 1){ |
f0c86dd6 | 369 | if(kf == kNeutron) fProjectileSpecn += 1; |
370 | if(kf == kProton) fProjectileSpecp += 1; | |
371 | } | |
2d677e30 | 372 | else if(ksp == 10 || ksp == 11){ |
f0c86dd6 | 373 | if(kf == kNeutron) fTargetSpecn += 1; |
374 | if(kf == kProton) fTargetSpecp += 1; | |
36b81802 | 375 | } |
376 | // -------------------------------------------------------------------------- | |
377 | // | |
378 | if (!fSelectAll) { | |
379 | selected = KinematicSelection(iparticle,0)&&SelectFlavor(kf); | |
2d677e30 | 380 | if (!fSpectators && selected) selected = (ksp != 0 && ksp != 1 && ksp != 10 |
381 | && ksp != 11); | |
36b81802 | 382 | } |
383 | // | |
384 | // Put particle on the stack if selected | |
385 | // | |
386 | if (selected) { | |
387 | nc++; | |
388 | pSelected[i] = 1; | |
389 | } // selected | |
390 | } // particle loop final state | |
3439da17 | 391 | |
36b81802 | 392 | // |
3439da17 | 393 | // Time of the interactions |
394 | Float_t tInt = 0.; | |
395 | if (fPileUpTimeWindow > 0.) tInt = fPileUpTimeWindow * (2. * gRandom->Rndm() - 1.); | |
396 | ||
36b81802 | 397 | // |
3439da17 | 398 | // Write particles to stack |
399 | ||
36b81802 | 400 | for (i = 0; i<np; i++) { |
401 | TParticle * iparticle = (TParticle *) fParticles->At(i); | |
402 | Bool_t hasMother = (iparticle->GetFirstMother() >=0); | |
403 | Bool_t hasDaughter = (iparticle->GetFirstDaughter() >=0); | |
36b81802 | 404 | if (pSelected[i]) { |
405 | kf = iparticle->GetPdgCode(); | |
406 | ks = iparticle->GetStatusCode(); | |
407 | p[0] = iparticle->Px(); | |
408 | p[1] = iparticle->Py(); | |
b25b821e | 409 | p[2] = iparticle->Pz() * sign; |
36b81802 | 410 | origin[0] = origin0[0]+iparticle->Vx()/10; |
411 | origin[1] = origin0[1]+iparticle->Vy()/10; | |
412 | origin[2] = origin0[2]+iparticle->Vz()/10; | |
3439da17 | 413 | tof = kconv * iparticle->T() + sign * origin0[2] / 3.e10; |
414 | if (fPileUpTimeWindow > 0.) tof += tInt; | |
415 | ||
36b81802 | 416 | imo = -1; |
417 | TParticle* mother = 0; | |
418 | if (hasMother) { | |
419 | imo = iparticle->GetFirstMother(); | |
420 | mother = (TParticle *) fParticles->At(imo); | |
e57522c0 | 421 | imo = (mother->GetPdgCode() != 92) ? newPos[imo] : -1; |
36b81802 | 422 | } // if has mother |
423 | Bool_t tFlag = (fTrackIt && !hasDaughter); | |
3439da17 | 424 | PushTrack(tFlag,imo,kf,p,origin,polar,tof,kPNoProcess,nt, 1., ks); |
cf57b268 | 425 | |
426 | ||
36b81802 | 427 | KeepTrack(nt); |
428 | newPos[i] = nt; | |
429 | } // if selected | |
430 | } // particle loop | |
431 | delete[] newPos; | |
432 | delete[] pSelected; | |
433 | ||
434 | printf("\n I've put %i particles on the stack \n",nc); | |
435 | if (nc > 0) { | |
436 | jev += nc; | |
437 | if (jev >= fNpart || fNpart == -1) { | |
438 | fKineBias = Float_t(fNpart)/Float_t(fTrials); | |
439 | printf("\n Trials: %i %i %i\n",fTrials, fNpart, jev); | |
440 | break; | |
441 | } | |
442 | } | |
443 | } // event loop | |
444 | MakeHeader(); | |
445 | SetHighWaterMark(nt); | |
446 | } | |
447 | ||
448 | void AliGenHijing::KeepFullEvent() | |
449 | { | |
450 | fKeep=1; | |
451 | } | |
452 | ||
453 | void AliGenHijing::EvaluateCrossSections() | |
454 | { | |
455 | // Glauber Calculation of geometrical x-section | |
456 | // | |
457 | Float_t xTot = 0.; // barn | |
458 | Float_t xTotHard = 0.; // barn | |
459 | Float_t xPart = 0.; // barn | |
460 | Float_t xPartHard = 0.; // barn | |
461 | Float_t sigmaHard = 0.1; // mbarn | |
462 | Float_t bMin = 0.; | |
463 | Float_t bMax = fHijing->GetHIPR1(34)+fHijing->GetHIPR1(35); | |
464 | const Float_t kdib = 0.2; | |
465 | Int_t kMax = Int_t((bMax-bMin)/kdib)+1; | |
466 | ||
467 | ||
468 | printf("\n Projectile Radius (fm): %f \n",fHijing->GetHIPR1(34)); | |
469 | printf("\n Target Radius (fm): %f \n",fHijing->GetHIPR1(35)); | |
470 | Int_t i; | |
471 | Float_t oldvalue= 0.; | |
472 | ||
473 | Float_t* b = new Float_t[kMax]; | |
474 | Float_t* si1 = new Float_t[kMax]; | |
475 | Float_t* si2 = new Float_t[kMax]; | |
476 | ||
477 | for (i = 0; i < kMax; i++) | |
478 | { | |
479 | Float_t xb = bMin+i*kdib; | |
480 | Float_t ov; | |
481 | ov=fHijing->Profile(xb); | |
482 | Float_t gb = 2.*0.01*fHijing->GetHIPR1(40)*kdib*xb*(1.-TMath::Exp(-fHijing->GetHINT1(12)*ov)); | |
483 | Float_t gbh = 2.*0.01*fHijing->GetHIPR1(40)*kdib*xb*sigmaHard*ov; | |
484 | xTot+=gb; | |
485 | xTotHard += gbh; | |
486 | printf("profile %f %f %f\n", xb, ov, fHijing->GetHINT1(12)); | |
487 | ||
488 | if (xb > fMinImpactParam && xb < fMaxImpactParam) | |
489 | { | |
490 | xPart += gb; | |
491 | xPartHard += gbh; | |
492 | } | |
493 | ||
494 | if(oldvalue) if ((xTot-oldvalue)/oldvalue<0.0001) break; | |
495 | oldvalue = xTot; | |
496 | printf("\n Total cross section (barn): %d %f %f \n",i, xb, xTot); | |
497 | printf("\n Hard cross section (barn): %d %f %f \n\n",i, xb, xTotHard); | |
498 | if (i>0) { | |
499 | si1[i] = gb/kdib; | |
500 | si2[i] = gbh/gb; | |
501 | b[i] = xb; | |
502 | } | |
503 | } | |
504 | ||
505 | printf("\n Total cross section (barn): %f \n",xTot); | |
506 | printf("\n Hard cross section (barn): %f \n \n",xTotHard); | |
507 | printf("\n Partial cross section (barn): %f %f \n",xPart, xPart/xTot*100.); | |
508 | printf("\n Partial hard cross section (barn): %f %f \n",xPartHard, xPartHard/xTotHard*100.); | |
509 | ||
510 | // Store result as a graph | |
511 | b[0] = 0; | |
512 | si1[0] = 0; | |
513 | si2[0]=si2[1]; | |
514 | ||
515 | fDsigmaDb = new TGraph(i, b, si1); | |
516 | fDnDb = new TGraph(i, b, si2); | |
517 | } | |
518 | ||
519 | Bool_t AliGenHijing::DaughtersSelection(TParticle* iparticle) | |
520 | { | |
521 | // | |
522 | // Looks recursively if one of the daughters has been selected | |
523 | // | |
524 | // printf("\n Consider daughters %d:",iparticle->GetPdgCode()); | |
525 | Int_t imin = -1; | |
526 | Int_t imax = -1; | |
527 | Int_t i; | |
528 | Bool_t hasDaughters = (iparticle->GetFirstDaughter() >=0); | |
529 | Bool_t selected = kFALSE; | |
530 | if (hasDaughters) { | |
531 | imin = iparticle->GetFirstDaughter(); | |
532 | imax = iparticle->GetLastDaughter(); | |
533 | for (i = imin; i <= imax; i++){ | |
534 | TParticle * jparticle = (TParticle *) fParticles->At(i); | |
535 | Int_t ip = jparticle->GetPdgCode(); | |
536 | if (KinematicSelection(jparticle,0)&&SelectFlavor(ip)) { | |
537 | selected=kTRUE; break; | |
538 | } | |
539 | if (DaughtersSelection(jparticle)) {selected=kTRUE; break; } | |
540 | } | |
541 | } else { | |
542 | return kFALSE; | |
543 | } | |
544 | return selected; | |
545 | } | |
546 | ||
547 | ||
548 | Bool_t AliGenHijing::SelectFlavor(Int_t pid) | |
549 | { | |
550 | // Select flavor of particle | |
551 | // 0: all | |
552 | // 4: charm and beauty | |
553 | // 5: beauty | |
554 | Bool_t res = 0; | |
555 | ||
556 | if (fFlavor == 0) { | |
557 | res = kTRUE; | |
558 | } else { | |
559 | Int_t ifl = TMath::Abs(pid/100); | |
560 | if (ifl > 10) ifl/=10; | |
561 | res = (fFlavor == ifl); | |
562 | } | |
563 | // | |
564 | // This part if gamma writing is inhibited | |
565 | if (fNoGammas) | |
566 | res = res && (pid != kGamma && pid != kPi0); | |
567 | // | |
568 | return res; | |
569 | } | |
570 | ||
14cae7e9 | 571 | Bool_t AliGenHijing::Stable(TParticle* particle) const |
36b81802 | 572 | { |
573 | // Return true for a stable particle | |
574 | // | |
575 | ||
576 | if (particle->GetFirstDaughter() < 0 ) | |
577 | { | |
578 | return kTRUE; | |
579 | } else { | |
580 | return kFALSE; | |
581 | } | |
582 | } | |
583 | ||
584 | ||
36b81802 | 585 | |
586 | void AliGenHijing::MakeHeader() | |
587 | { | |
588 | // Builds the event header, to be called after each event | |
589 | AliGenEventHeader* header = new AliGenHijingEventHeader("Hijing"); | |
590 | ((AliGenHijingEventHeader*) header)->SetNProduced(fHijing->GetNATT()); | |
591 | ((AliGenHijingEventHeader*) header)->SetImpactParameter(fHijing->GetHINT1(19)); | |
592 | ((AliGenHijingEventHeader*) header)->SetTotalEnergy(fHijing->GetEATT()); | |
593 | ((AliGenHijingEventHeader*) header)->SetHardScatters(fHijing->GetJATT()); | |
594 | ((AliGenHijingEventHeader*) header)->SetParticipants(fHijing->GetNP(), fHijing->GetNT()); | |
595 | ((AliGenHijingEventHeader*) header)->SetCollisions(fHijing->GetN0(), | |
596 | fHijing->GetN01(), | |
597 | fHijing->GetN10(), | |
598 | fHijing->GetN11()); | |
f0c86dd6 | 599 | ((AliGenHijingEventHeader*) header)->SetSpectators(fProjectileSpecn, fProjectileSpecp, |
600 | fTargetSpecn,fTargetSpecp); | |
3c0c211c | 601 | ((AliGenHijingEventHeader*) header)->SetReactionPlaneAngle(fHijing->GetHINT1(20)); |
602 | ||
603 | ||
36b81802 | 604 | |
605 | // 4-momentum vectors of the triggered jets. | |
606 | // | |
607 | // Before final state gluon radiation. | |
608 | TLorentzVector* jet1 = new TLorentzVector(fHijing->GetHINT1(21), | |
609 | fHijing->GetHINT1(22), | |
610 | fHijing->GetHINT1(23), | |
611 | fHijing->GetHINT1(24)); | |
612 | ||
613 | TLorentzVector* jet2 = new TLorentzVector(fHijing->GetHINT1(31), | |
614 | fHijing->GetHINT1(32), | |
615 | fHijing->GetHINT1(33), | |
616 | fHijing->GetHINT1(34)); | |
617 | // After final state gluon radiation. | |
618 | TLorentzVector* jet3 = new TLorentzVector(fHijing->GetHINT1(26), | |
619 | fHijing->GetHINT1(27), | |
620 | fHijing->GetHINT1(28), | |
621 | fHijing->GetHINT1(29)); | |
622 | ||
623 | TLorentzVector* jet4 = new TLorentzVector(fHijing->GetHINT1(36), | |
624 | fHijing->GetHINT1(37), | |
625 | fHijing->GetHINT1(38), | |
626 | fHijing->GetHINT1(39)); | |
627 | ((AliGenHijingEventHeader*) header)->SetJets(jet1, jet2, jet3, jet4); | |
628 | // Bookkeeping for kinematic bias | |
629 | ((AliGenHijingEventHeader*) header)->SetTrials(fTrials); | |
630 | // Event Vertex | |
0c0c6204 | 631 | header->SetPrimaryVertex(fVertex); |
cf57b268 | 632 | AddHeader(header); |
36b81802 | 633 | fCollisionGeometry = (AliGenHijingEventHeader*) header; |
634 | } | |
635 | ||
cf57b268 | 636 | void AliGenHijing::AddHeader(AliGenEventHeader* header) |
637 | { | |
638 | // Passes header either to the container or to gAlice | |
639 | if (fContainer) { | |
640 | fContainer->AddHeader(header); | |
641 | } else { | |
642 | gAlice->SetGenEventHeader(header); | |
643 | } | |
644 | } | |
645 | ||
646 | ||
36b81802 | 647 | Bool_t AliGenHijing::CheckTrigger() |
648 | { | |
649 | // Check the kinematic trigger condition | |
650 | // | |
651 | Bool_t triggered = kFALSE; | |
652 | ||
653 | if (fTrigger == 1) { | |
654 | // | |
655 | // jet-jet Trigger | |
656 | ||
657 | TLorentzVector* jet1 = new TLorentzVector(fHijing->GetHINT1(26), | |
658 | fHijing->GetHINT1(27), | |
659 | fHijing->GetHINT1(28), | |
660 | fHijing->GetHINT1(29)); | |
661 | ||
662 | TLorentzVector* jet2 = new TLorentzVector(fHijing->GetHINT1(36), | |
663 | fHijing->GetHINT1(37), | |
664 | fHijing->GetHINT1(38), | |
665 | fHijing->GetHINT1(39)); | |
666 | Double_t eta1 = jet1->Eta(); | |
667 | Double_t eta2 = jet2->Eta(); | |
668 | Double_t phi1 = jet1->Phi(); | |
669 | Double_t phi2 = jet2->Phi(); | |
670 | // printf("\n Trigger: %f %f %f %f", | |
671 | // fEtaMinJet, fEtaMaxJet, fPhiMinJet, fPhiMaxJet); | |
672 | if ( | |
673 | (eta1 < fEtaMaxJet && eta1 > fEtaMinJet && | |
674 | phi1 < fPhiMaxJet && phi1 > fPhiMinJet) | |
675 | || | |
676 | (eta2 < fEtaMaxJet && eta2 > fEtaMinJet && | |
677 | phi2 < fPhiMaxJet && phi2 > fPhiMinJet) | |
678 | ) | |
679 | triggered = kTRUE; | |
680 | } else if (fTrigger == 2) { | |
681 | // Gamma Jet | |
682 | // | |
683 | Int_t np = fParticles->GetEntriesFast(); | |
684 | for (Int_t i = 0; i < np; i++) { | |
685 | TParticle* part = (TParticle*) fParticles->At(i); | |
686 | Int_t kf = part->GetPdgCode(); | |
2d677e30 | 687 | Int_t ksp = part->GetUniqueID(); |
688 | if (kf == 22 && ksp == 40) { | |
36b81802 | 689 | Float_t phi = part->Phi(); |
690 | Float_t eta = part->Eta(); | |
691 | if (eta < fEtaMaxJet && | |
692 | eta > fEtaMinJet && | |
693 | phi < fPhiMaxJet && | |
694 | phi > fPhiMinJet) { | |
695 | triggered = 1; | |
696 | break; | |
697 | } // check phi,eta within limits | |
698 | } // direct gamma ? | |
699 | } // particle loop | |
700 | } // fTrigger == 2 | |
701 | return triggered; | |
702 | } | |
703 | ||
704 | ||
39192f05 | 705 | void AliGenHijing::Copy(TObject &) const |
9c63d20a | 706 | { |
707 | Fatal("Copy","Not implemented!\n"); | |
708 | } | |
36b81802 | 709 | |
710 | AliGenHijing& AliGenHijing::operator=(const AliGenHijing& rhs) | |
711 | { | |
9c63d20a | 712 | rhs.Copy(*this); |
713 | return (*this); | |
36b81802 | 714 | } |
715 |