1 |
paus |
1.1 |
#include "MitEdm/VertexFitInterface/interface/MvfInterface.h"
|
2 |
bendavid |
1.2 |
#include "MitEdm/DataFormats/interface/Types.h"
|
3 |
|
|
#include "TMath.h"
|
4 |
|
|
#include "TMatrixDSym.h"
|
5 |
|
|
#include "TVectorD.h"
|
6 |
paus |
1.1 |
|
7 |
|
|
using namespace reco;
|
8 |
|
|
using namespace mitedm;
|
9 |
|
|
|
10 |
|
|
const int cms2GenMap[5] = { 1, 0, 4, 3, 2 }; // parameter map: transfer CMS to generic coordinates
|
11 |
|
|
|
12 |
|
|
MvfInterface::MvfInterface(MultiVertexFitter *fitter) :
|
13 |
|
|
_mvf (fitter),
|
14 |
|
|
_fCurv0(0.5 * 0.0029979),
|
15 |
|
|
_fCurv (_fCurv0 * fitter->bField())
|
16 |
|
|
{
|
17 |
|
|
}
|
18 |
|
|
|
19 |
|
|
bool MvfInterface::addTrack(const reco::Track* trk, const int id, const float mass,
|
20 |
|
|
MultiVertexFitter::vertexNumber jv)
|
21 |
|
|
{
|
22 |
|
|
// Fill the parameters and matrix compliant with the generic fitter this involves remapping and a
|
23 |
|
|
// simple parameter transformation
|
24 |
bendavid |
1.2 |
TVectorD params(5); // track parameters
|
25 |
|
|
FiveMatrix derivatives;
|
26 |
|
|
TMatrixDSym covmat(5);
|
27 |
|
|
|
28 |
bendavid |
1.3 |
params[0] = 1.0/TMath::Tan(TMath::PiOver2() - trk->lambda()); //cotTheta
|
29 |
|
|
params[1] = _fCurv*trk->qoverp()/TMath::Cos(trk->lambda()); //curvature
|
30 |
|
|
params[2] = trk->dsz()/TMath::Cos(trk->lambda()); //z0
|
31 |
|
|
params[3] = -trk->dxy(); //d0
|
32 |
|
|
params[4] = trk->phi(); //phi0
|
33 |
bendavid |
1.2 |
|
34 |
|
|
//derivatives(i,j) gives partial dx_i/dy_j where x are the new parameters and y are the old ones
|
35 |
|
|
derivatives(0,0) = 0;
|
36 |
|
|
derivatives(0,1) = -1.0/(TMath::Sin(TMath::PiOver2() - trk->lambda())*TMath::Sin(TMath::PiOver2() - trk->lambda()));
|
37 |
|
|
derivatives(0,2) = 0;
|
38 |
|
|
derivatives(0,3) = 0;
|
39 |
|
|
derivatives(0,4) = 0;
|
40 |
|
|
derivatives(1,0) = _fCurv/TMath::Cos(trk->lambda());
|
41 |
|
|
derivatives(1,1) = _fCurv*TMath::Abs(trk->qoverp())*TMath::Tan(trk->lambda())/TMath::Cos(trk->lambda());
|
42 |
|
|
derivatives(1,2) = 0;
|
43 |
|
|
derivatives(1,3) = 0;
|
44 |
|
|
derivatives(1,4) = 0;
|
45 |
|
|
derivatives(2,0) = 0;
|
46 |
|
|
derivatives(2,1) = -trk->dsz()*TMath::Tan(trk->lambda())/TMath::Cos(trk->lambda());
|
47 |
|
|
derivatives(2,2) = 0;
|
48 |
|
|
derivatives(2,3) = 0;
|
49 |
|
|
derivatives(2,4) = 1.0/TMath::Cos(trk->lambda());
|
50 |
|
|
derivatives(3,0) = 0;
|
51 |
|
|
derivatives(3,1) = 0;
|
52 |
|
|
derivatives(3,2) = 0;
|
53 |
|
|
derivatives(3,3) = -1.0;
|
54 |
|
|
derivatives(3,4) = 0;
|
55 |
|
|
derivatives(4,0) = 0;
|
56 |
|
|
derivatives(4,1) = 0;
|
57 |
|
|
derivatives(4,2) = 1.0;
|
58 |
|
|
derivatives(4,3) = 0;
|
59 |
|
|
derivatives(4,4) = 0;
|
60 |
|
|
|
61 |
|
|
for (Int_t i=0; i<5; i++)
|
62 |
|
|
for (Int_t j=0; j<5; j++) {
|
63 |
|
|
covmat(i,j)=0;
|
64 |
|
|
for (Int_t k=0; k<5; k++)
|
65 |
|
|
for (Int_t l=0; l<5; l++)
|
66 |
|
|
covmat(i,j) += derivatives(i,k)*derivatives(j,l)*trk->covariance(k,l);
|
67 |
paus |
1.1 |
}
|
68 |
bendavid |
1.2 |
|
69 |
|
|
|
70 |
|
|
// double fcCosTheta = _fCurv * cos(trk->theta());
|
71 |
|
|
// double fcCosThetaSq = fcCosTheta * fcCosTheta;
|
72 |
|
|
//
|
73 |
|
|
// // double loop to fill covariance matrix
|
74 |
|
|
// for (int i=0; i<5; i++) {
|
75 |
|
|
// params[i] = trk->parameter(cms2GenMap[i]);
|
76 |
|
|
//
|
77 |
|
|
// // apply q/p correction
|
78 |
|
|
// if (i == 1)
|
79 |
|
|
// params[i] = params[i] * fcCosTheta;
|
80 |
|
|
//
|
81 |
|
|
// for (int j=i; j<5; j++) {
|
82 |
|
|
// covmat(i,j) = trk->covariance(cms2GenMap[i],cms2GenMap[j]);
|
83 |
|
|
//
|
84 |
|
|
// // apply q/p correction
|
85 |
|
|
// if (1 == 1 && j == 1)
|
86 |
|
|
// covmat(i,j) = covmat(i,j) * fcCosThetaSq;
|
87 |
|
|
// else if (i == 1 || j == 1)
|
88 |
|
|
// covmat(i,j) = covmat(i,j) * fcCosTheta;
|
89 |
|
|
//
|
90 |
|
|
// // force symmetry (should not be needed but well, better apply)
|
91 |
|
|
// if (i != j)
|
92 |
|
|
// covmat[j][i] = covmat(i,j);
|
93 |
|
|
// }
|
94 |
|
|
// }
|
95 |
paus |
1.1 |
|
96 |
|
|
return (_mvf->addTrack(params,covmat,id,mass,jv));
|
97 |
|
|
}
|