Skip to content
Snippets Groups Projects
Commit 79556685 authored by Adam Bailey's avatar Adam Bailey
Browse files

Changed copy of temporary TauJet container from shallow to deep copy. Followed...

Changed copy of temporary TauJet container from shallow to deep copy. Followed deep copy function that was in the old TauProcessorTool.h


Former-commit-id: 794c4dc6
parent eb13b411
No related branches found
No related tags found
8 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,!28528Revert 63f845ae,!27054Atr20369 210,!26342Monopole: Handle fractionally charged particles
......@@ -64,7 +64,6 @@ StatusCode TauRunnerAlg::initialize() {
ATH_CHECK( m_hadronicPFOOutputContainer.initialize() );
ATH_CHECK( m_vertexOutputContainer.initialize() );
ATH_CHECK( m_chargedPFOOutputContainer.initialize() );
ATH_CHECK( m_pi0Container.initialize() );
//-------------------------------------------------------------------------
// Allocate tools
......@@ -169,14 +168,6 @@ StatusCode TauRunnerAlg::execute() {
SG::WriteHandle<xAOD::PFOContainer> chargedPFOHandle( m_chargedPFOOutputContainer );
ATH_MSG_DEBUG(" write: " << chargedPFOHandle.key() << " = " << "..." );
ATH_CHECK(chargedPFOHandle.record(std::unique_ptr<xAOD::PFOContainer>{chargedPFOContainer}, std::unique_ptr<xAOD::PFOAuxContainer>{chargedPFOAuxStore}));
// write pi0 container
xAOD::ParticleContainer* pi0Container = new xAOD::ParticleContainer();
xAOD::ParticleAuxContainer* pi0AuxStore = new xAOD::ParticleAuxContainer();
pi0Container->setStore(pi0AuxStore);
SG::WriteHandle<xAOD::ParticleContainer> pi0Handle( m_pi0Container );
ATH_MSG_DEBUG(" write: " << pi0Handle.key() << " = " << "..." );
ATH_CHECK(pi0Handle.record(std::unique_ptr<xAOD::ParticleContainer>{pi0Container}, std::unique_ptr<xAOD::ParticleAuxContainer>{pi0AuxStore}));
//-------------------------------------------------------------------------
// Initialize tools for this event
......@@ -200,16 +191,20 @@ StatusCode TauRunnerAlg::execute() {
}
pTauContainer = tauInputHandle.cptr();
// create shallow copy, write that
std::pair< xAOD::TauJetContainer*, xAOD::ShallowAuxContainer* > taus_shallowCopy = xAOD::shallowCopyContainer( *pTauContainer );
// Make new container which is deep copy of that
xAOD::TauJetContainer* newTauCon = 0;
xAOD::TauJetAuxContainer* newTauAuxCon = 0;
xAOD::TauJet* tau(0);
// See function in header file
ATH_CHECK(deepCopy(newTauCon, newTauAuxCon, tau, pTauContainer));
// Write final taujets container
SG::WriteHandle<xAOD::TauJetContainer> outputTauHandle(m_tauOutputContainer);
ATH_CHECK( outputTauHandle.record(std::unique_ptr<xAOD::TauJetContainer>(taus_shallowCopy.first),
std::unique_ptr<xAOD::ShallowAuxContainer>(taus_shallowCopy.second)) );
ATH_CHECK( outputTauHandle.record(std::unique_ptr<xAOD::TauJetContainer>(newTauCon),
std::unique_ptr<xAOD::TauJetAuxContainer>(newTauAuxCon)) );
// iterate over the shallow copy
xAOD::TauJetContainer::iterator itTau = (taus_shallowCopy.first)->begin();
xAOD::TauJetContainer::iterator itTauE = (taus_shallowCopy.first)->end();
// iterate over the copy
xAOD::TauJetContainer::iterator itTau = newTauCon->begin();
xAOD::TauJetContainer::iterator itTauE = newTauCon->end();
for (; itTau != itTauE; ++itTau) {
xAOD::TauJet* pTau = (*itTau);
......
......@@ -24,9 +24,6 @@
#include "xAODTracking/VertexContainer.h"
#include "xAODTracking/VertexAuxContainer.h"
#include "xAODParticleEvent/ParticleContainer.h"
#include "xAODParticleEvent/ParticleAuxContainer.h"
/**
* @brief Main class for tau candidate processing.
*/
......@@ -48,7 +45,10 @@ class TauRunnerAlg: public AthAlgorithm
virtual StatusCode execute();
virtual StatusCode finalize();
private:
// template for deep copy function
template<class T, class U, class V> StatusCode deepCopy(T*& containerOut, U*& containerStoreOut, const V* dummyContainerType,
const T*& oldContainer);
private:
ToolHandleArray<ITauToolBase> m_tools;
......@@ -63,9 +63,33 @@ class TauRunnerAlg: public AthAlgorithm
SG::WriteHandleKey<xAOD::PFOContainer> m_hadronicPFOOutputContainer{this,"Key_hadronicPFOOutputContainer", "TauHadronicParticleFlowObjects", "tau hadronic pfo out key"};
SG::WriteHandleKey<xAOD::VertexContainer> m_vertexOutputContainer{this,"Key_vertexOutputContainer", "TauSecondaryVertices", "input vertex container key"};
SG::WriteHandleKey<xAOD::PFOContainer> m_chargedPFOOutputContainer{this,"Key_chargedPFOOutputContainer", "TauChargedParticleFlowObjects", "tau charged pfo out key"};
SG::WriteHandleKey<xAOD::ParticleContainer> m_pi0Container{this,"Key_pi0Container", "finalTauPi0s", "tau final pi0s output"};
};
// Function to perform deep copy on container
template<class T, class U, class V> StatusCode TauRunnerAlg::deepCopy(T*& container, U*& containerStore, const V* /*dummyContainerElementType*/,
const T*& oldContainer){
// The new container should be null, check here
if(container==0 && containerStore==0){
container = new T();
containerStore = new U();
container->setStore(containerStore);
}
else{
ATH_MSG_FATAL("Proviced non-null containters, not initializing please provide null containers: ");
return StatusCode::FAILURE;
}
for( const V* v : *oldContainer ){
V* newV = new V();
// Put objects into new container
container->push_back(newV);
// Copy across aux store
*newV = *v;
}
return StatusCode::SUCCESS;
}
#endif // TAUREC_TAURUNNERALG_H
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