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