diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/DerivationFrameworkSUSY/ATLAS_CHECK_THREAD_SAFETY b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/DerivationFrameworkSUSY/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..2ee262f91430593833a8d1f317b1a71ed5544cd0 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/DerivationFrameworkSUSY/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/DerivationFrameworkSUSY/SUSYGenFilterTool.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/DerivationFrameworkSUSY/SUSYGenFilterTool.h index 79e1defa305542a0caf5e282d04c4964ad991751..ab0d90b02f2454aee33484bbd24f49148136090b 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/DerivationFrameworkSUSY/SUSYGenFilterTool.h +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/DerivationFrameworkSUSY/SUSYGenFilterTool.h @@ -1,7 +1,7 @@ /** -*- C++ -*- */ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ /* @@ -32,9 +32,8 @@ namespace DerivationFramework { public: SUSYGenFilterTool(const std::string& t, const std::string& n, const IInterface* p); ~SUSYGenFilterTool(); - StatusCode initialize(); - StatusCode finalize(); - virtual StatusCode addBranches() const; + virtual StatusCode initialize() override; + virtual StatusCode addBranches() const override; StatusCode getGenFiltVars(const xAOD::TruthParticleContainer* tpc, float& genFiltHT, float& genFiltMET) const; @@ -53,7 +52,6 @@ namespace DerivationFramework { float m_MaxLepEta; //!< Max eta for the truth leptons int m_SimBarcodeOffset; //!< G4 particle barcode offset value (Particles having a barcode greater than this value are defined to be G4 particles) - mutable std::map<const xAOD::TruthParticle*,MCTruthPartClassifier::ParticleOrigin> m_originMap; ToolHandle<IMCTruthClassifier> m_classif; diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/DerivationFrameworkSUSY/Truth3CollectionMaker.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/DerivationFrameworkSUSY/Truth3CollectionMaker.h index 1061a003f82483d555fff725effe4569b3f98b65..ca2931fbb24cf50b95170c1896ddec4bfeccac33 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/DerivationFrameworkSUSY/Truth3CollectionMaker.h +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/DerivationFrameworkSUSY/Truth3CollectionMaker.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -24,12 +24,12 @@ namespace DerivationFramework { public: Truth3CollectionMaker(const std::string& t, const std::string& n, const IInterface* p); ~Truth3CollectionMaker(); - StatusCode initialize(); - StatusCode finalize(); - virtual StatusCode addBranches() const; + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + virtual StatusCode addBranches() const override; private: - mutable unsigned int m_ntotpart, m_npasspart; + mutable std::atomic<unsigned int> m_ntotpart, m_npasspart; std::string m_particlesKey; //std::string m_verticesKey; std::string m_collectionName; diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/src/SUSYGenFilterTool.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/src/SUSYGenFilterTool.cxx index 4e992809083887ae819496d7a4b1c9d911e9f327..742f2842e2d60c5518ca4ff4df18bf297f7ae9dc 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/src/SUSYGenFilterTool.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/src/SUSYGenFilterTool.cxx @@ -54,15 +54,10 @@ namespace DerivationFramework { } - StatusCode SUSYGenFilterTool::finalize(){ - - return StatusCode::SUCCESS; - - } bool SUSYGenFilterTool::isPrompt( const xAOD::TruthParticle* tp ) const { - ParticleOrigin orig = getPartOrigin(tp); + ParticleOrigin orig = m_classif->particleTruthClassifier( tp ).second; ATH_MSG_VERBOSE("Particle has origin " << orig); switch(orig) { @@ -91,16 +86,6 @@ namespace DerivationFramework { return true; } - MCTruthPartClassifier::ParticleOrigin SUSYGenFilterTool::getPartOrigin( const xAOD::TruthParticle* tp ) const - { - if(m_originMap.find(tp)==m_originMap.end()) { - std::pair<ParticleType, ParticleOrigin> classification = m_classif->particleTruthClassifier( tp ); - m_originMap[tp] = classification.second; - } - return m_originMap[tp]; - } - - StatusCode SUSYGenFilterTool::addBranches() const{ ATH_MSG_VERBOSE("SUSYGenFilterTool::addBranches()"); @@ -116,8 +101,6 @@ namespace DerivationFramework { return StatusCode::FAILURE; } - m_originMap.clear(); - float genFiltHT(0.), genFiltMET(0.); ATH_CHECK( getGenFiltVars(truthPC, genFiltHT, genFiltMET) ); diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/src/Truth3CollectionMaker.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/src/Truth3CollectionMaker.cxx index 8ec3bdbc0f375958ecc2caa75f433fc8880bd18e..8252ce607b27c7662dcb3b6431a7941dcd3e8474 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/src/Truth3CollectionMaker.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/src/Truth3CollectionMaker.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ ///////////////////////////////////////////////////////////////// @@ -106,21 +106,20 @@ StatusCode DerivationFramework::Truth3CollectionMaker::addBranches() const m_ntotpart += nParticles; // Set up decorators - SG::AuxElement::Decorator< ElementLink<xAOD::TruthParticleContainer> > linkDecorator("originalTruthParticle"); - SG::AuxElement::Decorator< int > originDecorator("particleMotherPdgId"); - SG::AuxElement::Decorator< int > typeDecorator("particleOriginBarcode"); - SG::AuxElement::Decorator< float > typeDecoratorMass("particleOriginMass"); - SG::AuxElement::Decorator< int > tauprongDecorator("nprong"); - SG::AuxElement::Decorator< int > tautypeDecorator("islep"); + static const SG::AuxElement::Decorator< ElementLink<xAOD::TruthParticleContainer> > linkDecorator("originalTruthParticle"); + static const SG::AuxElement::Decorator< int > originDecorator("particleMotherPdgId"); + static const SG::AuxElement::Decorator< int > typeDecorator("particleOriginBarcode"); + static const SG::AuxElement::Decorator< float > typeDecoratorMass("particleOriginMass"); + static const SG::AuxElement::Decorator< int > tauprongDecorator("nprong"); + static const SG::AuxElement::Decorator< int > tautypeDecorator("islep"); std::vector<int> entries; // Execute the text parsers and update the mask if (!m_partString.empty()) { - entries = m_parser->evaluateAsVector(); - unsigned int nEntries = entries.size(); + entries = m_parser->evaluateAsVector(); // check the sizes are compatible - if (nParticles != nEntries ) { + if (nParticles != entries.size() ) { ATH_MSG_ERROR("Sizes incompatible! Are you sure your selection string used TruthParticles?"); return StatusCode::FAILURE; } else { @@ -129,7 +128,7 @@ StatusCode DerivationFramework::Truth3CollectionMaker::addBranches() const ElementLink<xAOD::TruthParticleContainer> eltp(*importedTruthParticles,i); if (entries[i]==1) { - xAOD::TruthParticle* theParticle = const_cast<xAOD::TruthParticle*>( (*importedTruthParticles)[i] ); + const xAOD::TruthParticle* theParticle = (*importedTruthParticles)[i]; //SUSYTRUTH definitions are based on Appendix A in http://arxiv.org/pdf/1403.4853v1.pdf.