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
20 changes: 10 additions & 10 deletions PWGDQ/Core/VarManager.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 PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Provide mandatory file documentation.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand All @@ -8,8 +8,8 @@
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#include <cmath>

Check failure on line 11 in PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \author is missing, incorrect or misplaced.

Check failure on line 11 in PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \brief is missing, incorrect or misplaced.

Check failure on line 11 in PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \file is missing, incorrect or misplaced.
#include <iostream>

Check failure on line 12 in PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[include-iostream]

Do not include iostream. Use O2 logging instead.
#include <vector>
#include <map>
#include "PWGDQ/Core/VarManager.h"
Expand Down Expand Up @@ -45,7 +45,7 @@
o2::globaltracking::MatchGlobalFwd VarManager::mMatching;
std::map<VarManager::CalibObjects, TObject*> VarManager::fgCalibs;
bool VarManager::fgRunTPCPostCalibration[4] = {false, false, false, false};
int VarManager::fgCalibrationType = 0; // 0 - no calibration, 1 - calibration vs (TPCncls,pIN,eta) typically for pp, 2 - calibration vs (eta,nPV,nLong,tLong) typically for PbPb
int VarManager::fgCalibrationType = 0; // 0 - no calibration, 1 - calibration vs (TPCncls,pIN,eta) typically for pp, 2 - calibration vs (eta,nPV,nLong,tLong) typically for PbPb
bool VarManager::fgUseInterpolatedCalibration = true; // use interpolated calibration histograms (default: true)

//__________________________________________________________________
Expand Down Expand Up @@ -105,7 +105,7 @@
if (!values) {
values = fgValues;
}
for (Int_t i = startValue; i < endValue; ++i) {

Check failure on line 108 in PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
values[i] = -9999.;
}
}
Expand Down Expand Up @@ -164,8 +164,8 @@
// TO Do: add more systems

// set the beam 4-momentum vectors
float beamAEnergy = energy / 2.0 * sqrt(NumberOfProtonsA * NumberOfProtonsC / NumberOfProtonsC / NumberOfProtonsA); // GeV

Check failure on line 167 in PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
float beamCEnergy = energy / 2.0 * sqrt(NumberOfProtonsC * NumberOfProtonsA / NumberOfProtonsA / NumberOfProtonsC); // GeV

Check failure on line 168 in PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
float beamAMomentum = std::sqrt(beamAEnergy * beamAEnergy - NumberOfNucleonsA * NumberOfNucleonsA * MassProton * MassProton);
float beamCMomentum = std::sqrt(beamCEnergy * beamCEnergy - NumberOfNucleonsC * NumberOfNucleonsC * MassProton * MassProton);
fgBeamA.SetPxPyPzE(0, 0, beamAMomentum, beamAEnergy);
Expand Down Expand Up @@ -213,7 +213,8 @@
}

//__________________________________________________________________
double VarManager::ComputePIDcalibration(int species, double nSigmaValue) {
double VarManager::ComputePIDcalibration(int species, double nSigmaValue)
{
// species: 0 - electron, 1 - pion, 2 - kaon, 3 - proton
// Depending on the PID calibration type, we use different types of calibration histograms

Expand Down Expand Up @@ -263,8 +264,7 @@
double mean = calibMeanHist->GetBinContent(binTPCncls, binPin, binEta);
double sigma = calibSigmaHist->GetBinContent(binTPCncls, binPin, binEta);
return (nSigmaValue - mean) / sigma; // Return the calibrated nSigma value
}
else if (fgCalibrationType == 2) {
} else if (fgCalibrationType == 2) {

Check failure on line 267 in PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
// get the calibration histograms
CalibObjects calibMean, calibSigma, calibStatus;
switch (species) {
Expand Down Expand Up @@ -323,12 +323,12 @@
case 0:
// good calibration, return the calibrated nSigma value
return (nSigmaValue - mean) / sigma;
break;
break;
case 1:
// calibration not valid, return the original nSigma value
return nSigmaValue;
break;
case 2: // calibration constant has poor stat uncertainty, consider the user option for what to do
break;
case 2: // calibration constant has poor stat uncertainty, consider the user option for what to do
case 3:
// calibration constants have been interpolated
if (fgUseInterpolatedCalibration) {
Expand All @@ -337,14 +337,14 @@
// return the original nSigma value
return nSigmaValue;
}
break;
break;
case 4:
// calibration constants interpolation failed, return the original nSigma value
return nSigmaValue;
break;
break;
default:
return nSigmaValue; // unknown status, return the original nSigma value
break;
break;
};
} else {
// unknown calibration type, return the original nSigma value
Expand All @@ -359,7 +359,7 @@
//
// Set default variable names
//
for (Int_t ivar = 0; ivar < kNVars; ++ivar) {

Check failure on line 362 in PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
fgVariableNames[ivar] = "DEFAULT NOT DEFINED";
fgVariableUnits[ivar] = "n/a";
}
Expand Down
7 changes: 3 additions & 4 deletions PWGDQ/Core/VarManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -1239,8 +1239,8 @@ class VarManager : public TObject

static std::map<CalibObjects, TObject*> fgCalibs; // map of calibration histograms
static bool fgRunTPCPostCalibration[4]; // 0-electron, 1-pion, 2-kaon, 3-proton
static int fgCalibrationType; // 0 - no calibration, 1 - calibration vs (TPCncls,pIN,eta) typically for pp, 2 - calibration vs (eta,nPV,nLong,tLong) typically for PbPb
static bool fgUseInterpolatedCalibration; // use interpolated calibration histograms (default: true)
static int fgCalibrationType; // 0 - no calibration, 1 - calibration vs (TPCncls,pIN,eta) typically for pp, 2 - calibration vs (eta,nPV,nLong,tLong) typically for PbPb
static bool fgUseInterpolatedCalibration; // use interpolated calibration histograms (default: true)

VarManager& operator=(const VarManager& c);
VarManager(const VarManager& c);
Expand Down Expand Up @@ -1380,7 +1380,6 @@ o2::dataformats::GlobalFwdTrack VarManager::PropagateMuon(const T& muon, const C
return propmuon;
}


template <uint32_t fillMap, typename T, typename C>
void VarManager::FillMuonPDca(const T& muon, const C& collision, float* values)
{
Expand Down Expand Up @@ -2480,7 +2479,7 @@ void VarManager::FillTrack(T const& track, float* values)
values[kTPCnSigmaPr_Corr] = track.tpcNSigmaPr();
}
}

if constexpr ((fillMap & TrackPID) > 0 || (fillMap & ReducedTrackBarrelPID) > 0) {
values[kTOFnSigmaEl] = track.tofNSigmaEl();
values[kTOFnSigmaPi] = track.tofNSigmaPi();
Expand Down
Loading