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
31 changes: 2 additions & 29 deletions PWGHF/TableProducer/pidCreator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
/// \author Vít Kučera <vit.kucera@cern.ch>, Inha University

#include "PWGHF/DataModel/CandidateReconstructionTables.h"
#include "PWGHF/Utils/utilsPid.h"

#include "Common/Core/TableHelper.h"
#include "Common/DataModel/PIDResponseTOF.h"
#include "Common/DataModel/PIDResponseTPC.h"

#include <Framework/AnalysisDataModel.h>
#include <Framework/AnalysisHelpers.h>
Expand All @@ -32,6 +31,7 @@

using namespace o2;
using namespace o2::framework;
using namespace o2::aod::pid_tpc_tof_utils;

struct HfPidCreator {
Produces<aod::PidTpcTofFullEl> trackPidFullEl;
Expand All @@ -47,9 +47,6 @@ struct HfPidCreator {
Produces<aod::PidTpcTofFullDe> trackPidFullDe;
Produces<aod::PidTpcTofTinyDe> trackPidTinyDe;

static constexpr float NSigmaToleranceDefault = .1f;
static constexpr float NSigmaDefault = -999.f + NSigmaToleranceDefault; // -999.f is the default value set in TPCPIDResponse.h and PIDTOF.h

/// Function to check whether the process function flag matches the need for filling the table
/// \param initContext workflow context (argument of the init function)
/// \param table name of the table
Expand Down Expand Up @@ -85,30 +82,6 @@ struct HfPidCreator {
checkTableSwitch(initContext, "PidTpcTofTinyDe", doprocessTinyDe);
}

/// Function to combine TPC and TOF NSigma
/// \param tiny switch between full and tiny (binned) PID tables
/// \param tpcNSigma is the (binned) NSigma separation in TPC (if tiny = true)
/// \param tofNSigma is the (binned) NSigma separation in TOF (if tiny = true)
/// \return combined NSigma of TPC and TOF
template <bool Tiny, typename T1>
T1 combineNSigma(T1 tpcNSigma, T1 tofNSigma)
{
if constexpr (Tiny) {
tpcNSigma *= aod::pidtpc_tiny::binning::bin_width;
tofNSigma *= aod::pidtof_tiny::binning::bin_width;
}
if ((tpcNSigma > NSigmaDefault) && (tofNSigma > NSigmaDefault)) { // TPC and TOF
return std::sqrt(.5f * (tpcNSigma * tpcNSigma + tofNSigma * tofNSigma));
}
if (tpcNSigma > NSigmaDefault) { // only TPC
return std::abs(tpcNSigma);
}
if (tofNSigma > NSigmaDefault) { // only TOF
return std::abs(tofNSigma);
}
return tofNSigma; // no TPC nor TOF
}

void processDummy(aod::Collisions const&) {}
PROCESS_SWITCH(HfPidCreator, processDummy, "Process nothing", true);

Expand Down
20 changes: 10 additions & 10 deletions PWGHF/Utils/utilsPid.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,29 +43,29 @@ enum PidMethod {
NPidMethods
};

/// Function to combine TPC and TOF NSigma
/// \param tiny switch between full and tiny (binned) PID tables
/// \param nSigmaTpc is the (binned) NSigma separation in TPC (if tiny = true)
/// \param nSigmaTof is the (binned) NSigma separation in TOF (if tiny = true)
/// \return combined NSigma of TPC and TOF
/// Function to combine TPC and TOF nSigma
/// \tparam Tiny switch between full and tiny (binned) PID tables
/// \param nSigmaTpc is the (binned) nSigma separation in TPC (if Tiny = true)
/// \param nSigmaTof is the (binned) nSigma separation in TOF (if Tiny = true)
/// \return combined nSigma of TPC and TOF
template <bool Tiny, typename TNumber>
TNumber combineNSigma(TNumber nSigmaTpc, TNumber nSigmaTof)
{
static constexpr float DefaultNSigmaTolerance = .1f;
static constexpr float DefaultNSigma = -999.f + DefaultNSigmaTolerance; // -999.f is the default value set in TPCPIDResponse.h and PIDTOF.h
static constexpr float NSigmaToleranceDefault = .1f;
static constexpr float NSigmaDefault = -999.f + NSigmaToleranceDefault; // -999.f is the default value set in TPCPIDResponse.h and PIDTOF.h

if constexpr (Tiny) {
nSigmaTpc *= aod::pidtpc_tiny::binning::bin_width;
nSigmaTof *= aod::pidtof_tiny::binning::bin_width;
}

if ((nSigmaTpc > DefaultNSigma) && (nSigmaTof > DefaultNSigma)) { // TPC and TOF
if ((nSigmaTpc > NSigmaDefault) && (nSigmaTof > NSigmaDefault)) { // TPC and TOF
return std::sqrt(.5f * (nSigmaTpc * nSigmaTpc + nSigmaTof * nSigmaTof));
}
if (nSigmaTpc > DefaultNSigma) { // only TPC
if (nSigmaTpc > NSigmaDefault) { // only TPC
return std::abs(nSigmaTpc);
}
if (nSigmaTof > DefaultNSigma) { // only TOF
if (nSigmaTof > NSigmaDefault) { // only TOF
return std::abs(nSigmaTof);
}
return nSigmaTof; // no TPC nor TOF
Expand Down
Loading