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