FairRoot/PandaRoot
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
PndTrackCollection Class Reference

#include <PndTrackCollection.h>

Public Member Functions

 PndTrackCollection ()
 
virtual ~PndTrackCollection ()
 
void add (PndLineApproximation l, Bool_t skewed)
 
PndLine getCurrLine ()
 
PndLine getLastLine ()
 
vector< PndLineApproximation > * getLines ()
 
PndTrack getPndTrack (map< Int_t, PndFtsHit * > orgHits)
 
vector< PndFtsHit * > getHits ()
 
void addHit (PndFtsHit *h)
 
Double_t getDistTo (PndLine l, Int_t layer)
 

Public Attributes

vector< PndFtsHit * > fHits
 

Private Member Functions

PndFtsHitcopyHit (PndFtsHit *h)
 
void refitAllHits ()
 
void refitAllTracks ()
 
void refitHit (PndLine &l, PndFtsHit *hit)
 

Private Attributes

std::vector
< PndLineApproximation > * 
fLines
 
PndLine fCurrLine
 

Detailed Description

Definition at line 17 of file PndTrackCollection.h.

Constructor & Destructor Documentation

PndTrackCollection::PndTrackCollection ( )

Definition at line 10 of file PndTrackCollection.cxx.

References fLines.

10  {
11  fLines = new vector<PndLineApproximation>();
12 }
std::vector< PndLineApproximation > * fLines
PndTrackCollection::~PndTrackCollection ( )
virtual

Definition at line 14 of file PndTrackCollection.cxx.

14  {
15 }

Member Function Documentation

void PndTrackCollection::add ( PndLineApproximation  l,
Bool_t  skewed 
)

Definition at line 17 of file PndTrackCollection.cxx.

References copyHit(), fCurrLine, fLines, PndLineApproximation::getHits(), PndLineApproximation::getLine(), PndLine::getRating(), hits, i, refitAllHits(), refitAllTracks(), refitHit(), and PndLineApproximation::setHits().

Referenced by PndModuleCombiner::combineModules(), and PndWayFollower::followLines().

17  {
18  if(l.getLine().getRating()==-1)return;
19  //copy hits
20  vector<PndFtsHit*> newHits;
21  vector<PndFtsHit*> oldHits = l.getHits();
22  for(size_t i=0;i<oldHits.size();i++){
23  newHits.push_back(copyHit(oldHits[i]));
24  }
25  l.setHits(newHits);
26  //add new Aprrox
27  fLines->push_back(l);
28  //refit
29  if(fLines->size()==1)fCurrLine=(*fLines)[0].getLine();
30  if(fLines->size()>1 && skewed){
31  refitAllHits();
32  } else if(fLines->size()>1){
33  vector<PndFtsHit*> hits = l.getHits();
34  for(size_t i=0;i<hits.size();i++){
35  refitHit(fCurrLine,hits[i]);
36  }
37  }
39 }
vector< PndFtsHit * > getHits()
std::vector< PndLineApproximation > * fLines
Int_t i
Definition: run_full.C:25
void refitHit(PndLine &l, PndFtsHit *hit)
Int_t getRating()
Definition: PndLine.h:42
PndFtsHit * copyHit(PndFtsHit *h)
CbmHit * hits[nHits]
Definition: RiemannTest.C:19
void setHits(vector< PndFtsHit * > h)
void PndTrackCollection::addHit ( PndFtsHit h)
inline

Definition at line 36 of file PndTrackCollection.h.

36 {fHits.push_back(h);}
vector< PndFtsHit * > fHits
PndFtsHit * PndTrackCollection::copyHit ( PndFtsHit h)
private

Definition at line 41 of file PndTrackCollection.cxx.

References PndFtsHit::GetChamberID(), PndFtsHit::GetIsochrone(), PndFtsHit::GetIsochroneError(), PndFtsHit::GetLayerID(), PndFtsHit::GetTubeID(), h2, PndFtsHit::SetChamberID(), PndFtsHit::SetIsochrone(), PndFtsHit::SetIsochroneError(), PndFtsHit::SetLayerID(), and PndFtsHit::SetTubeID().

Referenced by add().

41  {
42  PndFtsHit* h2 = new PndFtsHit();
43  h2->SetDetectorID(h->GetDetectorID());
44  h2->SetTubeID(h->GetTubeID());
45  h2->SetChamberID(h->GetChamberID());
46  h2->SetLayerID(h->GetLayerID());
47  h2->SetXYZ(h->GetX(),h->GetY(),h->GetZ());
48  h2->SetIsochrone(h->GetIsochrone());
50  h2->SetRefIndex(h->GetRefIndex());
51  h2->SetEntryNr(h->GetEntryNr());
52  return h2;
53 }
void SetIsochrone(Double_t isochrone)
Definition: PndFtsHit.h:64
void SetChamberID(Int_t chamberid)
Definition: PndFtsHit.h:71
void SetTubeID(Int_t tubeid)
Definition: PndFtsHit.h:69
Int_t GetTubeID() const
Definition: PndFtsHit.h:70
Int_t GetLayerID() const
Definition: PndFtsHit.h:74
Double_t GetIsochrone() const
Definition: PndFtsHit.h:57
Double_t GetIsochroneError() const
Definition: PndFtsHit.h:58
void SetLayerID(Int_t layerid)
Definition: PndFtsHit.h:73
void SetIsochroneError(Double_t isochroneError)
Definition: PndFtsHit.h:65
Int_t GetChamberID() const
Definition: PndFtsHit.h:72
PndLine PndTrackCollection::getCurrLine ( )
inline

Definition at line 22 of file PndTrackCollection.h.

Referenced by PndForwardTrackFinderTask::saveTrackCollection().

22 {return fCurrLine;}
Double_t PndTrackCollection::getDistTo ( PndLine  l,
Int_t  layer 
)

Definition at line 110 of file PndTrackCollection.cxx.

References Double_t, fLines, PndLineApproximation::getHits(), PndLineApproximation::getLine(), PndLine::getPerpendicular(), i, p1, and p2.

110  {
111  Double_t dist = 9999999999;
112  for(size_t i=0;i<fLines->size();i++){
113  PndLineApproximation appr = (*fLines)[i];
114  Int_t apprLayer = appr.getHits()[0]->GetLayerID();
115  if(layer<8 && apprLayer>=8)continue;
116  if(layer>=16 && apprLayer<16)continue;
117  if(layer>8 && layer < 16 && layer!=apprLayer)continue;
118  PndLine l2 = appr.getLine();
119  TVector3 p1 = l.getPerpendicular(l2);
120  TVector3 p2 = l2.getPerpendicular(l);
121  Double_t dist2 = (p1-p2).Mag();
122  if(dist2<dist) dist = dist2;
123  }
124  return dist;
125 }
vector< PndFtsHit * > getHits()
std::vector< PndLineApproximation > * fLines
TVector3 getPerpendicular(PndLine l2)
Definition: PndLine.cxx:76
Int_t i
Definition: run_full.C:25
Double_t
TPad * p2
Definition: hist-t7.C:117
Int_t layer
Definition: reco_muo.C:36
TPad * p1
Definition: hist-t7.C:116
vector<PndFtsHit*> PndTrackCollection::getHits ( )
inline

Definition at line 26 of file PndTrackCollection.h.

References i.

Referenced by PndForwardTrackFinderTask::getBest().

26  {
27  vector<PndFtsHit*> result;
28  for(size_t i=0;i<fLines->size();i++){
29  for(size_t j=0;j<(*fLines)[i].getHits().size();j++){
30  result.push_back((*fLines)[i].getHits()[j]);
31  }
32  }
33  return result;
34  }
std::vector< PndLineApproximation > * fLines
Int_t i
Definition: run_full.C:25
vector< PndFtsHit * > getHits()
PndLine PndTrackCollection::getLastLine ( )
inline

Definition at line 23 of file PndTrackCollection.h.

Referenced by PndModuleCombiner::combineModules(), PndForwardTrackFinderTask::createStatictcs(), and PndWayFollower::followLines().

23 {return (*fLines)[fLines->size()-1].getLine();}
std::vector< PndLineApproximation > * fLines
vector<PndLineApproximation>* PndTrackCollection::getLines ( )
inline

Definition at line 24 of file PndTrackCollection.h.

Referenced by PndForwardTrackFinderTask::saveTrackCollection().

24 {return fLines;}
std::vector< PndLineApproximation > * fLines
PndTrack PndTrackCollection::getPndTrack ( map< Int_t, PndFtsHit * >  orgHits)

Definition at line 89 of file PndTrackCollection.cxx.

References a, fHits, fLines, PndLine::getDir(), PndLineApproximation::getHits(), PndLine::getP1(), hits, i, and v.

Referenced by PndForwardTrackFinderTask::saveTrackCollection().

89  {
90  PndLine first = (*fLines)[0].getLine();
91  PndLine last = (*fLines)[fLines->size()-1].getLine();
92  TVector3 v(1,1,1);
93  FairTrackParP tp1(first.getP1(),3 * first.getDir().Unit(), v, v, 1, v, v, v);
94  FairTrackParP tp2(last.getP1(),3 * last.getDir().Unit(), v, v, 1, v, v, v);
95  PndTrackCand trackCand;
96  Int_t hitCount;
97  for(size_t i=0;i<fLines->size();i++){
98  PndLineApproximation a = (*fLines)[i];
99  vector<PndFtsHit*> hits = a.getHits();
100  hitCount = hits.size();
101  for(size_t j=0;j<hits.size();j++){
102  trackCand.AddHit(orgHits[hits[j]->GetTubeID()]->GetEntryNr(),j);
103  }
104  }
105  for(size_t i=0;i<fHits.size();i++)
106  trackCand.AddHit(fHits[i]->GetEntryNr(),i+hitCount);
107  return PndTrack(tp1,tp2,trackCand);
108 }
vector< PndFtsHit * > getHits()
std::vector< PndLineApproximation > * fLines
Int_t i
Definition: run_full.C:25
TVector3 getDir()
Definition: PndLine.h:34
__m128 v
Definition: P4_F32vec4.h:4
Int_t a
Definition: anaLmdDigi.C:126
vector< PndFtsHit * > fHits
CbmHit * hits[nHits]
Definition: RiemannTest.C:19
TVector3 getP1()
Definition: PndLine.h:32
void PndTrackCollection::refitAllHits ( )
private

Definition at line 55 of file PndTrackCollection.cxx.

References fCurrLine, fLines, hits, i, and refitHit().

Referenced by add().

55  {
56  //get all hits
57  vector<PndFtsHit*> allHits;
58  for(size_t i=0;i<fLines->size();i++){
59  vector<PndFtsHit*> hits = (*fLines)[i].getHits();
60  for(size_t j=0;j<hits.size();j++) allHits.push_back(hits[j]);
61  }
62  //refit with line
63  PndLine zyLine = (*fLines)[0].linearRegressionZY(allHits);
64  //set the z pos
65  for(size_t i=0;i<allHits.size();i++){
66  refitHit(zyLine,allHits[i]);
67  }
68  fCurrLine = zyLine;
69 }
std::vector< PndLineApproximation > * fLines
Int_t i
Definition: run_full.C:25
void refitHit(PndLine &l, PndFtsHit *hit)
CbmHit * hits[nHits]
Definition: RiemannTest.C:19
void PndTrackCollection::refitAllTracks ( )
private

Definition at line 71 of file PndTrackCollection.cxx.

References a, fCurrLine, fLines, PndLine::getDir(), PndLineApproximation::getLine(), PndLine::getP1(), i, p, and p2.

Referenced by add().

71  {
72  for(size_t i=0;i<fLines->size();i++){
73  PndLineApproximation a = (*fLines)[i];
74  PndPlane p(a.getLine(),0);
75  PndPlane p2(fCurrLine.getP1(),fCurrLine.getDir(),TVector3(1,0,0));
76  PndLine newLine = p.getIntersection(p2);
77  (*fLines)[i].setLine(newLine);
78  }
79 }
std::vector< PndLineApproximation > * fLines
Double_t p
Definition: anasim.C:58
Int_t i
Definition: run_full.C:25
TVector3 getDir()
Definition: PndLine.h:34
Int_t a
Definition: anaLmdDigi.C:126
TPad * p2
Definition: hist-t7.C:117
TVector3 getP1()
Definition: PndLine.h:32
void PndTrackCollection::refitHit ( PndLine l,
PndFtsHit hit 
)
private

Definition at line 81 of file PndTrackCollection.cxx.

References Double_t, PndLine::getDir(), PndLine::getP1(), and p.

Referenced by add(), and refitAllHits().

81  {
82  TVector3 base = l.getP1();
83  TVector3 dir = l.getDir();
84  Double_t lamp = (hit->GetZ()-base[2])/dir[2];
85  TVector3 p = base+lamp*dir;
86  hit->SetY(p[1]);
87 }
Double_t p
Definition: anasim.C:58
TVector3 getDir()
Definition: PndLine.h:34
Double_t
TVector3 getP1()
Definition: PndLine.h:32

Member Data Documentation

PndLine PndTrackCollection::fCurrLine
private

Definition at line 40 of file PndTrackCollection.h.

Referenced by add(), refitAllHits(), and refitAllTracks().

vector<PndFtsHit*> PndTrackCollection::fHits

Definition at line 35 of file PndTrackCollection.h.

Referenced by getPndTrack().

std::vector<PndLineApproximation>* PndTrackCollection::fLines
private

The documentation for this class was generated from the following files: