1 |
paus |
1.1 |
#include "MitEdm/VertexFitInterface/interface/MvfInterface.h"
|
2 |
|
|
|
3 |
|
|
using namespace reco;
|
4 |
|
|
using namespace mitedm;
|
5 |
|
|
|
6 |
|
|
const int cms2GenMap[5] = { 1, 0, 4, 3, 2 }; // parameter map: transfer CMS to generic coordinates
|
7 |
|
|
|
8 |
|
|
MvfInterface::MvfInterface(MultiVertexFitter *fitter) :
|
9 |
|
|
_mvf (fitter),
|
10 |
|
|
_fCurv0(0.5 * 0.0029979),
|
11 |
|
|
_fCurv (_fCurv0 * fitter->bField())
|
12 |
|
|
{
|
13 |
|
|
}
|
14 |
|
|
|
15 |
|
|
bool MvfInterface::addTrack(const reco::Track* trk, const int id, const float mass,
|
16 |
|
|
MultiVertexFitter::vertexNumber jv)
|
17 |
|
|
{
|
18 |
|
|
// Fill the parameters and matrix compliant with the generic fitter this involves remapping and a
|
19 |
|
|
// simple parameter transformation
|
20 |
|
|
HepVector params(5); // track parameters
|
21 |
|
|
HepSymMatrix covmat(5,0); // 5x5 matrix filled with 0
|
22 |
|
|
double fcCosTheta = _fCurv * cos(trk->theta());
|
23 |
|
|
double fcCosThetaSq = fcCosTheta * fcCosTheta;
|
24 |
|
|
|
25 |
|
|
// double loop to fill covariance matrix
|
26 |
|
|
for (int i=0; i<5; i++) {
|
27 |
|
|
params[i] = trk->parameter(cms2GenMap[i]);
|
28 |
|
|
|
29 |
|
|
// apply q/p correction
|
30 |
|
|
if (i == 1)
|
31 |
|
|
params[i] = params[i] * fcCosTheta;
|
32 |
|
|
|
33 |
|
|
for (int j=i; j<5; j++) {
|
34 |
|
|
covmat[i][j] = trk->covariance(cms2GenMap[i],cms2GenMap[j]);
|
35 |
|
|
|
36 |
|
|
// apply q/p correction
|
37 |
|
|
if (1 == 1 && j == 1)
|
38 |
|
|
covmat[i][j] = covmat[i][j] * fcCosThetaSq;
|
39 |
|
|
else if (i == 1 || j == 1)
|
40 |
|
|
covmat[i][j] = covmat[i][j] * fcCosTheta;
|
41 |
|
|
|
42 |
|
|
// force symmetry (should not be needed but well, better apply)
|
43 |
|
|
if (i != j)
|
44 |
|
|
covmat[j][i] = covmat[i][j];
|
45 |
|
|
}
|
46 |
|
|
}
|
47 |
|
|
|
48 |
|
|
return (_mvf->addTrack(params,covmat,id,mass,jv));
|
49 |
|
|
}
|