Jet Finder - hard coded geom parameters removed
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALJetFinderAlgoUA1BG.cxx
CommitLineData
f7d5860b 1//SARAH'S REVISED PERSONAL COPY!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2//BASED ON UA1REVISED BUT WITH UPFRONT BG SUBTRACTION!!!!
3
4
5/**************************************************************************
6 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
7 * *
8 * Author: The ALICE Off-line Project. *
9 * Contributors are mentioned in the code where appropriate. *
10 * *
11 * Permission to use, copy, modify and distribute this software and its *
12 * documentation strictly for non-commercial purposes is hereby granted *
13 * without fee, provided that the above copyright notice appears in all *
14 * copies and that both the copyright notice and this permission notice *
15 * appear in the supporting documentation. The authors make no claims *
16 * about the suitability of this software for any purpose. It is *
17 * provided "as is" without express or implied warranty. *
18 **************************************************************************/
19
ee6b678f 20/* $Id$ */
f7d5860b 21
22//*--Author: Sarah Blyth (LBL)
23//*--Based on UA1 jet algorithm from LUND JETSET called from EMC-erj
24
25#include "TTask.h"
26#include "AliEMCALJetFinderInput.h"
27#include "AliEMCALJetFinderOutput.h"
28#include "AliEMCALJetFinderAlgo.h"
29#include "AliEMCALJetFinderAlgoUA1BG.h"
30#include "AliEMCALJetFinderAlgoUA1Unit.h"
31#include "AliEMCALGeometry.h"
32#include "AliEMCAL.h"
33#include "AliEMCALDigit.h"
34#include "TParticle.h"
35#include "AliRun.h"
36#include "AliEMCALJet.h"
37#include "TMath.h"
38
39
40ClassImp(AliEMCALJetFinderAlgoUA1BG)
41
42 AliEMCALJetFinderAlgoUA1BG::AliEMCALJetFinderAlgoUA1BG()
43{
44 //Default constructor
45if (fDebug>0) Info("AliEMCALJetFinderAlgoUA1BG","Beginning Default Constructor");
46
47 fNumIter = 0;
48 fNumUnits = 13824; //Number of towers in EMCAL
49 fESeed = 5.0; //Default value
50 fConeRad = 0.5; //Default value
51 fJetEMin = 10.0; //Default value
52 fEtMin = 0.28; //Default value
53 fMinMove = 0.05; //From original UA1 JetFinder
54 fMaxMove = 0.15; //From original UA1 JetFinder
55 fBGMaxMove = 0.035; //From original UA1 JetFinder
56 fPtCut = 0;
57 fHadCorr = 0;
58 fEBGTotal = 1.0; //Set to 1 so that no div by zero in first FindJets() loop
59 fEBGTotalOld = 0.0;
60 fEBGAve = 0.0;
61 fEnergy = 0.0;
62 fJetEta = 0.0;
63 fJetPhi = 0.0;
64 fEtaInit = 0.0;
65 fPhiInit = 0.0;
66 fEtaB = 0.0;
67 fPhiB = 0.0;
68 fJetESum = 0.0;
69 fJetEtaSum = 0.0;
70 fJetPhiSum = 0.0;
71 fDEta = 0.0;
72 fDPhi = 0.0;
73 fDistP = 0.0;
74 fDistI = 0.0;
75 fTempE = 0.0;
76 fRad = 2.0; //Set to 2 to start
77 fNumInCone = 0;
78 fNumJets = 0;
79 fArrayInitialised = 0; //Set to FALSE to start
80}
81
82 AliEMCALJetFinderAlgoUA1BG::~AliEMCALJetFinderAlgoUA1BG()
83 {
84 //Destructor
85 if (fDebug>0) Info("AliEMCALJetFinderAlgoUA1BG","Beginning Destructor");
86 delete[] fUnit;
87 }
88
89 void AliEMCALJetFinderAlgoUA1BG::SetJetFindingParameters
90 (Int_t numUnits, Float_t eSeed, Float_t coneRad, Float_t jetEMin, Float_t etMin,
91 Float_t minMove, Float_t maxMove, Float_t bgMaxMove)
92 {
93 //Sets parameters for the JetFinding algorithm
94 if (fDebug>1) Info("SetJetFindingParameters","Setting parameters for JetFinding");
95
96 SetNumUnits(numUnits);
97 SetJetESeed(eSeed);
98 SetConeRad(coneRad);
99 SetJetEMin(jetEMin);
100 SetEtMin(etMin);
101 SetMinMove(minMove);
102 SetMaxMove(maxMove);
103 SetBGMaxMove(bgMaxMove);
104 }
105
106 void AliEMCALJetFinderAlgoUA1BG::SetJetFindingParameters
107 (Int_t numUnits, Float_t eSeed, Float_t coneRad, Float_t jetEMin, Float_t etMin)
108 {
109 //Sets fewer parameters for the JetFinding algorithm
110 if (fDebug>1) Info("SetJetFindingParameters","Setting parameters for JetFinding");
111
112 SetNumUnits(numUnits);
113 SetJetESeed(eSeed);
114 SetConeRad(coneRad);
115 SetJetEMin(jetEMin);
116 SetEtMin(etMin);
117 SetMinMove(fMinMove);
118 SetMaxMove(fMaxMove);
119 SetBGMaxMove(fBGMaxMove);
120 }
121
122 void AliEMCALJetFinderAlgoUA1BG::InitUnitArray()
123 {
124 //Initialises unit array
125 if(fArrayInitialised) delete[] fUnit;
126 fUnit = new AliEMCALJetFinderAlgoUA1Unit[fNumUnits];
127 fArrayInitialised = 1;
128 }
129
130 void AliEMCALJetFinderAlgoUA1BG::FillUnitArray(AliEMCALJetFinderAlgoUA1FillUnitFlagType_t flag)
131 {
132 if (fDebug>1) Info("FillUnitArray","Beginning FillUnitArray");
133 AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL");
134
135 // if (pEMCAL){
136 // AliEMCALGeometry* geom = AliEMCALGeometry::GetInstance(pEMCAL->GetTitle(), "");
137 // }else
138 // {
139 AliEMCALGeometry* geom = AliEMCALGeometry::GetInstance("EMCAL_5655_21", "");
140 // }
141
142 AliEMCALJetFinderAlgoUA1FillUnitFlagType_t option = flag;
143 Int_t numTracks, numDigits;
144
145 //Loops over all elements in the AliEMCALJetFinderAlgoUA1Unit array and
146 //fills the objects with relevant values from the Data Input object
147 if (fDebug>1) Info("FillUnitArray","Filling array with Unit objects");
148 if (fDebug>1) Info("FillUnitArray","NTracks %i NDigits %i",fInputPointer->GetNTracks(),fInputPointer->GetNDigits());
149 numTracks = fInputPointer->GetNTracks();
150 numDigits = fInputPointer->GetNDigits();
151 TParticle *myPart;
152 AliEMCALDigit *myDigit;
153
154 //Fill units with Track info if appropriate
155 if(option==kFillTracksOnly || option ==kFillAll)
156 {
157 for(Int_t j=0; j<numTracks; j++)
158 {
159 myPart = fInputPointer->GetTrack(j);
160 Float_t eta = myPart->Eta();
161 Float_t phi = myPart->Phi();
162 Int_t towerID = geom->TowerIndexFromEtaPhi(eta,180.0/TMath::Pi()*phi);
163 Float_t pT = myPart->Pt();
164 Float_t unitEnergy = fUnit[towerID-1].GetUnitEnergy();
165
166 //Do Hadron Correction
167 if(fHadCorr != 0)
168 {
169 Double_t fullP = myPart->P();
170 Double_t hCEnergy = fHadCorr->GetEnergy(fullP, (Double_t)eta);
171 unitEnergy -= hCEnergy*TMath::Sin(myPart->Theta());
172 fUnit[towerID-1].SetUnitEnergy(unitEnergy);
173 } //end Hadron Correction loop
174
175 //Do Pt cut on tracks
176 if(fPtCut != 0 && pT < fPtCut) continue;
177
178 fUnit[towerID-1].SetUnitEnergy(unitEnergy+pT);
179
180 }//end tracks loop
181 }//end Tracks condition
182
183
184 //Fill units with Digit info if appropriate
185 if(option ==kFillDigitsOnly || option ==kFillAll)
186 {
187 for(Int_t k=0; k<numDigits; k++)
188 {
189 myDigit = fInputPointer->GetDigit(k);
190 if (fDebug>1) Info("FillUnitArray","getting digits %i %i numdigits",k,numDigits );
191 Int_t towerID = myDigit->GetId();
192 Int_t amplitude = myDigit->GetAmp(); //Gets the integer valued amplitude of the digit
193 Float_t amp = (Float_t)amplitude; //Need to typecast to Float_t before doing real energy conversion
194 Float_t digitEnergy = amp/10000000.0; //Factor of 10 million needed to convert!
195 Float_t unitEnergy = fUnit[towerID-1].GetUnitEnergy() + digitEnergy;
196 fUnit[towerID-1].SetUnitEnergy(unitEnergy);
197
198 }//end digits loop
199 }//end digits condition
200
201 //NEW BG SUBTRACTION!!!!!!!!!!!!!!!!!!!!
202 for(Int_t m=0; m<fNumUnits; m++)
203 {
204 Float_t prevEnergy = fUnit[m].GetUnitEnergy();
205 prevEnergy -= 0.13; //From previous Hijing BG study
206 if(prevEnergy < 0) prevEnergy =0.0;
207 fUnit[m].SetUnitEnergy(prevEnergy);
208 }//end for
209
210 //Set all unit flags, Eta, Phi
211 for(Int_t i=0; i<fNumUnits; i++)
212 {
213 if (fDebug>1) Info("FillUnitArray","Setting all units outside jets");
214 fUnit[i].SetUnitFlag(kOutJet); //Set all units to be outside a jet initially
215 fUnit[i].SetUnitID(i+1);
216 Float_t eta;
217 Float_t phi;
218 geom->EtaPhiFromIndex(fUnit[i].GetUnitID(), eta, phi);
219 fUnit[i].SetUnitEta(eta);
220 fUnit[i].SetUnitPhi(phi*TMath::Pi()/180.0);
221 // if(i>13000) cout<<"!!!!!!!!!!!!!!!!!For unit0, eta="<<eta<<" and phi="<<phi*TMath::Pi()/180.0<<" and ID="<<fUnit[i].GetUnitID()<<endl;
222 // if(fUnit[i].GetUnitEnergy()>0) cout<<"Unit ID "<<fUnit[i].GetUnitID() <<"with eta="<<eta<<" and phi="<<phi*TMath::Pi()/180.0<<" has energy="<<fUnit[i].GetUnitEnergy()<<endl;
223 }//end loop over all units in array (same as all towers in EMCAL)
224 }
225
226
227 void AliEMCALJetFinderAlgoUA1BG::Sort(AliEMCALJetFinderAlgoUA1Unit *unit, Int_t length)
228 {
229 //Calls the recursive quicksort method to sort unit objects in decending order of Energy
230 if (fDebug>1) Info("Sort","Sorting Unit objects");
231 QS(unit, 0, length-1);
232 }
233
234
235 void AliEMCALJetFinderAlgoUA1BG::QS(AliEMCALJetFinderAlgoUA1Unit *unit, Int_t left, Int_t right)
236 {
237 //Sorts the AliEMCALJetFinderAlgoUA1Unit objects in decending order of Energy
238 if (fDebug>111) Info("QS","QuickSorting Unit objects");
239
240 Int_t i;
241 Int_t j;
242 AliEMCALJetFinderAlgoUA1Unit unitFirst;
243 AliEMCALJetFinderAlgoUA1Unit unitSecond;
244
245 i = left;
246 j = right;
247 unitFirst = unit[(left+right)/2];
248
249 do
250 {
251 while( (unit[i].GetUnitEnergy() > unitFirst.GetUnitEnergy()) && (i < right)) i++;
252 while( (unitFirst.GetUnitEnergy() > unit[j].GetUnitEnergy()) && (j > left)) j--;
253
254 if(i <= j)
255 {
256 unitSecond = unit[i];
257 unit[i] = unit[j];
258 unit[j] = unitSecond;
259 i++;
260 j--;
261 }//end if
262 }while(i <= j);
263
264 if(left < j) QS(unit, left, j);
265 if(i < right) QS(unit, i, right);
266 }
267
268
269 void AliEMCALJetFinderAlgoUA1BG::FindBG()
270 {
271 //Finds the background energy for the iteration
272 if (fDebug>1) Info("FindBG","Finding Average Background");
273
274 fEBGTotal = 0.0;
275 Int_t numCone = 0;
276
277 //Loop over all unit objects in the array and sum the energy of those not in a jet
278 for(Int_t i=0; i<fNumUnits; i++)
279 {
280 if(fUnit[i].GetUnitFlag() != kInJet)
281 fEBGTotal += fUnit[i].GetUnitEnergy();
282 else numCone++;
283 }//end for
284
285 fEBGTotalOld = fEBGTotal;
286 fEBGAve = fEBGTotal / (fNumUnits - numCone);
287 if (fDebug>5) Info("FindBG","Average BG is %f: ",fEBGAve);
288
289 for(Int_t count=0; count<fNumUnits;count++)
290 {
291 fUnit[count].SetUnitFlag(kOutJet);
292 }//end for
293 }
294
295
296 void AliEMCALJetFinderAlgoUA1BG::FindJetEtaPhi(Int_t counter)
297 {
298 //Finds the eta and phi of the jet axis
299 if (fDebug>1) Info("FindJetEtaPhi","Finding Jet Eta and Phi");
300
301 fDEta = fUnit[counter].GetUnitEta() - fEtaInit;
302 fDPhi = fUnit[counter].GetUnitPhi() - fPhiInit;
303
304 fEnergy = fUnit[counter].GetUnitEnergy() - fEBGAve;
305 fJetEtaSum += fEnergy * fDEta;
306 fJetPhiSum += fEnergy * fDPhi;
307 fJetESum += fEnergy;
308 fJetEta = fEtaInit + (fJetEtaSum / fJetESum);
309 fJetPhi = fPhiInit + (fJetPhiSum / fJetESum);
310 }
311
312
313 void AliEMCALJetFinderAlgoUA1BG::FindJetEnergy()
314 {
315 //Finds the energy of the jet after the final axis has been found
316 if (fDebug>1) Info("FindJetEnergy","Finding Jet Energy");
317
318 for(Int_t i=0; i<fNumUnits; i++)
319 {
320 //Loop over all unit objects in the array and find if within cone radius
321 Float_t dEta = fUnit[i].GetUnitEta() - fJetEta;
322 Float_t dPhi = fUnit[i].GetUnitPhi() - fJetPhi;
323 Float_t rad = TMath::Sqrt( (dEta*dEta) + (dPhi*dPhi) );
324
325 if(fUnit[i].GetUnitFlag()==kOutJet && rad<= fConeRad)
326 {
327 fUnit[i].SetUnitFlag(kInCurrentJet);
328 Float_t energy = fUnit[i].GetUnitEnergy() - fEBGAve;
329 fJetESum += energy;
330 fJetEtaSum += energy * dEta;
331 fJetPhiSum += energy * dPhi;
332 fNumInCone++; //Increment the number of cells in the jet cone
333 }//end if
334 }//end for
335 }
336
337
338 void AliEMCALJetFinderAlgoUA1BG::StoreJetInfo()
339 {
340 //Stores the resulting jet information in appropriate storage structure (TO BE DECIDED!!!!)
341 if (fDebug>1) Info("StoreJetInfo","Storing Jet Information");
342
343 //Store:
344 //fJetESum is the final jet energy (background has been subtracted)
345 //fJetEta is the final jet Eta
346 //fJetPhi is the final jet Phi
347 //fNumInCone is the final number of cells included in the jet cone
348 //fEtaInit is the eta of the initiator cell
349 //fPhiInit is the phi of the initiator cell
350 fJet.SetEnergy(fJetESum);
351 fJet.SetEta(fJetEta);
352 fJet.SetPhi(fJetPhi);
353
354 cout<<"For iteration "<<fNumIter <<" and Jet number " <<fNumJets <<endl;
355 cout<<"The jet energy is: " <<fJetESum <<endl;
356 cout<<"The jet eta is ---->" <<fJetEta <<endl;
357 cout<<"The jet phi is ---->" <<fJetPhi <<endl;
358
359 Int_t numberTracks = fInputPointer->GetNTracks();
360 TParticle *myP;
361 Int_t numTracksInCone = 0;
362
363 for(Int_t counter=0; counter<numberTracks; counter++)
364 {
365 myP = fInputPointer->GetTrack(counter);
366 Float_t eta = myP->Eta();
367 Float_t phi = myP->Phi();
368 Float_t deta = fJetEta-eta;
369 Float_t dphi = fJetPhi -phi;
370 Float_t rad = TMath::Sqrt( (deta*deta) + (dphi*dphi));
371 if(rad<=fConeRad) numTracksInCone++;
372 }//end for
373
374 Float_t *pTArray = new Float_t[numTracksInCone];
375 Float_t *etaArray = new Float_t[numTracksInCone];
376 Float_t *phiArray = new Float_t[numTracksInCone];
377 Int_t *pdgArray = new Int_t[numTracksInCone];
378 Int_t index = 0;
379
380 for(Int_t counter2=0; counter2<numberTracks; counter2++)
381 {
382 myP = fInputPointer->GetTrack(counter2);
383 Float_t eta = myP->Eta();
384 Float_t phi = myP->Phi();
385 Float_t deta = fJetEta-eta;
386 Float_t dphi = fJetPhi -phi;
387 Float_t rad = TMath::Sqrt( (deta*deta) + (dphi*dphi));
388 if(rad<=fConeRad)
389 {
390 pTArray[index] = myP->Pt();
391 etaArray[index] = eta;
392 phiArray[index] = phi;
393 pdgArray[index] = myP->GetPdgCode();
394 index++;
395 }//end if
396 }//end for
397
398 fJet.SetTrackList(numTracksInCone,pTArray, etaArray, phiArray, pdgArray);
399 fOutputObject.AddJet(&fJet);
400 delete[] pTArray;
401 delete[] etaArray;
402 delete[] phiArray;
403 delete[] pdgArray;
404 }
405
406
407 void AliEMCALJetFinderAlgoUA1BG::FindJets()
408 {
409 //Runs the complete UA1 JetFinding algorithm to find jets!
410 if (fDebug>1) Info("FindJets","Starting Jet Finding!!!");
411
412 //If the array of JetFinderUnit objects has not been initialised then initialise with default settings
413 if(!fArrayInitialised)
414 {
415 InitUnitArray();
416 FillUnitArray(kFillAll);
417 }//end if
418 if (fDebug>1) Info("FindJets","Unit array filled");
419
420 //Step 1. Sort the array in descending order of Energy
421 Sort(fUnit,fNumUnits);
422
423 //Step 2. Set the number of iterations and Number of jets found to zero to start
424 fNumIter = 0;
425 fNumJets = 0;
426
427 //Step 3. Begin the iteration loop to find jets
428 //Need to iterate the algorithm while number of iterations<2 OR number of iterations<10 AND
429 //the value of the average background has changed more than specified amount
430 //Min iterations = 2, Max iterations = 10
431 //while(fNumIter<2 || (fNumIter <10 && ( (fEBGTotal-fEBGTotalOld)/fEBGTotal) > fBGMaxMove) )
432
433 while(fNumIter<2 || (fNumIter <10 && ( fEBGTotal-fEBGTotalOld) > fEBGTotal*fBGMaxMove) )
434 {
435 if (fDebug>1) Info("FindJets","Starting BIG iteration ---> %i",fNumIter);
436
437 //Step 4. Find the value of the average background energy
438 FindBG();
439 fOutputObject.Reset(kResetJets); //Reset output object to store info for new iteration
440 fNumJets=0;
441
442 //Loop over the array of unit objects and flag those with energy below MinCellEt = 0
443 Int_t numbelow = 0;
444 for(Int_t j=0; j<fNumUnits; j++)
445 {
446 if( (fUnit[j].GetUnitEnergy()-fEBGAve) <= (fEtMin-0.13))
447 {
448 fUnit[j].SetUnitFlag(kBelowMinEt);
449 numbelow++;
450 // if (fDebug>1) Info("FindJets","Below Min Et: %i",j);
451 }//end if
452 }//end for
453
454 //Do quick check if there are no jets upfront
455 if(fUnit[0].GetUnitFlag() == kBelowMinEt)
456 {
457 cout <<"There are no jets for this event!" <<endl;
458 break;
459 }//end if
460
461 //Step 5. Begin with the first jet candidate cell (JET SEED LOOP)
462 if (fDebug>5) Info("FindJets","Beginning JET SEED LOOP");
463 for(Int_t count=0; count<fNumUnits; count++)
464 {
465
466//CHECK CONDITION HERE _ NOT SURE IF SHOULD MAYBE BE: GetUnitEnergy()-fEBGAve >fESeed?????????????????????????????
467 if(fUnit[count].GetUnitEnergy()>=fESeed && fUnit[count].GetUnitFlag()==kOutJet)
468 {
469 fEnergy = fUnit[count].GetUnitEnergy() - fEBGAve;
470 fJetEta = fUnit[count].GetUnitEta();
471 fJetPhi = fUnit[count].GetUnitPhi();
472 Int_t seedID = fUnit[count].GetUnitID();
473 if (fDebug>5) Info("FindJets","Inside first candidate jet seed loop for time : %i", count);
474 if (fDebug>5) Info("FindJets","Found candidate energy %f ",fEnergy);
475 if (fDebug>5) Info("FindJets","Found candidate eta %f ", fJetEta);
476 if (fDebug>5) Info("FindJets","Found candidate phi %f ", fJetPhi);
477 if (fDebug>5) Info("FindJets","Found candidate ID %i", seedID);
478
479 fEtaInit = fJetEta;
480 fPhiInit = fJetPhi;
481 fEtaB = fJetEta;
482 fPhiB = fJetPhi;
483 fJetESum = 0.0;
484 fJetEtaSum = 0.0;
485 fJetPhiSum = 0.0;
486
487 //Step 6. Find Jet Eta and Phi
488 //Loop over all units in the array to find the ones in the jet cone and determine contrib to Jet eta, phi
489 do
490 {
491 for(Int_t count1=0; count1<fNumUnits; count1++)
492 {
493 if(fUnit[count1].GetUnitID() == seedID) continue; //skip unit if the jetseed to avoid doublecounting
494 if(fUnit[count1].GetUnitFlag() == kOutJet)
495 {
496 fDEta = fUnit[count1].GetUnitEta() - fJetEta;
497 fDPhi = fUnit[count1].GetUnitPhi() - fJetPhi;
498 fRad = TMath::Sqrt( (fDEta*fDEta) + (fDPhi*fDPhi) );
499 if(fRad <= fConeRad)
500 {
501 FindJetEtaPhi(count1);
502 }//end if
503 }//end if
504 }//end for (Jet Eta, Phi LOOP)
505
506 //Find the distance cone centre moved from previous cone centre
507 if (fDebug>10) Info("FindJets","Checking if cone move small enough");
508 fDistP = TMath::Sqrt( ((fJetEta-fEtaB)*(fJetEta-fEtaB)) + ((fJetPhi-fPhiB)*(fJetPhi-fPhiB)) );
509 // if(fDistP <= fMinMove) break;
510
511
512 //Find the distance cone centre is from initiator cell
513 if (fDebug>10) Info("FindJets","Checking if cone move too large");
514 fDistI = TMath::Sqrt( ((fJetEtaSum/fJetESum)*(fJetEtaSum/fJetESum)) + ((fJetPhiSum/fJetESum)*
515 (fJetPhiSum/fJetESum)));
516
517 if(fDistP>fMinMove && fDistI<fMaxMove)
518 {
519 fEtaB = fJetEta;
520 fPhiB = fJetPhi;
521 }//end if
522
523 }while(fDistP>fMinMove && fDistI<fMaxMove);
524
525 fJetEta = fEtaB;
526 fJetPhi = fPhiB;
527
528
529 //Step 7. Find the Jet Energy
530 if (fDebug>1) Info("FindJets","Looking for Jet energy");
531 fJetESum = 0.0;
532 fJetEtaSum = 0.0;
533 fJetPhiSum = 0.0;
534 fNumInCone = 0;
535 FindJetEnergy();
536
537 //Step 8. Check if the jet is a valid jet
538 //Check if cluster energy is above Min allowed to be a jet
539//DID NOT DO THE COSH COMPARISON HERE -> NEED TO CHECK WHICH COMPARISON IS BEST!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
540 if (fDebug>5) Info("FindJets","Checking cluster is valid jet");
541 if(fJetESum < fJetEMin)
542 {
543 for(Int_t count2=0; count2<fNumUnits; count2++)
544 {
545 if(fUnit[count2].GetUnitFlag()==kInCurrentJet || fUnit[count2].GetUnitFlag()==kOutJet)
546 fUnit[count2].SetUnitFlag(kOutJet);
547 }//end for
548 if (fDebug>10) Info("FindJets","NOT a valid jet cell");
549 }else
550 {
551 for(Int_t count2=0; count2<fNumUnits; count2++)
552 {
553 if(fUnit[count2].GetUnitFlag()==kInCurrentJet)
554 {
555 // cout<<"Setting unit #"<<count2 <<" to be officially in a jet!"<<endl;
556 fUnit[count2].SetUnitFlag(kInJet);
557 }
558 }//end for
559
560 //NEED TO CHECK FINAL WEIRD ITERATION OF ETA AND PHI CHANGES!!!!!!!!!
561 // fJetPhi += fJetPhiSum/fJetESum; //CHECK!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
562 // fJetEta += fJetEtaSum/fJetESum; //CHECK!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
563
564 fNumJets++; //Incrementing number of jets found
565 StoreJetInfo(); //Storing jet info
566
567 }//end if (check cluster above Min Jet Energy)
568 }//end if (Jet Seed condition)
569 }//end (JET SEED LOOP)
570
571if (fDebug>5) Info("FindJets","End of BIG iteration number %i",fNumIter);
572// this->Dump();
573 fNumIter++;
574 }//end 10 iteration WHILE LOOP
575 }
576
577
578
579
580
581
582
583
584
585
586