#include "ATOOLS/Org/CXXFLAGS_PACKAGES.H" #include "MODEL/Main/Model_Base.H" #include "MODEL/Main/Running_AlphaQED.H" #include "PHASIC++/Main/Phase_Space_Handler.H" #include "ATOOLS/Org/Message.H" #include "ATOOLS/Org/MyStrStream.H" #include "ATOOLS/Org/Library_Loader.H" #include "ATOOLS/Org/Run_Parameter.H" #include #include #include "AddOns/GoSam/GoSam_Interface.H" using namespace GoSam; using namespace PHASIC; using namespace MODEL; using namespace ATOOLS; using namespace std; extern "C" { // initialisation void OLP_Start(const char * filename, int* success); void gosam_start() { int success(0); OLP_Start("none",&success); } // finalisation void gosam_finish() {} // information void OLP_Info(char * olp_name,char * olp_version,char * message); void gosam_info(char* str) { OLP_Info(str,str,str); } // parameter setting void OLP_SetParameter(const char* name, const double* re, const double* im, int* ierr); void gosam_setparameter_complex(const char* key, const double* reval, const double* imval, int* ierr) { OLP_SetParameter(key,reval,imval,ierr); } void gosam_setparameter_double(const char* key, const double* val, int* ierr) { const double im(0.); OLP_SetParameter(key,val,&im,ierr); } void gosam_setparameter_int(const char* key, const int* val, int* ierr) { const double re(*val), im(0.); OLP_SetParameter(key,&re,&im,ierr); } void gosam_setparameter_string(const char* key, const char* val, int* ierr) { msg_Out()< GoSam_Interface::s_procmap; std::string GoSam_Interface::s_gosamprefix = std::string(""); bool GoSam_Interface::s_ignore_model = false; bool GoSam_Interface::s_exit_on_error = true; size_t GoSam_Interface::s_vmode = 0; bool GoSam_Interface::s_newlibs = false; GoSam_Interface::GoSam_Interface() : ME_Generator_Base("GoSam") { RegisterDefaults(); } GoSam_Interface::~GoSam_Interface() { gosam_finish(); } void GoSam_Interface::RegisterDefaults() const { Settings& s = Settings::GetMainSettings(); s["GOSAM_VERBOSITY"].SetDefault("0"); s["GOSAM_VMODE"].SetDefault(0); s["GOSAM_EXIT_ON_ERROR"].SetDefault(1); s["GOSAM_IGNORE_MODEL"].SetDefault(0); // find GS installation prefix with several overwrite options s_gosamprefix = rpa->gen.Variable("SHERPA_CPP_PATH")+"/Process/GoSam"; if (stat(s_gosamprefix.c_str(), nullptr) != 0) s_gosamprefix = GOSAM_PREFIX; s["GOSAM_PREFIX"].SetDefault(s_gosamprefix); s_gosamprefix = s["GOSAM_PREFIX"].Get(); } bool GoSam_Interface::Initialize(MODEL::Model_Base *const model, BEAM::Beam_Spectra_Handler *const beam, PDF::ISR_Handler *const isr) { msg_Info()<<"Initialising GoSam generator from "<(); if (s_ignore_model) msg_Info()<(); s_vmode = s["GOSAM_VMODE"].Get(); msg_Tracking()<AddPath(s_gosamprefix+"/lib"); if (!s_loader->LoadLibrary("gosam")) THROW(fatal_error, "Failed to load libgosam."); // set OL verbosity std::string gosam_verbosity = s["GOSAM_VERBOSITY"].Get(); SetParameter("Verbosity",gosam_verbosity); // tell OL about the current model and check whether accepted if (!s_ignore_model) SetParameter("Model", MODEL::s_model->Name()); // we give parameters to GoSam as alpha(MZ) and masses SetParameter("EWScheme","alphaMZ"); // ew-renorm-scheme to Gmu by default switch (ToType(rpa->gen.Variable("EW_REN_SCHEME"))) { case 1: SetParameter("EWRenormalisationScheme","alpha0"); break; case 2: SetParameter("EWRenormalisationScheme","alphaMZ"); break; case 3: SetParameter("EWRenormalisationScheme","alphaGF"); break; default: THROW(fatal_error,"Unknown electroweak renormalisation scheme."); break; } // set couplings to unity (corrected in interface) GoSam_Interface::SetParameter("alpha", MODEL::aqed->Default()); // GoSam_Interface::SetParameter("alpha_s", AlphaQCD()); // set particle masses/widths // Flavour_Vector flavs(MODEL::s_model->IncludedFlavours()); // for (size_t i(0); iScalarNumber(std::string("YukawaScheme"))==1) // SetParameter("muy("+ToString(flavs[i].Kfcode())+")", Flavour(kf_h0).Mass(true)); // else // SetParameter("muy("+ToString(flavs[i].Kfcode())+")", flavs[i].Yuk()); // } // } // } // if (s_model->ComplexConstant("CKM_0_2")!=Complex(0.0,0.0) || // s_model->ComplexConstant("CKM_2_0")!=Complex(0.0,0.0)) { // SetParameter("CKMorder", 3); // } // else if (s_model->ComplexConstant("CKM_1_2")!=Complex(0.0,0.0) || // s_model->ComplexConstant("CKM_2_1")!=Complex(0.0,0.0)) { // SetParameter("CKMorder", 2); // } // else if (s_model->ComplexConstant("CKM_0_1")!=Complex(0.0,0.0) || // s_model->ComplexConstant("CKM_1_0")!=Complex(0.0,0.0)) { // SetParameter("CKMorder", 1); // } // else { // SetParameter("CKMorder", 0); // } // set remaining GoSam parameters specified by user for (const auto& key : s["GOSAM_PARAMETERS"].GetKeys()) { const auto val = s["GOSAM_PARAMETERS"][key].SetDefault("").Get(); SetParameter(key, val); } // instruct GoSam to return I instead of V if (s_vmode&2) SetParameter("VMode","I"); char infostr[700]; gosam_info(infostr); msg_Info()<gen.AddCitation(1,cite.str()); return true; } int GoSam_Interface::RegisterProcess(const Subprocess_Info& is, const Subprocess_Info& fs) { DEBUG_FUNC(""); string shprocname(PHASIC::Process_Base::GenerateName(is,fs)),gsprocname(""); Flavour_Vector isflavs(is.GetExternal()); for (size_t i=0; i::const_iterator it=s_procmap.begin(); it!=s_procmap.end();++it) msg_Tracking()<first<<": "<second< pp(5*momenta.size()); for (size_t i=0; i loop(4); gosam_evaluate_loop(&id, &pp[0], &mu, &loop[0], &accu); virt.Finite()=loop[2]; virt.IR()=loop[1]; virt.IR2()=loop[0]; born=loop[3]; msg_Debugging()<<"Born = "<:: operator()(const ME_Generator_Key &key) const { return new GoSam::GoSam_Interface(); } void ATOOLS::Getter:: PrintInfo(ostream &str,const size_t width) const { str<<"Interface to the GoSam loop ME generator"; }