Skip to content

Commit 002e6c7

Browse files
authored
TOF: add dynamic columns for TOFBeta and TOFMass
1 parent 657a599 commit 002e6c7

File tree

1 file changed

+74
-59
lines changed

1 file changed

+74
-59
lines changed

Common/DataModel/PIDResponseTOF.h

Lines changed: 74 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,65 @@ perSpeciesWrapper(tofExpSignalDiff);
209209

210210
} // namespace pidutils
211211

212+
// Extra tables
213+
namespace pidflags
214+
{
215+
216+
namespace enums
217+
{
218+
enum PIDFlags : uint8_t {
219+
EvTimeUndef = 0x0, // Event collision not set, corresponding to the LHC Fill event time
220+
EvTimeTOF = 0x1, // Event collision time from TOF
221+
EvTimeT0AC = 0x2, // Event collision time from the FT0AC
222+
EvTimeTOFT0AC = 0x4 // Event collision time from the TOF and FT0AC
223+
};
224+
}
225+
226+
DECLARE_SOA_COLUMN(GoodTOFMatch, goodTOFMatch, bool); //! Bool for the TOF PID information on the single track information
227+
DECLARE_SOA_COLUMN(TOFFlags, tofFlags, uint8_t); //! Flag for the complementary TOF PID information for the event time
228+
DECLARE_SOA_DYNAMIC_COLUMN(IsEvTimeDefined, isEvTimeDefined, //! True if the Event Time was computed with any method i.e. there is a usable event time
229+
[](uint8_t flags) -> bool { return (flags > 0); });
230+
DECLARE_SOA_DYNAMIC_COLUMN(IsEvTimeTOF, isEvTimeTOF, //! True if the Event Time was computed with the TOF
231+
[](uint8_t flags) -> bool { return (flags & enums::PIDFlags::EvTimeTOF) == enums::PIDFlags::EvTimeTOF; });
232+
DECLARE_SOA_DYNAMIC_COLUMN(IsEvTimeT0AC, isEvTimeT0AC, //! True if the Event Time was computed with the T0AC
233+
[](uint8_t flags) -> bool { return (flags & enums::PIDFlags::EvTimeT0AC) == enums::PIDFlags::EvTimeT0AC; });
234+
DECLARE_SOA_DYNAMIC_COLUMN(IsEvTimeTOFT0AC, isEvTimeTOFT0AC, //! True if the Event Time was computed with the TOF and T0AC
235+
[](uint8_t flags) -> bool { return (flags & enums::PIDFlags::EvTimeTOFT0AC) == enums::PIDFlags::EvTimeTOFT0AC; });
236+
237+
} // namespace pidflags
238+
239+
DECLARE_SOA_TABLE(pidTOFFlags, "AOD", "pidTOFFlags", //! Table of the flags for TOF signal quality on the track level
240+
pidflags::GoodTOFMatch);
241+
242+
DECLARE_SOA_TABLE(pidEvTimeFlags, "AOD", "pidEvTimeFlags", //! Table of the PID flags for the event time tables
243+
pidflags::TOFFlags,
244+
pidflags::IsEvTimeDefined<pidflags::TOFFlags>,
245+
pidflags::IsEvTimeTOF<pidflags::TOFFlags>,
246+
pidflags::IsEvTimeT0AC<pidflags::TOFFlags>,
247+
pidflags::IsEvTimeTOFT0AC<pidflags::TOFFlags>);
248+
249+
namespace pidtofsignal
250+
{
251+
DECLARE_SOA_COLUMN(TOFSignal, tofSignal, float); //! TOF signal from track time
252+
DECLARE_SOA_DYNAMIC_COLUMN(EventCollisionTime, eventCollisionTime, //! Event collision time used for the track. Needs the TOF
253+
[](float signal, float tMinusTexp, float texp) -> float { return texp + tMinusTexp - signal; });
254+
255+
} // namespace pidtofsignal
256+
257+
DECLARE_SOA_TABLE(TOFSignal, "AOD", "TOFSignal", //! Table of the TOF signal
258+
pidtofsignal::TOFSignal,
259+
pidtofsignal::EventCollisionTime<pidtofsignal::TOFSignal>);
260+
261+
namespace pidtofevtime
262+
{
263+
DECLARE_SOA_COLUMN(TOFEvTime, tofEvTime, float); //! event time for TOF signal. Can be obtained via a combination of detectors e.g. TOF, FT0A, FT0C
264+
DECLARE_SOA_COLUMN(TOFEvTimeErr, tofEvTimeErr, float); //! event time error for TOF. Can be obtained via a combination of detectors e.g. TOF, FT0A, FT0C
265+
} // namespace pidtofevtime
266+
267+
DECLARE_SOA_TABLE(TOFEvTime, "AOD", "TOFEvTime", //! Table of the TOF event time. One entry per track.
268+
pidtofevtime::TOFEvTime,
269+
pidtofevtime::TOFEvTimeErr);
270+
212271
namespace pidtof
213272
{
214273
// Expected signals
@@ -397,69 +456,15 @@ DECLARE_SOA_TABLE(pidTOFHe, "AOD", "pidTOFHe", //! Table of the TOF response wit
397456
DECLARE_SOA_TABLE(pidTOFAl, "AOD", "pidTOFAl", //! Table of the TOF response with binned Nsigma for alpha
398457
pidtof_tiny::TOFNSigmaStoreAl, pidtof_tiny::TOFNSigmaAl<pidtof_tiny::TOFNSigmaStoreAl>);
399458

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-
459459
namespace pidtofbeta
460460
{
461461
DECLARE_SOA_COLUMN(Beta, beta, float); //! TOF beta
462462
DECLARE_SOA_COLUMN(BetaError, betaerror, float); //! Uncertainty on the TOF beta
463+
// Dynamic column, i.e. the future
464+
DECLARE_SOA_DYNAMIC_COLUMN(TOFBetaImp, tofBeta, //! TOF Beta value
465+
[](const float length, const float tofSignal, const float collisionTime) -> float {
466+
return o2::pid::tof::Beta::GetBeta(length, tofSignal, collisionTime);
467+
});
463468
//
464469
DECLARE_SOA_COLUMN(ExpBetaEl, expbetael, float); //! Expected beta of electron
465470
DECLARE_SOA_COLUMN(ExpBetaElError, expbetaelerror, float); //! Expected uncertainty on the beta of electron
@@ -469,14 +474,24 @@ DECLARE_SOA_DYNAMIC_COLUMN(DiffBetaEl, diffbetael, //! Difference be
469474
[](float beta, float expbetael) -> float { return beta - expbetael; });
470475
} // namespace pidtofbeta
471476

477+
using TOFBeta = pidtofbeta::TOFBetaImp<o2::aod::track::Length, o2::aod::pidtofsignal::TOFSignal, o2::aod::pidtofevtime::TOFEvTime>;
478+
472479
DECLARE_SOA_TABLE(pidTOFbeta, "AOD", "pidTOFbeta", //! Table of the TOF beta
473480
pidtofbeta::Beta, pidtofbeta::BetaError);
474481

475482
namespace pidtofmass
476483
{
477484
DECLARE_SOA_COLUMN(TOFMass, mass, float); //! TOF mass
485+
// Dynamic column, i.e. the future
486+
DECLARE_SOA_DYNAMIC_COLUMN(TOFMassImp, tofMass, //! TOF Mass value
487+
[](const float length, const float tofSignal, const float collisionTime, const float momentum) -> float {
488+
const float beta = o2::pid::tof::Beta::GetBeta(length, tofSignal, collisionTime);
489+
return o2::pid::tof::TOFMass::GetTOFMass(momentum, beta);
490+
});
478491
} // namespace pidtofmass
479492

493+
using TOFMass = pidtofmass::TOFMassImp<o2::aod::track::Length, o2::aod::pidtofsignal::TOFSignal, o2::aod::pidtofevtime::TOFEvTime, o2::aod::track::TOFExpMom>;
494+
480495
DECLARE_SOA_TABLE(pidTOFmass, "AOD", "pidTOFmass", //! Table of the TOF mass
481496
pidtofmass::TOFMass);
482497

0 commit comments

Comments
 (0)