Skip to content

Commit f8c1c94

Browse files
committed
Add extra safety for invalid TOF values
1 parent 642561a commit f8c1c94

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ struct strangenesstofpid {
103103
Configurable<int> calculateCascades{"calculateCascades", -1, "calculate cascade-related TOF PID (0: no, 1: yes, -1: auto)"};
104104
Configurable<bool> reassociateTracks{"reassociateTracks", true, "if true, reassociate tracks to the collision the V0 or cascade belongs to. Relevant especially at high IR"};
105105
Configurable<bool> doBCshift{"doBCshift", true, "if true, perform time shift for collisions in different BCs when reassigning"};
106+
Configurable<bool> rejectUndefinedTof{"rejectUndefinedTof", true, "if true, reject tracks with TOF signal 0.000f for safety"};
106107

107108
// auxiliary / debug tables as desired
108109
Configurable<int> calculateV0TOFPIDs{"calculateV0TOFPIDs", -1, "calculate V0TOFPIDs table (0: no, 1: yes, -1: auto)"};
@@ -791,12 +792,15 @@ struct strangenesstofpid {
791792
std::abs(pTof.tpcNSigmaPi) < v0Group.qaTPCNSigma &&
792793
std::abs(nTof.tpcNSigmaPi) < v0Group.qaTPCNSigma;
793794

795+
bool pValidTOF = rejectUndefinedTof.value ? static_cast<bool>(std::fabs(pTof.tofSignal)>o2::aod::v0data::kEpsilon) : true;
796+
bool nValidTOF = rejectUndefinedTof.value ? static_cast<bool>(std::fabs(nTof.tofSignal)>o2::aod::v0data::kEpsilon) : true;
797+
794798
//_____________________________________________________________________________________________
795799
// Actual calculation
796800
float velocityPositivePr, velocityPositivePi, lengthPositive;
797801
velocityPositivePr = velocityPositivePi = lengthPositive = o2::aod::v0data::kNoTOFValue;
798802

799-
if (pTof.hasTOF && pTof.hasITS && pTof.tofEvTime > -1e+5) {
803+
if (pTof.hasTOF && pTof.hasITS && pTof.tofEvTime > -1e+5 && pValidTOF) {
800804
// method 0: legacy standalone without use of primary particle TOF
801805
if (calculationMethod.value == 0) {
802806
velocityPositivePr = velocity(posTrack.getP(), o2::constants::physics::MassProton);
@@ -872,7 +876,7 @@ struct strangenesstofpid {
872876
}
873877
float velocityNegativePr, velocityNegativePi, lengthNegative;
874878
velocityNegativePr = velocityNegativePi = lengthNegative = o2::aod::v0data::kNoTOFValue;
875-
if (nTof.hasTOF && nTof.hasITS && nTof.tofEvTime > -1e+5) {
879+
if (nTof.hasTOF && nTof.hasITS && nTof.tofEvTime > -1e+5 && nValidTOF) {
876880
// method 0: legacy standalone without use of primary particle TOF
877881
if (calculationMethod.value == 0) {
878882
velocityNegativePr = velocity(negTrack.getP(), o2::constants::physics::MassProton);
@@ -1058,9 +1062,13 @@ struct strangenesstofpid {
10581062
std::abs(nTof.tpcNSigmaPr) < cascadeGroup.qaTPCNSigma &&
10591063
std::abs(bTof.tpcNSigmaKa) < cascadeGroup.qaTPCNSigma;
10601064

1065+
bool pValidTOF = rejectUndefinedTof.value ? static_cast<bool>(std::fabs(pTof.tofSignal)>o2::aod::v0data::kEpsilon) : true;
1066+
bool nValidTOF = rejectUndefinedTof.value ? static_cast<bool>(std::fabs(nTof.tofSignal)>o2::aod::v0data::kEpsilon) : true;
1067+
bool bValidTOF = rejectUndefinedTof.value ? static_cast<bool>(std::fabs(bTof.tofSignal)>o2::aod::v0data::kEpsilon) : true;
1068+
10611069
//_____________________________________________________________________________________________
10621070
// Actual calculation
1063-
if (pTof.hasTOF && pTof.hasITS) {
1071+
if (pTof.hasTOF && pTof.hasITS && pTof.tofEvTime > -1e+5 && pValidTOF) {
10641072
float velocityPositivePr, velocityPositivePi, lengthPositive;
10651073
velocityPositivePr = velocityPositivePi = lengthPositive = o2::aod::v0data::kNoTOFValue;
10661074
if (calculationMethod.value == 0) {
@@ -1149,7 +1157,7 @@ struct strangenesstofpid {
11491157
}
11501158
} // end positive
11511159

1152-
if (nTof.hasTOF && nTof.hasITS) {
1160+
if (nTof.hasTOF && nTof.hasITS && nTof.tofEvTime > -1e+5 && nValidTOF) {
11531161
float velocityNegativePr, velocityNegativePi, lengthNegative;
11541162
velocityNegativePr = velocityNegativePi = lengthNegative = o2::aod::v0data::kNoTOFValue;
11551163
// method 0: legacy standalone without use of primary particle TOF
@@ -1239,7 +1247,7 @@ struct strangenesstofpid {
12391247
}
12401248
} // end negative
12411249

1242-
if (bTof.hasTOF && bTof.hasITS) {
1250+
if (bTof.hasTOF && bTof.hasITS && bTof.tofEvTime > -1e+5 && bValidTOF) {
12431251
float velocityBachelorKa, velocityBachelorPi, lengthBachelor;
12441252
velocityBachelorKa = velocityBachelorPi = lengthBachelor = o2::aod::v0data::kNoTOFValue;
12451253
// method 0: legacy standalone without use of primary particle TOF

0 commit comments

Comments
 (0)