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