StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StConeJetFinderBase.cxx
1 // $Id: StConeJetFinderBase.cxx,v 1.11 2010/07/02 21:47:56 pibero Exp $
2 #include "StConeJetFinderBase.h"
3 
4 #include "TObject.h"
5 
6 //std
7 #include <iostream>
8 #include <algorithm>
9 #include <time.h>
10 #include <map>
11 using std::sort;
12 
13 //StJetFinder
14 #include "StJetEtCell.h"
15 #include "StJetSpliterMerger.h"
16 #include "StProtoJet.h"
17 
18 using namespace StSpinJet;
19 
21  : mPars(pars)
22  , mWorkCell(new StJetEtCell)
23  , _cellGrid(mPars)
24 {
25 
26 }
27 
28 StConeJetFinderBase::~StConeJetFinderBase()
29 {
30  delete mWorkCell;
31 }
32 
33 void StConeJetFinderBase::Init()
34 {
35  _cellGrid.buildGrid(makeCellFactory());
36 }
37 
38 StEtaPhiCell::CellList StConeJetFinderBase::generateToSearchListFrom(CellList& orderedList)
39 {
40  CellList toSearchList;
41 
42  for (CellList::iterator cell = orderedList.begin(); cell != orderedList.end(); ++cell) {
43 
44  if ((*cell)->eT() <= mPars.seedEtMin()) break;
45 
46  toSearchList.push_back(*cell);
47 
48  }
49 
50  return toSearchList;
51 }
52 
53 void StConeJetFinderBase::initializeWorkCell(const StEtaPhiCell* other)
54 {
55  mWorkCell->clear();
56  *mWorkCell = *other;
57  mWorkCell->setEt(0.);
58  if (mWorkCell->cellList().empty()==false) {
59  cout <<"StConeJetFinderBase::initializeWorkCell(). ERROR:\t"
60  <<"workCell is not empty. abort()"<<endl;
61  abort();
62  }
63 }
64 
65 void StConeJetFinderBase::formCone()
66 {
67  CellList cellList = _cellGrid.WithinTheConeRadiusCellList(*mWorkCell);
68 
69  for (CellList::iterator cell = cellList.begin(); cell != cellList.end(); ++cell) {
70  if(shouldNotAddToTheCell(*mWorkCell, **cell)) continue;
71  mWorkCell->addCell(*cell);
72  }
73 }
74 
75 const StProtoJet& StConeJetFinderBase::collectCell(StEtaPhiCell* seed)
76 {
77 
78  if (seed->cellList().empty()) {
79  StProtoJet& center = seed->protoJet();
80  center.update();
81  cout <<"\treturn w/o action. empty cell"<<endl;
82  return center;
83  }
84 
85 
86  //arbitrarily choose protojet from first cell in list
87  CellList& cells = seed->cellList();
88  StEtaPhiCell* centerCell = cells.front();
89  StProtoJet& center = centerCell->protoJet();
90 
91 
92  //now combine protojets from other cells
93  for (CellList::iterator it = cells.begin(); it != cells.end(); ++it) {
94  if (it != cells.begin()) { //don't double count first!
95  StEtaPhiCell* cell = (*it);
96  if (!cell) {
97  cout <<"\tStConeJetFinderBase::collectCell(). ERROR:\t"
98  <<"null cell. skip"<<endl;
99  }
100  if (centerCell==*it) {
101  cout <<"\tStConeJetFinderBase::collectCell(). ERROR:\t"
102  <<"attempt to add self! skip"<<endl;
103  } else {
104  //cout <<"\t\tadding cell:\t"<<icell++<<endl;
105  if (cell->empty()==false) {
106  center.add( cell->protoJet() );
107  }
108  }
109  }
110  }
111  center.update();
112  return center;
113 }
114 
StConeJetFinderBase()
Only available for derived classes.
StEtaPhiCell * mWorkCell
run-time pars