StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StCdfChargedConeJetFinder.cxx
1 // $Id: StCdfChargedConeJetFinder.cxx,v 1.27 2008/05/08 05:02:13 tai Exp $
2 #include "StCdfChargedConeJetFinder.h"
3 
4 #include "StJetEtCell.h"
5 #include "StProtoJet.h"
6 #include "StCdfChargedJetEtCell.h"
7 
8 StCdfChargedConeJetFinder::StCdfChargedConeJetFinder(const StCdfChargedConePars& pars)
9  : StConeJetFinderBase(pars)
10 {
11 
12 }
13 
14 StCdfChargedConeJetFinder::~StCdfChargedConeJetFinder()
15 {
16 }
17 
18 StJetEtCellFactory* StCdfChargedConeJetFinder::makeCellFactory()
19 {
21 }
22 
23 void StCdfChargedConeJetFinder::findJets(JetList& protoJetList, const FourVecList& particleList)
24 {
25  protoJetList.clear();
26 
27  for(FourVecList::const_iterator particle = particleList.begin(); particle != particleList.end(); ++particle) {
28  protoJetList.push_back(StProtoJet(*particle));
29  }
30 
31  clearPreviousResult();
32 
33  CellList orderedList = generateLeadingPtOrderedList(protoJetList);
34 
35  CellList toSearchList = generateToSearchListFrom(orderedList);
36 
37  findProtoJets(toSearchList);
38 
39  storeTheResultIn(protoJetList);
40 
41 }
42 
43 void StCdfChargedConeJetFinder::clearPreviousResult()
44 {
45  for(CellList::iterator it = _preJets.begin(); it != _preJets.end(); ++it) {
46  delete *it;
47  }
48  _preJets.clear();
49 }
50 
51 void StCdfChargedConeJetFinder::storeTheResultIn(JetList& protoJetList)
52 {
53  protoJetList.clear();
54 
55  for (CellList::iterator jet = _preJets.begin(); jet != _preJets.end(); ++jet) {
56 
57  if ((*jet)->cellList().size() == 0) continue;
58 
59  protoJetList.push_back( collectCell(*jet) );
60  }
61 }
62 
63 void StCdfChargedConeJetFinder::findProtoJets(CellList& toSearchList)
64 {
65  for (CellList::iterator cell = toSearchList.begin(); cell != toSearchList.end(); ++cell) {
66 
67  if (shouldNotSearchForJetAroundThis((*cell))) continue;
68 
69  findJetAroundThis(*cell);
70  }
71 }
72 
73 StEtaPhiCell::CellList StCdfChargedConeJetFinder::generateLeadingPtOrderedList(JetList& protoJetList)
74 {
75  _cellGrid.fillGridWith(protoJetList);
76  return _cellGrid.EtSortedCellList();
77 }
78 
79 void StCdfChargedConeJetFinder::findJetAroundThis(StEtaPhiCell* cell)
80 {
81  initializeWorkCell(cell);
82 
83  formCone();
84  addToPrejets(*mWorkCell);
85 }
86 
87 bool StCdfChargedConeJetFinder::shouldNotSearchForJetAroundThis(const StEtaPhiCell* cell) const
88 {
89  if (cell->nTimesUsed()) return true;
90 
91  if (cell->empty()) return true;
92 
93  return false;
94 }
95 
96 bool StCdfChargedConeJetFinder::shouldNotAddToTheCell(const StEtaPhiCell& theCell, const StEtaPhiCell& otherCell) const
97 {
98  if (otherCell.nTimesUsed()) return true;
99  if (otherCell.empty()) return true;
100  if (otherCell.eT() <= mPars.assocEtMin()) return true;
101  return false;
102 }
103 
104 void StCdfChargedConeJetFinder::addToPrejets(StEtaPhiCell& cell)
105 {
106  cell.setEt(0);
107  for(CellList::iterator etCell = cell.cellList().begin(); etCell != cell.cellList().end(); ++etCell) {
108  (*etCell)->update();
109  cell.setEt(cell.Et() + (*etCell)->eT());
110  }
111 
112  _preJets.push_back(cell.clone());
113 
114 }
115 
StEtaPhiCell * mWorkCell
run-time pars