PandaRoot
PndSttHelixTrackFitter.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 
22 #ifndef PNDSTTHELIXTRACKFITTER
23 #define PNDSTTHELIXTRACKFITTER 1
24 
25 #include "PndSttTrack.h"
26 //#include "PndTrackCand.h"
27 //#include "PndSttPoint.h"
28 //#include "FairTrackParam.h"
29 #include "PndSttTrackFitter.h"
30 
31 //#include "TH2F.h"
32 //#include "TCanvas.h"
33 #include "TList.h"
34 
35 #include <map>
36 
37 class FairTrackParam;
38 class PndSttHit;
39 // class PndSttTrackFitter;
40 class TCanvas;
41 class TH2F;
42 class TH1F;
43 
44 void fcnHelix(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag);
45 void fcnHelix2(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag);
46 
48  private:
49  Int_t fEventCounter;
50 
51  PndSttTrack *fTrack;
52  PndTrackCand *fTrackCand;
53  PndSttTrack currentTrack;
54 
55  TClonesArray *fHitArray;
56  TClonesArray *fPointArray;
57  TObjArray *ZPointsArray;
58 
59  TH2F *h1, *h2, *h3, *h4, *houg;
60  TH1F *hougcon;
61  TCanvas *eventCanvas, *eventDetails;
62  Bool_t rootoutput;
63  Int_t fVerbose;
64 
65  public:
67  PndSttHelixTrackFitter(Int_t verbose);
69  void Init();
70 
71  // xy plane ----------------------
72  // intersection finder
73  Bool_t IntersectionFinder(PndTrackCand *pTrackCand);
74  // fit
75  Int_t XYFit(PndTrackCand *pTrackCand, Int_t whatToFit);
76  Int_t XYFitThroughOrigin(PndTrackCand *pTrackCand, Int_t whatToFit);
77  Int_t MinuitFit(PndTrackCand *pTrackCand, Int_t whatToFit);
78  Int_t SetUpFitVector(PndTrackCand *pTrackCand, TMatrixT<Double32_t> &fitvect);
79 
80  // z track length plane ----------
81  // zfinder
82  Bool_t ZFinder(PndTrackCand *pTrackCand, Int_t whatToFit);
83  Bool_t ZFinderThroughOrigin(PndTrackCand *pTrackCand, Int_t whatToFit);
84 
85  // hough
86  void Hough(TVector3 *choice, Double_t Phi0, Double_t x0, Double_t y0, Double_t R);
87  TVector3 GetHoughResponse();
88  void HoughThroughOrigin(TVector3 *choice, Double_t Phi0, Double_t x0, Double_t y0, Double_t R);
90 
91  // zfit
92  Int_t ZFit(PndTrackCand *pTrackCand, Int_t whatToFit);
93  Int_t ZFitThroughOrigin(PndTrackCand *pTrackCand, Int_t whatToFit);
94  TVector3 FindCorrectZ(TObjArray *choices, Double_t x_0, Double_t y_0, Double_t x0, Double_t y0, Double_t R);
95  Int_t DoFit(PndTrackCand *pTrackCand, PndSttTrack *pTrack, Int_t pidHypo = 211);
96  // plain = with no constraint
97  Int_t DoFitPlain(PndTrackCand *pTrackCand, PndSttTrack *pTrack, Int_t pidHypo = 211);
98  // through origin = force the track to pass in 0, 0, 0.
99  // Int_t DoFitThroughOrigin(PndTrackCand* pTrackCand, PndSttTrack* pTrack, Int_t pidHypo = 211);
100 
101  // charge reconstruction from xy fit
102  Int_t GetCharge(Double_t dCenter, Double_t phiCenter, Double_t radius);
103  void OrderHitsByR(std::map<Double_t, Int_t> &hitMap);
104  Double_t GetHitAngle(Int_t hitNo, Double_t dCenter, Double_t phiCenter, Double_t radius);
105 
106  PndSttHit *GetHitFromCollections(Int_t hitCounter) const;
108  virtual void AddHitCollection(TClonesArray *mHitArray) { fHitCollectionList.Add(mHitArray); }
109 
110  virtual void Extrapolate(PndSttTrack *track, Double_t r, FairTrackParam *param);
111 
112  // all: kTRUE = also z param; kFALSE = only xy param
113  // void SetParameters(PndSttTrack* pTrack, Bool_t all); /* commented out by JGM, 16/01/2010 */
114 
115  // marray reset
116  void ResetMArray();
117 
118  PndSttTrack *GetTrack() const { return fTrack; };
119  PndTrackCand *GetTrackCand() const { return fTrackCand; };
120  TClonesArray *GetHitArray() const { return fHitArray; };
121 
122  void SetConstraint(Int_t con) { fConstraint = con; };
123  Int_t GetConstraint() { return fConstraint; };
124 
125  Double_t refAngle;
126 
127  // 0 = no contraint, 1 = the track passes through (0, 0, 0)
128  Int_t fConstraint;
129 
130  TClonesArray *fTubeArray;
131  void SetTubeArray(TClonesArray *tubeArray) { fTubeArray = tubeArray; };
132 
133  Int_t fDisplayLevel;
134  void SetDisplayLevel(Int_t display = 2) { fDisplayLevel = display; };
135  void InitEventDisplay();
136  Bool_t RunEventDisplay(PndTrackCand *trackCand);
137  void FinishEventDisplay(PndSttTrack *track);
138 
140 };
141 
142 #endif
Int_t XYFit(PndTrackCand *pTrackCand, Int_t whatToFit)
Double_t GetHitAngle(Int_t hitNo, Double_t dCenter, Double_t phiCenter, Double_t radius)
void Hough(TVector3 *choice, Double_t Phi0, Double_t x0, Double_t y0, Double_t R)
PndTrackCand * GetTrackCand() const
#define choice(c1, c2, c3)
Definition: PndCAMath.h:143
void HoughThroughOrigin(TVector3 *choice, Double_t Phi0, Double_t x0, Double_t y0, Double_t R)
Int_t ZFit(PndTrackCand *pTrackCand, Int_t whatToFit)
Bool_t RunEventDisplay(PndTrackCand *trackCand)
Int_t ZFitThroughOrigin(PndTrackCand *pTrackCand, Int_t whatToFit)
TVector3 FindCorrectZ(TObjArray *choices, Double_t x_0, Double_t y_0, Double_t x0, Double_t y0, Double_t R)
Bool_t IntersectionFinder(PndTrackCand *pTrackCand)
void FinishEventDisplay(PndSttTrack *track)
virtual void Extrapolate(PndSttTrack *track, Double_t r, FairTrackParam *param)
TClonesArray * GetHitArray() const
PndSttTrack * GetTrack() const
virtual void AddHitCollection(TClonesArray *mHitArray)
void fcnHelix2(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
ClassDef(PndSttHelixTrackFitter, 1)
void SetTubeArray(TClonesArray *tubeArray)
Int_t DoFit(PndTrackCand *pTrackCand, PndSttTrack *pTrack, Int_t pidHypo=211)
TVector3 GetHoughResponse()
void SetDisplayLevel(Int_t display=2)
void OrderHitsByR(std::map< Double_t, Int_t > &hitMap)
TVector3 GetHoughResponseThroughOrigin()
PndSttHit * GetHitFromCollections(Int_t hitCounter) const
float f
Definition: P4_F32vec4.h:32
void fcnHelix(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
Int_t DoFitPlain(PndTrackCand *pTrackCand, PndSttTrack *pTrack, Int_t pidHypo=211)
Bool_t ZFinderThroughOrigin(PndTrackCand *pTrackCand, Int_t whatToFit)
Int_t XYFitThroughOrigin(PndTrackCand *pTrackCand, Int_t whatToFit)
Bool_t ZFinder(PndTrackCand *pTrackCand, Int_t whatToFit)
Int_t MinuitFit(PndTrackCand *pTrackCand, Int_t whatToFit)
Int_t GetCharge(Double_t dCenter, Double_t phiCenter, Double_t radius)
Int_t SetUpFitVector(PndTrackCand *pTrackCand, TMatrixT< Double32_t > &fitvect)