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
55 changes: 35 additions & 20 deletions PWGLF/Utils/nucleiUtils.h
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 PWGLF/Utils/nucleiUtils.h

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,29 +8,28 @@
// 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.

Check failure on line 11 in PWGLF/Utils/nucleiUtils.h

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 PWGLF/Utils/nucleiUtils.h

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 PWGLF/Utils/nucleiUtils.h

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \file is missing, incorrect or misplaced.
#ifndef PWGLF_UTILS_NUCLEIUTILS_H_
#define PWGLF_UTILS_NUCLEIUTILS_H_

#include "Framework/HistogramRegistry.h"
#include "Framework/HistogramSpec.h"

#include "Common/DataModel/Centrality.h"
#include "Common/DataModel/EventSelection.h"
#include "Common/DataModel/PIDResponse.h"
#include "Common/DataModel/PIDResponseITS.h"
#include "Common/TableProducer/PID/pidTOFBase.h"

#include "DataFormatsTPC/BetheBlochAleph.h"
#include "Framework/HistogramRegistry.h"
#include "Framework/HistogramSpec.h"

#include <algorithm>
#include <string>
#include <vector>
#include <algorithm>

using namespace o2;

Check failure on line 29 in PWGLF/Utils/nucleiUtils.h

View workflow job for this annotation

GitHub Actions / O2 linter

[using-directive]

Do not put using directives at global scope in headers.
using namespace o2::framework;

Check failure on line 30 in PWGLF/Utils/nucleiUtils.h

View workflow job for this annotation

GitHub Actions / O2 linter

[using-directive]

Do not put using directives at global scope in headers.
using namespace o2::framework::expressions;

Check failure on line 31 in PWGLF/Utils/nucleiUtils.h

View workflow job for this annotation

GitHub Actions / O2 linter

[using-directive]

Do not put using directives at global scope in headers.
using namespace o2::constants::physics;

Check failure on line 32 in PWGLF/Utils/nucleiUtils.h

View workflow job for this annotation

GitHub Actions / O2 linter

[using-directive]

Do not put using directives at global scope in headers.

struct NucleusCandidate {
int globalIndex;
Expand All @@ -42,7 +41,7 @@
float beta;
float zVertex;
int nContrib;
float DCAxy;

Check failure on line 44 in PWGLF/Utils/nucleiUtils.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
float DCAz;
float TPCsignal;
float ITSchi2;
Expand Down Expand Up @@ -424,7 +423,7 @@
return;
}

for (int i = 0; i < 6; i++) {

Check failure on line 426 in PWGLF/Utils/nucleiUtils.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.
mTpcBetheBlochParams[i] = tpcBetheBlochParams[i];
}
}
Expand All @@ -435,15 +434,17 @@
template <typename Ttrack>
float getBetaTOF(const Ttrack& track)
{
if (!track.hasTOF()) return -999.f;
if (!track.hasTOF())
return -999.f;
float beta = o2::pid::tof::Beta::GetBeta(track);
return std::min(1.f - 1.e-6f, std::max(1.e-4f, beta)); /// sometimes beta > 1 or < 0, to be checked
}

template <typename Ttrack>
float getMassTOF(const Ttrack& track)
{
if (!track.hasTOF()) return -999.f;
if (!track.hasTOF())
return -999.f;
const float charge{1.f + static_cast<float>(mSpecies == Species::kHe || mSpecies == Species::kAl)};
const float beta = getBetaTOF(track);
return track.tpcInnerParam() * charge * std::sqrt(1.f / (beta * beta) - 1.f);
Expand All @@ -452,15 +453,22 @@
template <typename Ttrack>
float getNSigmaTOF(const Ttrack& track)
{
if (!track.hasTOF()) return -999.f;
if (!track.hasTOF())
return -999.f;

switch (mSpecies) {
case Species::kPr: return track.tofNSigmaPr();
case Species::kDe: return track.tofNSigmaDe();
case Species::kTr: return track.tofNSigmaTr();
case Species::kHe: return track.tofNSigmaHe();
case Species::kAl: return track.tofNSigmaAl();
default: return -999.f;
case Species::kPr:
return track.tofNSigmaPr();
case Species::kDe:
return track.tofNSigmaDe();
case Species::kTr:
return track.tofNSigmaTr();
case Species::kHe:
return track.tofNSigmaHe();
case Species::kAl:
return track.tofNSigmaAl();
default:
return -999.f;
}
}

Expand Down Expand Up @@ -497,7 +505,8 @@
// TPC
float getExpectedTPCsignal(const float p)
{
if (!mUseTpcCentralCalibration) return -999.f;
if (!mUseTpcCentralCalibration)
return -999.f;

float pScaled = p * mMomScaling[0] + mMomScaling[1];
float betaGamma = pScaled / masses[mSpecies];
Expand Down Expand Up @@ -526,12 +535,18 @@
float getNSigmaTPCcentral(const Ttrack& track)
{
switch (mSpecies) {
case Species::kPr: return track.tpcNSigmaPr();
case Species::kDe: return track.tpcNSigmaDe();
case Species::kTr: return track.tpcNSigmaTr();
case Species::kHe: return track.tpcNSigmaHe();
case Species::kAl: return track.tpcNSigmaAl();
default: return -999.f;
case Species::kPr:
return track.tpcNSigmaPr();
case Species::kDe:
return track.tpcNSigmaDe();
case Species::kTr:
return track.tpcNSigmaTr();
case Species::kHe:
return track.tpcNSigmaHe();
case Species::kAl:
return track.tpcNSigmaAl();
default:
return -999.f;
}
}

Expand Down
Loading