Skip to content
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
5 changes: 3 additions & 2 deletions Common/DataModel/PIDResponseITS.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
float sum = 0;
int nclusters = 0;
int max = 0;
for (int layer = 0; layer < 7; layer++) {

Check failure on line 42 in Common/DataModel/PIDResponseITS.h

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.
int clsize = (itsClusterSizes >> (layer * 4)) & 0xf;
if (clsize > 0) {
nclusters++;
Expand All @@ -59,7 +59,7 @@
template <o2::track::PID::ID id>
static float expSignal(const float momentum)
{
static constexpr float inverseMass = 1. / o2::track::pid_constants::sMasses[id];

Check failure on line 62 in Common/DataModel/PIDResponseITS.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/constexpr-constant]

Use UpperCamelCase for names of constexpr constants. Names of special constants may be prefixed with "k".
// static constexpr float charge = static_cast<float>(o2::track::pid_constants::sCharges[id]);
const float bg = momentum * inverseMass;
if (id == o2::track::PID::Helium3 || id == o2::track::PID::Alpha) {
Expand All @@ -71,18 +71,20 @@
template <o2::track::PID::ID id>
static float expResolution(const float momentum)
{
static constexpr float inverseMass = 1. / o2::track::pid_constants::sMasses[id];

Check failure on line 74 in Common/DataModel/PIDResponseITS.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/constexpr-constant]

Use UpperCamelCase for names of constexpr constants. Names of special constants may be prefixed with "k".
// static constexpr float charge = static_cast<float>(o2::track::pid_constants::sCharges[id]);
const float bg = momentum * inverseMass;
if (id == o2::track::PID::Helium3 || id == o2::track::PID::Alpha) {
return mResolutionParamsZ2[1] > -999.0 ? mResolutionParamsZ2[0] * std::erf((bg - mResolutionParamsZ2[1]) / mResolutionParamsZ2[2]) : mResolutionParamsZ2[0];

Check failure on line 78 in Common/DataModel/PIDResponseITS.h

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.
}
return mResolutionParams[1] > -999.0 ? mResolutionParams[0] * std::erf((bg - mResolutionParams[1]) / mResolutionParams[2]) : mResolutionParams[0];

Check failure on line 80 in Common/DataModel/PIDResponseITS.h

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.
}

template <o2::track::PID::ID id>
static float nSigmaITS(uint32_t itsClusterSizes, float momentum, float eta)
{
unsigned int charge = (id == o2::track::PID::Helium3 || id == o2::track::PID::Alpha) ? 2 : 1;
momentum *= charge;
const float exp = expSignal<id>(momentum);
const float average = averageClusterSize(itsClusterSizes);
const float coslInv = 1. / std::cosh(eta);
Expand All @@ -93,8 +95,7 @@
template <o2::track::PID::ID id, typename T>
static float nSigmaITS(const T& track)
{
unsigned int charge = (id == o2::track::PID::Helium3 || id == o2::track::PID::Alpha) ? 2 : 1;
return nSigmaITS<id>(track.itsClusterSizes(), charge * track.p(), track.eta());
return nSigmaITS<id>(track.itsClusterSizes(), track.p(), track.eta());
}

static void setParameters(float p0, float p1, float p2,
Expand Down Expand Up @@ -133,14 +134,14 @@
static void setParameters(o2::framework::InitContext& initContext, bool isMC = false)
{
float p0 = 0, p1 = 0, p2 = 0;
float p0_Z2 = 0, p1_Z2 = 0, p2_Z2 = 0;

Check failure on line 137 in Common/DataModel/PIDResponseITS.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
float p0_res = 0, p1_res = 0, p2_res = 0;

Check failure on line 138 in Common/DataModel/PIDResponseITS.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
float p0_res_Z2 = 0, p1_res_Z2 = 0, p2_res_Z2 = 0;

Check failure on line 139 in Common/DataModel/PIDResponseITS.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
o2::framework::LabeledArray<float> itsParams;
getTaskOptionValue(initContext, "its-pid", "itsParams", itsParams, true);
auto data = itsParams.getData();
const int col = isMC ? 1 : 0; // 0 for Data, 1 for MC
if (data.rows != 2 || data.cols != 12) {

Check failure on line 144 in Common/DataModel/PIDResponseITS.h

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.
LOG(fatal) << "ITSResponse parameters not initialized, check the itsParams configuration";
}
p0 = data(col, 0);
Expand Down Expand Up @@ -179,7 +180,7 @@

namespace pidits
{
DECLARE_SOA_DYNAMIC_COLUMN(ITSNSigmaElImp, itsNSigmaEl, //! Nsigma separation with the ITS detector for electrons

Check failure on line 183 in Common/DataModel/PIDResponseITS.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
[](uint32_t itsClusterSizes, float momentum, float eta) -> float {
return ITSResponse::nSigmaITS<o2::track::PID::Electron>(itsClusterSizes, momentum, eta);
});
Expand Down
Loading