Skip to content
Snippets Groups Projects
Commit def57af1 authored by Vakhtang Tsulaia's avatar Vakhtang Tsulaia
Browse files

Merge branch 'eflowRec_ATLJETMET_997' into 'master'

Eflow rec atljetmet 997

Closes ATLJETMET-997

See merge request atlas/athena!15125
parents b0ff8b71 f13440b4
No related branches found
No related tags found
No related merge requests found
......@@ -56,9 +56,6 @@ private:
std::vector<eflowRecCluster*> m_clustersToConsider;
std::vector<eflowRecTrack*> m_tracksToRecover;
double m_rCell;
double m_windowRms;
/* Tool for getting e/p values and hadronic shower cell ordering principle parameters */
ToolHandle<IEFlowCellEOverPTool> m_theEOverPTool{this,"eflowCellEOverPTool","eflowCellEOverPTool","Energy Flow E/P Values and Shower Parameters Tool"};
......
......@@ -16,11 +16,19 @@
#include <stdexcept>
#include <math.h>
#include <memory>
#include <mutex>
/** Lookup-table based exponential function to save CPU time, which is used by eflowCellIntegrator */
class eflowLookupExp{
public:
static eflowLookupExp* getInstance(int nExpBins = 50, int nExpSubBins = 1000){
//Creation of the unique_ptr is not thread-safe - therefore we get a mutex and pass it to a lock-guard
//The lock is released automatically when getInstance returns
//The mutex is static so that all threads check the status of the *same* mutex
static std::mutex mutex_instance;
std::lock_guard<std::mutex> lock(mutex_instance);
if ( !m_instance) {
m_instance = std::make_unique<eflowLookupExp>(nExpBins, nExpSubBins);
} else {
......
......@@ -35,10 +35,6 @@ class eflowRingSubtractionManager {
eflowRingSubtractionManager();
~eflowRingSubtractionManager() {}
static void setRMaxAndWeightRange(double rMax, double weightRange) {
m_rMax = rMax;
m_weightRange = weightRange;
}
double fudgeMean() const {return m_fudgeMean;}
double fudgeStdDev() const {return m_fudgeStdDev;}
/* for eflowTauTool */
......@@ -66,7 +62,7 @@ class eflowRingSubtractionManager {
double m_fudgeMean;
double m_fudgeStdDev;
static double m_rMax;
static double m_weightRange;
static constexpr double m_rMax = 0.75;
static constexpr double m_weightRange = 1.0e6;
};
#endif
......@@ -16,6 +16,7 @@
#include <map>
#include <vector>
#include <iostream>
#include <mutex>
#include "GaudiKernel/ToolHandle.h"
......@@ -41,6 +42,11 @@ public:
static eflowTrackClusterLink* getInstance(eflowRecTrack* track, eflowRecCluster* cluster){
std::pair<eflowRecTrack*, eflowRecCluster*> thisPair(std::make_pair(track, cluster));
//Read and write from the map is not thread-safe - therefore we get a mutex and pass it to a lock-guard
//The lock is released automatically when getInstance returns
//The mutex is static so that all threads check the status of the *same* mutex
static std::mutex mutex_instance;
std::lock_guard<std::mutex> lock(mutex_instance);
/* The find returns a valid iterator. If there is no existing entry it returns the end iterator */
InstanceMap::iterator mapIterator = m_instances.find(thisPair);
......@@ -67,6 +73,7 @@ private:
std::vector<double> m_clusterIntegral;
static InstanceMap m_instances;
};
#endif /* EFLOWTRACKCLUSTERLINK_H_ */
......@@ -28,12 +28,9 @@ using namespace eflowSubtract;
PFRecoverSplitShowersTool::PFRecoverSplitShowersTool(const std::string& type,const std::string& name,const IInterface* parent):
base_class(type, name, parent),
m_eflowCaloObjectContainer(0),
m_rCell(0.75),
m_windowRms(0.032),
m_binnedParameters(std::make_unique<eflowEEtaBinnedParameters>()),
m_nTrackClusterMatches(0)
{
eflowRingSubtractionManager::setRMaxAndWeightRange(m_rCell, 1.0e6);
}
PFRecoverSplitShowersTool::~PFRecoverSplitShowersTool() {}
......
......@@ -23,10 +23,6 @@ CREATED: 18th Aug, 2005
using std::vector;
double eflowRingSubtractionManager::m_rMax = 0.75;
double eflowRingSubtractionManager::m_weightRange = 1.0e6;
eflowRingSubtractionManager::eflowRingSubtractionManager() : m_ringThickness(eflowCalo::nRegions), m_fudgeMean(0), m_fudgeStdDev(-1) {}
double eflowRingSubtractionManager::ringMeanRank(const vector<double>& p, double rMin, double rMax) const {
......
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