StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StjeParticleCollector.cxx
1 // $Id: StjeParticleCollector.cxx,v 1.3 2010/04/24 04:15:35 pibero Exp $
2 // Copyright (C) 2008 Tai Sakuma <sakuma@bnl.gov>
3 #include "StjeParticleCollector.h"
4 
5 #include <StJetFinder/AbstractFourVec.h>
6 
7 #include <emulator/StMuTrackFourVec.h>
8 #include <StFourPMaker.h>
9 
10 #include <vector>
11 
12 using namespace std;
13 
14 StjeParticleCollector::StjeParticleCollector(const StppAnaPars* ap, StFourPMaker* fp, ParticleList& particleList)
15  : _fourPMaker(fp)
16  , _particleList(particleList)
17  , _anaPar(*ap)
18 {
19 }
20 
21 void StjeParticleCollector::Do(int iVertex)
22 {
23  const vector<AbstractFourVec*> &particleList = _fourPMaker->getVertexNodes()[iVertex].tracks;
24 
25  _particleList.clear();
26 
27  for(vector<AbstractFourVec*>::const_iterator particle = particleList.begin(); particle != particleList.end(); ++particle) {
28 
29  if(shoudNotPassToJetFinder(*particle)) continue;
30 
31  _particleList.push_back(*particle);
32  }
33 }
34 
35 size_t StjeParticleCollector::numberOfVertices() const
36 {
37  return _fourPMaker->getVertexNodes().size();
38 }
39 
40 bool StjeParticleCollector::shoudNotPassToJetFinder(const AbstractFourVec* particle) const
41 {
42  const StMuTrackFourVec* p = dynamic_cast<const StMuTrackFourVec*>(particle);
43 
44  if (p == 0) return true;
45 
46  if (p->pt() <= _anaPar.mPtMin) return true;
47 
48  if (fabs(p->eta()) >= _anaPar.mEtaMax) return true;
49 
50  if(isChargedTrack(p)) {
51 
52  StMuTrackEmu* track = p->track();
53  if (track->flag() <= _anaPar.mFlagMin) return true;
54 
55  if (track->nHits() <= _anaPar.mNhits) return true;
56  }
57 
58  return false;
59 }
60 
61 bool StjeParticleCollector::isChargedTrack(const StMuTrackFourVec* p) const
62 {
63  return p->track() != 0;
64 }
double pt() const
momenta