StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StJetSpliterMerger.h
1 // -*- mode: c++;-*-
2 // $Id: StJetSpliterMerger.h,v 1.8 2008/05/08 05:02:14 tai Exp $
3 //StJetSpliterMerger.h
4 //M.L. Miller (Yale Software)
5 //10/02
6 
7 #ifndef StJetSpliterMerger_HH
8 #define StJetSpliterMerger_HH
9 
10 //std
11 #include <vector>
12 #include <map>
13 #include <list>
14 using std::vector;
15 using std::multimap;
16 
17 //local
18 #include "StConeJetFinder.h"
19 #include "StEtaPhiCell.h"
20 
21 //useful struct for recording overlaping jets
22 struct EtNeighbor {
23 
24  // typedef StConeJetFinder::ValueCellList ValueCellList;
25  typedef vector<StEtaPhiCell*> CellVec;
26 
27  EtNeighbor() : nCommonCells(0), sharedEt(0) { }
28 
29  //are these the same? If so, book-keep
30  void check(StEtaPhiCell* lhs, StEtaPhiCell* rhs);
31 
32  //careful, this gets invalidated after insert/delete/sorts in list
33  StEtaPhiCell::CellList::iterator _otherCell;
34 
35  //book-keep
36  int nCommonCells;
37  double sharedEt;
38  CellVec cells; //shared cells
39 
40  friend bool operator<(const EtNeighbor& lhs, const EtNeighbor& rhs){
41  return lhs.sharedEt < rhs.sharedEt;
42  }
43 
44 };
45 
55 {
56 public:
57  typedef StEtaPhiCell::CellList CellList;
58 
59  StJetSpliterMerger() {};
60  virtual ~StJetSpliterMerger() {};
61 
63  void setSplitFraction(double v) {mSplitFraction=v;}
64  double splitFraction() const {return mSplitFraction;}
65 
67  void splitMerge(CellList& jets);
68 
69 private:
70 
71  typedef vector<StEtaPhiCell*> CellVec;
72  void split(StEtaPhiCell& root, StEtaPhiCell& neighbor, CellVec& commonCells);
73  void merge(StEtaPhiCell& root, StEtaPhiCell& neighbor, CellVec& commonCells);
74 
75  double mSplitFraction;
76 
77  CellList _preJets;
78  std::list<EtNeighbor> _OverlapList;
79 
80 };
81 
82 //non-members
83 
84 //are these the same? If so, book-keep
85 inline void EtNeighbor::check(StEtaPhiCell* lhs, StEtaPhiCell* rhs)
86 {
87  // if (!(*lhs==*rhs)) return;
88  if (!lhs->isSamePosition(*rhs)) return;
89 
90  sharedEt += lhs->eT();
91  ++nCommonCells;
92  cells.push_back(lhs);
93 }
94 
95 inline ostream& operator<<(ostream& os, const EtNeighbor& n)
96 {
97  return os <<"sumEt:\t"<<n.sharedEt<<"\tnCells:\t"<<n.nCommonCells;
98 }
99 
100 struct PreJetLazyUpdater //assume proto-jet updated
101 {
102  PreJetLazyUpdater() : sumEt(0.) {};
103  double sumEt;
104 
105  void operator()(StEtaPhiCell& cell);
106  void operator()(StEtaPhiCell* cell);
107 };
108 
110 {
111  void operator()(StEtaPhiCell& cell);
112 };
113 
114 
115 //inlines
116 
117 #endif
void setSplitFraction(double v)
split jets if E_shared/E_neighbor&gt;splitFraction
void splitMerge(CellList &jets)
action