cepgen is hosted by Hepforge, IPPP Durham
CepGen 1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
EventModifier.cpp
Go to the documentation of this file.
1/*
2 * CepGen: a central exclusive processes event generator
3 * Copyright (C) 2019-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
22
23namespace cepgen {
25 : EventHandler(params), seed_(steerAs<int, long long>("seed")), max_trials_(steer<int>("maxTrials")) {
26 CG_DEBUG("EventModifier:init") << "\"" << name_ << "\"-type event modifier built with:\n\t"
27 << "* seed = " << seed_ << "\n\t"
28 << "* maximum trials: " << max_trials_;
29 }
30
31 void EventModifier::readStrings(const std::vector<std::string>& params) {
32 if (params.empty())
33 return;
34 std::ostringstream os;
35 for (const auto& p : params) {
36 readString(p);
37 os << "\n\t '" << p << "'";
38 }
39 CG_DEBUG("EventModifier:configure") << "Feeding \"" << name_ << "\" event modifier algorithm with:" << os.str();
40 }
41
43 auto desc = EventHandler::description();
44 desc.add<int>("seed", -1).setDescription("Random number generator seed");
45 desc.add<int>("maxTrials", 1)
46 .setDescription(
47 "Maximum number of attempts to modify the event"
48 " before giving up and returning a zero-weight");
49 return desc;
50 }
51} // namespace cepgen
#define CG_DEBUG(mod)
Definition Message.h:220
Class template for modules interacting with events.
static ParametersDescription description()
virtual void readStrings(const std::vector< std::string > &)
Parse a list of configuration strings.
virtual void readString(const std::string &)
Parse a configuration string.
EventModifier(const ParametersList &)
Default constructor for an undefined modifier.
unsigned short max_trials_
Maximal number of trials for the algorithm.
static ParametersDescription description()
long long seed_
Random numbers generator seed fed to the algorithm.
const std::string name_
Module unique indexing name.
Definition NamedModule.h:45
A description object for parameters collection.
Common namespace for this Monte Carlo generator.