Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Common/Tasks/centralityStudypp.cxx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.

Check failure on line 1 in Common/Tasks/centralityStudypp.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/workflow-file]

Name of a workflow file must match the name of the main struct in it (without the PWG prefix). (Class implementation files should be in "Core" directories.)
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand Down Expand Up @@ -475,7 +475,7 @@
getHist(TH1, histPath + "hFT0M_Collisions")->Fill((multFT0A + multFT0C));
getHist(TH1, histPath + "hFDDA_Collisions")->Fill(multFDDA);
getHist(TH1, histPath + "hFDDC_Collisions")->Fill(multFDDC);
getHist(TH1, histPath + "hFDDM_Collisions")->Fill(multFDDA+multFDDC);
getHist(TH1, histPath + "hFDDM_Collisions")->Fill(multFDDA + multFDDC);
getHist(TH1, histPath + "hFV0A_Collisions")->Fill(multFV0A);
getHist(TH1, histPath + "hNGlobalTracks")->Fill(multNTracksGlobal);
getHist(TH1, histPath + "hNMFTTracks")->Fill(mftNtracks);
Expand Down
64 changes: 32 additions & 32 deletions Common/Tools/Multiplicity/multCalibrator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <RtypesCore.h>

#include <cmath>
#include <iostream> // FIXME

Check failure on line 32 in Common/Tools/Multiplicity/multCalibrator.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[include-iostream]

Do not include iostream. Use O2 logging instead.

using namespace std;

Expand Down Expand Up @@ -93,14 +93,14 @@
// --- output: fOutputFileName, containing OABD object
//

cout << "=== STARTING CALIBRATION PROCEDURE ===" << endl;

Check failure on line 96 in Common/Tools/Multiplicity/multCalibrator.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[logging]

Use O2 logging (LOG, LOGF, LOGP).
cout << " * Input File.....: " << fInputFileName.Data() << endl;

Check failure on line 97 in Common/Tools/Multiplicity/multCalibrator.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[logging]

Use O2 logging (LOG, LOGF, LOGP).
cout << " * Output File....: " << fOutputFileName.Data() << endl;

Check failure on line 98 in Common/Tools/Multiplicity/multCalibrator.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[logging]

Use O2 logging (LOG, LOGF, LOGP).
cout << endl;

Check failure on line 99 in Common/Tools/Multiplicity/multCalibrator.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[logging]

Use O2 logging (LOG, LOGF, LOGP).

TFile* fileInput = new TFile(fInputFileName.Data(), "READ");
if (!fileInput) {
cout << "Input file not found!" << endl;

Check failure on line 103 in Common/Tools/Multiplicity/multCalibrator.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[logging]

Use O2 logging (LOG, LOGF, LOGP).
return kFALSE;
}

Expand All @@ -109,18 +109,18 @@
for (Int_t iv = 0; iv < kNCentEstim; iv++) {
hRaw[iv] = reinterpret_cast<TH1D*>(fileInput->Get(Form("multiplicity-qa/multiplicityQa/h%s", fCentEstimName[iv].Data())));
if (!hRaw[iv]) {
cout << Form("File does not contain histogram h%s, which is necessary for calibration!", fCentEstimName[iv].Data()) << endl;

Check failure on line 112 in Common/Tools/Multiplicity/multCalibrator.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[logging]

Use O2 logging (LOG, LOGF, LOGP).
return kFALSE;
}
}

cout << "Histograms loaded! Will now calibrate..." << endl;

Check failure on line 117 in Common/Tools/Multiplicity/multCalibrator.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[logging]

Use O2 logging (LOG, LOGF, LOGP).

// Create output file
TFile* fOut = new TFile(fOutputFileName.Data(), "RECREATE");
TH1F* hCalib[kNCentEstim];
for (Int_t iv = 0; iv < kNCentEstim; iv++) {
cout << Form("Calibrating estimator: %s", fCentEstimName[iv].Data()) << endl;

Check failure on line 123 in Common/Tools/Multiplicity/multCalibrator.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[logging]

Use O2 logging (LOG, LOGF, LOGP).
hCalib[iv] = GetCalibrationHistogram(hRaw[iv], Form("hCalib%s", fCentEstimName[iv].Data()));
hCalib[iv]->Write();
}
Expand Down Expand Up @@ -236,15 +236,15 @@
// Function to set standard adaptive boundaries
// Run 3 exclusive: goes to 0.00001% binning for highest multiplicity
// Warning: this setting requires well filled input histograms
//
// -> at 0.00001%, one needs 10 million events to get a single one in the highest
// category. In Run 3, at 500 kHz, this corresponds to 20 seconds of dataking;
// any run lasting over 5 minutes should have enough to calibrate to the highest
// boundary.
//
// QA when using hyperfine binning is still advised:
// Selecting very fine percentages may select on spurious situations
// such as beam-background, pileup, etc.
//
// -> at 0.00001%, one needs 10 million events to get a single one in the highest
// category. In Run 3, at 500 kHz, this corresponds to 20 seconds of dataking;
// any run lasting over 5 minutes should have enough to calibrate to the highest
// boundary.
//
// QA when using hyperfine binning is still advised:
// Selecting very fine percentages may select on spurious situations
// such as beam-background, pileup, etc.

lNDesiredBoundaries = 0;
lDesiredBoundaries = new Double_t[1100];
Expand Down Expand Up @@ -293,28 +293,28 @@
}

//________________________________________________________________
bool multCalibrator::IsBinningSane(TH1 *histogram)
bool multCalibrator::IsBinningSane(TH1* histogram)
{
// check if binning that will be attempted is too fine for this histogram
double minimumBinWidth = 1000.0f;
for(int ib = 0; ib<lNDesiredBoundaries-1; ib++){
if(std::abs(lDesiredBoundaries[ib+1]-lDesiredBoundaries[ib])<minimumBinWidth){
minimumBinWidth = std::abs(lDesiredBoundaries[ib+1]-lDesiredBoundaries[ib]);
double minimumBinWidth = 1000.0f;
for (int ib = 0; ib < lNDesiredBoundaries - 1; ib++) {
if (std::abs(lDesiredBoundaries[ib + 1] - lDesiredBoundaries[ib]) < minimumBinWidth) {
minimumBinWidth = std::abs(lDesiredBoundaries[ib + 1] - lDesiredBoundaries[ib]);
}
}
if(minimumBinWidth<1e-9){
cout << "Excessively fine binning requested: minimum bin width registers as "<< minimumBinWidth << endl;
return false; // not reasonable
if (minimumBinWidth < 1e-9) {
cout << "Excessively fine binning requested: minimum bin width registers as " << minimumBinWidth << endl;
return false; // not reasonable
}
if(histogram->GetEntries() < 1000.0/minimumBinWidth){
cout << "Histogram "<<histogram->GetName()<<" does not have enough entries ("<<histogram->GetEntries()<<") to calibrate!" << endl;
return false;
if (histogram->GetEntries() < 1000.0 / minimumBinWidth) {
cout << "Histogram " << histogram->GetName() << " does not have enough entries (" << histogram->GetEntries() << ") to calibrate!" << endl;
return false;
}
if(std::abs(histogram->GetMean())<1e-9){
cout << "Histogram "<<histogram->GetName()<<" has suspicious mean: "<<histogram->GetMean()<<endl;
return false;
if (std::abs(histogram->GetMean()) < 1e-9) {
cout << "Histogram " << histogram->GetName() << " has suspicious mean: " << histogram->GetMean() << endl;
return false;
}
cout << "Sanity check: " << histogram->GetName() << ", entries = " << histogram->GetEntries() << ", 1/(min bin width) = " <<100.0/minimumBinWidth << " -> OK ! " << endl;
cout << "Sanity check: " << histogram->GetName() << ", entries = " << histogram->GetEntries() << ", 1/(min bin width) = " << 100.0 / minimumBinWidth << " -> OK ! " << endl;
return true;
}

Expand All @@ -334,13 +334,13 @@
cout << "Last boundary: " << lDesiredBoundaries[0] << endl;
}

// binning check
if(!IsBinningSane(histoRaw)){
cout << "Requested binning is not viable for input histogram named "<<histoRaw->GetName()<<"! Will return 100.5 for all requests." <<endl;
Double_t lDummyBounds[2];
// binning check
if (!IsBinningSane(histoRaw)) {
cout << "Requested binning is not viable for input histogram named " << histoRaw->GetName() << "! Will return 100.5 for all requests." << endl;
Double_t lDummyBounds[2];
lDummyBounds[0] = 0;
lDummyBounds[1] = 1.0;
TH1F *hCalib = new TH1F(lHistoName.Data(), "", 1, lDummyBounds);
TH1F* hCalib = new TH1F(lHistoName.Data(), "", 1, lDummyBounds);
hCalib->SetBinContent(0, 100.5);
hCalib->SetBinContent(1, 100.5);
hCalib->SetBinContent(2, 100.5);
Expand Down Expand Up @@ -369,16 +369,16 @@
TString lPrecisionString = "(Precision OK)";
if (ii != 0 && ii != lNDesiredBoundaries - 1) {
// check precision, please
if ((lPrecision[ii] / TMath::Abs(lDesiredBoundaries[ii + 1] - lDesiredBoundaries[ii])) > fkPrecisionWarningThreshold){
if ((lPrecision[ii] / TMath::Abs(lDesiredBoundaries[ii + 1] - lDesiredBoundaries[ii])) > fkPrecisionWarningThreshold) {
lPrecisionString = "(WARNING: BINNING MAY LEAD TO IMPRECISION!)";
warnUser = true;
}
if ((lPrecision[ii] / TMath::Abs(lDesiredBoundaries[ii - 1] - lDesiredBoundaries[ii])) > fkPrecisionWarningThreshold){
if ((lPrecision[ii] / TMath::Abs(lDesiredBoundaries[ii - 1] - lDesiredBoundaries[ii])) > fkPrecisionWarningThreshold) {
lPrecisionString = "(WARNING: BINNING MAY LEAD TO IMPRECISION!)";
warnUser = true;
}
}
if(warnUser){
if (warnUser) {
cout << histoRaw->GetName() << " boundaries, percentile: " << lDesiredBoundaries[ii] << "%\t Signal value = " << lBounds[lDisplacedii] << "\tprecision = " << lPrecision[ii] << "% " << lPrecisionString.Data() << endl;
}
}
Expand Down
4 changes: 2 additions & 2 deletions Common/Tools/Multiplicity/multCalibrator.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ class multCalibrator : public TNamed
void SetStandardAdaptiveBoundaries(); // standard adaptive (pp-like)
void SetRun3AdaptiveBoundaries(); // Run 3 adaptive (down to 0.00001%)
void SetStandardOnePercentBoundaries(); // standard 1% (Pb-Pb like)
bool IsBinningSane(TH1 *histogram); // for safety
bool IsBinningSane(TH1* histogram); // for safety

// Master Function in this Class: To be called once filenames are set
Bool_t Calibrate();

Expand Down
Loading