Fork me on GitHub

source: git/external/TrackCovariance/VertexFit.h@ 7bca620

Last change on this file since 7bca620 was 7bca620, checked in by Franco BEDESCHI <bed@…>, 3 years ago

Add feature to force starting radius in vertex fit

  • Property mode set to 100644
File size: 3.4 KB
Line 
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 "TrkUtil.h"
9#include "ObsTrk.h"
10#include <vector>
11#include <iostream>
12//
13// Class for vertex fitting
14
15class VertexFit: public TrkUtil
16{
17 //
18 // Vertex fitting with track parameters steering
19 // Author: F. Bedeschi, INFN-Pisa, Italy
20 // February 10, 2021
21 //
22private:
23 //
24 // Inputs
25 Int_t fNtr; // Number of tracks
26 std::vector<TVectorD*> fPar; // Input parameter array
27 std::vector<TVectorD*> fParNew; // Updated parameter array
28 std::vector<TMatrixDSym*> fCov; // Input parameter covariances
29 std::vector<TMatrixDSym*> fCovNew; // Updated parameter covariances
30 // Constraints
31 Bool_t fVtxCst; // Vertex constraint flag
32 TVectorD fxCst; // Constraint value
33 TMatrixDSym fCovCst; // Constraint
34 TMatrixDSym fCovCstInv; // Inverse of constraint covariance
35 //
36 // Results
37 Bool_t fVtxDone; // Flag vertex fit completed
38 Double_t fRstart; // Starting value of vertex radius (0 = none)
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 //
44 // Work arrays
45 std::vector<Double_t> ffi; // Fit phases
46 std::vector<TVectorD*> fx0i; // Track expansion points
47 std::vector<TVectorD*> fai; // dx/dphi
48 std::vector<TVectorD*> fdi; // x-shift
49 std::vector<Double_t> fa2i; // a'Wa
50 std::vector<TMatrixD*> fAti; // A transposed
51 std::vector<TMatrixDSym*> fDi; // W-WBW
52 std::vector<TMatrixDSym*> fWi; // (ACA')^-1
53 std::vector<TMatrixDSym*> fWinvi; // ACA'
54 //
55 // Service routines
56 void ResetWrkArrays(); // Clear work arrays
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
62 TVectorD Fill_x0(TVectorD par); // Track position at dma to z-axis
63 TVectorD Fill_x(TVectorD par, Double_t phi); // Track position at given phase
64 void UpdateTrkArrays(Int_t i); // Fill track realted arrays
65 void VtxFitNoSteer(); // Vertex fitter routine w/o parameter steering
66 void VertexFitter(); // Vertex fitter routine w/ parameter steering
67public:
68 //
69 // Constructors
70 VertexFit(); // Initialize waiting for tracks
71 VertexFit(Int_t Ntr, ObsTrk** tracks); // Initialize with ObsTrk tracks
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
85 void AddTrk(TVectorD *par, TMatrixDSym *Cov); // Add track to input list
86 void RemoveTrk(Int_t iTrk); // Remove iTrk track
87 void SetStartR(Double_t R) { fRstart = R; }; // Set starting radius
88 //
89};
90
91#endif
Note: See TracBrowser for help on using the repository browser.