Page MenuHomeHEPForge

No OneTemporary

diff --git a/src/LesHouchesReader.cc b/src/LesHouchesReader.cc
index c373fb0..70ff455 100644
--- a/src/LesHouchesReader.cc
+++ b/src/LesHouchesReader.cc
@@ -1,73 +1,74 @@
/**
* \authors The HEJ collaboration (see AUTHORS for details)
* \date 2022
* \copyright GPLv2 or later
*/
#include "HEJ/LesHouchesReader.hh"
#include "HEJ/Version.hh"
#include <vector>
namespace HEJ {
HEJ::generator get_generator(
LHEF::HEPRUP const & heprup, std::string const & header
){
// try getting generator name from specific tag
if(!heprup.generators.empty()){
std::string const & gen_name = heprup.generators.back().name;
if(gen_name == "HEJ" || gen_name == HEJ::Version::String())
return HEJ::generator::HEJ;
if(gen_name == "HEJ Fixed Order Generation")
return HEJ::generator::HEJFOG;
if(gen_name == "MadGraph5_aMC@NLO") return HEJ::generator::MG;
std::cerr << "Unknown LHE Generator " << gen_name
<< " using default LHE interface.\n";
return HEJ::generator::unknown;
}
// The generator tag is not always used -> check by hand
if(header.find("generated with HEJ")!=std::string::npos)
return HEJ::generator::HEJ;
if(header.find("# created by SHERPA")!=std::string::npos)
return HEJ::generator::Sherpa;
if(header.find("<MGVersion>")!=std::string::npos)
return HEJ::generator::MG;
std::cerr<<"Could not determine LHE Generator using default LHE interface.\n";
return HEJ::generator::unknown;
}
HEJLHEReader::HEJLHEReader(std::string const & filename):
LesHouchesReader{filename},
num_trials_{0.}, num_events_{0}
{
// LesHouchesReader tmp_reader{filename};
// reader().heprup.XSECUP = std::vector<double>{0};
// while(tmp_reader.read_event()){
// ++num_events_;
// num_trials_ += std::stod(tmp_reader.hepeup().attributes.at("trials"));
// reader().heprup.XSECUP.front() += tmp_reader.hepeup().XWGTUP;
// }
// reader().heprup.XSECUP.front() /= num_trials_;
-// Generator=get_generator(heprup(), header());
- Generator=HEJ::generator::HEJ;
+ Generator=get_generator(reader().heprup, reader().headerBlock);
// // For IDWTUP == 1 or 4 we assume avg(weight)=xs
// // With the modified weights we have in Sherpa sum(weight)=xs
// // -> overwrite IDWTUP to "something neutral"
reader().heprup.IDWTUP = reader().heprup.IDWTUP>0?3:-3;
}
bool HEJLHEReader::read_event() {
if(!LesHouchesReader::read_event()) return false;
if (Generator==HEJ::generator::Sherpa) {
++num_events_;
reader().heprup.XSECUP.front() *= num_trials_;
num_trials_ += std::stod(hepeup().attributes.at("trials"));
reader().heprup.XSECUP.front() += hepeup().XWGTUP;
reader().heprup.XSECUP.front() /= num_trials_;
+ } else {
+ reader().heprup.XSECUP.front() += hepeup().XWGTUP;
}
return true;
}
} // namespace HEJ

File Metadata

Mime Type
text/x-diff
Expires
Tue, Nov 19, 9:14 PM (22 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3806222
Default Alt Text
(2 KB)

Event Timeline