6#include "AthLinks/ElementLink.h"
10#include "GaudiKernel/MsgStream.h"
11#include "GaudiKernel/DataSvc.h"
12#include "GaudiKernel/PhysicalConstants.h"
37 return StatusCode::SUCCESS;
45 ATH_MSG_WARNING(
"xAOD MET Truth Particles are already available in the event");
46 return StatusCode::SUCCESS;
51 ATH_CHECK(xTruthParticleContainerMET.
record(std::make_unique<xAOD::TruthParticleContainer>(), std::make_unique<xAOD::TruthParticleAuxContainer>()));
56 if ( !xTruthEventContainer.
isValid() )
59 return StatusCode::FAILURE;
67 for (itr = xTruthEventContainer->begin(); itr!=xTruthEventContainer->end(); ++itr) {
69 unsigned int nPart = (*itr)->nTruthParticles();
70 std::vector<int> uniqueID_list;
74 for (
unsigned int iPart = 0; iPart < nPart; ++iPart) {
83 if (uniqueID_list.size() > 0){
84 found = (std::find(uniqueID_list.begin(), uniqueID_list.end(), my_uniqueID) != uniqueID_list.end());
89 uniqueID_list.push_back(my_uniqueID);
102 xTruthParticleContainerMET->push_back( xTruthParticle );
105 *xTruthParticle=*theParticle;
110 if(zero_uniqueID != 0 || dup_uniqueID !=0 )
ATH_MSG_INFO(
"Found " << zero_uniqueID <<
" uniqueID=0 particles and " <<dup_uniqueID <<
"duplicated");
113 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
Helpers for checking error return status codes and reporting errors.
ATLAS-specific HepMC functions.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
ServiceHandle< StoreGateSvc > & evtStore()
DataModel_detail::const_iterator< DataVector > const_iterator
SG::Decorator< T, ALLOC > Decorator
virtual bool isValid() override final
Can the handle be successfully dereferenced?
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
SG::WriteHandleKey< xAOD::TruthParticleContainer > m_xaodTruthParticleContainerNameMET
The key for the output xAOD truth containers.
virtual StatusCode initialize()
Function initialising the algorithm.
virtual StatusCode execute()
Function executing the algorithm.
PublicToolHandle< IMCTruthClassifier > m_classif
SG::ReadHandleKey< xAOD::TruthEventContainer > m_xaodTruthEventContainerName
xAODTruthParticleSlimmerMET(const std::string &name, ISvcLocator *svcLoc)
Regular algorithm constructor.
bool isGenStable() const
Check if this is generator stable particle.
bool contains(const std::string &s, const std::string ®x)
does a string contain the substring
bool prompt(const xAOD::TruthParticle *part, ToolHandle< IMCTruthClassifier > &m_classif)
constexpr int UNDEFINED_ID
bool isInteracting(const T &p)
Identify if the particle with given PDG ID would not interact with the detector, i....
TruthParticle_v1 TruthParticle
Typedef to implementation.