1 |
econte |
1.1 |
#ifndef CollinearFitAtTM2_h_
|
2 |
|
|
#define CollinearFitAtTM2_h_
|
3 |
|
|
|
4 |
|
|
#include "TrackingTools/PatternTools/interface/TrajectoryMeasurement.h"
|
5 |
|
|
#include "DataFormats/GeometryCommonDetAlgo/interface/Measurement1D.h"
|
6 |
|
|
#include "DataFormats/Math/interface/Vector.h"
|
7 |
|
|
#include "DataFormats/Math/interface/Error.h"
|
8 |
|
|
|
9 |
|
|
// #include "Workspace/TrajectoryMeasurementFits/interface/RandomVector.h"
|
10 |
|
|
|
11 |
|
|
/** Constrained fit at a TrajectoryMeasurement assuming collinearity
|
12 |
|
|
* of incoming / outgoing momenta. The result of the fit is a vector
|
13 |
|
|
* of 6 variables: the first five correspond to local trajectory
|
14 |
|
|
* parameters for the incoming momentum, the 6th is the estimated
|
15 |
|
|
* remaining energy fraction (p_out / p_in). The NDF are 6 (4)
|
16 |
|
|
* for a valid (invalid) RecHit. **/
|
17 |
|
|
|
18 |
|
|
class CollinearFitAtTM2 {
|
19 |
|
|
public:
|
20 |
|
|
/// parameter indices in the result vector / covariance matrix
|
21 |
|
|
enum { ParQpIn=0, ParQpOut, ParDxDz, ParDyDz, ParX, ParY };
|
22 |
|
|
|
23 |
|
|
CollinearFitAtTM2 (const TrajectoryMeasurement& tm);
|
24 |
|
|
CollinearFitAtTM2 (const AlgebraicVector5& fwdParameters,
|
25 |
|
|
const AlgebraicSymMatrix55& fwdCovariance,
|
26 |
|
|
const AlgebraicVector5& bwdParameters,
|
27 |
|
|
const AlgebraicSymMatrix55& bwdCovariance,
|
28 |
|
|
const LocalPoint& hitPosition,
|
29 |
|
|
const LocalError& hitErrors);
|
30 |
|
|
|
31 |
|
|
typedef ROOT::Math::SVector<double,6> ResultVector;
|
32 |
|
|
typedef ROOT::Math::SMatrix<double,6,6,ROOT::Math::MatRepSym<double,6> > ResultMatrix;
|
33 |
|
|
/// status of the fit
|
34 |
|
|
bool valid () const {return valid_;}
|
35 |
|
|
/// chi2
|
36 |
|
|
double chi2 () const {return chi2_;}
|
37 |
|
|
/// degrees of freedom
|
38 |
|
|
int ndof () const {return ndof_;}
|
39 |
|
|
/// vector of fitted parameters
|
40 |
|
|
const ResultVector& parameters () const {return parameters_;}
|
41 |
|
|
/// covariance matrix of fitted parameters
|
42 |
|
|
const ResultMatrix& covariance () const {return covariance_;}
|
43 |
|
|
/// estimated deltaP (out-in) from fit parameters
|
44 |
|
|
Measurement1D deltaP () const;
|
45 |
|
|
|
46 |
|
|
private:
|
47 |
|
|
/// initialise the jacobian
|
48 |
|
|
void initJacobian ();
|
49 |
|
|
/// Perform the fit. Return value "true" for success.
|
50 |
|
|
bool fit (const AlgebraicVector5& fwdParameters,
|
51 |
|
|
const AlgebraicSymMatrix55& fwdCovariance,
|
52 |
|
|
const AlgebraicVector5& bwdParameters,
|
53 |
|
|
const AlgebraicSymMatrix55& bwdCovariance,
|
54 |
|
|
const LocalPoint& hitPosition, const LocalError& hitErrors);
|
55 |
|
|
|
56 |
|
|
private:
|
57 |
|
|
ROOT::Math::SMatrix<double,12,6> jacobian_;
|
58 |
|
|
ROOT::Math::SVector<double,12> measurements_;
|
59 |
|
|
ROOT::Math::SMatrix<double,12,12,ROOT::Math::MatRepSym<double,12> > weightMatrix_;
|
60 |
|
|
ROOT::Math::SVector<double,6> projectedMeasurements_;
|
61 |
|
|
// RandomVector randomGenerator;
|
62 |
|
|
|
63 |
|
|
bool valid_;
|
64 |
|
|
ResultVector parameters_;
|
65 |
|
|
ResultMatrix covariance_;
|
66 |
|
|
double chi2_;
|
67 |
|
|
int ndof_;
|
68 |
|
|
};
|
69 |
|
|
|
70 |
|
|
#endif
|