Skip to content
Snippets Groups Projects
Commit ec28df85 authored by Mark Hodgkinson's avatar Mark Hodgkinson
Browse files

Migrate eflowRecCluster such that each CaloCluster it is based on is copied in...

Migrate eflowRecCluster such that each CaloCluster it is based on is copied in the eflowRecCluster constructor, rather than on demand later on.
parent b0b94ca2
No related branches found
No related tags found
No related merge requests found
...@@ -32,12 +32,12 @@ This class extends the information about a xAOD::CaloCluster. It includes an ele ...@@ -32,12 +32,12 @@ This class extends the information about a xAOD::CaloCluster. It includes an ele
*/ */
class eflowRecCluster { class eflowRecCluster {
public: public:
eflowRecCluster(const ElementLink<xAOD::CaloClusterContainer>& clusElementLink); eflowRecCluster(const ElementLink<xAOD::CaloClusterContainer>& clusElementLink, xAOD::CaloClusterContainer& newClusContainer);
eflowRecCluster(const eflowRecCluster& originalEflowRecCluster); eflowRecCluster(const eflowRecCluster& originalEflowRecCluster);
eflowRecCluster& operator=(const eflowRecCluster& originalEflowRecCluster); eflowRecCluster& operator=(const eflowRecCluster& originalEflowRecCluster);
virtual ~eflowRecCluster(); virtual ~eflowRecCluster();
const xAOD::CaloCluster* getCluster() const { return m_cluster; } xAOD::CaloCluster* getCluster() const { return m_cluster; }
xAOD::CaloCluster* getClusterForModification(xAOD::CaloClusterContainer* container); xAOD::CaloCluster* getClusterForModification(xAOD::CaloClusterContainer* container);
ElementLink<xAOD::CaloClusterContainer> getClusElementLink() const { return m_clusElementLink; } ElementLink<xAOD::CaloClusterContainer> getClusElementLink() const { return m_clusElementLink; }
...@@ -66,7 +66,7 @@ private: ...@@ -66,7 +66,7 @@ private:
enum CalorimeterType { CALORIMETER_START = 0, UNASSIGNED = CALORIMETER_START, ECAL = 1, HCAL = 2, FCAL = 3, UNKNOWN = 4, CALORIMETER_END = 5}; enum CalorimeterType { CALORIMETER_START = 0, UNASSIGNED = CALORIMETER_START, ECAL = 1, HCAL = 2, FCAL = 3, UNKNOWN = 4, CALORIMETER_END = 5};
int m_clusterId; int m_clusterId;
const xAOD::CaloCluster* m_cluster; xAOD::CaloCluster* m_cluster;
ElementLink<xAOD::CaloClusterContainer> m_originalClusElementLink; ElementLink<xAOD::CaloClusterContainer> m_originalClusElementLink;
ElementLink<xAOD::CaloClusterContainer> m_clusElementLink; ElementLink<xAOD::CaloClusterContainer> m_clusElementLink;
bool m_isTouchable; bool m_isTouchable;
......
...@@ -33,7 +33,7 @@ StatusCode PFClusterSelectorTool::execute(eflowRecClusterContainer& theEFlowRecC ...@@ -33,7 +33,7 @@ StatusCode PFClusterSelectorTool::execute(eflowRecClusterContainer& theEFlowRecC
unsigned int nClusters = caloClustersReadHandle->size(); unsigned int nClusters = caloClustersReadHandle->size();
for (unsigned int iCluster = 0; iCluster < nClusters; ++iCluster) { for (unsigned int iCluster = 0; iCluster < nClusters; ++iCluster) {
/* Create the eflowRecCluster and put it in the container */ /* Create the eflowRecCluster and put it in the container */
std::unique_ptr<eflowRecCluster> thisEFRecCluster = std::make_unique<eflowRecCluster>(ElementLink<xAOD::CaloClusterContainer>(*caloClustersReadHandle, iCluster)); std::unique_ptr<eflowRecCluster> thisEFRecCluster = std::make_unique<eflowRecCluster>(ElementLink<xAOD::CaloClusterContainer>(*caloClustersReadHandle, iCluster), theCaloClusterContainer);
if (caloCalClustersReadHandle.isValid()){ if (caloCalClustersReadHandle.isValid()){
std::map<IdentifierHash,double> cellsWeightMap; std::map<IdentifierHash,double> cellsWeightMap;
......
...@@ -14,8 +14,24 @@ ...@@ -14,8 +14,24 @@
#include "eflowRec/eflowTrackClusterLink.h" #include "eflowRec/eflowTrackClusterLink.h"
#include "xAODCaloEvent/CaloClusterKineHelper.h" #include "xAODCaloEvent/CaloClusterKineHelper.h"
eflowRecCluster::eflowRecCluster(const ElementLink<xAOD::CaloClusterContainer>& clusElementLink) : eflowRecCluster::eflowRecCluster(const ElementLink<xAOD::CaloClusterContainer>& clusElementLink, xAOD::CaloClusterContainer& newClusContainer) :
m_clusterId(-1), m_cluster(*clusElementLink),m_originalClusElementLink(clusElementLink), m_clusElementLink(clusElementLink), m_isTouchable(false),m_calorimeterType(UNASSIGNED) , m_matchCluster(nullptr) { m_clusterId(-1), m_originalClusElementLink(clusElementLink), m_isTouchable(false),m_calorimeterType(UNASSIGNED) , m_matchCluster(nullptr) {
const xAOD::CaloCluster* originalCluster = *clusElementLink;
m_cluster = new xAOD::CaloCluster();
newClusContainer.push_back(m_cluster);
const CaloClusterCellLink* theOldCellLinks = originalCluster->getCellLinks();
CaloClusterCellLink *newLinks = new CaloClusterCellLink(*theOldCellLinks);
m_cluster->addCellLink(newLinks);
m_cluster->setClusterSize(xAOD::CaloCluster::Topo_420);
CaloClusterKineHelper::calculateKine(m_cluster,true,true);
m_cluster->setRawE(m_cluster->calE());
m_cluster->setRawEta(m_cluster->calEta());
m_cluster->setRawPhi(m_cluster->calPhi());
m_cluster->setRawM(m_cluster->calM());
m_matchCluster = std::make_unique<eflowMatchCluster>(this); m_matchCluster = std::make_unique<eflowMatchCluster>(this);
} }
...@@ -70,11 +86,7 @@ void eflowRecCluster::replaceClusterByCopyInContainer(xAOD::CaloClusterContainer ...@@ -70,11 +86,7 @@ void eflowRecCluster::replaceClusterByCopyInContainer(xAOD::CaloClusterContainer
} }
xAOD::CaloCluster* eflowRecCluster::getClusterForModification(xAOD::CaloClusterContainer* container) { xAOD::CaloCluster* eflowRecCluster::getClusterForModification(xAOD::CaloClusterContainer* container) {
if (!m_isTouchable){ return getCluster();
replaceClusterByCopyInContainer(container);
m_isTouchable = true;
}
return const_cast<xAOD::CaloCluster*>(getCluster());
} }
bool eflowRecCluster::isEOverPFail(bool consistencySigmaCut, bool useGoldenMode) { bool eflowRecCluster::isEOverPFail(bool consistencySigmaCut, bool useGoldenMode) {
......
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