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