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