763 double weight = measurement.weight();
764 const Amg::Vector3D& driftDirection = measurement.minimizationDirection();
765 double xDrift = driftDirection.x();
766 double yDrift = driftDirection.y();
772 measurement.derivative(
777 measurement.derivative(
781 if (measurement.numericalDerivative()) {
784 measurement.derivative(
792 measurement.derivative(
805 && !measurement.isPseudo()) {
806 measurement.derivative(
D0, 0.);
807 measurement.derivative(
Phi0, 0.);
809 measurement.derivative(
811 measurement.derivative(
812 Phi0,
weight * (xDistance * yDrift - yDistance * xDrift));
815 measurement.derivative(
Z0,
weight * driftDirection.z());
816 measurement.derivative(
Theta0,
weight * driftDirection.z() * rDistance);
821 std::vector<FitMeasurement*>::const_iterator
s =
m_scatterers.begin();
822 while (++param < measurement.lastParameter()) {
823 const TrackSurfaceIntersection& scatteringCentre =
826 intersection.position().x() - scatteringCentre.position().x();
828 intersection.position().y() - scatteringCentre.position().y();
829 double rDistScat = -(scatteringCentre.direction().x() * xDistScat +
830 scatteringCentre.direction().y() * yDistScat) /
831 (scatteringCentre.direction().perp2() *
832 scatteringCentre.direction().perp());
833 measurement.derivative(
834 param,
weight * (xDistScat * yDrift - yDistScat * xDrift));
835 measurement.derivative(++param,
weight * driftDirection.z() * rDistScat);
840 if (measurement.alignmentParameter()) {
841 param = measurement.alignmentParameter();
847 const TrackSurfaceIntersection& alignmentCentre =
850 intersection.position().x() - alignmentCentre.position().x();
852 intersection.position().y() - alignmentCentre.position().y();
853 double rDistance = -(alignmentCentre.direction().x() * xDistance +
854 alignmentCentre.direction().y() * yDistance) /
855 (alignmentCentre.direction().perp2() *
856 alignmentCentre.direction().perp());
857 measurement.derivative(param,
weight * driftDirection.z() * rDistance);
861 double projection = 0;
862 const Surface& surface = *fm->surface();
863 if (std::abs(surface.normal().z()) > 0.5) {
864 projection = (driftDirection.x() * surface.center().x() +
865 driftDirection.y() * surface.center().y()) /
866 surface.center().perp();
868 projection = driftDirection.z();
870 measurement.derivative(++param,
weight * projection);
872 if (measurement.alignmentParameter2()) {
873 param = measurement.alignmentParameter2();
879 const TrackSurfaceIntersection& alignmentCentre =
882 intersection.position().x() - alignmentCentre.position().x();
884 intersection.position().y() - alignmentCentre.position().y();
885 rDistance = -(alignmentCentre.direction().x() * xDistance +
886 alignmentCentre.direction().y() * yDistance) /
887 (alignmentCentre.direction().perp2() *
888 alignmentCentre.direction().perp());
889 measurement.derivative(param,
weight * driftDirection.z() * rDistance);
893 const Surface& surface = *fm->surface();
894 if (surface.normal().dot(surface.center().unit()) < 0.5) {
895 projection = driftDirection.z();
897 projection = (driftDirection.x() * surface.center().x() +
898 driftDirection.y() * surface.center().y()) /
899 surface.center().perp();
901 measurement.derivative(++param,
weight * projection);
907 if (derivativeFlag == 1)
909 double weight = measurement.weight2();
910 const Amg::Vector3D& wireDirection = measurement.sensorDirection();
911 double xWire = wireDirection.x();
912 double yWire = wireDirection.y();
918 measurement.derivative2(
923 measurement.derivative2(
927 if (measurement.numericalDerivative()) {
930 measurement.derivative2(
937 measurement.derivative2(
943 measurement.derivative2(
D0,
945 measurement.derivative2(
Phi0,
946 weight * (xDistance * yWire - yDistance * xWire));
949 measurement.derivative2(
Z0,
weight * wireDirection.z());
950 measurement.derivative2(
Theta0,
weight * wireDirection.z() * rDistance);
955 std::vector<FitMeasurement*>::const_iterator
s =
m_scatterers.begin();
956 while (++param < measurement.lastParameter()) {
957 const TrackSurfaceIntersection& scatteringCentre =
960 intersection.position().x() - scatteringCentre.position().x();
962 intersection.position().y() - scatteringCentre.position().y();
963 double rDistScat = -(scatteringCentre.direction().x() * xDistScat +
964 scatteringCentre.direction().y() * yDistScat) /
965 (scatteringCentre.direction().perp2() *
966 scatteringCentre.direction().perp());
967 measurement.derivative2(param,
968 weight * (xDistScat * yWire - yDistScat * xWire));
969 measurement.derivative2(++param,
weight * wireDirection.z() * rDistScat);