|
ATLAS Offline Software
|
Go to the documentation of this file.
10 #include "GaudiKernel/SystemOfUnits.h"
13 const std::string&
name,
23 return StatusCode::SUCCESS;
29 ATH_MSG_DEBUG (
"prepareEvent: there are " << nInputEvents <<
" subevents in this event." );
33 return StatusCode::SUCCESS;
42 while (iEvt != eSubEvents) {
45 bunchXing, iEvt).isSuccess()) {
47 if ( !inputTruthParticleContainer ) {
49 return StatusCode::FAILURE;
51 ATH_MSG_DEBUG (
"processBunchXing: bunch Crossing = " << bunchXing <<
" xAOD::TruthParticleContainer size = " << inputTruthParticleContainer->size());
59 ATH_MSG_DEBUG (
"processBunchXing: No TruthParticleContainer found." );
67 return StatusCode::SUCCESS;
75 ATH_MSG_ERROR(
"mergeEvent: Failed to record InTimeOutputTruthParticleContainer");
76 return StatusCode::FAILURE;
82 return StatusCode::SUCCESS;
89 ATH_MSG_DEBUG(
"Check Aux store: " << pTruthParticles <<
" ... " << &pTruthParticles->
auxbase() <<
" ... " << pTruthParticlesAux );
90 if ( !pTruthParticlesAux ) {
91 ATH_MSG_ERROR(
"Unable to retrieve xAOD::TruthParticleAuxContainer");
92 return StatusCode::FAILURE;
95 if ( evtStore()->
record(pTruthParticlesAux, truthParticleContainerName+
"Aux.").isFailure() ) {
96 ATH_MSG_ERROR(
"Unable to write new xAOD::TruthParticleAuxContainer to event store: " << truthParticleContainerName);
97 return StatusCode::FAILURE;
100 if ( evtStore()->
record(pTruthParticles, truthParticleContainerName).isFailure() ) {
101 ATH_MSG_ERROR(
"Unable to write new xAOD::TruthParticleContainer to event store: " << truthParticleContainerName);
102 return StatusCode::FAILURE;
104 ATH_MSG_DEBUG(
"Created new xAOD::TruthParticleContainer in event store: " << truthParticleContainerName);
105 return StatusCode::SUCCESS;
118 TruthParticleList truthList;
120 if (!truthList.empty()) {
122 TruthParticleList::const_iterator truthParticleColl_iter(truthList.begin());
123 const TruthParticleList::const_iterator endOfTruthParticleColls(truthList.end());
124 while (truthParticleColl_iter!=endOfTruthParticleColls) {
125 const int eventNumber{
static_cast<int>((truthParticleColl_iter)->
first.index())};
134 ++truthParticleColl_iter;
138 ATH_MSG_DEBUG (
"processAllSubEvents: TruthParticleList is empty" );
142 ATH_MSG_ERROR (
"processAllSubEvents: Can not find TruthParticleList" );
146 ATH_MSG_ERROR (
"processAllSubEvents: Failed to record InTimeOutputTruthParticleContainer" );
147 return StatusCode::FAILURE;
154 return StatusCode::SUCCESS;
160 if (!inputTruthParticleContainer || !outputTruthParticleContainer) {
return StatusCode::FAILURE; }
167 outputTruthParticleContainer->
push_back(xTruthParticle);
168 *xTruthParticle = *theParticle;
170 eventNumberAccessor(*xTruthParticle) =
eventNumber;
172 return StatusCode::SUCCESS;
virtual StatusCode processAllSubEvents(const EventContext &ctx) override final
Merge the Truth TruthParticleContainers using the PileUpMergeSvc.
MergeTruthParticlesTool(const std::string &type, const std::string &name, const IInterface *parent)
Helper class to provide type-safe access to aux data.
Gaudi::Property< bool > m_includeSignalTruthParticles
Gaudi::Property< std::string > m_inputTruthParticleCollKey
#define ATH_MSG_VERBOSE(x)
ServiceHandle< PileUpMergeSvc > m_pMergeSvc
virtual StatusCode mergeEvent(const EventContext &ctx) override final
called at the end of the subevts loop.
virtual StatusCode processBunchXing(int bunchXing, SubEventIterator bSubEvents, SubEventIterator eSubEvents) override final
called for each active bunch-crossing to process current SubEvents bunchXing is in ns
const SG::AuxVectorBase & auxbase() const
Convert to AuxVectorBase.
std::list< value_t > type
type of the collection of timed data object
StatusCode initialize() override final
Initialize.
Auxiliary store for the truth vertices.
::StatusCode StatusCode
StatusCode definition for legacy code.
Class describing a truth particle in the MC record.
TruthParticle_v1 TruthParticle
Typedef to implementation.
virtual StatusCode prepareEvent(const EventContext &ctx, unsigned int nInputEvents) override final
called before the subevts loop.
virtual StatusCode processTruthParticleContainer(const xAOD::TruthParticleContainer *inputTruthParticleContainer, xAOD::TruthParticleContainer *outputTruthParticleContainer, int eventNumber)
TruthParticleContainer Loop.
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.
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.
StatusCode record(const xAOD::TruthParticleContainer *pTruthParticles, const std::string &truthParticleContainerName) const
xAOD::TruthParticleContainer * m_inTimeOutputTruthParticleContainer
size_type size() const noexcept
Returns the number of elements in the collection.
Gaudi::Property< std::string > m_inTimeOutputTruthParticleCollKey