ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitEdm/VertexFitInterface/src/MvfInterface.cc
Revision: 1.2
Committed: Thu Jul 31 19:20:11 2008 UTC (16 years, 9 months ago) by bendavid
Content type: text/plain
Branch: MAIN
Changes since 1.1: +75 -26 lines
Log Message:
Fixed track parameter and covariance matrix transformation

File Contents

# User Rev Content
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    
29     params[0] = 1.0/TMath::Tan(TMath::PiOver2() - trk->lambda());
30     params[1] = _fCurv*trk->qoverp()/TMath::Cos(trk->lambda());
31     params[2] = trk->dsz()/TMath::Cos(trk->lambda());
32     params[3] = -trk->dxy();
33     params[4] = trk->phi();
34    
35     //derivatives(i,j) gives partial dx_i/dy_j where x are the new parameters and y are the old ones
36     derivatives(0,0) = 0;
37     derivatives(0,1) = -1.0/(TMath::Sin(TMath::PiOver2() - trk->lambda())*TMath::Sin(TMath::PiOver2() - trk->lambda()));
38     derivatives(0,2) = 0;
39     derivatives(0,3) = 0;
40     derivatives(0,4) = 0;
41     derivatives(1,0) = _fCurv/TMath::Cos(trk->lambda());
42     derivatives(1,1) = _fCurv*TMath::Abs(trk->qoverp())*TMath::Tan(trk->lambda())/TMath::Cos(trk->lambda());
43     derivatives(1,2) = 0;
44     derivatives(1,3) = 0;
45     derivatives(1,4) = 0;
46     derivatives(2,0) = 0;
47     derivatives(2,1) = -trk->dsz()*TMath::Tan(trk->lambda())/TMath::Cos(trk->lambda());
48     derivatives(2,2) = 0;
49     derivatives(2,3) = 0;
50     derivatives(2,4) = 1.0/TMath::Cos(trk->lambda());
51     derivatives(3,0) = 0;
52     derivatives(3,1) = 0;
53     derivatives(3,2) = 0;
54     derivatives(3,3) = -1.0;
55     derivatives(3,4) = 0;
56     derivatives(4,0) = 0;
57     derivatives(4,1) = 0;
58     derivatives(4,2) = 1.0;
59     derivatives(4,3) = 0;
60     derivatives(4,4) = 0;
61    
62     for (Int_t i=0; i<5; i++)
63     for (Int_t j=0; j<5; j++) {
64     covmat(i,j)=0;
65     for (Int_t k=0; k<5; k++)
66     for (Int_t l=0; l<5; l++)
67     covmat(i,j) += derivatives(i,k)*derivatives(j,l)*trk->covariance(k,l);
68 paus 1.1 }
69 bendavid 1.2
70    
71     // double fcCosTheta = _fCurv * cos(trk->theta());
72     // double fcCosThetaSq = fcCosTheta * fcCosTheta;
73     //
74     // // double loop to fill covariance matrix
75     // for (int i=0; i<5; i++) {
76     // params[i] = trk->parameter(cms2GenMap[i]);
77     //
78     // // apply q/p correction
79     // if (i == 1)
80     // params[i] = params[i] * fcCosTheta;
81     //
82     // for (int j=i; j<5; j++) {
83     // covmat(i,j) = trk->covariance(cms2GenMap[i],cms2GenMap[j]);
84     //
85     // // apply q/p correction
86     // if (1 == 1 && j == 1)
87     // covmat(i,j) = covmat(i,j) * fcCosThetaSq;
88     // else if (i == 1 || j == 1)
89     // covmat(i,j) = covmat(i,j) * fcCosTheta;
90     //
91     // // force symmetry (should not be needed but well, better apply)
92     // if (i != j)
93     // covmat[j][i] = covmat(i,j);
94     // }
95     // }
96 paus 1.1
97     return (_mvf->addTrack(params,covmat,id,mass,jv));
98     }