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
26 changes: 23 additions & 3 deletions Common/Core/PID/TPCPIDResponse.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 Common/Core/PID/TPCPIDResponse.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 @@ -12,7 +12,7 @@
/// \file TPCPIDResponse.h
/// \author Annalena Kalteyer <annalena.sophie.kalteyer@cern.ch>
/// \author Christian Sonnabend
/// \brief

Check failure on line 15 in Common/Core/PID/TPCPIDResponse.h

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \brief is missing, incorrect or misplaced.

#ifndef COMMON_CORE_PID_TPCPIDRESPONSE_H_
#define COMMON_CORE_PID_TPCPIDRESPONSE_H_
Expand All @@ -39,13 +39,13 @@
~Response() = default;

/// Setter and Getter for the private parameters
void SetBetheBlochParams(const std::array<float, 5>& betheBlochParams) { mBetheBlochParams = betheBlochParams; }

Check failure on line 42 in Common/Core/PID/TPCPIDResponse.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
void SetResolutionParamsDefault(const std::array<float, 2>& resolutionParamsDefault) { mResolutionParamsDefault = resolutionParamsDefault; }

Check failure on line 43 in Common/Core/PID/TPCPIDResponse.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
void SetResolutionParams(const std::vector<double>& resolutionParams) { mResolutionParams = resolutionParams; }

Check failure on line 44 in Common/Core/PID/TPCPIDResponse.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
void SetMIP(const float mip) { mMIP = mip; }

Check failure on line 45 in Common/Core/PID/TPCPIDResponse.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
void SetChargeFactor(const float chargeFactor) { mChargeFactor = chargeFactor; }

Check failure on line 46 in Common/Core/PID/TPCPIDResponse.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
void SetMultiplicityNormalization(const float multNormalization) { mMultNormalization = multNormalization; }

Check failure on line 47 in Common/Core/PID/TPCPIDResponse.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
void SetNClNormalization(const float nclnorm) { nClNorm = nclnorm; }

Check failure on line 48 in Common/Core/PID/TPCPIDResponse.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
void SetUseDefaultResolutionParam(const bool useDefault) { mUseDefaultResolutionParam = useDefault; }
void SetParameters(const Response* response)
{
Expand Down Expand Up @@ -74,12 +74,18 @@
/// Gets the expected resolution of the track
template <typename CollisionType, typename TrackType>
float GetExpectedSigma(const CollisionType& collision, const TrackType& trk, const o2::track::PID::ID id) const;
/// Gets the expected resolution of the track with multTPC explicitly provided
template <typename TrackType>
float GetExpectedSigmaAtMultiplicity(const long multTPC, const TrackType& trk, const o2::track::PID::ID id) const;
/// Gets the number of sigmas with respect the expected value
template <typename CollisionType, typename TrackType>
float GetNumberOfSigma(const CollisionType& collision, const TrackType& trk, const o2::track::PID::ID id) const;
// Number of sigmas with respect to expected for MC, defining a tune-on-data signal value
template <typename CollisionType, typename TrackType>
float GetNumberOfSigmaMCTuned(const CollisionType& collision, const TrackType& trk, const o2::track::PID::ID id, float mcTunedTPCSignal) const;
// Number of sigmas with respect to expected for MC, defining a tune-on-data signal value, explicit multTPC
template <typename TrackType>
float GetNumberOfSigmaMCTunedAtMultiplicity(const long multTPC, const TrackType& trk, const o2::track::PID::ID id, float mcTunedTPCSignal) const;
/// Gets the deviation to the expected signal
template <typename TrackType>
float GetSignalDelta(const TrackType& trk, const o2::track::PID::ID id) const;
Expand Down Expand Up @@ -116,6 +122,14 @@
/// Gets the expected resolution of the measurement
template <typename CollisionType, typename TrackType>
inline float Response::GetExpectedSigma(const CollisionType& collision, const TrackType& track, const o2::track::PID::ID id) const
{
// use multTPC (legacy behaviour) if multTPC not provided
return Response::GetExpectedSigmaAtMultiplicity(collision.multTPC(), track, id);
}

/// Gets the expected resolution of the measurement
template <typename TrackType>
inline float Response::GetExpectedSigmaAtMultiplicity(const long multTPC, const TrackType& track, const o2::track::PID::ID id) const
{
if (!track.hasTPC()) {
return -999.f;
Expand All @@ -133,9 +147,9 @@
const double dEdx = o2::tpc::BetheBlochAleph(static_cast<float>(bg), mBetheBlochParams[0], mBetheBlochParams[1], mBetheBlochParams[2], mBetheBlochParams[3], mBetheBlochParams[4]) * std::pow(static_cast<float>(o2::track::pid_constants::sCharges[id]), mChargeFactor);
const double relReso = GetRelativeResolutiondEdx(p, mass, o2::track::pid_constants::sCharges[id], mResolutionParams[3]);

const std::vector<double> values{1.f / dEdx, track.tgl(), std::sqrt(ncl), relReso, track.signed1Pt(), collision.multTPC() / mMultNormalization};
const std::vector<double> values{1.f / dEdx, track.tgl(), std::sqrt(ncl), relReso, track.signed1Pt(), multTPC / mMultNormalization};

const float reso = sqrt(pow(mResolutionParams[0], 2) * values[0] + pow(mResolutionParams[1], 2) * (values[2] * mResolutionParams[5]) * pow(values[0] / sqrt(1 + pow(values[1], 2)), mResolutionParams[2]) + values[2] * pow(values[3], 2) + pow(mResolutionParams[4] * values[4], 2) + pow(values[5] * mResolutionParams[6], 2) + pow(values[5] * (values[0] / sqrt(1 + pow(values[1], 2))) * mResolutionParams[7], 2)) * dEdx * mMIP;

Check failure on line 152 in Common/Core/PID/TPCPIDResponse.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
reso >= 0.f ? resolution = reso : resolution = -999.f;
}
return resolution;
Expand All @@ -160,7 +174,13 @@
template <typename CollisionType, typename TrackType>
inline float Response::GetNumberOfSigmaMCTuned(const CollisionType& collision, const TrackType& trk, const o2::track::PID::ID id, float mcTunedTPCSignal) const
{
if (GetExpectedSigma(collision, trk, id) < 0.) {
return Response::GetNumberOfSigmaMCTunedAtMultiplicity(collision.multTPC(), trk, id, mcTunedTPCSignal);
}

template <typename TrackType>
inline float Response::GetNumberOfSigmaMCTunedAtMultiplicity(const long multTPC, const TrackType& trk, const o2::track::PID::ID id, float mcTunedTPCSignal) const
{
if (GetExpectedSigmaAtMultiplicity(multTPC, trk, id) < 0.) {
return -999.f;
}
if (GetExpectedSignal(trk, id) < 0.) {
Expand All @@ -169,7 +189,7 @@
if (!trk.hasTPC()) {
return -999.f;
}
return ((mcTunedTPCSignal - GetExpectedSignal(trk, id)) / GetExpectedSigma(collision, trk, id));
return ((mcTunedTPCSignal - GetExpectedSignal(trk, id)) / GetExpectedSigmaAtMultiplicity(multTPC, trk, id));
}

/// Gets the deviation between the actual signal and the expected signal
Expand Down
5 changes: 5 additions & 0 deletions Common/TableProducer/PID/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ o2physics_add_dpl_workflow(pid-tof-full

# TPC

o2physics_add_dpl_workflow(pid-tpc-service
SOURCES pidTPCService.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::MLCore O2Physics::AnalysisCCDB
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(pid-tpc-base
SOURCES pidTPCBase.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::AnalysisCCDB
Expand Down
7 changes: 6 additions & 1 deletion Common/TableProducer/PID/pidTPC.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,11 @@ struct tpcPid {
}

float nSigma = -999.f;
int multTPC = 0;
if (trk.has_collision()) {
auto collision = collisions.rawIteratorAt(trk.collisionId());
multTPC = collision.multTPC();
}
float bg = trk.tpcInnerParam() / o2::track::pid_constants::sMasses[pid]; // estimated beta-gamma for network cutoff
if (useNetworkCorrection && speciesNetworkFlags[pid] && trk.has_collision() && bg > networkBetaGammaCutoff) {

Expand All @@ -457,7 +462,7 @@ struct tpcPid {
LOGF(fatal, "Network output-dimensions incompatible!");
}
} else {
nSigma = response->GetNumberOfSigmaMCTuned(collisions.iteratorAt(trk.collisionId()), trk, pid, tpcSignal);
nSigma = response->GetNumberOfSigmaMCTunedAtMultiplicity(multTPC, trk, pid, tpcSignal);
}
if (flagFull)
tableFull(expSigma, nSigma);
Expand Down
Loading
Loading