Belle II Software  release-08-01-10
Scrooge.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #pragma once
9 
10 #include <tracking/trackFindingVXD/trackSetEvaluator/OverlapResolverNodeInfo.h>
11 
12 #include <vector>
13 #include <algorithm>
14 
15 namespace Belle2 {
26  class Scrooge {
27  public:
33  void performSelection(std::vector <OverlapResolverNodeInfo>& overlapResolverNodeInfo)
34  {
35  //sort the vector according to the QI supplied.
36  std::sort(overlapResolverNodeInfo.begin(), overlapResolverNodeInfo.end(),
37  [](OverlapResolverNodeInfo const & lhs, OverlapResolverNodeInfo const & rhs) -> bool {
38  return lhs.qualityIndicator > rhs.qualityIndicator;
39  });
40 
41  //kill all tracks, that have overlaps and lower QI:
42  auto endOfOverlapResolverNodeInfo = overlapResolverNodeInfo.cend();
43  for (auto trackIter = overlapResolverNodeInfo.begin(); trackIter != endOfOverlapResolverNodeInfo; trackIter++) {
44  if (!trackIter->activityState) continue;
45  for (auto testTrackIter = trackIter; testTrackIter != endOfOverlapResolverNodeInfo; testTrackIter++) {
46  if (std::find(trackIter->overlaps.begin(), trackIter->overlaps.end(), testTrackIter->trackIndex) !=
47  trackIter->overlaps.end()) {
48  testTrackIter->activityState = 0.;
49  }
50  }
51  }
52  }
53  };
55 }
Executes greedy algorithm for vector of QITrackOverlap structs.
Definition: Scrooge.h:26
void performSelection(std::vector< OverlapResolverNodeInfo > &overlapResolverNodeInfo)
Sets the isActive flag in m_qiTrackOverlap to false, for killed tracks.
Definition: Scrooge.h:33
Abstract base class for different kinds of events.
Struct for holding information needed by overlap resolving algorithms for one node.