PandaRoot
PndBarrelTrackFinder.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 
13 //* $Id: */
14 
15 // -------------------------------------------------------------------------
16 // ----- PndBarrelTrackFinder header file -----
17 // ----- Created 05/12/2010 by R. Karabowicz -----
18 // -------------------------------------------------------------------------
19 
30 #ifndef PNDBARRELTRACKFINDER_H
31 #define PNDBARRELTRACKFINDER_H 1
32 
33 #include "PndPersistencyTask.h"
34 #include "FairHit.h"
35 #include "FairTSBufferFunctional.h"
36 
37 #include "TStopwatch.h"
38 #include "PndGeoSttPar.h"
39 
40 #include <list>
41 #include <map>
42 #include <vector>
43 
44 class TEllipse;
45 class TCanvas;
46 class TClonesArray;
47 class TLatex;
48 class PndGemDigiPar;
49 class TH1F;
50 
52  Double_t x;
53  Double_t y;
54  Double_t r;
55  Double_t z_phi;
56  Int_t n;
57  // x,y,r parameters of the circle,
58  // // p=atan(x/y),
59  // z_phi - z increase divided by phi angle increase,
60  // // p_1=atan(x_1/y_1) of the first hit,
61  // n='goodness' of parameter
62 };
63 
64 struct TrackBasis {
65  std::vector<TrackParameter> trackPars;
66  std::vector<FairHit *> trackHits;
67  std::vector<Int_t> trackHitD;
68  std::vector<Int_t> trackHitN;
69  Double_t meanX;
70  Double_t meanY;
71  Double_t meanR;
72  Double_t meanZ_Phi;
73 };
74 
76 
77  public:
80 
82  PndBarrelTrackFinder(Int_t iVerbose);
83 
85  PndBarrelTrackFinder(const char *name, Int_t iVerbose);
86 
88  virtual ~PndBarrelTrackFinder();
89 
91  virtual void Exec(Option_t *opt);
92 
93  void UseMvdSttGem(const Bool_t useMvd, const Bool_t useStt, const Bool_t useGem);
94 
95  void DrawDetails(Bool_t tb = kTRUE) { fDrawDetails = tb; }
96  void DrawHistos(Bool_t tb = kTRUE) { fDrawHistos = tb; }
97 
98  void SetRunTimeBased(Bool_t val = kTRUE) { fRunTimeBased = val; }
99 
100  private:
101  Bool_t fRunTimeBased;
102  StopTime *fFunctor;
103  double fStopTimeValue;
104 
105  Bool_t fDrawDetails;
106  Bool_t fDrawHistos;
107  TEllipse *fEllipse[1000];
108  TCanvas *fCanvas;
109  TLatex *fStageDesc;
110  TH1F *fClonesXDiff;
111  TH1F *fClonesYDiff;
112  TH1F *fClonesRDiff;
113  TH1F *fClonesZ_PhiDiff;
114  TH1F *fClonesXDiffRel;
115  TH1F *fClonesYDiffRel;
116  TH1F *fClonesRDiffRel;
117  TH1F *fClonesZ_PhiDiffRel;
118 
119  TH1F *fhHitDist[5][3];
120 
121  std::vector<TrackBasis> fTracksVector;
122 
123  std::vector<Int_t> fHitDetId;
124  std::vector<Int_t> fHitDetNo;
125  // previous hits
126  std::vector<FairHit *> fHitVector;
127  std::vector<Int_t> fHitVectDI;
128  std::vector<Int_t> fHitVectHN;
129 
130  Bool_t fIncludeDet[4];
131  TClonesArray *fHitArray[4];
132  TString fDetName[4];
133  Int_t fDetType[4];
134  TString fHitArrayName[4];
135 
137  TClonesArray *fBarrelTrackArray;
138  TClonesArray *fBarrelTrackCandArray;
139 
141  Int_t fTNofEvents;
142  Int_t fTNofTracks;
143 
144  double fRadToMomConversion;
145 
146  Double_t fMaximalDist;
147  Double_t fReasonableDist;
148  Double_t fMaximalZ_PhiD;
149  Double_t fReasonableZ_PhiD;
150  Double_t fMaximalRadDiff;
151  Double_t fMaximalPhiDiff;
152 
153  Bool_t MatchHitToTrack(FairHit *thisHit, Int_t detId, Int_t hitNo, Int_t trackNo);
154  Bool_t MatchSkewedSttHitTT(FairHit *thisHit, Int_t detId, Int_t hitNo, Int_t trackNo);
155  Bool_t MatchParallelSttHitTT(FairHit *thisHit, Int_t detId, Int_t hitNo, Int_t trackNo);
156  Bool_t MatchHitWithZInfoTT(FairHit *thisHit, Int_t detId, Int_t hitNo, Int_t trackNo);
157 
158  Bool_t ExtractMeanRPhiFromTrack(Int_t trackNo);
159  Bool_t ExtractMeanZ_PhiFromTrack(Int_t trackNo);
160 
161  Bool_t MatchHitToHit(FairHit *thisHit, Int_t detId, Int_t hitNo, Int_t prevHNo);
162  void RemoveHitFromPreviousHits(Int_t hitNo);
163 
164  Bool_t HitBelongsToTrack(Int_t detId, Int_t hitNo, Int_t trackNo);
165 
166  void AddHitToPreviousHits(FairHit *thisHit, Int_t detId, Int_t hitNo);
167 
168  void DrawTracks();
169  void PrintTracks();
170  Int_t CleanTracks();
171  Int_t WriteTracks();
172 
173  void RemoveShortTracks();
174  void RemoveCloneTracks();
175 
176  Bool_t FindCircPar(Double_t *c1, Double_t *c2, Double_t *c3, Int_t cno, Double_t *cl);
177  Double_t FindCircDist(Double_t *c1, Double_t *c2);
178  Int_t FindInterestingRegions(Double_t *circ, Double_t *tube, Double_t *reg);
179 
180  Double_t CalcPhi(Double_t x, Double_t y);
181  Double_t CalcZ_Phi(Double_t *circ, Double_t hx, Double_t hy, Double_t hz);
182 
184  virtual void SetParContainers();
185  // CHECK added
187  TClonesArray *fTubeArray;
188  PndGeoSttPar *fSttParameters; // CHECK added
189  Int_t fGeoType;
190 
192  virtual InitStatus Init();
193 
195  virtual InitStatus ReInit();
196 
198  void Reset();
199 
201  virtual void Finish();
202 
203  ClassDef(PndBarrelTrackFinder, 1);
204 };
205 
206 #endif
void DrawHistos(Bool_t tb=kTRUE)
Digitization Parameter Class for GEM part.
Definition: PndGemDigiPar.h:42
std::vector< Int_t > trackHitD
std::vector< FairHit * > trackHits
std::vector< Int_t > trackHitN
void DrawDetails(Bool_t tb=kTRUE)
void SetRunTimeBased(Bool_t val=kTRUE)
std::vector< TrackParameter > trackPars