Skip to content

Commit 9113856

Browse files
committed
small change in mtd time computation
1 parent 7257ba1 commit 9113856

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

RecoHGCal/TICL/plugins/TICLCandidateProducer.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -409,15 +409,16 @@ void TICLCandidateProducer::assignTimeToCandidates(std::vector<TICLCandidate> &r
409409
float invTimeErr = 0.f;
410410
float timeErr = -1.f;
411411

412+
const int trackIndex =
413+
cand.trackPtr().isNonnull() ? (cand.trackPtr().get() - (edm::Ptr<reco::Track>(track_h, 0)).get()) : -1;
412414
for (const auto &tr : cand.tracksters()) {
413415
if (tr->timeError() > 0) {
414416
const auto invTimeESq = pow(tr->timeError(), -2);
415417
const auto x = tr->barycenter().X();
416418
const auto y = tr->barycenter().Y();
417419
const auto z = tr->barycenter().Z();
418420
auto path = std::sqrt(x * x + y * y + z * z);
419-
if (cand.trackPtr().get() != nullptr) {
420-
const auto &trackIndex = cand.trackPtr().get() - (edm::Ptr<reco::Track>(track_h, 0)).get();
421+
if (trackIndex != -1) {
421422
if (useMTDTiming_ and inputTimingView.timeErr()[trackIndex] > 0) {
422423
const auto xMtd = inputTimingView.posInMTD_x()[trackIndex];
423424
const auto yMtd = inputTimingView.posInMTD_y()[trackIndex];
@@ -448,7 +449,6 @@ void TICLCandidateProducer::assignTimeToCandidates(std::vector<TICLCandidate> &r
448449

449450
if (useMTDTiming_ and cand.charge()) {
450451
// Check MTD timing availability
451-
const auto &trackIndex = cand.trackPtr().get() - (edm::Ptr<reco::Track>(track_h, 0)).get();
452452
const bool assocQuality = inputTimingView.MVAquality()[trackIndex] > timingQualityThreshold_;
453453
if (assocQuality) {
454454
const auto timeHGC = cand.time();

0 commit comments

Comments
 (0)