00001
00002 #include "StCdfChargedConeJetFinder.h"
00003
00004 #include "StJetEtCell.h"
00005 #include "StProtoJet.h"
00006 #include "StCdfChargedJetEtCell.h"
00007
00008 StCdfChargedConeJetFinder::StCdfChargedConeJetFinder(const StCdfChargedConePars& pars)
00009 : StConeJetFinderBase(pars)
00010 {
00011
00012 }
00013
00014 StCdfChargedConeJetFinder::~StCdfChargedConeJetFinder()
00015 {
00016 }
00017
00018 StJetEtCellFactory* StCdfChargedConeJetFinder::makeCellFactory()
00019 {
00020 return new StCdfChargedJetEtCellFactory;
00021 }
00022
00023 void StCdfChargedConeJetFinder::findJets(JetList& protoJetList, const FourVecList& particleList)
00024 {
00025 protoJetList.clear();
00026
00027 for(FourVecList::const_iterator particle = particleList.begin(); particle != particleList.end(); ++particle) {
00028 protoJetList.push_back(StProtoJet(*particle));
00029 }
00030
00031 clearPreviousResult();
00032
00033 CellList orderedList = generateLeadingPtOrderedList(protoJetList);
00034
00035 CellList toSearchList = generateToSearchListFrom(orderedList);
00036
00037 findProtoJets(toSearchList);
00038
00039 storeTheResultIn(protoJetList);
00040
00041 }
00042
00043 void StCdfChargedConeJetFinder::clearPreviousResult()
00044 {
00045 for(CellList::iterator it = _preJets.begin(); it != _preJets.end(); ++it) {
00046 delete *it;
00047 }
00048 _preJets.clear();
00049 }
00050
00051 void StCdfChargedConeJetFinder::storeTheResultIn(JetList& protoJetList)
00052 {
00053 protoJetList.clear();
00054
00055 for (CellList::iterator jet = _preJets.begin(); jet != _preJets.end(); ++jet) {
00056
00057 if ((*jet)->cellList().size() == 0) continue;
00058
00059 protoJetList.push_back( collectCell(*jet) );
00060 }
00061 }
00062
00063 void StCdfChargedConeJetFinder::findProtoJets(CellList& toSearchList)
00064 {
00065 for (CellList::iterator cell = toSearchList.begin(); cell != toSearchList.end(); ++cell) {
00066
00067 if (shouldNotSearchForJetAroundThis((*cell))) continue;
00068
00069 findJetAroundThis(*cell);
00070 }
00071 }
00072
00073 StEtaPhiCell::CellList StCdfChargedConeJetFinder::generateLeadingPtOrderedList(JetList& protoJetList)
00074 {
00075 _cellGrid.fillGridWith(protoJetList);
00076 return _cellGrid.EtSortedCellList();
00077 }
00078
00079 void StCdfChargedConeJetFinder::findJetAroundThis(StEtaPhiCell* cell)
00080 {
00081 initializeWorkCell(cell);
00082
00083 formCone();
00084 addToPrejets(*mWorkCell);
00085 }
00086
00087 bool StCdfChargedConeJetFinder::shouldNotSearchForJetAroundThis(const StEtaPhiCell* cell) const
00088 {
00089 if (cell->nTimesUsed()) return true;
00090
00091 if (cell->empty()) return true;
00092
00093 return false;
00094 }
00095
00096 bool StCdfChargedConeJetFinder::shouldNotAddToTheCell(const StEtaPhiCell& theCell, const StEtaPhiCell& otherCell) const
00097 {
00098 if (otherCell.nTimesUsed()) return true;
00099 if (otherCell.empty()) return true;
00100 if (otherCell.eT() <= mPars.assocEtMin()) return true;
00101 return false;
00102 }
00103
00104 void StCdfChargedConeJetFinder::addToPrejets(StEtaPhiCell& cell)
00105 {
00106 cell.setEt(0);
00107 for(CellList::iterator etCell = cell.cellList().begin(); etCell != cell.cellList().end(); ++etCell) {
00108 (*etCell)->update();
00109 cell.setEt(cell.Et() + (*etCell)->eT());
00110 }
00111
00112 _preJets.push_back(cell.clone());
00113
00114 }
00115