10 #include "LHAPDF/LHAPDF.h"
11 #include "LHAPDF/PDFSet.h"
19 m_eventInfoName(
"EventInfo") {
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) {
80 if ( !truthEvent->pdfInfoParameter( pdg_id1, xAOD::TruthEvent::PdfParam::PDGID1 ) ) {
83 if ( !truthEvent->pdfInfoParameter( pdg_id2, xAOD::TruthEvent::PdfParam::PDGID2 ) ) {
86 if ( !truthEvent->pdfInfoParameter( pdf_id1, xAOD::TruthEvent::PdfParam::PDFID1 ) ) {
89 if ( !truthEvent->pdfInfoParameter( pdf_id2, xAOD::TruthEvent::PdfParam::PDFID2 ) ) {
92 if ( !truthEvent->pdfInfoParameter(
x1, xAOD::TruthEvent::PdfParam::X1 ) ) {
95 if ( !truthEvent->pdfInfoParameter(
x2, xAOD::TruthEvent::PdfParam::X2 ) ) {
98 if ( !truthEvent->pdfInfoParameter(
q, xAOD::TruthEvent::PdfParam::Q ) ) {
101 if ( !truthEvent->pdfInfoParameter( xf1, xAOD::TruthEvent::PdfParam::XF1 ) ) {
104 if ( !truthEvent->pdfInfoParameter( xf2, xAOD::TruthEvent::PdfParam::XF2 ) ) {
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) {