PandaRoot
PndHoughMerge.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
14 // PndHoughMerge
15 // Class for merging single tracklets
17 
28 #ifndef PndHoughMerge_H_
29 #define PndHoughMerge_H_
30 
31 #include "PndSttGeometryMap.h"
32 
33 #include "PndHoughUtilities.h"
34 #include "PndHoughTransformation.h"
36 
37 #include <vector>
38 
40  public:
41  PndHoughMerge(PndHoughData *data) : fCutMergeByHoughSpace(5.), fWithGhostReduction(kTRUE)
42 
43  {
44 
45  // fPndHoughUtilities = new PndHoughUtilities(data);
46  // fPndHoughTransformation = new PndHoughTransformation(data);
47 
48  ioman = FairRootManager::Instance();
49  fMapFairLinktoFairHit = data->GetMapFairLinktoFairHit();
50  fMergedTracks.clear();
51  // fMergedTrackCands.clear();
52  fData = data;
53  };
54 
55  virtual ~PndHoughMerge() { fMergedTracks.clear(); };
57  virtual void SetCutMergeByHoughSpace(float cut) { fCutMergeByHoughSpace = cut; };
59  virtual void SetWithGhostReduction(bool ghostred) { fWithGhostReduction = ghostred; }
60 
61  virtual void SetUtilities(PndHoughUtilities *utilities) { fPndHoughUtilities = utilities; }
62  // virtual void SetHoughTransformation(PndHoughTransformation *trafo) { fPndHoughTransformation = trafo; };
63  virtual void SetTrackCorrection(PndHoughTrackCorrection *correction) { fPndHoughTrackCorrection = correction; };
64  // virtual void SetHoughTransformation(PndHoughTransformation *trafo) { fPndHoughTransformation = trafo; };
65 
67  void mergeByHoughSpace(std::vector<TVector3> &PreselectedCircles, std::vector<PndTrackCand> &TrackCands, double fBz);
69  void mergeSingle(std::vector<std::vector<int>> &mergeTracks, std::vector<PndTrack> &Tracks, std::vector<PndTrackCand> &TrackCands, double fBz);
70  double findMedian(std::vector<double> a);
72  bool IsGhost(std::vector<double> &trackcirc);
74  void CalculateGhostReductionParameters(std::vector<double> &trackcirc);
76  void CountHits();
78  PndTrack GetMergedTrack(int i) { return fMergedTracks[i]; };
80  // PndTrackCand GetMergedTrackCand(int i) { return fMergedTrackCands[i]; };
82  int GetNumMergedTracks() { return fMergedTracks.size(); };
84  // int GetNumMergedTrackCands() { return fMergedTrackCands.size(); };
85  void UpdateMergedTrack(int i, PndTrack &track) { fMergedTracks[i] = track; };
87  std::vector<PndTrack> GetMergedTracks() { return fMergedTracks; };
89  void SetMergedTracks(std::vector<PndTrack> vec)
90  {
91  if (vec.size() < fMergedTracks.size()) {
92  fMergedTracks.erase(fMergedTracks.begin() + vec.size(), fMergedTracks.end());
93  }
94  for (int i = 0; i < vec.size(); i++) {
95  vec[i].Print();
96  fMergedTracks[i] = (PndTrack)vec[i];
97  }
98  };
99 
100  private:
101  FairRootManager *ioman = nullptr;
102 
103  PndHoughUtilities *fPndHoughUtilities = nullptr;
104  // PndHoughTransformation *fPndHoughTransformation = nullptr;
105  PndHoughTrackCorrection *fPndHoughTrackCorrection = nullptr;
106  PndHoughData *fData = nullptr;
107 
108  std::map<FairLink, FairHit *> fMapFairLinktoFairHit;
109  std::vector<PndTrack> fMergedTracks;
110  // std::vector<PndTrackCand> fMergedTrackCands;
111 
112  std::vector<std::vector<double>> fMaxima_x;
113  std::vector<std::vector<double>> fMaxima_y;
114  std::vector<std::vector<double>> fMaxima_r;
115 
116  PndTrackCand fApolloniusTrackCand;
117 
118  float fCutMergeByHoughSpace;
119 
120  Int_t fMVDHits;
121  Int_t fGEMHits;
122  double fSTTHits;
123  double fCounterHittedNeighborsRel;
124  double fmeanD;
125 
126  bool fGEMNeighborCut;
127  bool fSTTNeighborCut;
128  bool fWithGhostReduction;
129 
130  ClassDef(PndHoughMerge, 1);
131 };
132 
133 #endif /*PndHoughMerge_H_*/
virtual void SetCutMergeByHoughSpace(float cut)
Sets the value of the distance in the Hough space within two tracklets have to be merged...
Definition: PndHoughMerge.h:57
bool IsGhost(std::vector< double > &trackcirc)
Determines whether the specified track is a ghost.
void mergeSingle(std::vector< std::vector< int >> &mergeTracks, std::vector< PndTrack > &Tracks, std::vector< PndTrackCand > &TrackCands, double fBz)
Here all tracklets are merged.
virtual void SetTrackCorrection(PndHoughTrackCorrection *correction)
Definition: PndHoughMerge.h:63
int GetNumMergedTracks()
Returns a specific merged track candidate.
Definition: PndHoughMerge.h:82
std::map< FairLink, FairHit * > GetMapFairLinktoFairHit() const
Returns the map linking FairLinks to FairHits.
Definition: PndHoughData.h:104
void mergeByHoughSpace(std::vector< TVector3 > &PreselectedCircles, std::vector< PndTrackCand > &TrackCands, double fBz)
All tracklets are determined that have to be merged.
virtual void SetUtilities(PndHoughUtilities *utilities)
Definition: PndHoughMerge.h:61
unsigned int i
Definition: P4_F32vec4.h:33
std::vector< PndTrack > GetMergedTracks()
Returns a vector of all merged track.
Definition: PndHoughMerge.h:87
void CountHits()
Counts the number of hits of different detector parts for a specific track candidate.
PndHoughMerge(PndHoughData *data)
Definition: PndHoughMerge.h:41
void CalculateGhostReductionParameters(std::vector< double > &trackcirc)
Calculates the ghost reduction parameters.
void SetMergedTracks(std::vector< PndTrack > vec)
Sets a vector of all merged track.
Definition: PndHoughMerge.h:89
virtual void SetWithGhostReduction(bool ghostred)
Sets a bool for deciding to use a ghost reduction.
Definition: PndHoughMerge.h:59
virtual ~PndHoughMerge()
Definition: PndHoughMerge.h:55
PndTrack GetMergedTrack(int i)
Returns a specific merged track.
Definition: PndHoughMerge.h:78
double findMedian(std::vector< double > a)
void UpdateMergedTrack(int i, PndTrack &track)
Returns the number of merged track candidates.
Definition: PndHoughMerge.h:85