Skip to content
Snippets Groups Projects
Commit 4186dd33 authored by Stewart Martin-Haugh's avatar Stewart Martin-Haugh
Browse files

Make all T2TrackManager methods const

parent afd61af9
No related branches found
No related tags found
6 merge requests!58791DataQualityConfigurations: Modify L1Calo config for web display,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!45405updated ART test cron job,!42417Draft: DIRE and VINCIA Base Fragments for Pythia 8.3,!35623Make beamspot reentrant
...@@ -29,26 +29,11 @@ using std::abs; ...@@ -29,26 +29,11 @@ using std::abs;
using namespace PESA; using namespace PESA;
// Not much to do here now, will eventually init the config parameters
T2TrackManager::T2TrackManager( int nSplit, Algorithm alg )
// Fill the defaults
: m_nSplit ( nSplit )
, m_alg ( alg )
, m_altKey ( -1 )
//, m_ordKey ( 0 )
{
}
// Will have to clean up after myself here
T2TrackManager::~T2TrackManager()
{
}
// The meat of the class, return a vector of split clusters // The meat of the class, return a vector of split clusters
std::vector< ConstDataVector<TrackCollection> > std::vector< ConstDataVector<TrackCollection> >
T2TrackManager::split( const TrackCollection& cluster ) T2TrackManager::split( const TrackCollection& cluster, const EventContext& ctx ) const
{ {
int key = ctx.eventID().event_number() %2 -1;
const int nEntries = cluster.size(); const int nEntries = cluster.size();
//std::cout << "Reserve space" << std::endl; //std::cout << "Reserve space" << std::endl;
...@@ -69,9 +54,9 @@ T2TrackManager::split( const TrackCollection& cluster ) ...@@ -69,9 +54,9 @@ T2TrackManager::split( const TrackCollection& cluster )
// tracks in the 1st collection // tracks in the 1st collection
int nPos = 0; int nPos = 0;
if (m_alg == Alternating) if (m_alg == Alternating)
nPos = alternatingSplit(); nPos = alternatingSplit(key);
else if (m_alg == Pt) else if (m_alg == Pt)
nPos = orderedSplit(nEntries); nPos = orderedSplit(key, nEntries);
// Add the track to the appropriate collection // Add the track to the appropriate collection
trackCollections[nPos].push_back(*c_itr); trackCollections[nPos].push_back(*c_itr);
...@@ -82,18 +67,16 @@ T2TrackManager::split( const TrackCollection& cluster ) ...@@ -82,18 +67,16 @@ T2TrackManager::split( const TrackCollection& cluster )
} }
int constexpr int T2TrackManager::alternatingSplit(int key) const
T2TrackManager::alternatingSplit()
{ {
++m_altKey; ++key;
m_altKey %= m_nSplit; key %= m_nSplit;
return m_altKey; return key;
} }
int constexpr int T2TrackManager::orderedSplit(int key, const int nEntries) const
T2TrackManager::orderedSplit(const int nEntries)
{ {
++m_altKey; ++key;
return m_altKey * m_nSplit / nEntries; return key * m_nSplit / nEntries;
} }
...@@ -37,34 +37,18 @@ namespace PESA ...@@ -37,34 +37,18 @@ namespace PESA
// List of the splitter algorithms // List of the splitter algorithms
enum Algorithm { Alternating, Pt, Phi, NorthSouth, Charge }; enum Algorithm { Alternating, Pt, Phi, NorthSouth, Charge };
// Constructor/Destructor
T2TrackManager( int nSplit = 2, Algorithm alg = Alternating );
~T2TrackManager();
// Return a vector of sub-clusters // Return a vector of sub-clusters
std::vector< ConstDataVector<TrackCollection> > split( const TrackCollection& cluster); std::vector< ConstDataVector<TrackCollection> > split(const TrackCollection& cluster, const EventContext& ctx) const;
// Get and Set parameters
// int GetNSplit() {return m_nSplit;}
// int GetAlg() {return m_alg;}
// void SetNSplit(int nSplit) {m_nSplit = nSplit;}
// void SetAlg(int alg) {m_alg = alg;}
void ResetKey(int key = -1) { m_altKey = key;}
private: private:
// The splitter algorithms // The splitter algorithms
int alternatingSplit(); // 1 for me, 1 for you, 2 for me, ... constexpr int alternatingSplit(int key) const; // 1 for me, 1 for you, 2 for me, ...
int orderedSplit(int nEntries); // 1, 2, 3 for me, 1, 2, 3 for you ... constexpr int orderedSplit(int key, int nEntries) const; // 1, 2, 3 for me, 1, 2, 3 for you ...
/// Data members /// Data members
int m_nSplit; // How many output clusters int m_nSplit = 2; // How many output clusters
int m_alg; // Which algorithm to use int m_alg = Alternating; // Which algorithm to use
/// Algorithm helper objects
int m_altKey; // Alternating split key
//int m_ordKey; // Ordered split key
}; };
} //PESA } //PESA
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment