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