15 #include "CLHEP/GenericFunctions/CumulativeChiSquare.hh"
22 declareInterface<IMuonMatchQuality>(
this);
40 return StatusCode::SUCCESS;
47 return CA.innerMatchChi2;
57 if (perigee1 && perigee2 && (*perigee1).
associatedSurface().center() == (*perigee2).associatedSurface().center()) {
69 return CA.innerMatchProbability;
73 const EventContext& ctx)
const {
76 std::pair<int, std::pair<double, double> > aTriad =
77 std::make_pair(
CA.innerMatchDOF, std::make_pair(
CA.innerMatchChi2,
CA.innerMatchProbability));
98 if (outer_chi2 > 0. && outer_chi2 < 1000.) {
99 Genfun::CumulativeChiSquare func(4);
111 return perigee1 && perigee2 && (*perigee1).
associatedSurface().center() == (*perigee2).associatedSurface().center();
115 return CA.simpleChi2;
120 const EventContext& ctx)
const {
124 if (!
CA.innerMatchDOF)
return CA;
131 if (!perigee1 || !perigee2)
return CA;
133 double deltaD0 = perigee1->parameters()[
Trk::d0] - perigee2->parameters()[
Trk::d0];
134 double deltaZ0 = perigee1->parameters()[
Trk::z0] - perigee2->parameters()[
Trk::z0];
144 covariance.setZero();
156 if (
CA.innerMatchDOF < 5) {
175 paramDifference.setZero();
176 paramDifference(
Trk::d0, 0) = deltaD0;
177 paramDifference(
Trk::z0, 0) = deltaZ0;
182 double matchChi2 = paramDifference.dot(
weight * paramDifference);
183 CA.innerMatchChi2 = matchChi2;
186 if (
CA.innerMatchChi2 >= 0. &&
CA.innerMatchChi2 < 1000.) {
187 CA.innerMatchProbability = 1. - Genfun::CumulativeChiSquare(
CA.innerMatchDOF)(
CA.innerMatchChi2);
191 bool nonzerocov =
true;
192 for (
int k = 0;
k < covariance.cols();
k++) {
193 if (covariance(
k,
k) == 0) nonzerocov =
false;
203 if (
CA.simpleChi2 + 5. <
CA.innerMatchChi2) {
204 ATH_MSG_DEBUG(
"problem with matchChi2 " <<
CA.innerMatchChi2 <<
", simpleChi2 " <<
CA.simpleChi2);
207 ATH_MSG_WARNING(
"Could not compute simpleChi2. Covariance matrix contains zeros");
211 <<
"matchDOF" << std::setw(2) <<
CA.innerMatchDOF <<
" matchChi2:" << std::setw(6) << std::setprecision(1)
212 <<
CA.innerMatchChi2 <<
" simpleChi2:" << std::setw(6) << std::setprecision(1) <<
CA.simpleChi2 <<
" pullD0 "
213 << std::setw(5) << std::setprecision(1) << deltaD0 / std::sqrt(covariance(0, 0)) <<
" pullZ0 " << std::setw(5)
214 << std::setprecision(1) << deltaZ0 / std::sqrt(covariance(1, 1)) <<
" pullPhi0 " << std::setw(5)
215 << std::setprecision(1) <<
deltaPhi0 / std::sqrt(covariance(2, 2)) <<
" pullTheta " << std::setw(5)
216 << std::setprecision(1) << deltaTheta / std::sqrt(covariance(3, 3)) <<
" pullQoverP " << std::setw(5)
217 << std::setprecision(1) << deltaQoverP / std::sqrt(covariance(4, 4)));