Skip to content

Commit d0a7520

Browse files
authored
[O2-7038] DPL Analysis: correction for tpcNClsFindable overflow (#15584)
1 parent 63eafe3 commit d0a7520

1 file changed

Lines changed: 38 additions & 12 deletions

File tree

‎Framework/Core/include/Framework/AnalysisDataModel.h‎

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,18 @@ DECLARE_SOA_DYNAMIC_COLUMN(TPCDeltaTBwd, tpcDeltaTBwd, //! Delta Backward of tra
401401

402402
} // namespace v001
403403

404+
namespace
405+
{
406+
inline uint16_t fixTPCNClsFindable(uint8_t tpcNClsFindable, int8_t tpcNClsFindableMinusFound)
407+
{
408+
uint16_t res = tpcNClsFindable;
409+
if (tpcNClsFindable <= tpcNClsFindableMinusFound) {
410+
res += 256;
411+
}
412+
return res;
413+
}
414+
} // namespace
415+
404416
DECLARE_SOA_DYNAMIC_COLUMN(HasITS, hasITS, //! Flag to check if track has a ITS match
405417
[](uint8_t detectorMap) -> bool { return detectorMap & o2::aod::track::ITS; });
406418
DECLARE_SOA_DYNAMIC_COLUMN(HasTPC, hasTPC, //! Flag to check if track has a TPC match
@@ -424,9 +436,17 @@ DECLARE_SOA_DYNAMIC_COLUMN(HasTPCBothSides, hasTPCBothSides, //! Run 3: Has this
424436
DECLARE_SOA_DYNAMIC_COLUMN(PIDForTracking, pidForTracking, //! PID hypothesis used during tracking. See the constants in the class PID in PID.h
425437
[](uint32_t flags) -> uint32_t { return flags >> 28; });
426438
DECLARE_SOA_DYNAMIC_COLUMN(TPCNClsFound, tpcNClsFound, //! Number of found TPC clusters
427-
[](uint8_t tpcNClsFindable, int8_t tpcNClsFindableMinusFound) -> int16_t { return (int16_t)tpcNClsFindable - tpcNClsFindableMinusFound; });
439+
[](uint8_t tpcNClsFindable, int8_t tpcNClsFindableMinusFound) -> int16_t {
440+
return fixTPCNClsFindable(tpcNClsFindable, tpcNClsFindableMinusFound) - tpcNClsFindableMinusFound;
441+
});
428442
DECLARE_SOA_DYNAMIC_COLUMN(TPCNClsPID, tpcNClsPID, //! Number of found TPC clusters used for PID
429-
[](uint8_t tpcNClsFindable, int8_t tpcNClsFindableMinusPID) -> int16_t { return (int16_t)tpcNClsFindable - tpcNClsFindableMinusPID; });
443+
[](uint8_t tpcNClsFindable, int8_t tpcNClsFindableMinusPID, int8_t tpcNClsFindableMinusFound) -> int16_t {
444+
return fixTPCNClsFindable(tpcNClsFindable, tpcNClsFindableMinusFound) - tpcNClsFindableMinusPID;
445+
});
446+
DECLARE_SOA_DYNAMIC_COLUMN(TPCNClsCrossedRows_fix, tpcNClsCrossedRows, //! Number of crossed TPC Rows
447+
[](uint8_t tpcNClsFindable, int8_t TPCNClsFindableMinusCrossedRows, int8_t tpcNClsFindableMinusFound) -> int16_t {
448+
return fixTPCNClsFindable(tpcNClsFindable, tpcNClsFindableMinusFound) - TPCNClsFindableMinusCrossedRows;
449+
});
430450
DECLARE_SOA_DYNAMIC_COLUMN(TPCNClsCrossedRows, tpcNClsCrossedRows, //! Number of crossed TPC Rows
431451
[](uint8_t tpcNClsFindable, int8_t TPCNClsFindableMinusCrossedRows) -> int16_t { return (int16_t)tpcNClsFindable - TPCNClsFindableMinusCrossedRows; });
432452
DECLARE_SOA_DYNAMIC_COLUMN(ITSNCls, itsNCls, //! Number of ITS clusters
@@ -461,8 +481,14 @@ DECLARE_SOA_DYNAMIC_COLUMN(ITSNSharedCls, itsNSharedCls, //! Number of shared IT
461481
});
462482
DECLARE_SOA_DYNAMIC_COLUMN(TPCFoundOverFindableCls, tpcFoundOverFindableCls, //! Ratio of found over findable clusters
463483
[](uint8_t tpcNClsFindable, int8_t tpcNClsFindableMinusFound) -> float {
464-
int16_t tpcNClsFound = (int16_t)tpcNClsFindable - tpcNClsFindableMinusFound;
465-
return (float)tpcNClsFound / (float)tpcNClsFindable;
484+
int16_t tpcNClsFound = fixTPCNClsFindable(tpcNClsFindable, tpcNClsFindableMinusFound) - tpcNClsFindableMinusFound;
485+
return (float)tpcNClsFound / (float)fixTPCNClsFindable(tpcNClsFindable, tpcNClsFindableMinusFound);
486+
});
487+
488+
DECLARE_SOA_DYNAMIC_COLUMN(TPCCrossedRowsOverFindableCls_fix, tpcCrossedRowsOverFindableCls, //! Ratio crossed rows over findable clusters
489+
[](uint8_t tpcNClsFindable, int8_t tpcNClsFindableMinusCrossedRows, int8_t tpcNClsFindableMinusFound) -> float {
490+
int16_t tpcNClsCrossedRows = fixTPCNClsFindable(tpcNClsFindable, tpcNClsFindableMinusFound) - tpcNClsFindableMinusCrossedRows;
491+
return (float)tpcNClsCrossedRows / (float)fixTPCNClsFindable(tpcNClsFindable, tpcNClsFindableMinusFound);
466492
});
467493

468494
DECLARE_SOA_DYNAMIC_COLUMN(TPCCrossedRowsOverFindableCls, tpcCrossedRowsOverFindableCls, //! Ratio crossed rows over findable clusters
@@ -473,7 +499,7 @@ DECLARE_SOA_DYNAMIC_COLUMN(TPCCrossedRowsOverFindableCls, tpcCrossedRowsOverFind
473499

474500
DECLARE_SOA_DYNAMIC_COLUMN(TPCFractionSharedCls, tpcFractionSharedCls, //! Fraction of shared TPC clusters
475501
[](uint8_t tpcNClsShared, uint8_t tpcNClsFindable, int8_t tpcNClsFindableMinusFound) -> float {
476-
int16_t tpcNClsFound = (int16_t)tpcNClsFindable - tpcNClsFindableMinusFound;
502+
int16_t tpcNClsFound = fixTPCNClsFindable(tpcNClsFindable, tpcNClsFindableMinusFound) - tpcNClsFindableMinusFound;
477503
return (float)tpcNClsShared / (float)tpcNClsFound;
478504
});
479505

@@ -582,7 +608,7 @@ DECLARE_SOA_TABLE_FULL(StoredTracksExtra_000, "TracksExtra", "AOD", "TRACKEXTRA"
582608
track::HasITS<track::DetectorMap>, track::HasTPC<track::DetectorMap>,
583609
track::HasTRD<track::DetectorMap>, track::HasTOF<track::DetectorMap>,
584610
track::TPCNClsFound<track::TPCNClsFindable, track::TPCNClsFindableMinusFound>,
585-
track::TPCNClsCrossedRows<track::TPCNClsFindable, track::TPCNClsFindableMinusCrossedRows>,
611+
track::TPCNClsCrossedRows_fix<track::TPCNClsFindable, track::TPCNClsFindableMinusCrossedRows, track::TPCNClsFindableMinusFound>,
586612
track::TOFExpTimeEl<track::Length, track::TOFExpMom>,
587613
track::TOFExpTimeMu<track::Length, track::TOFExpMom>,
588614
track::TOFExpTimePi<track::Length, track::TOFExpMom>,
@@ -593,7 +619,7 @@ DECLARE_SOA_TABLE_FULL(StoredTracksExtra_000, "TracksExtra", "AOD", "TRACKEXTRA"
593619
track::TOFExpTimeHe<track::Length, track::TOFExpMom>,
594620
track::TOFExpTimeAl<track::Length, track::TOFExpMom>,
595621
track::ITSNCls<track::ITSClusterMap>, track::ITSNClsInnerBarrel<track::ITSClusterMap>,
596-
track::TPCCrossedRowsOverFindableCls<track::TPCNClsFindable, track::TPCNClsFindableMinusCrossedRows>,
622+
track::TPCCrossedRowsOverFindableCls_fix<track::TPCNClsFindable, track::TPCNClsFindableMinusCrossedRows, track::TPCNClsFindableMinusFound>,
597623
track::TPCFoundOverFindableCls<track::TPCNClsFindable, track::TPCNClsFindableMinusFound>,
598624
track::TPCFractionSharedCls<track::TPCNClsShared, track::TPCNClsFindable, track::TPCNClsFindableMinusFound>,
599625
track::TRDHasCrossing<track::TRDPattern>, track::TRDHasNeighbor<track::TRDPattern>, track::TRDNTracklets<track::TRDPattern>,
@@ -610,7 +636,7 @@ DECLARE_SOA_TABLE_FULL_VERSIONED(StoredTracksExtra_001, "TracksExtra", "AOD", "T
610636
track::HasITS<track::v001::DetectorMap>, track::HasTPC<track::v001::DetectorMap>,
611637
track::HasTRD<track::v001::DetectorMap>, track::HasTOF<track::v001::DetectorMap>,
612638
track::TPCNClsFound<track::TPCNClsFindable, track::TPCNClsFindableMinusFound>,
613-
track::TPCNClsCrossedRows<track::TPCNClsFindable, track::TPCNClsFindableMinusCrossedRows>,
639+
track::TPCNClsCrossedRows_fix<track::TPCNClsFindable, track::TPCNClsFindableMinusCrossedRows, track::TPCNClsFindableMinusFound>,
614640
track::v001::ITSClusterMap<track::ITSClusterSizes>, track::v001::ITSNCls<track::ITSClusterSizes>, track::v001::ITSNClsInnerBarrel<track::ITSClusterSizes>,
615641
track::v001::ITSClsSizeInLayer<track::ITSClusterSizes>,
616642
track::v001::IsITSAfterburner<track::v001::DetectorMap, track::ITSChi2NCl>,
@@ -623,7 +649,7 @@ DECLARE_SOA_TABLE_FULL_VERSIONED(StoredTracksExtra_001, "TracksExtra", "AOD", "T
623649
track::TOFExpTimeTr<track::Length, track::TOFExpMom>,
624650
track::TOFExpTimeHe<track::Length, track::TOFExpMom>,
625651
track::TOFExpTimeAl<track::Length, track::TOFExpMom>,
626-
track::TPCCrossedRowsOverFindableCls<track::TPCNClsFindable, track::TPCNClsFindableMinusCrossedRows>,
652+
track::TPCCrossedRowsOverFindableCls_fix<track::TPCNClsFindable, track::TPCNClsFindableMinusCrossedRows, track::TPCNClsFindableMinusFound>,
627653
track::TPCFoundOverFindableCls<track::TPCNClsFindable, track::TPCNClsFindableMinusFound>,
628654
track::TPCFractionSharedCls<track::TPCNClsShared, track::TPCNClsFindable, track::TPCNClsFindableMinusFound>,
629655
track::TRDHasCrossing<track::TRDPattern>, track::TRDHasNeighbor<track::TRDPattern>, track::TRDNTracklets<track::TRDPattern>,
@@ -640,8 +666,8 @@ DECLARE_SOA_TABLE_FULL_VERSIONED(StoredTracksExtra_002, "TracksExtra", "AOD", "T
640666
track::HasITS<track::v001::DetectorMap>, track::HasTPC<track::v001::DetectorMap>,
641667
track::HasTRD<track::v001::DetectorMap>, track::HasTOF<track::v001::DetectorMap>,
642668
track::TPCNClsFound<track::TPCNClsFindable, track::TPCNClsFindableMinusFound>,
643-
track::TPCNClsPID<track::TPCNClsFindable, track::TPCNClsFindableMinusPID>,
644-
track::TPCNClsCrossedRows<track::TPCNClsFindable, track::TPCNClsFindableMinusCrossedRows>,
669+
track::TPCNClsPID<track::TPCNClsFindable, track::TPCNClsFindableMinusPID, track::TPCNClsFindableMinusFound>,
670+
track::TPCNClsCrossedRows_fix<track::TPCNClsFindable, track::TPCNClsFindableMinusCrossedRows, track::TPCNClsFindableMinusFound>,
645671
track::v001::ITSClusterMap<track::ITSClusterSizes>, track::v001::ITSNCls<track::ITSClusterSizes>, track::v001::ITSNClsInnerBarrel<track::ITSClusterSizes>,
646672
track::v001::ITSClsSizeInLayer<track::ITSClusterSizes>,
647673
track::v001::IsITSAfterburner<track::v001::DetectorMap, track::ITSChi2NCl>,
@@ -654,7 +680,7 @@ DECLARE_SOA_TABLE_FULL_VERSIONED(StoredTracksExtra_002, "TracksExtra", "AOD", "T
654680
track::TOFExpTimeTr<track::Length, track::TOFExpMom>,
655681
track::TOFExpTimeHe<track::Length, track::TOFExpMom>,
656682
track::TOFExpTimeAl<track::Length, track::TOFExpMom>,
657-
track::TPCCrossedRowsOverFindableCls<track::TPCNClsFindable, track::TPCNClsFindableMinusCrossedRows>,
683+
track::TPCCrossedRowsOverFindableCls_fix<track::TPCNClsFindable, track::TPCNClsFindableMinusCrossedRows, track::TPCNClsFindableMinusFound>,
658684
track::TPCFoundOverFindableCls<track::TPCNClsFindable, track::TPCNClsFindableMinusFound>,
659685
track::TPCFractionSharedCls<track::TPCNClsShared, track::TPCNClsFindable, track::TPCNClsFindableMinusFound>,
660686
track::TRDHasCrossing<track::TRDPattern>, track::TRDHasNeighbor<track::TRDPattern>, track::TRDNTracklets<track::TRDPattern>,

0 commit comments

Comments
 (0)