ATLAS Offline Software
Loading...
Searching...
No Matches
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
28using std::abs;
29
30using namespace PESA;
31
32
33// The meat of the class, return a vector of split clusters
34std::vector<T2TrackManager::TrackVector>
35T2TrackManager::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
75int T2TrackManager::orderedSplit(int& key, const int nEntries) const
76{
77 ++key;
78 return key * m_nSplit / nEntries;
79}
int alternatingSplit(int &key) const
std::vector< TrackVector > split(const TrackVector &cluster, const EventContext &ctx) const
int orderedSplit(int &key, int nEntries) const
const int m_nSplit
Data members.
std::vector< const Trk::Track * > TrackVector
Local tools.
Definition idx.h:9