Loading [MathJax]/extensions/tex2jax.js
 |
ATLAS Offline Software
|
Go to the documentation of this file.
6 #include "AthLinks/ElementLink.h"
10 #include "GaudiKernel/MsgStream.h"
11 #include "GaudiKernel/DataSvc.h"
12 #include "GaudiKernel/PhysicalConstants.h"
32 return StatusCode::SUCCESS;
40 ATH_MSG_WARNING(
"xAOD Photon Truth Particles are already available in the event");
41 return StatusCode::SUCCESS;
46 ATH_CHECK(xTruthParticleContainerPhoton.
record(std::make_unique<xAOD::TruthParticleContainer>(), std::make_unique<xAOD::TruthParticleAuxContainer>()));
51 if ( !xTruthEventContainer.isValid() )
54 return StatusCode::FAILURE;
58 for (itr = xTruthEventContainer->begin(); itr!=xTruthEventContainer->end(); ++itr) {
60 std::vector<int> uniqueID_list;
64 unsigned int nPart = (*itr)->nTruthParticles();
66 for (
unsigned int iPart = 0; iPart < nPart; ++iPart) {
75 if (uniqueID_list.size() > 0){
76 found = (
std::find(uniqueID_list.begin(), uniqueID_list.end(), my_uniqueID) != uniqueID_list.end());
81 uniqueID_list.push_back(my_uniqueID);
88 xTruthParticleContainerPhoton->
push_back( xTruthParticle );
91 *xTruthParticle=*theParticle;
94 if (zero_uniqueID != 0 || dup_uniqueID != 0)
ATH_MSG_INFO(
"Found " << zero_uniqueID <<
" uniqueID zero particles and " <<dup_uniqueID<<
" duplicated");
97 return StatusCode::SUCCESS;
Const iterator class for DataVector/DataList.
SG::WriteHandleKey< xAOD::TruthParticleContainer > m_xaodTruthParticleContainerNamePhoton
The key for the output xAOD truth containers.
std::string find(const std::string &s)
return a remapped string
virtual StatusCode initialize()
Function initialising the algorithm.
const std::string & key() const
Return the StoreGate ID for the referenced object.
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
::StatusCode StatusCode
StatusCode definition for legacy code.
Class describing a truth particle in the MC record.
virtual StatusCode execute()
Function executing the algorithm.
TruthParticle_v1 TruthParticle
Typedef to implementation.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
constexpr int UNDEFINED_ID
SG::ReadHandleKey< xAOD::TruthEventContainer > m_xaodTruthEventContainerName
Helpers for checking error return status codes and reporting errors.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
xAODTruthParticleSlimmerPhoton(const std::string &name, ISvcLocator *svcLoc)
Regular algorithm constructor.
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
#define ATH_MSG_WARNING(x)
bool isPhoton(const xAOD::Egamma *eg)
is the object a photon