|
ATLAS Offline Software
|
Go to the documentation of this file.
8 #include "GaudiKernel/IEventProcessor.h"
9 #include "GaudiKernel/IAlgManager.h"
10 #include "GaudiKernel/IOpaqueAddress.h"
11 #include "GaudiKernel/IProperty.h"
12 #include "GaudiKernel/ClassID.h"
13 #include "GaudiKernel/IClassIDSvc.h"
15 #include "EventInfo/EventInfo.h"
52 return StatusCode::SUCCESS;
64 ATH_MSG_ERROR(
"Event number must be positive-definite; " << newnum <<
" is not allowed");
65 return StatusCode::FAILURE;
69 constexpr
long long int max32 =
std::pow(2, 31) - 1;
71 if (newnum >= max32) {
72 ATH_MSG_ERROR(
"Event number " << newnum <<
" exceeds 32bit limit. In HepMC2 it is not allowed.");
73 return StatusCode::FAILURE;
79 ATH_MSG_INFO(
"After " <<
m_nPass <<
" events we switch off HepMC3 warnings to avoid blowing up logs.");
80 HepMC3::Setup::set_print_warnings(
false);
91 HepMC::GenEvent* hepMC = *
evt;
97 return StatusCode::SUCCESS;
102 int inpRunNumber{-1};
106 ATH_CHECK(outputEvtInfoHandle.
record(std::make_unique<xAOD::EventInfo>(), std::make_unique<xAOD::EventAuxInfo>()));
108 outputEvtInfo = outputEvtInfoHandle.
ptr();
109 *outputEvtInfo = *inputEvtInfoHandle;
110 inpRunNumber = inputEvtInfoHandle->
runNumber();
113 outputEvtInfo->setMCEventWeights(mcWeights(0));
123 eventID->set_event_number(newnum);
127 return StatusCode::SUCCESS;
130 outputEvtInfo->setEventNumber(newnum);
150 return StatusCode::FAILURE;
154 outputEvtInfo->setMCChannelNumber(inpRunNumber);
155 outputEvtInfo->setMCEventNumber(newnum);
156 outputEvtInfo->setEventNumber(newnum);
163 unsigned int oldRunNumber = 0;
167 oldRunNumber = eventID->run_number();
177 return StatusCode::SUCCESS;
180 oldRunNumber = outputEvtInfo->runNumber();
186 auto newChannelNumber =
188 auto oldChannelNumber =
191 const char*
key =
"/Generation/Parameters";
202 if (collection->chanNum(
index) != oldChannelNumber) {
204 << collection->chanNum(
index));
208 if (collection->fixChanNum(oldChannelNumber, newChannelNumber))
210 << oldChannelNumber <<
" to " << newChannelNumber);
212 ATH_MSG_ERROR(
"Channel number update from " << oldChannelNumber
213 <<
" to " << newChannelNumber <<
" on \"" <<
key
220 const char*
key =
"/TagInfo";
230 for (
auto pair : *collection) {
232 if (pair.second.exists(
"mc_channel_number")) {
234 pair.second[
"mc_channel_number"].setValue(
255 ATH_MSG_INFO(
"Could not retrieve \"" <<
key <<
"\" from MetaDataStore");
263 SmartIF<IEventProcessor> apm(serviceLocator()->service(
"AthenaEventLoopMgr",
false));
272 return StatusCode::SUCCESS;
278 return StatusCode::SUCCESS;
def retrieve(aClass, aKey=None)
This class is a container for the payload of conditions data. It is intended to be used to store cond...
bool set_ll_event_number(HepMC::GenEvent *e, long long int num)
SG::WriteHandleKey< xAOD::EventInfo > m_outputEvtInfoKey
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
std::string m_inputKeyName
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
void set_mc_channel_number(number_type chan)
Add in the MC generator channel number (aka gen run number)
This class represents the "type of event" where the type is given by one or more "characteristics".
CountHepMC(const std::string &name, ISvcLocator *pSvcLocator)
This class provides general information about an event. It extends EventInfo with a list of sub-evts ...
This class is a collection of AttributeLists where each one is associated with a channel number....
uint32_t runNumber() const
The current event's run number.
number_type mc_channel_number() const
Access to the MC generator channel number (was used as run number for generator events)
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode execute() override
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
virtual StatusCode initialize() override
Base class for common behaviour of MC truth algorithms.
Handle class for reading a decoration on an object.
(Non-const) Iterator class for DataVector/DataList.
::StatusCode StatusCode
StatusCode definition for legacy code.
pointer_type ptr()
Dereference the pointer.
EventID * event_ID()
the unique identification of the event.
#define CHECK(...)
Evaluate an expression and check for errors.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
This defines the McEventCollection, which is really just an ObjectVector of McEvent objects.
This class is a container for the payload of conditions data. It is intended to be used to store cond...
std::string to_string(const DetectorType &type)
Helpers for checking error return status codes and reporting errors.
This class provides general information about an event. Event information is provided by the accessor...
Class describing the basic event information.
SG::ReadDecorHandleKey< xAOD::EventInfo > m_mcWeightsKey
void set_mc_event_number(uint64_t evt)
Add in the MC generator event number.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
#define ATH_MSG_WARNING(x)
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
Handle class for reading a decoration on an object.
SG::ReadHandleKey< xAOD::EventInfo > m_inputEvtInfoKey
ServiceHandle< StoreGateSvc > m_metaDataStore
virtual StatusCode finalize() override
constexpr int pow(int base, int exp) noexcept
virtual StatusCode initialize() override
EventType * event_type()
the type of the event, e.g. simulation, testbeam, etc
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.