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

#include <PndTrackCand.h>

Inheritance diagram for PndTrackCand:
PndFtsHoughTracklet

Public Member Functions

 PndTrackCand ()
 
 ~PndTrackCand ()
 
bool operator== (const PndTrackCand &rhs)
 
PndTrackCandHit GetSortedHit (UInt_t i)
 
UInt_t GetNHits () const
 
int getMcTrackId () const
 
UInt_t GetNHitsDet (Int_t detId)
 
std::vector< PndTrackCandHitGetSortedHits ()
 
void Sort ()
 
void AddHit (UInt_t detId, UInt_t hitId, Double_t rho)
 
void AddHit (TString branchName, UInt_t hitId, Double_t rho)
 
void AddHit (FairLink link, Double_t rho)
 
void DeleteHit (UInt_t detId, UInt_t hitId)
 
Int_t HitInTrack (UInt_t detId, UInt_t hitId) const
 
void setMcTrackId (int i)
 
void CalcTimeStamp ()
 
void ResetLinks ()
 
void Print () const
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 
 ClassDef (PndTrackCand, 3)
 

Private Attributes

std::vector< PndTrackCandHitfHitId
 first index is detId, second index is hit Id More...
 
bool sorted
 
int fMcTrackId
 
Int_t fVerbose
 

Detailed Description

Definition at line 43 of file PndTrackCand.h.

Constructor & Destructor Documentation

PndTrackCand::PndTrackCand ( )

Definition at line 31 of file PndTrackCand.cxx.

31 : fHitId(), sorted(false), fMcTrackId(-1),fVerbose(0){}
std::vector< PndTrackCandHit > fHitId
first index is detId, second index is hit Id
Definition: PndTrackCand.h:93
Int_t fVerbose
Definition: PndTrackCand.h:96
PndTrackCand::~PndTrackCand ( )

Definition at line 33 of file PndTrackCand.cxx.

33 {}

Member Function Documentation

void PndTrackCand::AddHit ( UInt_t  detId,
UInt_t  hitId,
Double_t  rho 
)

Definition at line 36 of file PndTrackCand.cxx.

References fHitId, and sorted.

Referenced by AddHit(), PndFtsHoughSpace::AddHitsToTrackletByCalculating(), PndMdtTrk::AddTrackCand(), PndFtsHoughTrackCand::addUniqueTrackletHits(), PndTrkTrack::ConvertToPndTrackCand(), PndSttMvdGemTracking::Copy(), PndRiemannTrackFinder::CreateOneTrackCand(), PndSttCellTrackletGenerator::CreatePndTrackCands(), PndCloneGenerator::CreateTrackCandClones(), PndPatternMatcher::CreateTrackCandFromMatch(), PndGemTrackFinderOnHits::CreateTracks(), PndMvdGemTrackFinderOnHits::CreateTracks(), PndGemTrackFinderOnHitsTB::CreateTracks(), PndGemTrackFinderIdeal::DoFind(), PndSttTrackFinderReal::DoFind(), PndSttTrackFinderIdeal::DoFind(), PndMvdRiemannTrackFinderTaskEff::Exec(), PndFtsCATracking::Exec(), PndSttMvdGemTracking::Exec(), PndLmdTrackFinderCATask::Exec(), PndFtsTrackerIdeal::Exec(), PndGemIdealPatternRecoTask::Exec(), PndCATracking::Exec(), PndFtsHoughSpace::FindAllPeaksScanPathsMergeBins(), PndFtsHoughSpace::FindAllPeaksScanPathsMergeBinsCalculatingPaths(), PndLmdTrackFinderTask::FindHitsI(), PndStraightLineTrackFinderTask::FindHitsI(), PndLmdTrackFinderTask::FindHitsII(), PndStraightLineTrackFinderTask::FindHitsII(), PndLmdTrackFinderTask::FindHitsIII(), PndStraightLineTrackFinderTask::FindHitsIII(), PndRiemannTrackFinder::FindTracks(), PndMvdSttGemRiemannTrackFinder::FindTracks(), Genfit2TrackCand2PndTrackCand(), GenfitTrackCand2PndTrackCand(), PndSttCellTrackletGenerator::InitStartTracklets(), PndTrkTracking2::LoadPndTrack_TrackCand(), PndLineApproximation::plot(), PndFtsExpandedTrackCand::PndFtsExpandedTrackCand(), PndSttCellTrackletGenerator::RefitTracks(), PndForwardTrackFinderTask::saveCombined(), PndForwardTrackFinderTask::saveCorrectedTracklets(), PndForwardTrackFinderTask::saveTrackCollection(), and PndBarrelTrackFinder::WriteTracks().

37 {
38  fHitId.push_back(PndTrackCandHit(detId, hitId, rho));
39  sorted = false;
40  AddLink(FairLink(detId, hitId));
41 // CalcTimeStamp();
42 }
std::vector< PndTrackCandHit > fHitId
first index is detId, second index is hit Id
Definition: PndTrackCand.h:93
void PndTrackCand::AddHit ( TString  branchName,
UInt_t  hitId,
Double_t  rho 
)

Definition at line 44 of file PndTrackCand.cxx.

References AddHit().

45 {
46  FairRootManager* ioman = FairRootManager::Instance();
47  UInt_t detId = ioman->GetBranchId(branchName);
48  AddHit(detId, hitId, rho);
49 }
void AddHit(UInt_t detId, UInt_t hitId, Double_t rho)
void PndTrackCand::AddHit ( FairLink  link,
Double_t  rho 
)

Definition at line 51 of file PndTrackCand.cxx.

References fHitId, and sorted.

52 {
53  fHitId.push_back(PndTrackCandHit(link, rho));
54  sorted = false;
55  AddLink(link);
56 }
std::vector< PndTrackCandHit > fHitId
first index is detId, second index is hit Id
Definition: PndTrackCand.h:93
void PndTrackCand::CalcTimeStamp ( )

Definition at line 112 of file PndTrackCand.cxx.

References Double_t, fVerbose, i, sqrt(), and TString.

Referenced by PndMvdSttGemRiemannTrackFinderTask::Exec(), PndMvdRiemannTrackFinderTask::Exec(), and PndFtsHoughTrackerTask::Exec().

113 {
114  Double_t timestamp = 0;
115  Double_t timestamperror = 0;
116  Int_t counts = 0;
117  for (int i = 0; i < GetNLinks(); i++){
118  FairLink myLink = GetLink(i);
119  Int_t type = myLink.GetType();
120 
121  if (fVerbose > 1){
122  std::cout << "Links: " << myLink << std::endl;
123  }
124 
125  if (type > -1){
126  TString branchName = FairRootManager::Instance()->GetBranchName(type);
127  if (branchName.Contains("Hit") == kFALSE) continue;
128 
129  TClonesArray* myArray = (TClonesArray*)FairRootManager::Instance()->GetObject(branchName);
130  if (myArray != NULL){
131  FairTimeStamp* myData = (FairTimeStamp*)(FairRootManager::Instance()->GetCloneOfLinkData(myLink));
132  if (myData != NULL){
133  Double_t var = myData->GetTimeStampError() * myData->GetTimeStampError();
134  timestamp += myData->GetTimeStamp()/var;
135  timestamperror += 1/var;
136  counts++;
137  delete myData;
138  }
139  else {
140  std::cout << "Data not found: " << FairRootManager::Instance()->GetBranchName(myLink.GetType()) << "/" << myLink << std::endl;
141  }
142  }
143  else {
144  // std::cout << "Array not found: " << ioman->GetBranchName(myLink.GetType()) << std::endl;
145  }
146  }
147  }
148  if (timestamperror > 0){
149  //std::cout << "TrackTimeStamp: " << timestamp/timestamperror << " +/- " << sqrt(timestamperror/counts) << " counts " << counts << std::endl;
150  SetTimeStamp(timestamp/timestamperror);
151  SetTimeStampError(sqrt(timestamperror/counts));
152  }
153 }
Int_t i
Definition: run_full.C:25
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
Int_t fVerbose
Definition: PndTrackCand.h:96
Double_t
PndTrackCand::ClassDef ( PndTrackCand  ,
 
)
void PndTrackCand::DeleteHit ( UInt_t  detId,
UInt_t  hitId 
)

Definition at line 75 of file PndTrackCand.cxx.

References fHitId, and HitInTrack().

76 {
77  int ind = HitInTrack(detId, hitId);
78  fHitId.erase(fHitId.begin()+ind);
79 
80  //Int_t det = detId;
81  //Int_t hit = hitId;
82  //DeleteLink(det, hit);
83 }
std::vector< PndTrackCandHit > fHitId
first index is detId, second index is hit Id
Definition: PndTrackCand.h:93
Int_t HitInTrack(UInt_t detId, UInt_t hitId) const
int PndTrackCand::getMcTrackId ( ) const
inline
UInt_t PndTrackCand::GetNHits ( ) const
inline

Definition at line 59 of file PndTrackCand.h.

References fHitId.

Referenced by PndTrackCandDraw::AddBoxesPndTrackCand(), PndFtsHoughTrackCand::addUniqueTrackletHits(), check_trackcand(), PndMvdRiemannVertexFinderTask::CheckRecoTrack(), PndMvdRiemannTrackFinderTaskEff::CheckRecoTrack(), PndMvdRiemannVertexFinderTask::CheckTwoCands(), PndSttMvdGemTracking::Copy(), PndRiemannTrackFinder::CreateOneTrackCand(), PndCloneGenerator::CreateTrackCandClones(), PndIdealTrackFinder::CreateTracks(), dedx_p_chain(), PndSttTrackFinderIdeal::DoFind(), PndSttMvdGemTracking::EvaluatePerformances(), PndMvdSttGemRiemannTrackFinderTask::Exec(), PndSttHelixHitProducer::Exec(), PndLmdTrksFilterTask::Exec(), PndFtsTrackerIdeal::Exec(), PndLmdLineTask::Exec(), PndLmdLinFitTask::Exec(), PndGemTrackFinderQA::Exec(), PndLmdTrkQTask::Exec(), PndLmdIdealFitTask::Exec(), PndTrkTrackFinder::Exec(), PndSttMatchTracks::Exec(), PndLmdKalmanTask::Exec(), PndSttMvdGemTracking::FillTrueDistances(), PndMvdSttGemRiemannTrackFinder::FindTracks(), PndRiemannTrackFinder::FindTracksWithSimilarHits(), PndMvdRiemannVertexFinderTask::FoundCandInMCCands(), PndPidCorrelator::GetFtsInfo(), PndPidCorrelator::GetGemInfo(), PndTrackingQualityBarrelTaskNewLinks::GetMCInfoFromIdealTrack(), PndTrackingQATask::GetMCInfoFromIdealTrack(), PndPidCorrelator::GetMvdInfo(), PndFtsHoughTracklet::getNSharedHits(), PndFtsHoughTrackCand::getPndTrack(), PndPidCorrelator::GetSttInfo(), PndSttHelixTrackFitter::IntersectionFinder(), main(), PndGemTrackFinderQA::MatchRecoTracks(), PndSttHelixTrackFitter::MinuitFit(), PndSttHelixTrackFitter::OrderHitsByR(), PndTrackCand2Genfit2TrackCand(), PndTrackCand2GenfitTrackCand(), PndSttMvdGemTracking::Prefit(), PndMvdIdealTrackFinderTask::PrintResult(), PndTrkTrackFinder::RecreateHitArrays(), PndMvdRiemannVertexFinderTask::refit(), PndLmdQATask::ResoAndPulls(), PndSttHelixTrackFitter::RunEventDisplay(), PndSttMvdGemTracking::SetStartParameters(), PndSttHelixTrackFitter::SetUpFitVector(), PndSttMvdGemTracking::UpdateMCTrackId(), PndSttHelixTrackFitter::XYFit(), PndSttHelixTrackFitter::XYFitThroughOrigin(), PndSttHelixTrackFitter::ZFinder(), PndSttHelixTrackFitter::ZFinderThroughOrigin(), PndSttHelixTrackFitter::ZFit(), and PndSttHelixTrackFitter::ZFitThroughOrigin().

59 {return fHitId.size();}
std::vector< PndTrackCandHit > fHitId
first index is detId, second index is hit Id
Definition: PndTrackCand.h:93
UInt_t PndTrackCand::GetNHitsDet ( Int_t  detId)

Definition at line 85 of file PndTrackCand.cxx.

References fHitId, PndTrackCandHit::GetDetId(), and GetSortedHit().

Referenced by PndTrackingQualityBarrelTaskNewLinks::GetMCInfoFromIdealTrack(), and PndTrackingQATask::GetMCInfoFromIdealTrack().

86 {
87  // Function to count the number of hits from the same detId
88  UInt_t detCounts = 0;
89 
90  for (UInt_t ihit = 0; ihit<fHitId.size(); ihit++)
91  {
92  PndTrackCandHit candhit = GetSortedHit(ihit);
93  if (candhit.GetDetId() == detId) detCounts++;
94  }
95 
96  return detCounts;
97 }
PndTrackCandHit GetSortedHit(UInt_t i)
Definition: PndTrackCand.h:54
std::vector< PndTrackCandHit > fHitId
first index is detId, second index is hit Id
Definition: PndTrackCand.h:93
Int_t GetDetId() const
PndTrackCandHit PndTrackCand::GetSortedHit ( UInt_t  i)
inline

Definition at line 54 of file PndTrackCand.h.

References fHitId, Sort(), and sorted.

Referenced by PndTrackCandDraw::AddBoxesPndTrackCand(), PndFtsHoughTrackCand::addUniqueTrackletHits(), check_trackcand(), PndMvdRiemannVertexFinderTask::CheckRecoTrack(), PndMvdRiemannTrackFinderTaskEff::CheckRecoTrack(), PndMvdRiemannVertexFinderTask::CheckTwoCands(), PndSttMvdGemTracking::Copy(), PndRiemannTrackFinder::CreateOneTrackCand(), PndCloneGenerator::CreateTrackCandClones(), PndIdealTrackFinder::CreateTracks(), dedx_p_chain(), PndGemTrackFinderIdeal::DoFind(), PndSttTrackFinderIdeal::DoFind(), PndSttMvdGemTracking::EvaluatePerformances(), PndSttHelixHitProducer::Exec(), PndFtsTrackerIdeal::Exec(), PndLmdLineTask::Exec(), PndLmdLinFitTask::Exec(), PndGemTrackFinderQA::Exec(), PndLmdBPtestTask::Exec(), PndLmdTrkQTask::Exec(), PndLmdIdealFitTask::Exec(), PndTrkTrackFinder::Exec(), PndSttMatchTracks::Exec(), PndLmdKalmanTask::Exec(), PndSttMvdGemTracking::FillTrueDistances(), PndRiemannTrackFinder::FindTracksWithSimilarHits(), PndMvdRiemannVertexFinderTask::FoundCandInMCCands(), PndPidCorrelator::GetFtsInfo(), PndPidCorrelator::GetGemInfo(), PndTrackingQualityBarrelTaskNewLinks::GetMCInfoFromIdealTrack(), PndTrackingQATask::GetMCInfoFromIdealTrack(), PndPidCorrelator::GetMvdInfo(), GetNHitsDet(), PndFtsHoughTracklet::getNSharedHits(), PndPidCorrelator::GetSttInfo(), PndFtsHoughTrackCand::getTrackParPForHit(), PndSttHelixTrackFitter::IntersectionFinder(), main(), PndGemTrackFinderQA::MatchRecoTracks(), PndSttHelixTrackFitter::OrderHitsByR(), PndTrackCand2Genfit2TrackCand(), PndTrackCand2GenfitTrackCand(), PndSttMvdGemTracking::Prefit(), PndMvdIdealTrackFinderTask::PrintResult(), PndTrkTrackFinder::RecreateHitArrays(), PndMvdRiemannVertexFinderTask::refit(), PndLmdQATask::ResoAndPulls(), PndSttHelixTrackFitter::RunEventDisplay(), PndSttMvdGemTracking::SetStartParameters(), PndSttHelixTrackFitter::SetUpFitVector(), PndSttMvdGemTracking::UpdateMCTrackId(), PndSttHelixTrackFitter::XYFit(), PndSttHelixTrackFitter::XYFitThroughOrigin(), PndSttHelixTrackFitter::ZFinder(), PndSttHelixTrackFitter::ZFinderThroughOrigin(), PndSttHelixTrackFitter::ZFit(), and PndSttHelixTrackFitter::ZFitThroughOrigin().

54  {
55  if (sorted == false)
56  Sort();
57  return fHitId.at(i);
58  }
Int_t i
Definition: run_full.C:25
std::vector< PndTrackCandHit > fHitId
first index is detId, second index is hit Id
Definition: PndTrackCand.h:93
std::vector< PndTrackCandHit > PndTrackCand::GetSortedHits ( )

Definition at line 105 of file PndTrackCand.cxx.

References fHitId, Sort(), and sorted.

Referenced by PndSttMvdGemTracking::Copy(), PndXYResidualTask::Exec(), and PndUnassignedHitsTask::FillTrackCands().

106 {
107  if (sorted == false)
108  Sort();
109  return fHitId;
110 }
std::vector< PndTrackCandHit > fHitId
first index is detId, second index is hit Id
Definition: PndTrackCand.h:93
int PndTrackCand::HitInTrack ( UInt_t  detId,
UInt_t  hitId 
) const

Definition at line 65 of file PndTrackCand.cxx.

References fHitId, and i.

Referenced by PndFtsHoughTrackCand::addUniqueTrackletHits(), DeleteHit(), and PndFtsHoughTracklet::getNSharedHits().

66 {
67  PndTrackCandHit test(detId, hitId, 0.);
68  for (UInt_t i = 0; i < fHitId.size(); i++){
69  if(fHitId[i] == test)
70  return i;
71  }
72  return -1;
73 }
Int_t i
Definition: run_full.C:25
std::vector< PndTrackCandHit > fHitId
first index is detId, second index is hit Id
Definition: PndTrackCand.h:93
bool PndTrackCand::operator== ( const PndTrackCand rhs)

Definition at line 155 of file PndTrackCand.cxx.

References fHitId, and i.

155  {
156  if(rhs.fHitId.size()!=fHitId.size()) return false;
157  for(unsigned int i=0;i<fHitId.size();++i){
158  if(fHitId.at(i) != rhs.fHitId.at(i) ) return false;
159  }
160  return true;
161 }
Int_t i
Definition: run_full.C:25
std::vector< PndTrackCandHit > fHitId
first index is detId, second index is hit Id
Definition: PndTrackCand.h:93
void PndTrackCand::Print ( ) const

Definition at line 164 of file PndTrackCand.cxx.

References fHitId, fMcTrackId, and i.

Referenced by PndTrackCandDraw::AddBoxesPndTrackCand(), check_trackcand(), PndFtsHoughTrackerTask::Exec(), PndMvdSttGemRiemannTrackFinder::FindTracks(), and PndFtsHoughTrackCand::Print().

164  {
165  std::cout << "=========== PndTrackCand::Print() ==========" << std::endl;
166  if(fMcTrackId>=0) std::cout << "McTrackId=" << fMcTrackId << std::endl;
167  for(unsigned int i=0;i<fHitId.size();++i){
168  fHitId.at(i).Print();
169  }
170 }
Int_t i
Definition: run_full.C:25
std::vector< PndTrackCandHit > fHitId
first index is detId, second index is hit Id
Definition: PndTrackCand.h:93
void PndTrackCand::ResetLinks ( )

Definition at line 59 of file PndTrackCand.cxx.

References fHitId.

60 {
61  fHitId.clear();
62  ResetLinks();
63 }
std::vector< PndTrackCandHit > fHitId
first index is detId, second index is hit Id
Definition: PndTrackCand.h:93
void ResetLinks()
template<class Archive >
void PndTrackCand::serialize ( Archive &  ar,
const unsigned int  version 
)
inline

Definition at line 82 of file PndTrackCand.h.

References fHitId, fMcTrackId, and sorted.

83  {
84  ar & boost::serialization::base_object<FairTimeStamp>(*this);
85  ar & fHitId;
86  ar & sorted;
87  ar & fMcTrackId;
88  }
std::vector< PndTrackCandHit > fHitId
first index is detId, second index is hit Id
Definition: PndTrackCand.h:93
void PndTrackCand::setMcTrackId ( int  i)
inline
void PndTrackCand::Sort ( )

Definition at line 99 of file PndTrackCand.cxx.

References fHitId, and sorted.

Referenced by PndGemTrackFinderOnHits::CreateTracks(), PndMvdGemTrackFinderOnHits::CreateTracks(), PndGemTrackFinderOnHitsTB::CreateTracks(), PndGemTrackFinderIdeal::DoFind(), PndFtsTrackerIdeal::Exec(), PndSttFindTracks::Exec(), GetSortedHit(), GetSortedHits(), and PndBarrelTrackFinder::WriteTracks().

100 {
101  std::sort(fHitId.begin(), fHitId.end());
102  sorted = true;
103 }
std::vector< PndTrackCandHit > fHitId
first index is detId, second index is hit Id
Definition: PndTrackCand.h:93

Member Data Documentation

std::vector<PndTrackCandHit> PndTrackCand::fHitId
private

first index is detId, second index is hit Id

Definition at line 93 of file PndTrackCand.h.

Referenced by AddHit(), DeleteHit(), GetNHits(), GetNHitsDet(), GetSortedHit(), GetSortedHits(), HitInTrack(), operator==(), Print(), ResetLinks(), serialize(), and Sort().

int PndTrackCand::fMcTrackId
private

Definition at line 95 of file PndTrackCand.h.

Referenced by getMcTrackId(), Print(), serialize(), and setMcTrackId().

Int_t PndTrackCand::fVerbose
private

Definition at line 96 of file PndTrackCand.h.

Referenced by CalcTimeStamp().

bool PndTrackCand::sorted
private

Definition at line 94 of file PndTrackCand.h.

Referenced by AddHit(), GetSortedHit(), GetSortedHits(), serialize(), and Sort().


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