10#include "LHAPDF/LHAPDF.h"
11#include "LHAPDF/PDFSet.h"
30 return StatusCode::FAILURE;
33 LHAPDF::pathsPrepend(
"/cvmfs/atlas.cern.ch/repo/sw/Generators/lhapdfsets/current");
39 return StatusCode::SUCCESS;
73 if (
sc.isFailure()) {
ATH_MSG_ERROR(
"Could not retrieve TruthEventContainer.");
return 0; }
77 for (
auto truthEvent : *truthEventContainer) {
110 ATH_MSG_DEBUG(
"Could not retrieve PDF information. xAODs generated with a version earlier than AtlasProduction-19.2.3.7 might have a bug that causes this. Please check your input xAOD. All PDF weights will be 1.");
114 if (xf1 == 0 || xf2 == 0) {
115 ATH_MSG_DEBUG(
"Skipping event, as this TruthEvent is not reliable.");
122 float reweighted_xf1 = 0;
123 float reweighted_xf2 = 0;
125 reweighted_xf1 =
m_pdf->xfxQ(pdg_id1, x1, q);
126 reweighted_xf2 =
m_pdf->xfxQ(pdg_id2, x2, q);
130 weight = reweighted_xf1*reweighted_xf2/(xf1*xf2);
142 if(
sc.isFailure() || !evtInfo) {
148 ATH_MSG_DEBUG (
" " << name() <<
" returning weight= " << weight <<
".");
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
std::string m_eventInfoName
double computeWeight(const xAOD::EventInfo *) const
virtual double getWeight() const override
returns: the value that was calculated from the usual Athena storegate
virtual double evaluate(const xAOD::IParticle *part) const override
returns: the value that was calculated from the xAOD::IParticle (composite built event object for ins...
std::string m_truthEventContainerName
StatusCode initialize() override
Usual initialize method of the framework.
PDFWeight(const std::string &name)
Create a proper constructor for Athena.
bool eventType(EventType type) const
Check for one particular bitmask value.
@ IS_SIMULATION
true: simulation, false: data
Class providing the definition of the 4-vector interface.
TruthEventContainer_v1 TruthEventContainer
Declare the latest version of the truth event container.
EventInfo_v1 EventInfo
Definition of the latest event info version.