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