00001
00002
00003
00004
00005
00006
00007 #ifndef StJetSpliterMerger_HH
00008 #define StJetSpliterMerger_HH
00009
00010
00011 #include <vector>
00012 #include <map>
00013 #include <list>
00014 using std::vector;
00015 using std::multimap;
00016
00017
00018 #include "StConeJetFinder.h"
00019 #include "StEtaPhiCell.h"
00020
00021
00022 struct EtNeighbor {
00023
00024
00025 typedef vector<StEtaPhiCell*> CellVec;
00026
00027 EtNeighbor() : nCommonCells(0), sharedEt(0) { }
00028
00029
00030 void check(StEtaPhiCell* lhs, StEtaPhiCell* rhs);
00031
00032
00033 StEtaPhiCell::CellList::iterator _otherCell;
00034
00035
00036 int nCommonCells;
00037 double sharedEt;
00038 CellVec cells;
00039
00040 friend bool operator<(const EtNeighbor& lhs, const EtNeighbor& rhs){
00041 return lhs.sharedEt < rhs.sharedEt;
00042 }
00043
00044 };
00045
00054 class StJetSpliterMerger
00055 {
00056 public:
00057 typedef StEtaPhiCell::CellList CellList;
00058
00059 StJetSpliterMerger() {};
00060 virtual ~StJetSpliterMerger() {};
00061
00063 void setSplitFraction(double v) {mSplitFraction=v;}
00064 double splitFraction() const {return mSplitFraction;}
00065
00067 void splitMerge(CellList& jets);
00068
00069 private:
00070
00071 typedef vector<StEtaPhiCell*> CellVec;
00072 void split(StEtaPhiCell& root, StEtaPhiCell& neighbor, CellVec& commonCells);
00073 void merge(StEtaPhiCell& root, StEtaPhiCell& neighbor, CellVec& commonCells);
00074
00075 double mSplitFraction;
00076
00077 CellList _preJets;
00078 std::list<EtNeighbor> _OverlapList;
00079
00080 };
00081
00082
00083
00084
00085 inline void EtNeighbor::check(StEtaPhiCell* lhs, StEtaPhiCell* rhs)
00086 {
00087
00088 if (!lhs->isSamePosition(*rhs)) return;
00089
00090 sharedEt += lhs->eT();
00091 ++nCommonCells;
00092 cells.push_back(lhs);
00093 }
00094
00095 inline ostream& operator<<(ostream& os, const EtNeighbor& n)
00096 {
00097 return os <<"sumEt:\t"<<n.sharedEt<<"\tnCells:\t"<<n.nCommonCells;
00098 }
00099
00100 struct PreJetLazyUpdater
00101 {
00102 PreJetLazyUpdater() : sumEt(0.) {};
00103 double sumEt;
00104
00105 void operator()(StEtaPhiCell& cell);
00106 void operator()(StEtaPhiCell* cell);
00107 };
00108
00109 struct PostMergeUpdater
00110 {
00111 void operator()(StEtaPhiCell& cell);
00112 };
00113
00114
00115
00116
00117 #endif