Skip to content

Commit

Permalink
[ALCA-DB] Replace abs with std::abs to fix clang warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
iarspider committed Dec 18, 2024
1 parent b205513 commit c2bd665
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions Alignment/OfflineValidation/src/PlotAlignmentValidation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ void PlotAlignmentValidation::plotDMR(const std::string& variable,
}

// Skip strip detectors if plotting any "Y" variable
if (i != 1 && i != 2 && variable.length() > 0 && variable[variable.length() - 1] == 'Y') {
if (i != 1 && i != 2 && !variable.empty() && variable[variable.length() - 1] == 'Y') {
continue;
}

Expand Down Expand Up @@ -2261,7 +2261,7 @@ double PlotAlignmentValidation::resampleTestOfEqualRMS(TH1F* h1, TH1F* h2, int n
std::vector<double> diff;
diff.clear();
//"true" (in bootstrap terms) difference of the samples' RMS
double rmsdiff = abs(h1->GetRMS() - h2->GetRMS());
double rmsdiff = std::abs(h1->GetRMS() - h2->GetRMS());
//means of the samples to calculate RMS
double m1 = h1->GetMean();
double m2 = h2->GetMean();
Expand All @@ -2281,8 +2281,8 @@ double PlotAlignmentValidation::resampleTestOfEqualRMS(TH1F* h1, TH1F* h2, int n
}
d1 /= h1->GetEntries();
d2 /= h2->GetEntries();
diff.push_back(abs(d1 - d2 - rmsdiff));
test_mean += abs(d1 - d2 - rmsdiff);
diff.push_back(std::abs(d1 - d2 - rmsdiff));
test_mean += std::abs(d1 - d2 - rmsdiff);
}
test_mean /= numSamples;
edm::LogPrint("") << "test mean:" << test_mean;
Expand All @@ -2309,7 +2309,7 @@ double PlotAlignmentValidation::resampleTestOfEqualMeans(TH1F* h1, TH1F* h2, int
std::vector<double> diff;
diff.clear();
//"true" (in bootstrap terms) difference of the samples' means
double meandiff = abs(h1->GetMean() - h2->GetMean());
double meandiff = std::abs(h1->GetMean() - h2->GetMean());
//realization of random variable
double d1 = 0;
double d2 = 0;
Expand All @@ -2326,8 +2326,8 @@ double PlotAlignmentValidation::resampleTestOfEqualMeans(TH1F* h1, TH1F* h2, int
}
d1 /= h1->GetEntries();
d2 /= h2->GetEntries();
diff.push_back(abs(d1 - d2 - meandiff));
test_mean += abs(d1 - d2 - meandiff);
diff.push_back(std::abs(d1 - d2 - meandiff));
test_mean += std::abs(d1 - d2 - meandiff);
}
test_mean /= numSamples;
edm::LogPrint("") << "test mean:" << test_mean;
Expand All @@ -2344,7 +2344,7 @@ double PlotAlignmentValidation::resampleTestOfEqualMeans(TH1F* h1, TH1F* h2, int
}

float PlotAlignmentValidation::twotailedStudentTTestEqualMean(float t, float v) {
return 2 * (1 - ROOT::Math::tdistribution_cdf(abs(t), v));
return 2 * (1 - ROOT::Math::tdistribution_cdf(std::abs(t), v));
}

const TString PlotAlignmentValidation::summaryfilename = "OfflineValidationSummary";
Expand Down
2 changes: 1 addition & 1 deletion Calibration/HcalCalibAlgos/src/hcalCalib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ void hcalCalib::GetCoefFromMtrxInvOfAve() {

std::map<Int_t, Float_t>::iterator n_it = aveHitE[iEtaList[i]].begin();
for (; n_it != aveHitE[iEtaList[i]].end(); ++n_it) {
if (fabs(n_it->first) > CALIB_ABS_IETA_MAX || fabs(n_it->first) < CALIB_ABS_IETA_MIN)
if (std::abs(n_it->first) > CALIB_ABS_IETA_MAX || std::abs(n_it->first) < CALIB_ABS_IETA_MIN)
continue;
Int_t j = Int_t(find(iEtaList.begin(), iEtaList.end(), n_it->first) - iEtaList.begin());
A(i, j) = n_it->second;
Expand Down

0 comments on commit c2bd665

Please sign in to comment.