Commit cf60403b authored by Vakhtang Tsulaia's avatar Vakhtang Tsulaia
Browse files

Merge branch 'hepmc3_22.10.21_rivet' into 'master'

Fix Rivet errors due to absent GenRunInfo in HepMC3 branch

See merge request atlas/athena!47537
parents 9f9842a3 8808df60
......@@ -64,7 +64,16 @@ inline McEventCollection& McEventCollection::operator=(const McEventCollection&
//
for (const HepMC::GenEvent* ev : in)
{
DataVector<HepMC::GenEvent>::push_back(new HepMC::GenEvent(*ev));
HepMC::GenEvent* nev = new HepMC::GenEvent(*ev);
#ifdef HEPMC3
auto ri = ev->run_info();
if (ri) {
std::shared_ptr<HepMC3::GenRunInfo> nri = std::make_shared<HepMC3::GenRunInfo>(*(ri.get()));
nev->set_run_info(nri);
}
#endif
DataVector<HepMC::GenEvent>::push_back(nev);
}
return *this;
......
......@@ -25,7 +25,6 @@
#include "Rivet/Tools/RivetYODA.hh"
#include <cstdlib>
#include <memory>
#include <regex>
......@@ -247,7 +246,6 @@ const HepMC::GenEvent* Rivet_i::checkEvent(const HepMC::GenEvent* event) {
// overwrite the HEPMC dummy event number with the proper ATLAS event number
const DataHandle<EventInfo> eventInfo;
if (StatusCode::SUCCESS == evtStore()->retrieve(eventInfo)) {
//int run=eventInfo->event_ID()->run_number();
uint64_t eventNumber = eventInfo->event_ID()->event_number();
modEvent->set_event_number((int)eventNumber);
}
......@@ -259,10 +257,10 @@ const HepMC::GenEvent* Rivet_i::checkEvent(const HepMC::GenEvent* event) {
modRunInfo = std::make_shared<HepMC3::GenRunInfo>(*(event->run_info().get()));
}
else {
ATH_MSG_ERROR("No run info, event weights size is " << event->weights().size() );
ATH_MSG_DEBUG("No run info, event weights size is " << event->weights().size() );
modRunInfo = std::make_shared<HepMC3::GenRunInfo>();
std::vector<std::string> w_names;
for (size_t i = 0; i < event->weights().size(); i++) { w_names.push_back(std::string("badweight")+std::to_string(i)); }
for (size_t i = 0; i < event->weights().size(); i++) { w_names.push_back(std::string("badweight") + std::to_string(i)); }
modRunInfo->set_weight_names(w_names);
}
modEvent->set_run_info(modRunInfo);
......@@ -337,8 +335,6 @@ const HepMC::GenEvent* Rivet_i::checkEvent(const HepMC::GenEvent* event) {
#endif
#ifdef HEPMC3
//ATH_MSG_ALWAYS("BEAM ENERGY = " << beams[0]->momentum().e());
//ATH_MSG_ALWAYS("UNITS == MEV = " << std::boolalpha << (modEvent->momentum_unit() == HepMC::Units::MEV));
modEvent->set_units(HepMC3::Units::GEV, HepMC3::Units::MM);
return modEvent;
#else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment