00001
00002 #include "StConeJetFinderBase.h"
00003
00004 #include "TObject.h"
00005
00006
00007 #include <iostream>
00008 #include <algorithm>
00009 #include <time.h>
00010 #include <map>
00011 using std::sort;
00012
00013
00014 #include "StJetEtCell.h"
00015 #include "StJetSpliterMerger.h"
00016 #include "StProtoJet.h"
00017
00018 using namespace StSpinJet;
00019
00020 StConeJetFinderBase::StConeJetFinderBase(const StConePars& pars)
00021 : mPars(pars)
00022 , mWorkCell(new StJetEtCell)
00023 , _cellGrid(mPars)
00024 {
00025
00026 }
00027
00028 StConeJetFinderBase::~StConeJetFinderBase()
00029 {
00030 delete mWorkCell;
00031 }
00032
00033 void StConeJetFinderBase::Init()
00034 {
00035 _cellGrid.buildGrid(makeCellFactory());
00036 }
00037
00038 StEtaPhiCell::CellList StConeJetFinderBase::generateToSearchListFrom(CellList& orderedList)
00039 {
00040 CellList toSearchList;
00041
00042 for (CellList::iterator cell = orderedList.begin(); cell != orderedList.end(); ++cell) {
00043
00044 if ((*cell)->eT() <= mPars.seedEtMin()) break;
00045
00046 toSearchList.push_back(*cell);
00047
00048 }
00049
00050 return toSearchList;
00051 }
00052
00053 void StConeJetFinderBase::initializeWorkCell(const StEtaPhiCell* other)
00054 {
00055 mWorkCell->clear();
00056 *mWorkCell = *other;
00057 mWorkCell->setEt(0.);
00058 if (mWorkCell->cellList().empty()==false) {
00059 cout <<"StConeJetFinderBase::initializeWorkCell(). ERROR:\t"
00060 <<"workCell is not empty. abort()"<<endl;
00061 abort();
00062 }
00063 }
00064
00065 void StConeJetFinderBase::formCone()
00066 {
00067 CellList cellList = _cellGrid.WithinTheConeRadiusCellList(*mWorkCell);
00068
00069 for (CellList::iterator cell = cellList.begin(); cell != cellList.end(); ++cell) {
00070 if(shouldNotAddToTheCell(*mWorkCell, **cell)) continue;
00071 mWorkCell->addCell(*cell);
00072 }
00073 }
00074
00075 const StProtoJet& StConeJetFinderBase::collectCell(StEtaPhiCell* seed)
00076 {
00077
00078 if (seed->cellList().empty()) {
00079 StProtoJet& center = seed->protoJet();
00080 center.update();
00081 cout <<"\treturn w/o action. empty cell"<<endl;
00082 return center;
00083 }
00084
00085
00086
00087 CellList& cells = seed->cellList();
00088 StEtaPhiCell* centerCell = cells.front();
00089 StProtoJet& center = centerCell->protoJet();
00090
00091
00092
00093 for (CellList::iterator it = cells.begin(); it != cells.end(); ++it) {
00094 if (it != cells.begin()) {
00095 StEtaPhiCell* cell = (*it);
00096 if (!cell) {
00097 cout <<"\tStConeJetFinderBase::collectCell(). ERROR:\t"
00098 <<"null cell. skip"<<endl;
00099 }
00100 if (centerCell==*it) {
00101 cout <<"\tStConeJetFinderBase::collectCell(). ERROR:\t"
00102 <<"attempt to add self! skip"<<endl;
00103 } else {
00104
00105 if (cell->empty()==false) {
00106 center.add( cell->protoJet() );
00107 }
00108 }
00109 }
00110 }
00111 center.update();
00112 return center;
00113 }
00114