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