12 #include <boost/filesystem.hpp>
13 #include <boost/filesystem/fstream.hpp>
14 #include <boost/program_options.hpp>
21 #ifndef TRENTO_VERSION_STRING
22 #define TRENTO_VERSION_STRING "dev"
29 void print_version() {
36 "@article{Moreland:2014oya,\n"
37 " author = \"Moreland, J. Scott and Bernhard, Jonah E. and Bass,\n"
39 " title = \"{Alternative ansatz to wounded nucleon and binary\n"
40 " collision scaling in high-energy nuclear collisions}\",\n"
41 " journal = \"Phys.Rev.\",\n"
43 " volume = \"C92\",\n"
44 " pages = \"011901\",\n"
45 " doi = \"10.1103/PhysRevC.92.011901\",\n"
47 " eprint = \"1412.4708\",\n"
48 " archivePrefix = \"arXiv\",\n"
49 " primaryClass = \"nucl-th\",\n"
50 " SLACcitation = \"%%CITATION = ARXIV:1412.4708;%%\",\n"
55 "@article{Ke:2016jrd,\n"
56 " author = \"Ke, Weiyao and Moreland, J. Scott and Bernhard, \n"
57 " Jonah E. and Bass, Steffen A.\",\n"
58 " title = \"{Constraints on rapidity-dependent initial conditions\n"
59 " from charged particle pseudorapidity densities and\n"
60 " two-particle correlations}\",\n"
61 " journal = \"Phys. Rev.\",\n"
62 " volume = \"C96\",\n"
65 " pages = \"044912\",\n"
66 " doi = \"10.1103/PhysRevC.96.044912\",\n"
67 " eprint = \"1610.08490\",\n"
68 " archivePrefix = \"arXiv\",\n"
69 " primaryClass = \"nucl-th\",\n"
70 " SLACcitation = \"%%CITATION = ARXIV:1610.08490;%%\"\n";
82 int main(
int argc,
char* argv[]) {
83 using namespace trento;
87 using OptDesc = po::options_description;
89 using VecStr = std::vector<std::string>;
91 main_opts.add_options()
92 (
"projectile", po::value<VecStr>()->required()->
94 [](
const VecStr& projectiles) {
95 if (projectiles.size() != 2)
96 throw po::required_option{
"projectile"};
99 (
"number-events", po::value<int>()->default_value(1),
103 po::positional_options_description positional_opts{};
105 .add(
"projectile", 2)
106 .add(
"number-events", 1);
108 using VecPath = std::vector<fs::path>;
109 OptDesc general_opts{
"general options"};
110 general_opts.add_options()
111 (
"help,h",
"show this help message and exit")
112 (
"version",
"print version information and exit")
113 (
"bibtex",
"print bibtex entry and exit")
115 (
"config-file,c", po::value<VecPath>()->value_name(
"FILE"),
116 "configuration file\n(can be passed multiple times)");
118 OptDesc output_opts{
"output options"};
119 output_opts.add_options()
120 (
"quiet,q", po::bool_switch(),
121 "do not print event properties to stdout")
122 (
"output,o", po::value<fs::path>()->value_name(
"PATH"),
123 "HDF5 file or directory for text files")
124 (
"no-header", po::bool_switch(),
125 "do not write headers to text files");
127 OptDesc phys_opts{
"physical options"};
128 phys_opts.add_options()
129 (
"reduced-thickness,p",
130 po::value<double>()->value_name(
"FLOAT")->default_value(0.,
"0"),
131 "reduced thickness parameter")
133 po::value<double>()->value_name(
"FLOAT")->default_value(1.,
"1"),
134 "gamma fluctuation shape parameter")
136 po::value<double>()->value_name(
"FLOAT")->default_value(.5,
"0.5"),
137 "Gaussian nucleon width [fm]")
138 (
"nucleon-min-dist,d",
139 po::value<double>()->value_name(
"FLOAT")->default_value(0.,
"0"),
140 "minimum nucleon-nucleon distance [fm]")
142 po::value<double>()->value_name(
"FLOAT")->default_value(1.,
"1."),
143 "rapidity mean coefficient")
145 po::value<double>()->value_name(
"FLOAT")->default_value(3.,
"3."),
146 "rapidity std coefficient")
148 po::value<double>()->value_name(
"FLOAT")->default_value(0.,
"0."),
149 "rapidity skew coefficient")
151 po::value<int>()->value_name(
"INT")->default_value(1,
"1"),
152 "rapidity skew type: 1: relative, 2: absolute, other: no skew")
154 po::value<double>()->value_name(
"FLOAT")->default_value(0.8,
"0.8"),
155 "<pt>/<mt> used in Jacobian")
157 po::value<double>()->value_name(
"FLOAT")->default_value(1.,
"1"),
158 "normalization factor");
160 OptDesc coll_opts{
"collision options"};
161 coll_opts.add_options()
163 po::value<double>()->value_name(
"FLOAT")->default_value(2760,
"2760"),
164 "collision beam energy sqrt(s) [GeV], initializes cross section")
166 po::value<double>()->value_name(
"FLOAT")->default_value(-1,
"off"),
167 "manual inelastic nucleon-nucleon cross section sigma_NN [fm^2]")
169 po::value<double>()->value_name(
"FLOAT")->default_value(0.,
"0"),
170 "minimum impact parameter [fm]")
172 po::value<double>()->value_name(
"FLOAT")->default_value(-1.,
"auto"),
173 "maximum impact parameter [fm]")
175 po::value<int>()->value_name(
"INT")->default_value(0,
"0"),
178 po::value<int>()->value_name(
"INT")->default_value(
179 std::numeric_limits<int>::max(),
"INT_MAX"),
"maximum Npart cut")
181 po::value<double>()->value_name(
"FLOAT")->default_value(0.,
"0"),
182 "minimum entropy cut")
184 po::value<double>()->value_name(
"FLOAT")->default_value(
185 std::numeric_limits<double>::max(),
"DOUBLE_MAX"),
"maxmimum entropy cut")
187 po::value<int64_t>()->value_name(
"INT")->default_value(-1,
"auto"),
189 (
"ncoll,b", po::bool_switch(),
190 "calculate # of binary collision and binary collision density");
192 OptDesc grid_opts{
"grid options"};
193 grid_opts.add_options()
195 po::value<double>()->value_name(
"FLOAT")->default_value(10.,
"10.0"),
196 "xy max [fm]\n(transverse grid from -max to +max)")
198 po::value<double>()->value_name(
"FLOAT")->default_value(0.2,
"0.2"),
199 "transverse step size [fm]")
201 po::value<double>()->value_name(
"FLOAT")->default_value(0.0,
"0.0"),
202 "pseudorapidity max \n(eta grid from -max to +max)")
204 po::value<double>()->value_name(
"FLOAT")->default_value(0.5,
"0.5"),
205 "pseudorapidity step size");
225 "usage: trento [options] projectile projectile [number-events = 1]\n"};
227 "To operate in 3D mode, make sure --eta-max is nonzero.\n"};
235 po::store(po::command_line_parser(argc, argv)
236 .
options(all_opts).positional(positional_opts).
run(), var_map);
240 if (var_map.count(
"help")) {
242 << usage_str << usage_str3d
244 "projectile = { p | d | Cu | Cu2 | Xe | Au | Au2 | Pb | U | U2 | U3 }\n"
247 "see the online documentation for complete usage information\n";
250 if (var_map.count(
"version")) {
254 if (var_map.count(
"bibtex")) {
264 if (var_map.count(
"config-file")) {
273 for (
const auto&
path : var_map[
"config-file"].as<VecPath>()) {
276 "configuration file '" +
path.string() +
"' not found"};
278 fs::ifstream ifs{
path};
279 po::store(po::parse_config_file(ifs, config_file_opts), var_map);
291 catch (
const po::required_option&) {
294 std::cerr << usage_str << usage_str3d
295 <<
"run 'trento --help' for more information\n";
298 catch (
const std::exception&
e) {
300 std::cerr << e.what() <<
'\n';