Skip to content

Commit 94105be

Browse files
authored
Add TOF PID flags for match (#4287)
- add flags for the TOF good match, add table for PID quality - extend documentation
1 parent 08ea522 commit 94105be

2 files changed

Lines changed: 46 additions & 5 deletions

File tree

Common/DataModel/PIDResponse.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,8 @@ enum PIDFlags : uint8_t {
388388
};
389389
}
390390

391-
DECLARE_SOA_COLUMN(TOFFlags, tofFlags, uint8_t); //! Flag for the complementary TOF PID information
391+
DECLARE_SOA_COLUMN(GoodTOFMatch, goodTOFMatch, bool); //! Bool for the TOF PID information on the single track information
392+
DECLARE_SOA_COLUMN(TOFFlags, tofFlags, uint8_t); //! Flag for the complementary TOF PID information for the event time
392393
DECLARE_SOA_DYNAMIC_COLUMN(IsEvTimeDefined, isEvTimeDefined, //! True if the Event Time was computed with any method i.e. there is a usable event time
393394
[](uint8_t flags) -> bool { return (flags > 0); });
394395
DECLARE_SOA_DYNAMIC_COLUMN(IsEvTimeTOF, isEvTimeTOF, //! True if the Event Time was computed with the TOF
@@ -529,6 +530,9 @@ DEFINE_UNWRAP_NSIGMA_COLUMN(TOFNSigmaAl, tofNSigmaAl); //! Unwrapped (float) nsi
529530
DECLARE_SOA_TABLE(TOFSignal, "AOD", "TOFSignal", //! Table of the TOF signal
530531
pidtofsignal::TOFSignal);
531532

533+
DECLARE_SOA_TABLE(pidTOFFlags, "AOD", "pidTOFFlags", //! Table of the flags for TOF signal quality on the track level
534+
pidflags::GoodTOFMatch);
535+
532536
DECLARE_SOA_TABLE(pidTOFbeta, "AOD", "pidTOFbeta", //! Table of the TOF beta
533537
pidtofbeta::Beta, pidtofbeta::BetaError);
534538

Common/TableProducer/PID/pidTOFBase.cxx

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "Common/DataModel/TrackSelectionTables.h"
3030
#include "Common/DataModel/EventSelection.h"
3131
#include "Common/DataModel/FT0Corrected.h"
32+
#include "Common/DataModel/Multiplicity.h"
3233
#include "TableHelper.h"
3334
#include "pidTOFBase.h"
3435

@@ -47,14 +48,36 @@ void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
4748

4849
#include "Framework/runDataProcessing.h"
4950

51+
/// Selection criteria for tracks used for TOF event time
52+
float trackDistanceForGoodMatch = 999.f;
53+
float trackDistanceForGoodMatchLowMult = 999.f;
54+
int multiplicityThreshold = 0;
55+
using Run3Trks = o2::soa::Join<aod::TracksIU, aod::TracksExtra>;
56+
using Run3Cols = o2::soa::Join<aod::Collisions, aod::PVMults>;
57+
bool isTrackGoodMatchForTOFPID(const Run3Trks::iterator& tr, const Run3Cols& ev)
58+
{
59+
if (!tr.hasTOF()) {
60+
return false;
61+
}
62+
if (tr.has_collision() && tr.collision_as<Run3Cols>().multNTracksPVeta1() < multiplicityThreshold) {
63+
return tr.tofChi2() < trackDistanceForGoodMatchLowMult;
64+
}
65+
return tr.tofChi2() < trackDistanceForGoodMatch;
66+
}
67+
5068
/// Task to produce the TOF signal from the trackTime information
5169
struct tofSignal {
5270
o2::framework::Produces<o2::aod::TOFSignal> table;
53-
bool enableTable = false;
71+
o2::framework::Produces<o2::aod::pidTOFFlags> tableFlags;
72+
bool enableTable = false; // Flag to check if the TOF signal table is requested or not
73+
bool enableTableFlags = false; // Flag to check if the TOF signal flags table is requested or not
5474
// CCDB configuration
5575
Configurable<std::string> url{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
5676
Configurable<int64_t> timestamp{"ccdb-timestamp", -1, "timestamp of the object"};
5777
Configurable<std::string> timeShiftCCDBPath{"timeShiftCCDBPath", "", "Path of the TOF time shift vs eta. If empty none is taken"};
78+
Configurable<float> distanceForGoodMatch{"distanceForGoodMatch", 999.f, "Maximum distance to consider a good match"};
79+
Configurable<float> distanceForGoodMatchLowMult{"distanceForGoodMatchLowMult", 999.f, "Maximum distance to consider a good match for low multiplicity events"};
80+
Configurable<int> multThreshold{"multThreshold", 0, "Multiplicity threshold to consider a low multiplicity event"};
5881

5982
void init(o2::framework::InitContext& initContext)
6083
{
@@ -70,16 +93,30 @@ struct tofSignal {
7093
if (enableTable) {
7194
LOG(info) << "Table TOFSignal enabled!";
7295
}
96+
enableTableFlags = isTableRequiredInWorkflow(initContext, "pidTOFFlags");
97+
if (enableTableFlags) {
98+
LOG(info) << "Table pidTOFFlags enabled!";
99+
}
100+
trackDistanceForGoodMatch = distanceForGoodMatch;
101+
trackDistanceForGoodMatchLowMult = distanceForGoodMatchLowMult;
102+
multiplicityThreshold = multThreshold;
103+
LOG(info) << "Configuring selections for good match: " << trackDistanceForGoodMatch << " low mult " << trackDistanceForGoodMatchLowMult << " mult. threshold " << multiplicityThreshold;
73104
}
74-
using Trks = o2::soa::Join<aod::TracksIU, aod::TracksExtra>;
75-
void processRun3(Trks const& tracks)
105+
void processRun3(Run3Trks const& tracks, Run3Cols const& collisions)
76106
{
77107
if (!enableTable) {
78108
return;
79109
}
80110
table.reserve(tracks.size());
111+
if (enableTableFlags) {
112+
tableFlags.reserve(tracks.size());
113+
}
81114
for (auto& t : tracks) {
82-
table(o2::pid::tof::TOFSignal<Trks::iterator>::GetTOFSignal(t));
115+
table(o2::pid::tof::TOFSignal<Run3Trks::iterator>::GetTOFSignal(t));
116+
if (!enableTableFlags) {
117+
continue;
118+
}
119+
tableFlags(isTrackGoodMatchForTOFPID(t, collisions));
83120
}
84121
}
85122
PROCESS_SWITCH(tofSignal, processRun3, "Process Run3 data i.e. input is TrackIU", true);

0 commit comments

Comments
 (0)