00001
00002
00003
00004 #ifndef STETAPHIGRID_H
00005 #define STETAPHIGRID_H
00006
00007 #include "StEtGridKey.h"
00008 #include "StEtaPhiCell.h"
00009
00010 #include <map>
00011 #include <list>
00012
00013 class StJetEtCellFactory;
00014 class StConePars;
00015
00016 namespace StSpinJet {
00017
00018 class StEtaPhiGrid {
00019
00020 public:
00021
00022 typedef std::list<StProtoJet> JetList;
00023 typedef std::map<StEtGridKey, StEtaPhiCell*> CellMap;
00024 typedef CellMap::value_type CellMapValType;
00025 typedef StEtaPhiCell::CellList CellList;
00026
00027 StEtaPhiGrid(StConePars& pars) : _pars(pars) { }
00028
00029 ~StEtaPhiGrid();
00030
00031 void buildGrid(StJetEtCellFactory* cellFactory);
00032
00033 void fillGridWith(JetList& protoJetList);
00034
00035 CellList EtSortedCellList();
00036 CellList WithinTheConeRadiusCellList(const StEtaPhiCell& theCell) const;
00037
00038 StEtaPhiCell* findMidpointCell(const StEtaPhiCell& cell1, const StEtaPhiCell& cell2);
00039
00040 StEtaPhiCell* Cell(double eta, double phi);
00041
00042 private:
00043
00044 StEtaPhiCell* CellI(int iEta, int iPhi) const;
00045
00046 StEtGridKey findKey(double eta, double phi) const;
00047 int findEtaKey(double eta) const;
00048 int findPhiKey(double phi) const;
00049
00050 double midpoint(double v1, double v2);
00051
00052 StConePars& _pars;
00053 CellMap _EtCellMap;
00054 CellList _EtCellList;
00055
00056 };
00057
00058 }
00059
00060 #endif // STETAPHIGRID_H