Skip to content
Snippets Groups Projects
Commit cec9c11c authored by Christian Gutschow's avatar Christian Gutschow
Browse files

21.6 make ATLAS event number available in Rivet

Replace HEPMC dummy event number with the proper ATLAS event number,
which can then be retrieved from within Rivet using
event.genEvent()->event_number()
parent 9ddc3f84
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,8 @@ atlas_depends_on_subdirs( PUBLIC
PRIVATE
Control/AthenaKernel
Generators/GeneratorObjects
Tools/PathResolver )
Tools/PathResolver
Event/EventInfo )
# External dependencies:
find_package( FastJet )
......@@ -32,12 +33,12 @@ atlas_add_library( Rivet_iLib
INCLUDE_DIRS ${RIVET_INCLUDE_DIRS}
PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${YODA_INCLUDE_DIRS} ${FASTJET_INCLUDE_DIRS} ${GSL_INCLUDE_DIRS}
LINK_LIBRARIES ${RIVET_LIBRARIES} AthenaBaseComps GaudiKernel
PRIVATE_LINK_LIBRARIES ${GSL_LIBRARIES} ${ROOT_LIBRARIES} ${HEPMC_LIBRARIES} ${YODA_LIBRARIES} ${FASTJET_LIBRARIES} AthenaKernel GeneratorObjects PathResolver )
PRIVATE_LINK_LIBRARIES ${GSL_LIBRARIES} ${ROOT_LIBRARIES} ${HEPMC_LIBRARIES} ${YODA_LIBRARIES} ${FASTJET_LIBRARIES} AthenaKernel GeneratorObjects PathResolver EventInfo )
atlas_add_component( Rivet_i
src/components/*.cxx
INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${YODA_INCLUDE_DIRS} ${FASTJET_INCLUDE_DIRS} ${RIVET_INCLUDE_DIRS} ${GSL_INCLUDE_DIRS}
LINK_LIBRARIES ${GSL_LIBRARIES} ${ROOT_LIBRARIES} ${HEPMC_LIBRARIES} ${YODA_LIBRARIES} ${FASTJET_LIBRARIES} ${RIVET_LIBRARIES} AthenaBaseComps GaudiKernel AthenaKernel GeneratorObjects PathResolver Rivet_iLib )
LINK_LIBRARIES ${GSL_LIBRARIES} ${ROOT_LIBRARIES} ${HEPMC_LIBRARIES} ${YODA_LIBRARIES} ${FASTJET_LIBRARIES} ${RIVET_LIBRARIES} AthenaBaseComps GaudiKernel AthenaKernel GeneratorObjects PathResolver EventInfo Rivet_iLib )
atlas_install_scripts(share/*.sh)
......
......@@ -13,6 +13,9 @@
#include "AthenaKernel/errorcheck.h"
#include "PathResolver/PathResolver.h"
#include "EventInfo/EventInfo.h"
#include "EventInfo/EventID.h"
#include "GaudiKernel/IAppMgrUI.h"
#include "GaudiKernel/Bootstrap.h"
#include "GaudiKernel/ITHistSvc.h"
......@@ -189,7 +192,7 @@ StatusCode Rivet_i::execute() {
const HepMC::GenEvent* checkedEvent = checkEvent(event);
// ATH_MSG_ALWAYS("CHK1 BEAM ENERGY = " << checkedEvent->beam_particles().first->momentum().e());
// ATH_MSG_ALWAYS("CHK1 UNITS == MEV = " << std::boolalpha << (checkedEvent->momentum_unit() == HepMC::Units::MEV));
//
if(!checkedEvent) {
ATH_MSG_ERROR("Check on HepMC event failed!");
return StatusCode::FAILURE;
......@@ -282,6 +285,14 @@ const HepMC::GenEvent* Rivet_i::checkEvent(const HepMC::GenEvent* event) {
std::vector<HepMC::GenParticle*> beams;
HepMC::GenEvent* modEvent = new 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();
int eventNumber = eventInfo->event_ID()->event_number();
modEvent->set_event_number(eventNumber);
}
if(m_weightName != ""){
if(event->weights().has_key(m_weightName)){
double weight = event->weights()[m_weightName];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment