Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4e21bb9

Browse filesBrowse files
authored
TOF PID: Check that track has collision before accessing collision info (#333)
1 parent 1a8dc0e commit 4e21bb9
Copy full SHA for 4e21bb9

File tree

Expand file treeCollapse file tree

1 file changed

+8
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-2
lines changed
Open diff view settings
Collapse file

‎Common/Core/PID/PIDTOF.h‎

Copy file name to clipboardExpand all lines: Common/Core/PID/PIDTOF.h
+8-2Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,16 @@ class ExpTimes
127127
if (!trk.hasTOF()) {
128128
return -999.f;
129129
}
130+
if (!trk.has_collision()) {
131+
return -999.f;
132+
}
130133
const float x[7] = {trk.p(), trk.tofSignal(), trk.collision().collisionTimeRes() * 1000.f, o2::track::PID::getMass2Z(id), trk.length(), trk.sigma1Pt(), trk.pt()};
131134
const float reso = response(response.kSigma, x);
132135
return reso >= 0.f ? reso : 0.f;
133136
}
134137

135138
/// Gets the number of sigmas with respect the expected time
136-
static float GetSeparation(const DetectorResponse& response, const TrackType& trk) { return trk.hasTOF() ? (trk.tofSignal() - trk.collision().collisionTime() * 1000.f - GetExpectedSignal(trk)) / GetExpectedSigma(response, trk) : -999.f; }
139+
static float GetSeparation(const DetectorResponse& response, const TrackType& trk) { return trk.has_collision() ? (trk.hasTOF() ? (trk.tofSignal() - trk.collision().collisionTime() * 1000.f - GetExpectedSignal(trk)) / GetExpectedSigma(response, trk) : -999.f) : -999.f; }
137140

138141
/// Gets the expected resolution of the measurement from the track time
139142
float GetExpectedSigmaFromTrackTime(const DetectorResponse& response, const TrackType& trk) const;
@@ -212,6 +215,9 @@ float ExpTimes<TrackType, id>::GetExpectedSigmaFromTrackTime(const DetectorRespo
212215
if (!trk.hasTOF()) {
213216
return -999.f;
214217
}
218+
if (!trk.has_collision()) {
219+
return -999.f;
220+
}
215221
const float x[7] = {trk.p(), o2::pid::tof::TOFSignal<TrackType>::GetTOFSignal(trk), trk.collision().collisionTimeRes() * 1000.f, o2::track::PID::getMass2Z(id), trk.length(), trk.sigma1Pt(), trk.pt()};
216222
const float reso = response(response.kSigma, x);
217223
return reso >= 0.f ? reso : 0.f;
@@ -221,7 +227,7 @@ float ExpTimes<TrackType, id>::GetExpectedSigmaFromTrackTime(const DetectorRespo
221227
template <typename TrackType, o2::track::PID::ID id>
222228
float ExpTimes<TrackType, id>::GetSeparationFromTrackTime(const DetectorResponse& response, const TrackType& trk) const
223229
{
224-
return trk.hasTOF() ? (o2::pid::tof::TOFSignal<TrackType>::GetTOFSignal(trk) - trk.collision().collisionTime() * 1000.f - GetExpectedSignal(trk)) / GetExpectedSigmaFromTrackTime(response, trk) : -999.f;
230+
return trk.has_collision() ? (trk.hasTOF() ? (o2::pid::tof::TOFSignal<TrackType>::GetTOFSignal(trk) - trk.collision().collisionTime() * 1000.f - GetExpectedSignal(trk)) / GetExpectedSigmaFromTrackTime(response, trk) : -999.f) : -999.f;
225231
}
226232

227233
} // namespace o2::pid::tof

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.