cepgen is hosted by Hepforge, IPPP Durham
CepGen 1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
cepgenProbeOnePoint.cc
Go to the documentation of this file.
1/*
2 * CepGen: a central exclusive processes event generator
3 * Copyright (C) 2013-2024 Laurent Forthomme
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
20#include "CepGen/Generator.h"
24
25using namespace std;
26
27int main(int argc, char* argv[]) {
28 string input_card;
29 int num_scans;
30 using point_t = vector<double>;
31 point_t user_point;
32
33 const auto args = cepgen::ArgumentsParser(argc, argv)
34 .addArgument("input,i", "input card", &input_card)
35 .addOptionalArgument("point,p", "point to test", &user_point, point_t(12, 0.3))
36 .addOptionalArgument("scan,s", "number of values to scan for a non-zero ME", &num_scans, 0)
37 .parse();
38
39 if (args.debugging())
40 CG_LOG_LEVEL(debugInsideLoop);
41
43 gen.parseRunParameters(input_card);
45 CG_DEBUG("main") << gen.runParameters();
46
47 const auto ndim = gen.runParameters().process().ndim();
48 vector<point_t> points;
49 if (num_scans > 0) {
50 for (const auto& range : cepgen::Limits{0., 1.}.generate(num_scans))
51 points.emplace_back(ndim, range);
52 } else
53 points = vector<point_t>{user_point};
54 CG_DEBUG("main") << points;
55
56 vector<pair<point_t, double> > values;
57 for (auto& point : points) {
58 if (point.size() < 2)
59 point = point_t(ndim, point[0]);
60 else if (point.size() != ndim)
61 point.resize(ndim);
62 const double weight = gen.computePoint(point);
63 CG_DEBUG("main") << "point " << point << ": weight=" << weight;
64 if (weight > 0.)
65 values.emplace_back(make_pair(point, weight));
66 }
67 CG_LOG << "Points with non-zero values: " << values;
68
69 return 0;
70}
#define CG_LOG_LEVEL(type)
Definition Logger.h:83
#define CG_LOG
Definition Message.h:212
#define CG_DEBUG(mod)
Definition Message.h:220
A generic command line arguments parser.
ArgumentsParser & addArgument(Args &&... args)
Add a parameter required for the parser.
ArgumentsParser & parse()
Associate command-line arguments to parameters.
ArgumentsParser & addOptionalArgument(Args &&... args)
Add a non-mandatory parameters that can be parsed.
Core generator object allowing for process definition, cross section computation, and event generatio...
Definition Generator.h:48
double computePoint(const std::vector< double > &x)
Compute one single point from the total phase space.
Definition Generator.cpp:90
void parseRunParameters(const std::string &)
Read a steering card to populate the run parameters block.
Definition Generator.cpp:72
const RunParameters & runParameters() const
Pointer to the parameters block.
Definition Generator.cpp:76
Validity interval for a variable.
Definition Limits.h:28
std::vector< double > generate(size_t num_bins, bool log_scale=false) const
Generate a collection of values from a number of bins.
Definition Limits.cpp:113
proc::Process & process()
Process object for cross-section computation/events generation.
void initialise()
Initialise the process once the kinematics has been set.
Definition Process.cpp:285
size_t ndim() const
Number of dimensions on which the integration is performed.
Definition Process.h:60
int main()