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());
65 unsigned int droppedSeparatorGenEvents{0};
66 int backupPileUpType{0};
67 int backupBunchCrossingTime{0};
70 if ( (*it)->event_number() == -1 ) {
71 ++droppedSeparatorGenEvents;
72 ATH_MSG_VERBOSE(
"Signal: Skipping a separator GenEvent. " << droppedSeparatorGenEvents <<
" skipped so far.");
73 backupBunchCrossingTime+=25;
79 if (bunchCrossingTime) {
87 copiedEvent->add_attribute(
HepMCStr::PileUpType,std::make_shared<HepMC3::IntAttribute>(pileupType->value()));
90 copiedEvent->add_attribute(
HepMCStr::PileUpType,std::make_shared<HepMC3::IntAttribute>(backupPileUpType));
91 if (backupPileUpType == 0) { backupPileUpType = 1; }
93 if (!copiedEvent->heavy_ion() && (*it)->heavy_ion()) {
97 copiedEvent->set_heavy_ion(std::move(hinew));
99 outputContainer->push_back(copiedEvent);
102 backupBunchCrossingTime = 0;
110 for ( ; it != bkgContainerPtr->
end(); ++it) {
111 if ( (*it)->event_number() == -1 ) {
112 ++droppedSeparatorGenEvents;
113 ATH_MSG_VERBOSE(
"Background: Skipping a separator GenEvent. " << droppedSeparatorGenEvents <<
" skipped so far.");
114 backupBunchCrossingTime+=25;
120 if (bunchCrossingTime) {
128 copiedEvent->add_attribute(
HepMCStr::PileUpType,std::make_shared<HepMC3::IntAttribute>(pileupType->value()));
131 copiedEvent->add_attribute(
HepMCStr::PileUpType,std::make_shared<HepMC3::IntAttribute>(backupPileUpType));
132 if (backupPileUpType == 0) { backupPileUpType = 1; }
134 if (!copiedEvent->heavy_ion() && (*it)->heavy_ion()) {
138 copiedEvent->set_heavy_ion(std::move(hinew));
140 outputContainer->push_back(copiedEvent);
143 ATH_MSG_VERBOSE(
"output size: " << outputContainer->size() <<
", Signal Input size: " << signalContainer->size() <<
", Bkg Input size: " << bkgContainerPtr->
size() <<
", dropped neutrino GenEvents: " << (
m_removeBkgHardScatterTruth ? 1 : 0) <<
" , dropped Separator GenEvents: " << droppedSeparatorGenEvents);
146 if (!outputContainer->empty()) {
155 return StatusCode::SUCCESS;