Skip to content

Commit be04afd

Browse files
committed
Add deuterons in HF MC TOF PID task
1 parent 044d08f commit be04afd

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

PWGHF/TableProducer/mcPidTof.cxx

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
///
1313
/// \file mcPidTof.cxx
1414
/// \author Fabrizio Grosa fabrizio.grosa@cern.ch
15-
/// \brief Task to produce PID tables for TOF split for pi, K, p, copied from https://github.com/AliceO2Group/O2Physics/blob/master/Common/TableProducer/PID/pidTofMerge.cxx
15+
/// \brief Task to produce PID tables for TOF split for pi, K, p, de, copied from https://github.com/AliceO2Group/O2Physics/blob/master/Common/TableProducer/PID/pidTofMerge.cxx
1616
/// It works only for MC and adds the possibility to apply postcalibrations for MC.
1717
///
1818

@@ -722,18 +722,21 @@ struct tofEventTime {
722722
static constexpr int idxPi = 2;
723723
static constexpr int idxKa = 3;
724724
static constexpr int idxPr = 4;
725+
static constexpr int idxDe = 5;
725726

726727
/// Task to produce the response table
727728
struct mcPidTof {
728729
// Tables to produce
729730
Produces<o2::aod::pidTOFPi> tablePIDPi;
730731
Produces<o2::aod::pidTOFKa> tablePIDKa;
731732
Produces<o2::aod::pidTOFPr> tablePIDPr;
733+
Produces<o2::aod::pidTOFDe> tablePIDDe;
732734

733735
// Tables to produce (full)
734736
Produces<o2::aod::pidTOFFullPi> tablePIDFullPi;
735737
Produces<o2::aod::pidTOFFullKa> tablePIDFullKa;
736738
Produces<o2::aod::pidTOFFullPr> tablePIDFullPr;
739+
Produces<o2::aod::pidTOFFullDe> tablePIDFullDe;
737740

738741
// Detector response parameters
739742
o2::pid::tof::TOFResoParamsV3 mRespParamsV3;
@@ -768,7 +771,7 @@ struct mcPidTof {
768771
{
769772
mTOFCalibConfig.inheritFromBaseTask(initContext);
770773
// Checking the tables are requested in the workflow and enabling them (only pi, K, p)
771-
std::array<int, 3> supportedSpecies = {idxPi, idxKa, idxPr};
774+
std::array<int, 4> supportedSpecies = {idxPi, idxKa, idxPr, idxDe};
772775
for (auto iSpecie{0u}; iSpecie < supportedSpecies.size(); ++iSpecie) {
773776
// First checking tiny
774777
int flag = -1;
@@ -881,6 +884,14 @@ struct mcPidTof {
881884
tablePIDPr);
882885
}
883886
break;
887+
case idxDe:
888+
if (fullTable) {
889+
tablePIDFullDe(-999.f, -999.f);
890+
} else {
891+
aod::pidutils::packInTable<aod::pidtof_tiny::binning>(-999.f,
892+
tablePIDDe);
893+
}
894+
break;
884895
default:
885896
LOG(fatal) << "Wrong particle ID in makeTableEmpty() for " << (fullTable ? "full" : "tiny") << " tables";
886897
break;
@@ -960,6 +971,7 @@ struct mcPidTof {
960971
constexpr auto responsePi = ResponseImplementation<PID::Pion>();
961972
constexpr auto responseKa = ResponseImplementation<PID::Kaon>();
962973
constexpr auto responsePr = ResponseImplementation<PID::Proton>();
974+
constexpr auto responseDe = ResponseImplementation<PID::Deuteron>();
963975

964976
mTOFCalibConfig.processSetup(mRespParamsV3, ccdb, bcs.iteratorAt(0)); // Update the calibration parameters
965977

@@ -1026,6 +1038,16 @@ struct mcPidTof {
10261038
aod::pidutils::packInTable<aod::pidtof_tiny::binning>(nSigma, tablePIDPr);
10271039
break;
10281040
}
1041+
case idxDe: {
1042+
nSigma = responseDe.GetSeparation(mRespParamsV3, trk);
1043+
if (enableMcRecalib && trk.has_mcParticle()) {
1044+
if (std::abs(trk.mcParticle().pdgCode()) == o2::constants::physics::kDeuteron) { // we rescale only true signal
1045+
nSigma = applyMcRecalib(idxPr, trk.pt(), nSigma); // FIXME: currently postcalibrations for protons applied to deuterons, to be checked
1046+
}
1047+
}
1048+
aod::pidutils::packInTable<aod::pidtof_tiny::binning>(nSigma, tablePIDDe);
1049+
break;
1050+
}
10291051
default:
10301052
LOG(fatal) << "Wrong particle ID for standard tables";
10311053
break;
@@ -1070,6 +1092,17 @@ struct mcPidTof {
10701092
tablePIDFullPr(resolution, nSigma);
10711093
break;
10721094
}
1095+
case idxDe: {
1096+
resolution = responseDe.GetExpectedSigma(mRespParamsV3, trk);
1097+
nSigma = responseDe.GetSeparation(mRespParamsV3, trk, resolution);
1098+
if (enableMcRecalib && trk.has_mcParticle()) {
1099+
if (std::abs(trk.mcParticle().pdgCode()) == o2::constants::physics::kDeuteron) { // we rescale only true signal
1100+
nSigma = applyMcRecalib(idxPr, trk.pt(), nSigma); // FIXME: currently postcalibrations for protons applied to deuterons, to be checked
1101+
}
1102+
}
1103+
tablePIDFullDe(resolution, nSigma);
1104+
break;
1105+
}
10731106
default:
10741107
LOG(fatal) << "Wrong particle ID for full tables";
10751108
break;

0 commit comments

Comments
 (0)