#include "PDF/LHAPDF/LHAPDF_Fortran_Interface.H" #include "ATOOLS/Org/Run_Parameter.H" #include "ATOOLS/Org/Scoped_Settings.H" #include "ATOOLS/Org/Message.H" #include "ATOOLS/Org/CXXFLAGS_PACKAGES.H" #include "ATOOLS/Org/CXXFLAGS.H" #include "ATOOLS/Org/Library_Loader.H" #include "ATOOLS/Org/MyStrStream.H" #include "ATOOLS/Math/Random.H" #include #include #include #ifdef DARWIN #if __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_8 #define DIRENT_TYPE dirent #else #define DIRENT_TYPE const dirent #endif // Lion or earlier #else //DARWIN #define DIRENT_TYPE const dirent #endif //DARWIN #ifndef _D_EXACT_NAMLEN #define _D_EXACT_NAMLEN(ENTRY) ENTRY->d_namlen #endif using namespace PDF; using namespace ATOOLS; #include "LHAPDF/LHAPDF.h" LHAPDF_Fortran_Interface::LHAPDF_Fortran_Interface(const ATOOLS::Flavour _bunch, const std::string _set,const int _member) : m_anti(1) { m_set=_set; m_smember=_member; m_type="LHA["+m_set+"]"; m_bunch = _bunch; if (m_bunch==Flavour(kf_p_plus).Bar()) m_anti=-1; static std::set s_init; if (s_init.find(m_set)==s_init.end()) { if (m_smember!=0) msg_Info()<()); msg_Info()<(); if (m_disallowedflavour.size()) { msg_Info()<Get(); m_member=1+Min((int)(rn*abs(m_smember)),-m_smember-1); LHAPDF::initPDF(m_member); } } void LHAPDF_Fortran_Interface::CalculateSpec(const double& ix,const double& Q2) { double x=ix/m_rescale; double Q = sqrt(Q2); if (LHAPDF::hasPhoton()) m_fv=LHAPDF::xfxphoton(x,Q); else m_fv=LHAPDF::xfx(x,Q); } double LHAPDF_Fortran_Interface::GetXPDF(const ATOOLS::Flavour& infl) { for (size_t i(0);i6) { msg_Out()<<"WARNING in "<(LHAPDF::hasPhoton()?7:6)) { msg_Out()<<"WARNING in "< LHAPDF_ScanDir(const std::string &path) { msg_Debugging()< res; struct dirent **entries; int n(scandir(path.c_str(),&entries,&LHAPDF_DummyInclude,alphasort)); if (n<0) { msg_Error()<d_type==DT_DIR); #ifdef ARCH_LINUX struct dirent **dentries; int n(scandir((path+"/"+entries[i]->d_name).c_str(), &dentries,&LHAPDF_DummyInclude,alphasort)); if (n>=0) isdir=true; #endif if (!isdir) { res.push_back(entries[i]->d_name); msg_Debugging()<<" "<d_name<<"\n"; } free(entries[i]); } free(entries); msg_Debugging()<<"}\n"; return res; } std::vector p_get_lhapdf; extern "C" void InitPDFLib() { Scoped_Settings s{ Settings::GetMainSettings()["LHAPDF"] }; if (s["GRID_PATH"].IsCustomised()) LHAPDF::setPDFPath(s["GRID_PATH"].Get()); std::vector files=LHAPDF_ScanDir(LHAPDF::pdfsetsPath()); p_get_lhapdf.resize(files.size()); for (size_t i(0);i