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

Use std::floor instead of casting double -> int -> double #1026

Merged
merged 1 commit into from
Nov 21, 2024
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
4 changes: 2 additions & 2 deletions src/CMSHistErrorPropagator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ RooArgList * CMSHistErrorPropagator::setupBinPars(double poissonThreshold) {
}

// Now check if we are below the poisson threshold
double n = int(0.5 + ((sub_sum * sub_sum) / (sub_err * sub_err)));
double n = std::floor(0.5 + ((sub_sum * sub_sum) / (sub_err * sub_err)));
double alpha = valsum_[j] / n;
std::cout << TString::Format(
"%-10i %-15f %-15f %-30s\n", j, n, std::sqrt(n),
Expand Down Expand Up @@ -373,7 +373,7 @@ RooArgList * CMSHistErrorPropagator::setupBinPars(double poissonThreshold) {
std::cout << TString::Format(" %-30s\n", "=> Cannot handle negative content, ignore");
bintypes_[j][i] = 4;
} else if (v_p > 0. && e_p > 0. && v_p >= (e_p*0.999)) {
double n_p_r = int(0.5 + ((v_p * v_p) / (e_p * e_p)));
double n_p_r = std::floor(0.5 + ((v_p * v_p) / (e_p * e_p)));
double alpha_p_r = v_p / n_p_r;
std::cout << TString::Format(
" %-20s %-15f %-15f %-30s\n", "", n_p_r, std::sqrt(n_p_r),
Expand Down
Loading