[127644a] | 1 | //
|
---|
| 2 | #ifndef G__VERTEXFIT_H
|
---|
| 3 | #define G__VERTEXFIT_H
|
---|
| 4 | //
|
---|
| 5 | #include <TMath.h>
|
---|
| 6 | #include <TVectorD.h>
|
---|
| 7 | #include <TMatrixDSym.h>
|
---|
| 8 | #include "ObsTrk.h"
|
---|
[82db145] | 9 | #include <vector>
|
---|
[127644a] | 10 | #include <iostream>
|
---|
| 11 | //
|
---|
| 12 | // Class for vertex fitting
|
---|
| 13 |
|
---|
| 14 | class VertexFit {
|
---|
| 15 | //
|
---|
| 16 | // Vertex fitting with track parameters steering
|
---|
| 17 | // Author: F. Bedeschi, INFN-Pisa, Italy
|
---|
| 18 | // February 10, 2021
|
---|
| 19 | //
|
---|
| 20 | private:
|
---|
| 21 | //
|
---|
| 22 | // Inputs
|
---|
| 23 | Int_t fNtr; // Number of tracks
|
---|
[82db145] | 24 | std::vector<TVectorD*> fPar; // Input parameter array
|
---|
| 25 | std::vector<TMatrixDSym*> fCov;// Input parameter covariances
|
---|
[127644a] | 26 | // Constraints
|
---|
| 27 | Bool_t fVtxCst; // Vertex constraint flag
|
---|
| 28 | TVectorD fxCst; // Constraint value
|
---|
[82db145] | 29 | TMatrixDSym fCovCst; // Constraint covariance
|
---|
[127644a] | 30 | //
|
---|
| 31 | // Results
|
---|
[82db145] | 32 | Bool_t fVtxDone; // Flag vertex fit completed
|
---|
| 33 | Double_t fRold; // Current value of vertex radius
|
---|
[127644a] | 34 | TVectorD fXv; // Found vertex
|
---|
| 35 | TMatrixDSym fcovXv; // Vertex covariance
|
---|
| 36 | Double_t fChi2; // Vertex fit Chi2
|
---|
| 37 | TVectorD fChi2List; // List of Chi2 contributions
|
---|
| 38 | //
|
---|
[82db145] | 39 | // Work arrays
|
---|
| 40 | std::vector<Double_t> ffi; // Fit phases
|
---|
| 41 | std::vector<TVectorD*> fx0i; // Track expansion points
|
---|
| 42 | std::vector<TVectorD*> fai; // dx/dphi
|
---|
| 43 | std::vector<Double_t> fa2i; // a'Wa
|
---|
| 44 | std::vector<TMatrixDSym*> fDi; // W-WBW
|
---|
| 45 | std::vector<TMatrixDSym*> fWi; // (ACA')^-1
|
---|
| 46 | std::vector<TMatrixDSym*> fWinvi; // ACA'
|
---|
[127644a] | 47 | //
|
---|
| 48 | // Service routines
|
---|
[82db145] | 49 | //void InitWrkArrays(); // Initializations
|
---|
| 50 | void ResetWrkArrays(); // Clear work arrays
|
---|
| 51 | Double_t StartRadius(); // Starting vertex radius determination
|
---|
[127644a] | 52 | Double_t FastRv(TVectorD p1, TVectorD p2); // Fast vertex radius determination
|
---|
[82db145] | 53 | TMatrixDSym RegInv(TMatrixDSym& Smat0); // Regularized 3D matrix inversion
|
---|
| 54 | TMatrixD Fill_A(TVectorD par, Double_t phi); // Derivative of track position wrt track parameters
|
---|
| 55 | TVectorD Fill_a(TVectorD par, Double_t phi); // Derivative of track position wrt track phase
|
---|
[127644a] | 56 | TVectorD Fill_x0(TVectorD par); // Track position at dma to z-axis
|
---|
[82db145] | 57 | TVectorD Fill_x(TVectorD par, Double_t phi); // Track position at given phase
|
---|
| 58 | void UpdateTrkArrays(Int_t i); // Fill track realted arrays
|
---|
| 59 | void VertexFitter(); // Vertex finder routine
|
---|
[127644a] | 60 | public:
|
---|
| 61 | //
|
---|
| 62 | // Constructors
|
---|
| 63 | VertexFit(); // Initialize waiting for tracks
|
---|
[82db145] | 64 | VertexFit(Int_t Ntr, ObsTrk** tracks); // Initialize with ObsTrk tracks
|
---|
[127644a] | 65 | VertexFit(Int_t Ntr, TVectorD** trkPar, TMatrixDSym** trkCov); // Initialize with parameters and covariances
|
---|
| 66 | // Destructor
|
---|
| 67 | ~VertexFit();
|
---|
| 68 | //
|
---|
| 69 | // Accessors also trigger calculations when needed
|
---|
| 70 | Int_t GetNtrk() { return fNtr; };
|
---|
| 71 | TVectorD GetVtx();
|
---|
| 72 | TMatrixDSym GetVtxCov();
|
---|
| 73 | Double_t GetVtxChi2();
|
---|
| 74 | TVectorD GetVtxChi2List();
|
---|
| 75 | //
|
---|
| 76 | // Handle tracks/constraints
|
---|
| 77 | void AddVtxConstraint(TVectorD xv, TMatrixDSym cov); // Add gaussian vertex constraint
|
---|
[82db145] | 78 | void AddTrk(TVectorD *par, TMatrixDSym *Cov); // Add track to input list
|
---|
| 79 | void RemoveTrk(Int_t iTrk); // Remove iTrk track
|
---|
[127644a] | 80 | //
|
---|
| 81 | };
|
---|
| 82 |
|
---|
| 83 | #endif
|
---|