Skip to content
Open
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
58 changes: 58 additions & 0 deletions Common/Core/PID/PIDHelpers.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// 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.

/// \file PIDHelpers.h
/// \brief Lightweight PID helper functions, usable without the full PID modules

#ifndef COMMON_CORE_PID_PIDHELPERS_H_
#define COMMON_CORE_PID_PIDHELPERS_H_

#include <CommonConstants/PhysicsConstants.h>
#include <ReconstructionDataFormats/PID.h>

#include <TPDGCode.h>

#include <cstdlib>

namespace o2::aod::pid
{
/// Get O2 PID index corresponding to MC PDG code.
/// \param pdgCode PDG code of the particle (the sign is ignored)
/// \param defaultPid value returned for PDG codes not among the species handled by o2::track::PID
/// (pion by default, as needed for the TPC Tune-on-Data sampling; pass -1 to flag them instead)
inline int getPIDIndex(const int pdgCode, const int defaultPid = o2::track::PID::Pion)
{
switch (std::abs(pdgCode)) {
case static_cast<int>(kElectron):
return o2::track::PID::Electron;
case static_cast<int>(kMuonMinus):
return o2::track::PID::Muon;
case static_cast<int>(kPiPlus):
return o2::track::PID::Pion;
case static_cast<int>(kKPlus):
return o2::track::PID::Kaon;
case static_cast<int>(kProton):
return o2::track::PID::Proton;
case static_cast<int>(o2::constants::physics::Pdg::kDeuteron):
return o2::track::PID::Deuteron;
case static_cast<int>(o2::constants::physics::Pdg::kTriton):
return o2::track::PID::Triton;
case static_cast<int>(o2::constants::physics::Pdg::kHelium3):
return o2::track::PID::Helium3;
case static_cast<int>(o2::constants::physics::Pdg::kAlpha):
return o2::track::PID::Alpha;
default:
return defaultPid;
}
}
} // namespace o2::aod::pid

#endif // COMMON_CORE_PID_PIDHELPERS_H_
28 changes: 1 addition & 27 deletions Common/Tools/PID/pidTPCModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include "Common/CCDB/ctpRateFetcher.h"
#include "Common/Core/CollisionTypeHelper.h"
#include "Common/Core/PID/PIDHelpers.h" // IWYU pragma: export (getPIDIndex was defined here before)
#include "Common/Core/PID/TPCPIDResponse.h"
#include "Common/Core/RecoDecay.h"
#include "Common/Core/TableHelper.h"
Expand Down Expand Up @@ -150,33 +151,6 @@ struct pidTPCConfigurables : o2::framework::ConfigurableGroup {
o2::framework::Configurable<float> phiEntranceCoeff2{"phiEntranceCoeff2", 85.f, "phiEntrance = phi + phiEntranceCoeff1 * LightSpeedDm2PS * 0.5 * phiEntranceCoeff2 * 1/pT[GeV/c]"};
};

// helper getter - FIXME should be separate
int getPIDIndex(const int pdgCode) // Get O2 PID index corresponding to MC PDG code
{
switch (std::abs(pdgCode)) {
case 11:
return o2::track::PID::Electron;
case 13:
return o2::track::PID::Muon;
case 211:
return o2::track::PID::Pion;
case 321:
return o2::track::PID::Kaon;
case 2212:
return o2::track::PID::Proton;
case 1000010020:
return o2::track::PID::Deuteron;
case 1000010030:
return o2::track::PID::Triton;
case 1000020030:
return o2::track::PID::Helium3;
case 1000020040:
return o2::track::PID::Alpha;
default: // treat as pion if not any of the above
return o2::track::PID::Pion;
}
}

typedef struct Str_dEdx_correction {
TMatrixD fMatrix;
bool warning = true;
Expand Down
Loading
Loading