Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SiPixelLorentzAnglePCLHarvester: protect the computation of the LA error in case of missing covariance matrix #39083

Merged
merged 1 commit into from
Aug 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -676,15 +676,17 @@ SiPixelLAHarvest::fitResults SiPixelLorentzAnglePCLHarvester::fitAndStore(

// compute the error on the drift-at-half-width parameter (d^2)
float dSq{0.};
float cov00{0.}; // needed later for the error on the tan(theta_LA)
if (!doChebyshevFit_) {
if (res.covMatrixStatus != SiPixelLAHarvest::kNotCalculated) {
for (int k = 0; k < order_; k++) {
for (int l = 0; l < order_; l++) {
dSq += (std::pow(half_width, k) * std::pow(half_width, l) * result->CovMatrix(k, l));
}
}
}
} // compute the error on the drift-at-half width only for the regular polynomial fit
cov00 = result->CovMatrix(0, 0);
} // if the covariance matrix is valid
} // compute the error on the drift-at-half width only for the regular polynomial fit

res.dSq = dSq;

Expand Down Expand Up @@ -717,7 +719,7 @@ SiPixelLAHarvest::fitResults SiPixelLorentzAnglePCLHarvester::fitAndStore(
pow((half_width * half_width * half_width * res.e4), 2) +
pow((half_width * half_width * half_width * half_width * res.e5), 2)); // Propagation of uncertainty

res.error_LA = doChebyshevFit_ ? sqrt(errsq_LA) : sqrt(res.dSq + result->CovMatrix(0, 0)) / half_width;
res.error_LA = doChebyshevFit_ ? sqrt(errsq_LA) : sqrt(res.dSq + cov00) / half_width;

hists_.h_bySectMeasLA_->setBinContent(i_index, (res.tan_LA / theMagField_));
hists_.h_bySectMeasLA_->setBinError(i_index, (res.error_LA / theMagField_));
Expand Down