|
ATLAS Offline Software
|
Go to the documentation of this file.
27 return StatusCode::SUCCESS;
41 ATH_MSG_ERROR(
"Could not get background McEventCollection container " << bkgContainer.
name() <<
" from store " << bkgContainer.
store());
42 return StatusCode::FAILURE;
44 bkgContainerPtr = bkgContainer.
cptr();
46 ATH_MSG_DEBUG(
"Found background McEventCollection container " << bkgContainer.
name() <<
" in store " << bkgContainer.
store());
50 if (!signalContainer.
isValid()) {
51 ATH_MSG_ERROR(
"Could not get signal McEventCollection container " << signalContainer.
name() <<
" from store " << signalContainer.
store());
52 return StatusCode::FAILURE;
54 ATH_MSG_DEBUG(
"Found signal McEventCollection container " << signalContainer.
name() <<
" in store " << signalContainer.
store());
58 ATH_CHECK(outputContainer.
record(std::make_unique<McEventCollection>()));
59 if (!outputContainer.
isValid()) {
60 ATH_MSG_ERROR(
"Could not record output McEventCollection container " << outputContainer.
name() <<
" to store " << outputContainer.
store());
61 return StatusCode::FAILURE;
63 ATH_MSG_DEBUG(
"Recorded output McEventCollection container " << outputContainer.
name() <<
" in store " << outputContainer.
store());
67 HepMC::GenEvent* copiedEvent =
new HepMC::GenEvent(**
it);
70 auto bunchCrossingTime = (*it)->attribute<HepMC3::IntAttribute>(
"BunchCrossingTime");
71 if (bunchCrossingTime) {
72 copiedEvent->add_attribute(
"BunchCrossingTime",std::make_shared<HepMC3::IntAttribute>(bunchCrossingTime->value()));
74 auto pileupType = (*it)->attribute<HepMC3::IntAttribute>(
"PileUpType");
76 copiedEvent->add_attribute(
"PileUpType",std::make_shared<HepMC3::IntAttribute>(pileupType->value()));
79 if (!copiedEvent->heavy_ion() && (*it)->heavy_ion()) {
83 HepMC::GenHeavyIonPtr hinew=std::make_shared<HepMC::GenHeavyIon>(*((*it)->heavy_ion()));
84 copiedEvent->set_heavy_ion(hinew);
86 copiedEvent->set_heavy_ion(*((*it)->heavy_ion()));
99 for ( ;
it != bkgContainerPtr->
end(); ++
it) {
100 HepMC::GenEvent* copiedEvent =
new HepMC::GenEvent(**
it);
103 auto bunchCrossingTime = (*it)->attribute<HepMC3::IntAttribute>(
"BunchCrossingTime");
104 if (bunchCrossingTime) {
105 copiedEvent->add_attribute(
"BunchCrossingTime",std::make_shared<HepMC3::IntAttribute>(bunchCrossingTime->value()));
107 auto pileupType = (*it)->attribute<HepMC3::IntAttribute>(
"PileUpType");
109 copiedEvent->add_attribute(
"PileUpType",std::make_shared<HepMC3::IntAttribute>(pileupType->value()));
112 if (!copiedEvent->heavy_ion() && (*it)->heavy_ion()) {
116 HepMC::GenHeavyIonPtr hinew=std::make_shared<HepMC::GenHeavyIon>(*((*it)->heavy_ion()));
117 copiedEvent->set_heavy_ion(hinew);
119 copiedEvent->set_heavy_ion(*((*it)->heavy_ion()));
128 if (!outputContainer->
empty()) {
130 for (
const HepMC::GenEvent *
event : *outputContainer) {
137 return StatusCode::SUCCESS;
SG::ReadHandleKey< McEventCollection > m_bkgInputKey
Const iterator class for DataVector/DataList.
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
const_pointer_type cptr()
Dereference the pointer.
const std::string & name() const
Return the StoreGate ID for the referenced object.
int signal_process_id(const GenEvent &e)
bool msgLvl(const MSG::Level lvl) const
#define ATH_MSG_VERBOSE(x)
const std::string & key() const
Return the StoreGate ID for the referenced object.
void fillBarcodesAttribute(GenEvent *)
An algorithm that can be simultaneously executed in multiple threads.
SG::ReadHandleKey< McEventCollection > m_signalInputKey
POOL::TEvent event(POOL::TEvent::kClassAccess)
virtual StatusCode initialize() override
::StatusCode StatusCode
StatusCode definition for legacy code.
std::string store() const
Return the name of the store holding the object we are proxying.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Gaudi::Property< bool > m_removeBkgHardScatterTruth
This defines the McEventCollection, which is really just an ObjectVector of McEvent objects.
SG::WriteHandleKey< McEventCollection > m_outputKey
virtual bool isValid() override final
Can the handle be successfully dereferenced?
virtual bool isValid() override final
Can the handle be successfully dereferenced?
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.
virtual StatusCode execute(const EventContext &ctx) const override
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
CopyMcEventCollection(const std::string &name, ISvcLocator *pSvcLocator)
bool empty() const noexcept
Returns true if the collection is empty.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.