Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrackHelpers.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TrackHelpers.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2023 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 #pragma once
9 
12 
13 namespace Acts {
14 
22 template <typename track_container_t, typename track_state_container_t,
23  template <typename> class holder_t>
25  Acts::TrackProxy<track_container_t, track_state_container_t, holder_t,
26  false>
27  track) {
28  track.chi2() = 0;
29  track.nDoF() = 0;
30 
31  track.nHoles() = 0;
32  track.nMeasurements() = 0;
33  track.nSharedHits() = 0;
34  track.nOutliers() = 0;
35 
36  for (const auto& trackState : track.trackStatesReversed()) {
37  auto typeFlags = trackState.typeFlags();
38 
39  if (typeFlags.test(Acts::TrackStateFlag::MeasurementFlag)) {
40  if (typeFlags.test(Acts::TrackStateFlag::SharedHitFlag)) {
41  track.nSharedHits()++;
42  }
43 
44  track.nMeasurements()++;
45  track.chi2() += trackState.chi2();
46  track.nDoF() += trackState.calibratedSize();
47  } else if (typeFlags.test(Acts::TrackStateFlag::OutlierFlag)) {
48  track.nOutliers()++;
49  } else if (typeFlags.test(Acts::TrackStateFlag::HoleFlag)) {
50  track.nHoles()++;
51  }
52  }
53 }
54 } // namespace Acts