Page MenuHomeHEPForge

No OneTemporary

diff --git a/examples/AnalysisPrint.cc b/examples/AnalysisPrint.cc
index 4c0d801..522fe2b 100644
--- a/examples/AnalysisPrint.cc
+++ b/examples/AnalysisPrint.cc
@@ -1,78 +1,78 @@
//! HEJ analysis to output the cross section to a file
#include <cmath>
#include <fstream>
#include <iostream>
#include <memory>
#include <string>
#include "HEJ/Analysis.hh"
#include "HEJ/Event.hh"
#include "yaml-cpp/yaml.h"
#include "LHEF/LHEF.h"
namespace {
class AnalysisPrint: public HEJ::Analysis {
public:
AnalysisPrint(YAML::Node const & config, LHEF::HEPRUP const & heprup):
xsection_{0.}, xsection_error_{0.},
outfile_{config["output"].as<std::string>()},
generators_{heprup.generators}
{}
void fill(
HEJ::Event const & event,
HEJ::Event const & /* FO_event */
) override {
const double wt = event.central().weight;
xsection_ += wt;
xsection_error_ += wt*wt; // this error estimate is too small
}
bool pass_cuts(
HEJ::Event const & /* event */,
HEJ::Event const & /* FO_event */
) override {
return true;
}
void scale(double xsscale) override {
- // used to scale the cross sections and histograms before .finalise in case the
- // normalisation is unknown until the end of the run
+ // used to scale the cross sections and histograms before .finalise in case the
+ // normalisation is unknown until the end of the run
xsection_*=xsscale;
xsection_error_*=xsscale*xsscale;
- }
+ }
void finalise() override {
// print to screen
std::cout << "Generated with:\n";
for(auto const & generator: generators_)
std::cout << generator.name << " " << generator.version << "\n";
std::cout << "cross section: " << xsection_ << " +- "
<< std::sqrt(xsection_error_) << std::endl;
// print to file
std::ofstream fout{outfile_};
fout << "Generated with\n";
for(auto const & generator: generators_)
fout << generator.name << " " << generator.version << "\n";
fout << "cross section: " << xsection_ << " +- "
<< std::sqrt(xsection_error_) << std::endl;
}
private:
double xsection_, xsection_error_;
std::string outfile_;
std::vector<LHEF::Generator> generators_;
};
}
extern "C"
__attribute__((visibility("default")))
std::unique_ptr<HEJ::Analysis> make_analysis(
YAML::Node const & config, LHEF::HEPRUP const & heprup
){
return std::make_unique<AnalysisPrint>(config, heprup);
}

File Metadata

Mime Type
text/x-diff
Expires
Sat, Dec 21, 1:35 PM (20 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4022976
Default Alt Text
(2 KB)

Event Timeline