#include "SHERPA/Tools/Output_LHEF.H" #include "MODEL/Main/Running_AlphaS.H" #include "ATOOLS/Org/CXXFLAGS.H" #include "ATOOLS/Org/MyStrStream.H" #include "ATOOLS/Org/Run_Parameter.H" #include "ATOOLS/Org/Shell_Tools.H" #include "ATOOLS/Org/MyStrStream.H" #include "ATOOLS/Org/Exception.H" #include "ATOOLS/Org/My_File.H" #include "ATOOLS/Org/Scoped_Settings.H" #include "PDF/Main/PDF_Base.H" #include "ATOOLS/Org/My_MPI.H" #include #include #include using namespace SHERPA; using namespace ATOOLS; using namespace std; Output_LHEF::Output_LHEF(const Output_Arguments &args): Output_Base{ "LHEF" }, m_xs(1.0), m_xserr(1.0), m_max(1.0) { Settings& s = Settings::GetMainSettings(); RegisterDefaults(); m_basename=args.m_outpath+"/"+args.m_outfile; m_ext=".lhe"; const int precision = s["EVENT_OUTPUT_PRECISION"].Get(); m_bntp = s["LHEF_BNTP"].Get(); #ifdef USING__GZIP m_ext += ".gz"; #endif #ifdef USING__MPI if (mpi->Size()>1) m_basename+="_"+rpa->gen.Variable("RNG_SEED"); #endif m_outstream.open((m_basename+m_ext).c_str()); if (!m_outstream.good()) THROW(fatal_error, "Could not open event file "+m_basename+m_ext+"."); m_outstream.precision(precision); } void Output_LHEF::RegisterDefaults() const { Settings& s = Settings::GetMainSettings(); s["LHEF_BNTP"].SetDefault(0); s["LHEF_IDWTUP"].SetDefault(0); int PDFSUP1_default{ rpa->gen.PDF(0)?rpa->gen.PDF(0)->LHEFNumber():-1 }; int PDFSUP2_default{ rpa->gen.PDF(1)?rpa->gen.PDF(1)->LHEFNumber():-1 }; s["LHEF_PDF_NUMBER_1"].SetDefault(PDFSUP1_default); s["LHEF_PDF_NUMBER_2"].SetDefault(PDFSUP2_default); } Output_LHEF::~Output_LHEF() { m_outstream.close(); } void Output_LHEF::ChangeFile() { m_outstream.close(); std::string newname(m_basename+m_ext); for (size_t i(0);FileExists(newname); newname=m_basename+"."+ToString(++i)+m_ext); m_outstream.open(newname.c_str()); } void Output_LHEF::Header() { Settings& s = Settings::GetMainSettings(); const auto path = s.GetPath(); const auto files = s.GetConfigFiles(); m_outstream<<""<"< "< "<rdbuf(); m_outstream<<" "<"<"<gen.Beam1(); Flavour Beam2 = rpa->gen.Beam2(); int IDBMUP1 = (long int)Beam1; int IDBMUP2 = (long int)Beam2; double EBMUP1 = rpa->gen.PBeam(0)[0]; double EBMUP2 = rpa->gen.PBeam(1)[0]; int IDWTUP{ s["LHEF_IDWTUP"].Get() }; if (IDWTUP==0) IDWTUP=ToType(rpa->gen.Variable("EVENT_GENERATION_MODE"))==0?1:3; int NPRUP = 1; int PDFGUP1 = 0; int PDFGUP2 = 0; const int PDFSUP1{ s["LHEF_PDF_NUMBER_1"].Get() }; const int PDFSUP2{ s["LHEF_PDF_NUMBER_2"].Get() }; m_outstream<"<Weight()); Blob *sp(blobs->FindFirst(btp::Signal_Process)); m_outstream<<""<gen.PBeam(0)+rpa->gen.PBeam(1)); for (Blob_List::const_iterator blit=blobs->begin();blit!=blobs->end();++blit){ if ((*blit)->Type()==ATOOLS::btp::Signal_Process) { //LHE event information int NUP = (*blit)->NInP()+(*blit)->NOutP(); int IDPRUP = 1; double XWGTUP = weight; double SCALUP = sqrt((*(*blit))["Factorisation_Scale"]->Get()); if (SCALUP==0.0) SCALUP=sqrt((*(*blit))["Renormalization_Scale"]->Get()); if ((*(*blit))["Resummation_Scale"]) SCALUP=sqrt((*(*blit))["Resummation_Scale"]->Get()); if (SCALUP==0.0) SCALUP=sqrt((*(*blit))["Renormalization_Scale"]->Get()); double AQEDUP = -1.; double AQCDUP = mur2?(*MODEL::as)(mur2):-1.0; m_outstream<NInP();i++) { Vec4D p((*blit)->InParticle(i)->Momentum()); if (m_bntp) cms.Boost(p); m_outstream<InParticle(i)->Flav()<<" -1 0 0 " <InParticle(i)->GetFlow(1)<<" " <InParticle(i)->GetFlow(2)<<" " <InParticle(i)->FinalMass()<<" " <<" 0 9"<NOutP();i++) { Vec4D p((*blit)->OutParticle(i)->Momentum()); if (m_bntp) cms.Boost(p); m_outstream<OutParticle(i)->Flav()<<" 1 1 2 " <OutParticle(i)->GetFlow(1)<<" " <OutParticle(i)->GetFlow(2)<<" " <OutParticle(i)->FinalMass()<<" " <<" 0 9"<"<"); m_outstream<:: operator()(const Output_Arguments &args) const { return new Output_LHEF(args); } void ATOOLS::Getter:: PrintInfo(std::ostream &str,const size_t width) const { str<<"LHEF output"; }