9 const std::string& name,
10 const IInterface *parent) :
20 return StatusCode::SUCCESS;
29 if (0 == nInputEvents) {
32 return StatusCode::RECOVERABLE;
34 ATH_MSG_VERBOSE( this->name()<<
"::prepareEvent: there are " << nInputEvents <<
" subevents in this event.");
46 return StatusCode::FAILURE;
49 return StatusCode::SUCCESS;
58 while (iEvt != eSubEvents){
62 ATH_MSG_VERBOSE( this->name()<<
"::processBunchXing: SubEvt McEventCollection from StoreGate " << seStore.name() <<
" of PileUpType " << iEvt->type() );
65 static_cast<int>(iEvt->type()), iEvt->time()));
69 return StatusCode::SUCCESS;
76 return StatusCode::SUCCESS;
84 ATH_CHECK(outputMcEventCollection.
record(std::make_unique<McEventCollection>()));
88 TimedTruthList truthList;
92 const unsigned int nInputMcEventColls=truthList.size();
93 if (0 == nInputMcEventColls) {
95 return StatusCode::SUCCESS;
98 ATH_MSG_DEBUG(
"execute: there are " << nInputMcEventColls <<
" subevents in this event.");
100 TimedTruthList::iterator timedTruthListIter(truthList.begin()), endOfTimedTruthList(truthList.end());
102 while (timedTruthListIter != endOfTimedTruthList) {
103 ATH_MSG_VERBOSE( this->name()<<
"::processBunchXing: SubEvt McEventCollection of PileUpType " << timedTruthListIter->first.type() );
106 ATH_CHECK(this->
processEvent(pBackgroundMcEvtColl, outputMcEventCollection.
ptr(),
static_cast<int>(timedTruthListIter->first.type()), timedTruthListIter->first.time()));
108 ++timedTruthListIter;
112 return StatusCode::SUCCESS;
117 ATH_MSG_VERBOSE( this->name()<<
"::processEvent() Event Type: " << pileupType );
118 if (!outputMcEventCollection) {
119 ATH_MSG_ERROR( this->name()<<
"::processEvent() was passed an null output McEventCollection pointer." );
120 return StatusCode::FAILURE;
123 ATH_MSG_ERROR( this->name()<<
"::processEvent() was passed an null input McEventCollection pointer." );
124 return StatusCode::FAILURE;
126 if (!pMcEvtColl->
empty()) {
127 for (
unsigned int iEv=0; iEv<pMcEvtColl->
size(); iEv++) {
128 const HepMC::GenEvent& c_evt(*((*pMcEvtColl)[iEv]));
130 HepMC::GenEvent * evt =
new HepMC::GenEvent(c_evt);
132 const int bunchCrossingTime=
static_cast<int>(timeOffset);
133 evt->add_attribute(
"BunchCrossingTime",std::make_shared<HepMC3::IntAttribute>(bunchCrossingTime));
134 evt->add_attribute(
"PileUpType",std::make_shared<HepMC3::IntAttribute>(pileupType));
135 for (
const auto& itVer: evt->vertices()) {
136 HepMC::FourVector newPos(itVer->position().x(),itVer->position().y(),itVer->position().z(),itVer->position().t()+timeOffset);
137 itVer->set_position(newPos);
141 HepMC::GenEvent * evt =
new HepMC::GenEvent(c_evt);
142 for (HepMC::GenEvent::vertex_iterator itVer=evt->vertices_begin(); itVer!=evt->vertices_end(); ++itVer) {
143 HepMC::FourVector newPos((*itVer)->position().x(),(*itVer)->position().y(),(*itVer)->position().z(),(*itVer)->position().t()+timeOffset);
144 (*itVer)->set_position(newPos);
150 return StatusCode::SUCCESS;
157 ATH_MSG_INFO (
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" );
159 ATH_MSG_INFO (
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" );
161 while(outputEventItr!=endOfEvents) {
163 const int event_number((*outputEventItr)->event_number());
164 ATH_MSG_INFO (
"GenEvent #"<<event_number<<
", signal_process_id="<<signal_process_id<<
", number of Vertices="<<(*outputEventItr)->vertices_size() );
167 std::ofstream of(fname);
168 const HepMC::GenEvent *evt=(*outputEventItr);
173 ATH_MSG_INFO (
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" );
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
DataModel_detail::const_iterator< DataVector > const_iterator
Standard const_iterator.
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.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
bool empty() const noexcept
Returns true if the collection is empty.
This defines the McEventCollection, which is really just an ObjectVector of McEvent objectsFile: Gene...
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
pointer_type ptr()
Dereference the pointer.
The Athena Transient Store API.
StatusCode retrieve(const T *&ptr) const
Retrieve the default object into a const T*.
void line(std::ostream &os, const GenEvent &e)
int signal_process_id(const GenEvent &e)
void fillBarcodesAttribute(GenEvent *)
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
std::list< value_t > type
type of the collection of timed data object