forked from cepgen/cepgen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EventHarvester.h
79 lines (69 loc) · 2.28 KB
/
EventHarvester.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
* CepGen: a central exclusive processes event generator
* Copyright (C) 2019-2023 Laurent Forthomme
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <fstream>
#include "CepGen/EventFilter/EventExporter.h"
#include "CepGen/Utils/Histogram.h"
#include "CepGen/Utils/Value.h"
namespace cepgen {
class Event;
namespace utils {
class Drawer;
class EventBrowser;
} // namespace utils
/**
* \brief Handler for the generic text file output
* \author Laurent Forthomme <laurent.forthomme@cern.ch>
* \date Jul 2019
*/
class EventHarvester : public EventExporter {
public:
explicit EventHarvester(const ParametersList&);
virtual ~EventHarvester();
static ParametersDescription description();
void initialise() override;
void setCrossSection(const Value& cross_section) override { cross_section_ = cross_section; }
void operator<<(const Event&) override;
private:
const std::unique_ptr<utils::EventBrowser> browser_;
//--- variables definition
const bool show_hists_, save_hists_;
const std::string filename_;
std::ofstream file_;
std::unique_ptr<utils::Drawer> drawer_;
Value cross_section_{1., 0.};
unsigned long num_evts_{0ul};
/// Name of the physics process
std::string proc_name_;
/// 1D histogram definition
struct Hist1DInfo {
std::string var;
utils::Hist1D hist;
bool log;
};
/// List of 1D histograms
std::vector<Hist1DInfo> hists_;
/// 2D histogram definition
struct Hist2DInfo {
std::string var1, var2;
utils::Hist2D hist;
bool log;
};
/// List of 2D histograms
std::vector<Hist2DInfo> hists2d_;
};
} // namespace cepgen