Page MenuHomeHEPForge

No OneTemporary

diff --git a/FixedOrderGen/src/main.cc b/FixedOrderGen/src/main.cc
index 6fe8cd6..dc53162 100644
--- a/FixedOrderGen/src/main.cc
+++ b/FixedOrderGen/src/main.cc
@@ -1,129 +1,132 @@
/**
* Name: main.cc
* Authors: Jeppe R. Andersen
*/
#include <fstream>
#include <algorithm>
#include <memory>
#include <chrono>
#include <iostream>
#include "yaml-cpp/yaml.h"
#include "LHEF/LHEF.h"
#include "RHEJ/CombinedEventWriter.hh"
#include "RHEJ/get_analysis.hh"
#include "RHEJ/utility.hh"
#include "RHEJ/PDF.hh"
//#include "RHEJ/EventReweighter.hh"
#include "RHEJ/config.hh"
#include "RHEJ/stream.hh"
#include "RHEJ/MatrixElement.hh"
#include "RHEJ/LesHouchesWriter.hh"
#include "PhaseSpacePoint.hh"
RHEJ::Config load_config(char const * filename){
try{
return RHEJ::load_config(filename);
}
catch(std::exception const & exc){
std::cerr << "Error: " << exc.what() << '\n';
std::exit(EXIT_FAILURE);
}
}
std::unique_ptr<RHEJ::Analysis> get_analysis(
YAML::Node const & parameters
){
try{
return RHEJ::get_analysis(parameters);
}
catch(std::exception const & exc){
std::cerr << "Failed to load analysis: " << exc.what() << '\n';
std::exit(EXIT_FAILURE);
}
}
int main(int argn, char** argv) {
std::cout << " __ ___ __ ______ __ __ \n";
std::cout << " / / / (_)___ _/ /_ / ____/___ ___ _________ ___ __ / /__ / /______ \n";
std::cout << " / /_/ / / __ `/ __ \\ / __/ / __ \\/ _ \\/ ___/ __ `/ / / / __ / / _ \\/ __/ ___/ \n";
std::cout << " / __ / / /_/ / / / / / /___/ / / / __/ / / /_/ / /_/ / / /_/ / __/ /_(__ ) \n";
std::cout << " /_/ /_/_/\\__, /_/ /_/ /_____/_/ /_/\\___/_/ \\__, /\\__, / \\____/\\___/\\__/____/ \n";
std::cout << " ____///__/ __ ____ ///__//____/ ______ __ \n";
std::cout << " / ____(_) _____ ____/ / / __ \\_________/ /__ _____ / ____/__ ____ ___ _________ _/ /_____ _____\n";
std::cout << " / /_ / / |/_/ _ \\/ __ / / / / / ___/ __ / _ \\/ ___/ / / __/ _ \\/ __ \\/ _ \\/ ___/ __ `/ __/ __ \\/ ___/\n";
std::cout << " / __/ / /> </ __/ /_/ / / /_/ / / / /_/ / __/ / / /_/ / __/ / / / __/ / / /_/ / /_/ /_/ / / \n";
std::cout << " /_/ /_/_/|_|\\___/\\__,_/ \\____/_/ \\__,_/\\___/_/ \\____/\\___/_/ /_/\\___/_/ \\__,_/\\__/\\____/_/ \n";
using clock = std::chrono::system_clock;
if (argn < 2) {
std::cerr << "\n# Usage:\n.FOgen config_file\n";
return EXIT_FAILURE;
}
const auto start_time = clock::now();
// read configuration
const RHEJ::Config config = load_config(argv[1]);
// RHEJ::istream in{argv[2]};
std::unique_ptr<RHEJ::Analysis> analysis = get_analysis(
config.analysis_parameters
);
assert(analysis != nullptr);
// Generate a matrix element:
RHEJ::MatrixElement ME(config.fixed_order_jets.def,config.fixed_order_jets.min_pt,config.log_correction,config.Higgs_coupling);
RHEJ::PDF pdf{230000,RHEJ::ParticleID::proton,RHEJ::ParticleID::proton};
-
+
RHEJ::LesHouchesWriter LHOfile{"HEJ.lh",LHEF::HEPRUP{}};
-
+
// Perform N trial generations
int nevent = 0;
while(nevent< config.trials){
if (int(10000.*nevent/config.trials) % 100 == 0)
std::cout << ".";
std::cout.flush();
-
+
// Generate phase space point
HEJFOG::PhaseSpacePoint psp{4,config.fixed_order_jets.def,config.fixed_order_jets.min_pt,5.0,pdf};
if (psp.weight()==0) continue;
-
+
RHEJ::Event ev{to_UnclusteredEvent(std::move(psp)), config.fixed_order_jets.def, config.fixed_order_jets.min_pt};
-
- // evaluate matrix element on this point
- ME.tree(pdf.Halphas(config.fixed_order_jets.min_pt), config.fixed_order_jets.min_pt,
- ev.incoming(), ev.outgoing(),false);
+
+ // evaluate matrix element on this point
+ ev.central().weight *= ME.tree(
+ pdf.Halphas(config.fixed_order_jets.min_pt),
+ config.fixed_order_jets.min_pt,
+ ev.incoming(), ev.outgoing(), false
+ )/(shat(ev)*shat(ev));
analysis->fill(ev);
LHOfile.write(ev);
// RHEJ::Event FO_event{
// RHEJ::UnclusteredEvent{reader.hepeup},
// config.fixed_order_jets.def, config.fixed_order_jets.min_pt,
// };
// auto resummed_events = rhej.reweight(
// FO_event,
// config.trials, config.scale_gen
// );
// const auto ev_class = rhej.last_event_class();
// ++nevent_class[ev_class];
// if(resummed_events.empty()) ++nfailed_class[ev_class];
// for(auto const & ev: resummed_events){
// analysis->fill(ev);
// writer.write(ev);
// }
nevent++;
} // main event loop
std::cout << std::endl;
std::chrono::duration<double> run_time = (clock::now() - start_time);
std::cout << "\nTask Runtime: " << run_time.count() << " seconds.\n";
return 0;
}

File Metadata

Mime Type
text/x-diff
Expires
Tue, Jan 21, 2:18 AM (1 d, 21 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4243640
Default Alt Text
(5 KB)

Event Timeline