|
ATLAS Offline Software
|
Go to the documentation of this file.
6 #include "AthLinks/ElementLink.h"
11 #include "GaudiKernel/MsgStream.h"
12 #include "GaudiKernel/DataSvc.h"
13 #include "GaudiKernel/PhysicalConstants.h"
33 return StatusCode::SUCCESS;
41 ATH_MSG_WARNING(
"xAOD LightLeptons Truth Particles are already available in the event");
42 return StatusCode::SUCCESS;
47 ATH_CHECK(xTruthParticleContainerLightLepton.
record(std::make_unique<xAOD::TruthParticleContainer>(), std::make_unique<xAOD::TruthParticleAuxContainer>()));
50 if (!xTruthEventContainerReadHandle.
isValid()) {
51 ATH_MSG_ERROR(
"Could not retrieve xAOD::TruthEventContainer with key:" <<
53 return StatusCode::FAILURE;
57 for (itr = xTruthEventContainerReadHandle->
begin(); itr!=xTruthEventContainerReadHandle->
end(); ++itr) {
59 unsigned int nPart = (*itr)->nTruthParticles();
60 std::vector<int> uniqueID_list;
64 for (
unsigned int iPart = 0; iPart < nPart; ++iPart) {
73 if (uniqueID_list.size() > 0){
74 found = (
std::find(uniqueID_list.begin(), uniqueID_list.end(), my_uniqueID) != uniqueID_list.end());
79 uniqueID_list.push_back(my_uniqueID);
86 xTruthParticleContainerLightLepton->
push_back( xTruthParticle );
91 if (zero_uniqueID != 0 || dup_uniqueID != 0)
ATH_MSG_INFO(
"Found " << zero_uniqueID <<
" uniqueID 0 particles and " <<dup_uniqueID <<
"duplicated");
96 return StatusCode::SUCCESS;
Const iterator class for DataVector/DataList.
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
std::string find(const std::string &s)
return a remapped string
SG::WriteHandleKey< xAOD::TruthParticleContainer > m_xaodTruthParticleContainerNameLightLeptonKey
An algorithm that can be simultaneously executed in multiple threads.
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
xAODTruthParticleSlimmerLightLepton(const std::string &name, ISvcLocator *svcLoc)
Regular algorithm constructor.
::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.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
constexpr int UNDEFINED_ID
SG::ReadHandleKey< xAOD::TruthEventContainer > m_xaodTruthEventContainerNameReadHandleKey
The key for the output xAOD truth containers.
virtual StatusCode initialize()
Function initialising the algorithm.
virtual StatusCode execute(const EventContext &context) const
Function executing the algorithm.
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.
const_iterator end() const noexcept
Return a const_iterator pointing past 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)
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.