ATLAS Offline Software
T2TrackManager.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
20 
21 // This class
22 #include "T2TrackManager.h"
23 #include "GaudiKernel/EventContext.h"
24 
25 //#include <iostream>
26 #include <cmath>
27 
28 using std::abs;
29 
30 using namespace PESA;
31 
32 
33 // The meat of the class, return a vector of split clusters
34 std::vector<T2TrackManager::TrackVector>
35 T2TrackManager::split( const TrackVector& cluster, const EventContext& ctx ) const
36 {
37  int key = ctx.eventID().event_number() %2 -1;
38  const int nEntries = cluster.size();
39 
40  //std::cout << "Reserve space" << std::endl;
41 
42  // Set up the output, reserve space, init collections
43  std::vector<TrackVector> trackCollections(m_nSplit);
44 
45  //if (m_alg == Pt)
46  //sort(holder.begin(), holder.end(), ptSort);
47 
48  // Iterate over all the tracks in the cluster
49  for (auto&& track: cluster) {
50  // By default (if the splitting algorithm doesn't exist) store
51  // tracks in the 1st collection
52  int nPos = 0;
53  if (m_alg == Alternating)
54  nPos = alternatingSplit(key);
55  else if (m_alg == Pt)
56  nPos = orderedSplit(key, nEntries);
57 
58  // Add the track to the appropriate collection
59  trackCollections[nPos].push_back(track);
60  }
61 
62  // if (!m_doCluster) {
63  return trackCollections;
64 }
65 
66 
68 {
69  ++key;
70  key %= m_nSplit;
71  return key;
72 }
73 
74 
75 int T2TrackManager::orderedSplit(int& key, const int nEntries) const
76 {
77  ++key;
78  return key * m_nSplit / nEntries;
79 }
PESA::T2TrackManager::TrackVector
std::vector< const Trk::Track * > TrackVector
Definition: T2TrackManager.h:37
PESA
Local tools.
Definition: T2BeamSpot.cxx:13
PESA::T2TrackManager::orderedSplit
int orderedSplit(int &key, int nEntries) const
Definition: T2TrackManager.cxx:75
PESA::T2TrackManager::Alternating
@ Alternating
Definition: T2TrackManager.h:42
PESA::T2TrackManager::Pt
@ Pt
Definition: T2TrackManager.h:42
PESA::T2TrackManager::alternatingSplit
int alternatingSplit(int &key) const
Definition: T2TrackManager.cxx:67
PESA::T2TrackManager::split
std::vector< TrackVector > split(const TrackVector &cluster, const EventContext &ctx) const
Definition: T2TrackManager.cxx:35
PESA::T2TrackManager::m_alg
const int m_alg
Definition: T2TrackManager.h:57
T2TrackManager.h
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
dqBeamSpot.nEntries
int nEntries
Definition: dqBeamSpot.py:73
PESA::T2TrackManager::m_nSplit
const int m_nSplit
Data members.
Definition: T2TrackManager.h:56
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37