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 Electron Truth Particles are already available in the event");
41 return StatusCode::SUCCESS;
46 ATH_CHECK(xTruthParticleContainerElectron.
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 unsigned int nPart = (*itr)->nTruthParticles();
61 std::vector<int> uniqueID_list;
64 for (
unsigned int iPart = 0; iPart < nPart; ++iPart) {
72 if (uniqueID_list.size() > 0){
73 found = (
std::find(uniqueID_list.begin(), uniqueID_list.end(), my_uniqueID) != uniqueID_list.end());
78 uniqueID_list.push_back(my_uniqueID);
85 xTruthParticleContainerElectron->
push_back( xTruthParticle );
88 *xTruthParticle=*theParticle;
91 if (zero_uniqueID!=0 || dup_uniqueID!=0)
ATH_MSG_INFO(
"Found " << zero_uniqueID <<
" uniqueID=0 particles and " << dup_uniqueID <<
" duplicated");
94 return StatusCode::SUCCESS;
Const iterator class for DataVector/DataList.
std::string find(const std::string &s)
return a remapped string
virtual StatusCode execute()
Function executing 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.
bool isElectron(const xAOD::Egamma *eg)
is the object an electron (not Fwd)
Class describing a truth particle in the MC record.
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.
SG::ReadHandleKey< xAOD::TruthEventContainer > m_xaodTruthEventContainerName
constexpr int UNDEFINED_ID
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.
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)
xAODTruthParticleSlimmerElectron(const std::string &name, ISvcLocator *svcLoc)
Regular algorithm constructor.
SG::WriteHandleKey< xAOD::TruthParticleContainer > m_xaodTruthParticleContainerNameElectron
The key for the output xAOD truth containers.
virtual StatusCode initialize()
Function initialising the algorithm.