2727#include " Framework/AnalysisDataModel.h"
2828#include " ReconstructionDataFormats/PID.h"
2929#include " Framework/Logger.h"
30+ #include " Common/Core/PID/PIDTOF.h"
3031
3132namespace o2 ::aod
3233{
@@ -209,6 +210,65 @@ perSpeciesWrapper(tofExpSignalDiff);
209210
210211} // namespace pidutils
211212
213+ // Extra tables
214+ namespace pidflags
215+ {
216+
217+ namespace enums
218+ {
219+ enum PIDFlags : uint8_t {
220+ EvTimeUndef = 0x0 , // Event collision not set, corresponding to the LHC Fill event time
221+ EvTimeTOF = 0x1 , // Event collision time from TOF
222+ EvTimeT0AC = 0x2 , // Event collision time from the FT0AC
223+ EvTimeTOFT0AC = 0x4 // Event collision time from the TOF and FT0AC
224+ };
225+ }
226+
227+ DECLARE_SOA_COLUMN (GoodTOFMatch, goodTOFMatch, bool ); // ! Bool for the TOF PID information on the single track information
228+ DECLARE_SOA_COLUMN (TOFFlags, tofFlags, uint8_t ); // ! Flag for the complementary TOF PID information for the event time
229+ DECLARE_SOA_DYNAMIC_COLUMN (IsEvTimeDefined, isEvTimeDefined, // ! True if the Event Time was computed with any method i.e. there is a usable event time
230+ [](uint8_t flags) -> bool { return (flags > 0 ); });
231+ DECLARE_SOA_DYNAMIC_COLUMN (IsEvTimeTOF, isEvTimeTOF, // ! True if the Event Time was computed with the TOF
232+ [](uint8_t flags) -> bool { return (flags & enums::PIDFlags::EvTimeTOF) == enums::PIDFlags::EvTimeTOF; });
233+ DECLARE_SOA_DYNAMIC_COLUMN (IsEvTimeT0AC, isEvTimeT0AC, // ! True if the Event Time was computed with the T0AC
234+ [](uint8_t flags) -> bool { return (flags & enums::PIDFlags::EvTimeT0AC) == enums::PIDFlags::EvTimeT0AC; });
235+ DECLARE_SOA_DYNAMIC_COLUMN (IsEvTimeTOFT0AC, isEvTimeTOFT0AC, // ! True if the Event Time was computed with the TOF and T0AC
236+ [](uint8_t flags) -> bool { return (flags & enums::PIDFlags::EvTimeTOFT0AC) == enums::PIDFlags::EvTimeTOFT0AC; });
237+
238+ } // namespace pidflags
239+
240+ DECLARE_SOA_TABLE (pidTOFFlags, " AOD" , " pidTOFFlags" , // ! Table of the flags for TOF signal quality on the track level
241+ pidflags::GoodTOFMatch);
242+
243+ DECLARE_SOA_TABLE (pidEvTimeFlags, " AOD" , " pidEvTimeFlags" , // ! Table of the PID flags for the event time tables
244+ pidflags::TOFFlags,
245+ pidflags::IsEvTimeDefined<pidflags::TOFFlags>,
246+ pidflags::IsEvTimeTOF<pidflags::TOFFlags>,
247+ pidflags::IsEvTimeT0AC<pidflags::TOFFlags>,
248+ pidflags::IsEvTimeTOFT0AC<pidflags::TOFFlags>);
249+
250+ namespace pidtofsignal
251+ {
252+ DECLARE_SOA_COLUMN (TOFSignal, tofSignal, float ); // ! TOF signal from track time
253+ DECLARE_SOA_DYNAMIC_COLUMN (EventCollisionTime, eventCollisionTime, // ! Event collision time used for the track. Needs the TOF
254+ [](float signal, float tMinusTexp, float texp) -> float { return texp + tMinusTexp - signal; });
255+
256+ } // namespace pidtofsignal
257+
258+ DECLARE_SOA_TABLE (TOFSignal, " AOD" , " TOFSignal" , // ! Table of the TOF signal
259+ pidtofsignal::TOFSignal,
260+ pidtofsignal::EventCollisionTime<pidtofsignal::TOFSignal>);
261+
262+ namespace pidtofevtime
263+ {
264+ DECLARE_SOA_COLUMN (TOFEvTime, tofEvTime, float ); // ! event time for TOF signal. Can be obtained via a combination of detectors e.g. TOF, FT0A, FT0C
265+ DECLARE_SOA_COLUMN (TOFEvTimeErr, tofEvTimeErr, float ); // ! event time error for TOF. Can be obtained via a combination of detectors e.g. TOF, FT0A, FT0C
266+ } // namespace pidtofevtime
267+
268+ DECLARE_SOA_TABLE (TOFEvTime, " AOD" , " TOFEvTime" , // ! Table of the TOF event time. One entry per track.
269+ pidtofevtime::TOFEvTime,
270+ pidtofevtime::TOFEvTimeErr);
271+
212272namespace pidtof
213273{
214274// Expected signals
@@ -397,69 +457,15 @@ DECLARE_SOA_TABLE(pidTOFHe, "AOD", "pidTOFHe", //! Table of the TOF response wit
397457DECLARE_SOA_TABLE (pidTOFAl, " AOD" , " pidTOFAl" , // ! Table of the TOF response with binned Nsigma for alpha
398458 pidtof_tiny::TOFNSigmaStoreAl, pidtof_tiny::TOFNSigmaAl<pidtof_tiny::TOFNSigmaStoreAl>);
399459
400- // Extra tables
401- namespace pidflags
402- {
403-
404- namespace enums
405- {
406- enum PIDFlags : uint8_t {
407- EvTimeUndef = 0x0 , // Event collision not set, corresponding to the LHC Fill event time
408- EvTimeTOF = 0x1 , // Event collision time from TOF
409- EvTimeT0AC = 0x2 , // Event collision time from the FT0AC
410- EvTimeTOFT0AC = 0x4 // Event collision time from the TOF and FT0AC
411- };
412- }
413-
414- DECLARE_SOA_COLUMN (GoodTOFMatch, goodTOFMatch, bool ); // ! Bool for the TOF PID information on the single track information
415- DECLARE_SOA_COLUMN (TOFFlags, tofFlags, uint8_t ); // ! Flag for the complementary TOF PID information for the event time
416- DECLARE_SOA_DYNAMIC_COLUMN (IsEvTimeDefined, isEvTimeDefined, // ! True if the Event Time was computed with any method i.e. there is a usable event time
417- [](uint8_t flags) -> bool { return (flags > 0 ); });
418- DECLARE_SOA_DYNAMIC_COLUMN (IsEvTimeTOF, isEvTimeTOF, // ! True if the Event Time was computed with the TOF
419- [](uint8_t flags) -> bool { return (flags & enums::PIDFlags::EvTimeTOF) == enums::PIDFlags::EvTimeTOF; });
420- DECLARE_SOA_DYNAMIC_COLUMN (IsEvTimeT0AC, isEvTimeT0AC, // ! True if the Event Time was computed with the T0AC
421- [](uint8_t flags) -> bool { return (flags & enums::PIDFlags::EvTimeT0AC) == enums::PIDFlags::EvTimeT0AC; });
422- DECLARE_SOA_DYNAMIC_COLUMN (IsEvTimeTOFT0AC, isEvTimeTOFT0AC, // ! True if the Event Time was computed with the TOF and T0AC
423- [](uint8_t flags) -> bool { return (flags & enums::PIDFlags::EvTimeTOFT0AC) == enums::PIDFlags::EvTimeTOFT0AC; });
424-
425- } // namespace pidflags
426-
427- DECLARE_SOA_TABLE (pidTOFFlags, " AOD" , " pidTOFFlags" , // ! Table of the flags for TOF signal quality on the track level
428- pidflags::GoodTOFMatch);
429-
430- DECLARE_SOA_TABLE (pidEvTimeFlags, " AOD" , " pidEvTimeFlags" , // ! Table of the PID flags for the event time tables
431- pidflags::TOFFlags,
432- pidflags::IsEvTimeDefined<pidflags::TOFFlags>,
433- pidflags::IsEvTimeTOF<pidflags::TOFFlags>,
434- pidflags::IsEvTimeT0AC<pidflags::TOFFlags>,
435- pidflags::IsEvTimeTOFT0AC<pidflags::TOFFlags>);
436-
437- namespace pidtofsignal
438- {
439- DECLARE_SOA_COLUMN (TOFSignal, tofSignal, float ); // ! TOF signal from track time
440- DECLARE_SOA_DYNAMIC_COLUMN (EventCollisionTime, eventCollisionTime, // ! Event collision time used for the track. Needs the TOF
441- [](float signal, float tMinusTexp, float texp) -> float { return texp + tMinusTexp - signal; });
442-
443- } // namespace pidtofsignal
444-
445- DECLARE_SOA_TABLE (TOFSignal, " AOD" , " TOFSignal" , // ! Table of the TOF signal
446- pidtofsignal::TOFSignal,
447- pidtofsignal::EventCollisionTime<pidtofsignal::TOFSignal>);
448-
449- namespace pidtofevtime
450- {
451- DECLARE_SOA_COLUMN (TOFEvTime, tofEvTime, float ); // ! event time for TOF signal. Can be obtained via a combination of detectors e.g. TOF, FT0A, FT0C
452- DECLARE_SOA_COLUMN (TOFEvTimeErr, tofEvTimeErr, float ); // ! event time error for TOF. Can be obtained via a combination of detectors e.g. TOF, FT0A, FT0C
453- } // namespace pidtofevtime
454-
455- DECLARE_SOA_TABLE (TOFEvTime, " AOD" , " TOFEvTime" , // ! Table of the TOF event time. One entry per track.
456- pidtofevtime::TOFEvTime,
457- pidtofevtime::TOFEvTimeErr);
458-
459460namespace pidtofbeta
460461{
461462DECLARE_SOA_COLUMN (Beta, beta, float ); // ! TOF beta
462463DECLARE_SOA_COLUMN (BetaError, betaerror, float ); // ! Uncertainty on the TOF beta
464+ // Dynamic column, i.e. the future
465+ DECLARE_SOA_DYNAMIC_COLUMN (TOFBetaImp, tofBeta, // ! TOF Beta value
466+ [](const float length, const float tofSignal, const float collisionTime) -> float {
467+ return o2::pid::tof::Beta::GetBeta (length, tofSignal, collisionTime);
468+ });
463469//
464470DECLARE_SOA_COLUMN (ExpBetaEl, expbetael, float ); // ! Expected beta of electron
465471DECLARE_SOA_COLUMN (ExpBetaElError, expbetaelerror, float ); // ! Expected uncertainty on the beta of electron
@@ -469,14 +475,24 @@ DECLARE_SOA_DYNAMIC_COLUMN(DiffBetaEl, diffbetael, //! Difference be
469475 [](float beta, float expbetael) -> float { return beta - expbetael; });
470476} // namespace pidtofbeta
471477
478+ using TOFBeta = pidtofbeta::TOFBetaImp<o2::aod::track::Length, o2::aod::pidtofsignal::TOFSignal, o2::aod::pidtofevtime::TOFEvTime>;
479+
472480DECLARE_SOA_TABLE (pidTOFbeta, " AOD" , " pidTOFbeta" , // ! Table of the TOF beta
473481 pidtofbeta::Beta, pidtofbeta::BetaError);
474482
475483namespace pidtofmass
476484{
477485DECLARE_SOA_COLUMN (TOFMass, mass, float ); // ! TOF mass
486+ // Dynamic column, i.e. the future
487+ DECLARE_SOA_DYNAMIC_COLUMN (TOFMassImp, tofMass, // ! TOF Mass value
488+ [](const float length, const float tofSignal, const float collisionTime, const float momentum) -> float {
489+ const float beta = o2::pid::tof::Beta::GetBeta (length, tofSignal, collisionTime);
490+ return o2::pid::tof::TOFMass::GetTOFMass (momentum, beta);
491+ });
478492} // namespace pidtofmass
479493
494+ using TOFMass = pidtofmass::TOFMassImp<o2::aod::track::Length, o2::aod::pidtofsignal::TOFSignal, o2::aod::pidtofevtime::TOFEvTime, o2::aod::track::TOFExpMom>;
495+
480496DECLARE_SOA_TABLE (pidTOFmass, " AOD" , " pidTOFmass" , // ! Table of the TOF mass
481497 pidtofmass::TOFMass);
482498
0 commit comments