2 //THIS Also includes summing ALL cells in the jetcone towards the jet energy NOT just those above threshold!!!!!
5 /**************************************************************************
6 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
8 * Author: The ALICE Off-line Project. *
9 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
22 //*--Author: Sarah Blyth (LBL)
23 //*--Based on UA1 jet algorithm from LUND JETSET called from EMC-erj
26 #include "AliEMCALJetFinderInput.h"
27 #include "AliEMCALJetFinderOutput.h"
28 #include "AliEMCALJetFinderAlgo.h"
29 #include "AliEMCALJetFinderAlgoOmni.h"
30 #include "AliEMCALJetFinderAlgoUA1Unit.h"
31 #include "AliEMCALGeometry.h"
33 #include "AliEMCALGetter.h"
34 #include "AliEMCALDigit.h"
35 #include "TParticle.h"
37 #include "AliEMCALJet.h"
41 ClassImp(AliEMCALJetFinderAlgoOmni)
43 AliEMCALJetFinderAlgoOmni::AliEMCALJetFinderAlgoOmni()
46 if (fDebug>0) Info("AliEMCALJetFinderAlgoOmni","Beginning Default Constructor");
49 fNumUnits = 13824; //Number of towers in EMCAL
50 fESeed = 5.0; //Default value
51 fConeRad = 0.3; //Default value
52 fJetEMin = 10.0; //Default value
53 fEtMin = 0.28; //Default value
54 fMinMove = 0.05; //From original UA1 JetFinder
55 fMaxMove = 0.15; //From original UA1 JetFinder
56 fBGMaxMove = 0.035; //From original UA1 JetFinder
59 fEBGTotal = 1.0; //Set to 1 so that no div by zero in first FindJets() loop
77 fRad = 2.0; //Set to 2 to start
80 fArrayInitialised = 0; //Set to FALSE to start
81 fBGType = kRatio; //Set Ratio method as default BG subtraction method
82 fBGPar = -1.0; //Set to 1 to start
85 AliEMCALJetFinderAlgoOmni::~AliEMCALJetFinderAlgoOmni()
88 if (fDebug>0) Info("AliEMCALJetFinderAlgoOmni","Beginning Destructor");
93 void AliEMCALJetFinderAlgoOmni::SetJetFindingParameters
94 (Int_t numUnits, Float_t eSeed, Float_t coneRad, Float_t jetEMin, Float_t etMin,
95 Float_t minMove, Float_t maxMove, Float_t bgMaxMove)
97 //Sets parameters for the JetFinding algorithm
98 if (fDebug>1) Info("SetJetFindingParameters","Setting parameters for JetFinding");
100 SetNumUnits(numUnits);
107 SetBGMaxMove(bgMaxMove);
110 void AliEMCALJetFinderAlgoOmni::SetJetFindingParameters
111 (Int_t numUnits, Float_t eSeed, Float_t coneRad, Float_t jetEMin, Float_t etMin)
113 //Sets fewer parameters for the JetFinding algorithm
114 if (fDebug>1) Info("SetJetFindingParameters","Setting parameters for JetFinding");
116 SetNumUnits(numUnits);
121 SetMinMove(fMinMove);
122 SetMaxMove(fMaxMove);
123 SetBGMaxMove(fBGMaxMove);
126 void AliEMCALJetFinderAlgoOmni::InitUnitArray()
128 //Initialises unit arrays
129 if(fArrayInitialised) delete[] fUnit;
130 fUnit = new AliEMCALJetFinderAlgoUA1Unit[fNumUnits];
131 fUnitNoCuts = new AliEMCALJetFinderAlgoUA1Unit[fNumUnits];
132 fArrayInitialised = 1;
135 void AliEMCALJetFinderAlgoOmni::FillUnitArray(AliEMCALJetFinderAlgoUA1FillUnitFlagType_t flag)
137 if (fDebug>1) Info("FillUnitArray","Beginning FillUnitArray");
138 // AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL");
141 // AliEMCALGeometry* geom = AliEMCALGeometry::GetInstance(pEMCAL->GetTitle(), "");
144 //AliEMCALGeometry* geom = AliEMCALGeometry::GetInstance("EMCAL_5655_21", "");
145 AliEMCALGeometry* geom = AliEMCALGetter::Instance()->EMCALGeometry() ;
148 AliEMCALJetFinderAlgoUA1FillUnitFlagType_t option = flag;
149 Int_t numTracks, numDigits;
151 //Loops over all elements in the AliEMCALJetFinderAlgoUA1Unit array and
152 //fills the objects with relevant values from the Data Input object
153 if (fDebug>10) Info("FillUnitArray","Filling array with Unit objects");
154 if (fDebug>15) Info("FillUnitArray","NTracks %i NDigits %i",fInputPointer->GetNTracks(),fInputPointer->GetNDigits());
155 numTracks = fInputPointer->GetNTracks();
156 numDigits = fInputPointer->GetNDigits();
158 AliEMCALDigit *myDigit;
160 //Fill units with Track info if appropriate
161 if(option==kFillTracksOnly || option ==kFillAll)
163 for(Int_t j=0; j<numTracks; j++)
165 myPart = fInputPointer->GetTrack(j);
166 Float_t eta = myPart->Eta();
167 Float_t phi = myPart->Phi();
168 Int_t towerID = geom->TowerIndexFromEtaPhi(eta,180.0/TMath::Pi()*phi);
169 Float_t pT = myPart->Pt();
170 Float_t unitEnergy = fUnit[towerID-1].GetUnitEnergy();
171 Float_t unitEnergyNoCuts = fUnitNoCuts[towerID-1].GetUnitEnergy();
174 //OLD WAY: //Do Hadron Correction
177 Double_t fullP = myPart->P();
178 Double_t hCEnergy = fHadCorr->GetEnergy(fullP, (Double_t)eta);
179 unitEnergy -= hCEnergy*TMath::Sin(myPart->Theta());
180 fUnit[towerID-1].SetUnitEnergy(unitEnergy);
181 } //end Hadron Correction loop
184 //Do Hadron Correction with propagate phi for the track
189 TParticlePDG *pdg = myPart->GetPDG();
190 if(pdg->Charge() < 0)
192 deltaPhi = PropagatePhi(myPart->Pt(), -1.0, curl);
195 deltaPhi = PropagatePhi(myPart->Pt(), 1.0, curl);
198 //Get new tower id for cell that track would curve into
200 if(phi<(1.0/3.0)*TMath::Pi() || phi>TMath::Pi())
205 towerID2 = geom->TowerIndexFromEtaPhi(eta,180.0/TMath::Pi()*phi);
210 //Find unit energy of new tower
211 Float_t unitEnergy2 = fUnit[towerID2-1].GetUnitEnergy();
212 Float_t unitEnergy2NoCuts = fUnitNoCuts[towerID2-1].GetUnitEnergy();
213 Double_t fullP = myPart->P();
214 Double_t hCEnergy = fHadCorr->GetEnergy(fullP, (Double_t)eta);
215 unitEnergy2 -= hCEnergy*TMath::Sin(myPart->Theta());
216 unitEnergy2NoCuts -= hCEnergy*TMath::Sin(myPart->Theta());
217 fUnit[towerID2-1].SetUnitEnergy(unitEnergy2);
218 fUnitNoCuts[towerID2-1].SetUnitEnergy(unitEnergy2NoCuts);
219 }//end if for towerID2
220 }//end Hadron Correction loop
222 fUnitNoCuts[towerID-1].SetUnitEnergy(unitEnergyNoCuts + pT);
223 //Do Pt cut on tracks
224 if(fPtCut != 0 && pT < fPtCut) continue;
226 fUnit[towerID-1].SetUnitEnergy(unitEnergy+pT);
229 }//end Tracks condition
232 //Fill units with Digit info if appropriate
233 if(option ==kFillDigitsOnly || option ==kFillAll)
235 for(Int_t k=0; k<numDigits; k++)
237 myDigit = fInputPointer->GetDigit(k);
238 if (fDebug>10) Info("FillUnitArray","getting digits %i %i numdigits",k,numDigits );
239 Int_t towerID = myDigit->GetId();
240 Int_t amplitude = myDigit->GetAmp(); //Gets the integer valued amplitude of the digit
241 Float_t amp = (Float_t)amplitude; //Need to typecast to Float_t before doing real energy conversion
242 Float_t digitEnergy = amp/10000000.0; //Factor of 10 million needed to convert!
243 Float_t unitEnergy = fUnit[towerID-1].GetUnitEnergy() + digitEnergy;
244 Float_t unitEnergyNoCuts = fUnitNoCuts[towerID-1].GetUnitEnergy() + digitEnergy;
245 fUnit[towerID-1].SetUnitEnergy(unitEnergy);
246 fUnitNoCuts[towerID-1].SetUnitEnergy(unitEnergyNoCuts);
248 }//end digits condition
250 //Set all unit flags, Eta, Phi
251 for(Int_t i=0; i<fNumUnits; i++)
253 if (fDebug>10) Info("FillUnitArray","Setting all units outside jets");
254 fUnit[i].SetUnitFlag(kOutJet); //Set all units to be outside a jet initially
255 fUnit[i].SetUnitID(i+1);
258 geom->EtaPhiFromIndex(fUnit[i].GetUnitID(), eta, phi);
259 fUnit[i].SetUnitEta(eta);
260 fUnit[i].SetUnitPhi(phi*TMath::Pi()/180.0);
262 fUnitNoCuts[i].SetUnitFlag(kOutJet); //Set all units to be outside a jet initially
263 fUnitNoCuts[i].SetUnitID(i+1);
266 geom->EtaPhiFromIndex(fUnitNoCuts[i].GetUnitID(), eta, phi);
267 fUnitNoCuts[i].SetUnitEta(eta);
268 fUnitNoCuts[i].SetUnitPhi(phi*TMath::Pi()/180.0);
269 // if(i>13000) cout<<"!!!!!!!!!!!!!!!!!For unit0, eta="<<eta<<" and phi="<<phi*TMath::Pi()/180.0<<" and ID="<<fUnit[i].GetUnitID()<<endl;
270 // 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;
271 }//end loop over all units in array (same as all towers in EMCAL)
275 void AliEMCALJetFinderAlgoOmni::Sort(AliEMCALJetFinderAlgoUA1Unit *unit, Int_t length)
277 //Calls the recursive quicksort method to sort unit objects in decending order of Energy
278 if (fDebug>1) Info("Sort","Sorting Unit objects");
279 QS(unit, 0, length-1);
283 void AliEMCALJetFinderAlgoOmni::QS(AliEMCALJetFinderAlgoUA1Unit *unit, Int_t left, Int_t right)
285 //Sorts the AliEMCALJetFinderAlgoUA1Unit objects in decending order of Energy
286 if (fDebug>111) Info("QS","QuickSorting Unit objects");
290 AliEMCALJetFinderAlgoUA1Unit unitFirst;
291 AliEMCALJetFinderAlgoUA1Unit unitSecond;
295 unitFirst = unit[(left+right)/2];
299 while( (unit[i].GetUnitEnergy() > unitFirst.GetUnitEnergy()) && (i < right)) i++;
300 while( (unitFirst.GetUnitEnergy() > unit[j].GetUnitEnergy()) && (j > left)) j--;
304 unitSecond = unit[i];
306 unit[j] = unitSecond;
312 if(left < j) QS(unit, left, j);
313 if(i < right) QS(unit, i, right);
317 void AliEMCALJetFinderAlgoOmni::FindBG()
319 if(fBGType == kRatio) RatioBG();
320 else if(fBGType == kCone) ConeBG();
321 else if(fBGType == kConstant) ConstantBG();
324 void AliEMCALJetFinderAlgoOmni::RatioBG()
326 //Finds the background energy for the iteration
327 //using the Ratio method
328 if (fDebug>1) Info("FindBG","Finding Average Background");
329 //Store BGEperCell from previous iteration!
330 fEBGTotalOld = fEBGTotal;
334 //If user has not set fBGPar, set it to the default
335 //for TPC = 90% efficiency, PtCut = 2GeV/c, timecut = 30ns
336 if(fBGPar == -1) fBGPar = 0.4685;
338 //Loop over all unit objects in the Unit array and link to same
339 //unit ID in NoCuts Unit array
340 for(Int_t i=0; i<fNumUnits; i++)
342 if(fUnit[i].GetUnitFlag() != kInJet)
344 Int_t id = fUnit[i].GetUnitID();
345 fEBGTotal += fUnitNoCuts[id-1].GetUnitEnergy();
351 fEBGAve = fEBGTotal / (fNumUnits - numCone);
352 if (fDebug>5) Info("FindBG","Average BG is %f: ",fEBGAve);
354 for(Int_t count=0; count<fNumUnits;count++)
356 fUnit[count].SetUnitFlag(kOutJet);
360 void AliEMCALJetFinderAlgoOmni::ConeBG()
362 //Finds the background energy for the iteration
363 //using all energy not contained inside a jet
364 if (fDebug>1) Info("FindBG","Finding Average Background");
365 //Store old value of BGEperCell!
366 fEBGTotalOld = fEBGTotal;
370 //Loop over all unit objects in the array and sum the energy of those not in a jet
371 for(Int_t i=0; i<fNumUnits; i++)
373 if(fUnit[i].GetUnitFlag() != kInJet)
374 fEBGTotal += fUnit[i].GetUnitEnergy();
378 fEBGAve = fEBGTotal / (fNumUnits - numCone);
379 if (fDebug>5) Info("FindBG","Average BG is %f: ",fEBGAve);
381 for(Int_t count=0; count<fNumUnits;count++)
383 fUnit[count].SetUnitFlag(kOutJet);
387 void AliEMCALJetFinderAlgoOmni::ConstantBG()
389 //Finds the background energy for the iteration
390 //using all energy not contained inside a jet
391 if (fDebug>1) Info("FindBG","Finding Average Background");
393 //If user has not set fBGPar, set it to the default
394 //for TPC = 90% efficiency, PtCut = 2GeV/c, timecut = 30ns
395 if(fBGPar == -1) fBGPar = 0.03378;
398 if (fDebug>5) Info("FindBG","Average BG is %f: ",fEBGAve);
402 for(Int_t count=0; count<fNumUnits;count++)
404 if(fUnit[count].GetUnitFlag() == kInJet)
408 fUnit[count].SetUnitFlag(kOutJet);
410 fEBGTotal = fEBGAve * (fNumUnits-numCone);
411 fEBGTotalOld = fEBGTotal;
414 void AliEMCALJetFinderAlgoOmni::FindJetEtaPhi(Int_t counter)
416 //Finds the eta and phi of the jet axis
417 if (fDebug>10) Info("FindJetEtaPhi","Finding Jet Eta and Phi");
419 fDEta = fUnit[counter].GetUnitEta() - fEtaInit;
420 fDPhi = fUnit[counter].GetUnitPhi() - fPhiInit;
422 fEnergy = fUnit[counter].GetUnitEnergy() - fEBGAve;
423 fJetEtaSum += fEnergy * fDEta;
424 fJetPhiSum += fEnergy * fDPhi;
426 fJetEta = fEtaInit + (fJetEtaSum / fJetESum);
427 fJetPhi = fPhiInit + (fJetPhiSum / fJetESum);
431 void AliEMCALJetFinderAlgoOmni::FindJetEnergy()
433 //Finds the energy of the jet after the final axis has been found
434 if (fDebug>1) Info("FindJetEnergy","Finding Jet Energy");
436 for(Int_t i=0; i<fNumUnits; i++)
438 //Loop over all unit objects in the array and find if within cone radius
439 Float_t dEta = fUnit[i].GetUnitEta() - fJetEta;
440 Float_t dPhi = fUnit[i].GetUnitPhi() - fJetPhi;
441 Float_t rad = TMath::Sqrt( (dEta*dEta) + (dPhi*dPhi) );
443 if(fUnit[i].GetUnitFlag()==kOutJet && rad<= fConeRad)
445 fUnit[i].SetUnitFlag(kInCurrentJet);
446 Float_t energy = fUnit[i].GetUnitEnergy() - fEBGAve;
448 fJetEtaSum += energy * dEta;
449 fJetPhiSum += energy * dPhi;
450 fNumInCone++; //Increment the number of cells in the jet cone
456 void AliEMCALJetFinderAlgoOmni::StoreJetInfo()
458 //Stores the resulting jet information in appropriate storage structure (TO BE DECIDED!!!!)
459 if (fDebug>1) Info("StoreJetInfo","Storing Jet Information");
462 //fJetESum is the final jet energy (background has been subtracted)
463 //fJetEta is the final jet Eta
464 //fJetPhi is the final jet Phi
465 //fNumInCone is the final number of cells included in the jet cone
466 //fEtaInit is the eta of the initiator cell
467 //fPhiInit is the phi of the initiator cell
468 fJet.SetEnergy(fJetESum);
469 fJet.SetEta(fJetEta);
470 fJet.SetPhi(fJetPhi);
472 cout<<"For iteration "<<fNumIter <<" and Jet number " <<fNumJets <<endl;
473 cout<<"The jet energy is: " <<fJetESum <<endl;
474 cout<<"The jet eta is ---->" <<fJetEta <<endl;
475 cout<<"The jet phi is ---->" <<fJetPhi <<endl;
477 Int_t numberTracks = fInputPointer->GetNTracks();
479 Int_t numTracksInCone = 0;
481 for(Int_t counter=0; counter<numberTracks; counter++)
483 myP = fInputPointer->GetTrack(counter);
484 Float_t eta = myP->Eta();
485 Float_t phi = myP->Phi();
486 Float_t deta = fJetEta-eta;
487 Float_t dphi = fJetPhi -phi;
488 Float_t rad = TMath::Sqrt( (deta*deta) + (dphi*dphi));
489 if(rad<=fConeRad) numTracksInCone++;
492 Float_t *pTArray = new Float_t[numTracksInCone];
493 Float_t *etaArray = new Float_t[numTracksInCone];
494 Float_t *phiArray = new Float_t[numTracksInCone];
495 Int_t *pdgArray = new Int_t[numTracksInCone];
498 for(Int_t counter2=0; counter2<numberTracks; counter2++)
500 myP = fInputPointer->GetTrack(counter2);
501 Float_t eta = myP->Eta();
502 Float_t phi = myP->Phi();
503 Float_t deta = fJetEta-eta;
504 Float_t dphi = fJetPhi -phi;
505 Float_t rad = TMath::Sqrt( (deta*deta) + (dphi*dphi));
508 pTArray[index] = myP->Pt();
509 etaArray[index] = eta;
510 phiArray[index] = phi;
511 pdgArray[index] = myP->GetPdgCode();
516 fJet.SetTrackList(numTracksInCone,pTArray, etaArray, phiArray, pdgArray);
517 fOutputObject.AddJet(&fJet);
525 void AliEMCALJetFinderAlgoOmni::FindJets()
527 //Runs the complete UA1 JetFinding algorithm to find jets!
528 if (fDebug>1) Info("FindJets","Starting Jet Finding!!!");
530 //If the array of JetFinderUnit objects has not been initialised then initialise with default settings
531 if(!fArrayInitialised)
534 FillUnitArray(kFillAll);
536 if (fDebug>1) Info("FindJets","Unit array filled");
538 //Step 1. Sort the array in descending order of Energy
539 Sort(fUnit,fNumUnits);
541 //Step 2. Set the number of iterations and Number of jets found to zero to start
545 //Step 3. Begin the iteration loop to find jets
546 //Need to iterate the algorithm while number of iterations<2 OR number of iterations<10 AND
547 //the value of the average background has changed more than specified amount
548 //Min iterations = 2, Max iterations = 10
549 //while(fNumIter<2 || (fNumIter <10 && ( (fEBGTotal-fEBGTotalOld)/fEBGTotal) > fBGMaxMove) )
551 while(fNumIter<2 || (fNumIter <10 && ( fEBGTotal-fEBGTotalOld) > fEBGTotal*fBGMaxMove) )
553 if (fDebug>1) Info("FindJets","Starting BIG iteration ---> %i",fNumIter);
555 //Step 4. Find the value of the average background energy
557 fOutputObject.Reset(kResetJets); //Reset output object to store info for new iteration
560 //Loop over the array of unit objects and flag those with energy below MinCellEt
562 for(Int_t j=0; j<fNumUnits; j++)
564 if( (fUnit[j].GetUnitEnergy()-fEBGAve) < fEtMin)
566 // fUnit[j].SetUnitFlag(kBelowMinEt); TAKING OUT kBelow flag
570 //cout<<"THERE WERE "<<numbelow<<" units with E <EtMin!!!!!!!!!!!!!!!"<<endl;
572 //Do quick check if there are no jets upfront
573 // if(fUnit[0].GetUnitFlag() == kBelowMinEt)
574 if( (fUnit[0].GetUnitEnergy()-fEBGAve) < fEtMin)
576 cout <<"There are no jets for this event!" <<endl;
580 //Step 5. Begin with the first jet candidate cell (JET SEED LOOP)
581 if (fDebug>5) Info("FindJets","Beginning JET SEED LOOP");
582 for(Int_t count=0; count<fNumUnits; count++)
585 //CHECK CONDITION HERE _ NOT SURE IF SHOULD MAYBE BE: GetUnitEnergy()-fEBGAve >fESeed?????????????????????????????
586 if(fUnit[count].GetUnitEnergy()>=fESeed && fUnit[count].GetUnitFlag()==kOutJet)
588 fEnergy = fUnit[count].GetUnitEnergy() - fEBGAve;
589 fJetEta = fUnit[count].GetUnitEta();
590 fJetPhi = fUnit[count].GetUnitPhi();
591 Int_t seedID = fUnit[count].GetUnitID();
592 if (fDebug>5) Info("FindJets","Inside first candidate jet seed loop for time : %i", count);
593 if (fDebug>5) Info("FindJets","Found candidate energy %f ",fEnergy);
594 if (fDebug>5) Info("FindJets","Found candidate eta %f ", fJetEta);
595 if (fDebug>5) Info("FindJets","Found candidate phi %f ", fJetPhi);
596 if (fDebug>5) Info("FindJets","Found candidate ID %i", seedID);
606 //Step 6. Find Jet Eta and Phi
607 //Loop over all units in the array to find the ones in the jet cone and determine contrib to Jet eta, phi
610 for(Int_t count1=0; count1<fNumUnits; count1++)
612 if(fUnit[count1].GetUnitID() == seedID) continue; //skip unit if the jetseed to avoid doublecounting
613 if(fUnit[count1].GetUnitFlag() == kOutJet)
615 fDEta = fUnit[count1].GetUnitEta() - fJetEta;
616 fDPhi = fUnit[count1].GetUnitPhi() - fJetPhi;
617 fRad = TMath::Sqrt( (fDEta*fDEta) + (fDPhi*fDPhi) );
620 FindJetEtaPhi(count1);
623 }//end for (Jet Eta, Phi LOOP)
625 //Find the distance cone centre moved from previous cone centre
626 if (fDebug>10) Info("FindJets","Checking if cone move small enough");
627 fDistP = TMath::Sqrt( ((fJetEta-fEtaB)*(fJetEta-fEtaB)) + ((fJetPhi-fPhiB)*(fJetPhi-fPhiB)) );
628 // if(fDistP <= fMinMove) break;
631 //Find the distance cone centre is from initiator cell
632 if (fDebug>10) Info("FindJets","Checking if cone move too large");
633 fDistI = TMath::Sqrt( ((fJetEtaSum/fJetESum)*(fJetEtaSum/fJetESum)) + ((fJetPhiSum/fJetESum)*
634 (fJetPhiSum/fJetESum)));
636 if(fDistP>fMinMove && fDistI<fMaxMove)
642 }while(fDistP>fMinMove && fDistI<fMaxMove);
648 //Step 7. Find the Jet Energy
649 if (fDebug>1) Info("FindJets","Looking for Jet energy");
656 //cout<<"Number of cells in jet cone is: "<<fNumInCone<<endl;
658 //Step 8. Check if the jet is a valid jet
659 //Check if cluster energy is above Min allowed to be a jet
660 //DID NOT DO THE COSH COMPARISON HERE -> NEED TO CHECK WHICH COMPARISON IS BEST!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
661 if (fDebug>5) Info("FindJets","Checking cluster is valid jet");
662 if(fJetESum < fJetEMin)
664 for(Int_t count2=0; count2<fNumUnits; count2++)
666 if(fUnit[count2].GetUnitFlag()==kInCurrentJet || fUnit[count2].GetUnitFlag()==kOutJet)
667 fUnit[count2].SetUnitFlag(kOutJet);
669 if (fDebug>10) Info("FindJets","NOT a valid jet cell");
672 for(Int_t count2=0; count2<fNumUnits; count2++)
674 if(fUnit[count2].GetUnitFlag()==kInCurrentJet)
676 // cout<<"Setting unit #"<<count2 <<" to be officially in a jet!"<<endl;
677 fUnit[count2].SetUnitFlag(kInJet);
681 //NEED TO CHECK FINAL WEIRD ITERATION OF ETA AND PHI CHANGES!!!!!!!!!
682 // fJetPhi += fJetPhiSum/fJetESum; //CHECK!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
683 // fJetEta += fJetEtaSum/fJetESum; //CHECK!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
685 fNumJets++; //Incrementing number of jets found
686 StoreJetInfo(); //Storing jet info
688 }//end if (check cluster above Min Jet Energy)
689 }//end if (Jet Seed condition)
690 }//end (JET SEED LOOP)
692 if (fDebug>5) Info("FindJets","End of BIG iteration number %i",fNumIter);
695 }//end 10 iteration WHILE LOOP