146 std::vector<RefCountedVertexTrack> refTracks = vtx.
tracks();
147 int size = refTracks.size();
154 double energy_total =
sqrt(par(3)*par(3)+par(6)*par(6) + par(5)*par(5)+par(4)*par(4));
156 std::vector<KinematicRefittedTrackState *>::const_iterator rs;
157 std::vector<RefCountedVertexTrack>::const_iterator rt_i;
159 for(rt_i = refTracks.begin(); rt_i != refTracks.end(); rt_i++)
163 double rho = param[0];
164 double theta = param[1];
165 double phi = param[2];
166 double mass = param[5];
168 if ((**rt_i).linearizedTrack()->charge()!=0) {
169 a = -(**rt_i).refittedState()->freeTrajectoryState().parameters().magneticFieldInInverseGeV(vtx.
position()).
z()
170 * (**rt_i).refittedState()->freeTrajectoryState().parameters ().charge();
171 if (a==0.)
throw cms::Exception(
"FinalTreeBuilder",
"Field is 0");
177 jc_el(1,1) = -a*
cos(phi)/(rho*
rho);
178 jc_el(2,1) = -a*
sin(phi)/(rho*
rho);
179 jc_el(3,1) = -a/(rho*rho*
tan(theta));
181 jc_el(3,2) = -a/(rho*
sin(theta)*
sin(theta));
183 jc_el(1,3) = -a*
sin(phi)/
rho;
184 jc_el(2,3) = a*
cos(phi)/
rho;
187 double energy_local =
sqrt(a*a/(rho*rho)*(1+1/(
tan(theta)*
tan(theta))) + mass*mass);
189 jc_el(4,4) = energy_total*mass/(par(6)*energy_local);
191 jc_el(4,1) = (-(energy_total/energy_local*a*a/(rho*rho*rho*
sin(theta)*
sin(theta)) )
192 + par(3)*a/(rho*
rho)*
cos(phi) + par(4)*a/(rho*
rho)*
sin(phi)
193 + par(5)*a/(rho*rho*
tan(theta)) )/par(6);
195 jc_el(4,2) = (-(energy_total/energy_local*a*a/(rho*rho*
sin(theta)*
sin(theta)*
tan(theta)) )
196 + par(5)*a/(rho*
sin(theta)*
sin(theta)) )/par(6);
198 jc_el(4,3) = ( par(3)*
sin(phi) - par(4)*
cos(phi) )*a/(rho*par(6));
200 jac.sub(4,i_int*4+4,jc_el);
204 cov.sub(1,1,asHepMatrix<7>((**rt_i).fullCovariance()));
207 AlgebraicMatrix fullCovMatrix(asHepMatrix<7>((**rt_i).fullCovariance()));
219 cov.sub(i_int*4 + 4, i_int*4 + 4,m_m_cov);
222 cov.sub(1,i_int*4 + 4,x_p_cov);
223 cov.sub(i_int*4 + 4,1,p_x_cov);
229 for(std::vector<RefCountedVertexTrack>::const_iterator rt_j = refTracks.begin(); rt_j != refTracks.end(); rt_j++)
235 cov.sub(i_int*4 + 4, j_int*4 + 4,i_k_cov_m);
236 cov.sub(j_int*4 + 4, i_int*4 + 4,i_k_cov_m.T());
246 return jac*cov*jac.T();
std::vector< RefCountedVertexTrack > tracks() const
Sin< T >::type sin(const T &t)
Geom::Theta< T > theta() const
ROOT::Math::SVector< double, 6 > AlgebraicVector6
CLHEP::HepMatrix AlgebraicMatrix
Cos< T >::type cos(const T &t)
Tan< T >::type tan(const T &t)
AlgebraicMatrixMM tkToTkCovariance(const RefCountedVertexTrack t1, const RefCountedVertexTrack t2) const
GlobalPoint position() const