Skip to content
Snippets Groups Projects
Commit 8f21da63 authored by Whitney Armstrong's avatar Whitney Armstrong
Browse files

modified: ../.clang-format

	modified:   src/pythia_dis.cc
parent d355c349
No related branches found
No related tags found
No related merge requests found
This commit is part of merge request !20. Comments created here will be created in the context of that merge request.
--- ---
BasedOnStyle: LLVM Language: Cpp
BreakConstructorInitializersBeforeComma: true BasedOnStyle: Chromium
ConstructorInitializerAllOnOneLineOrOnePerLine: true AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
#SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11 Standard: Cpp11
#SpaceBeforeParens: ControlStatements TabWidth: 8
SpaceAfterControlStatementKeyword: true UseTab: Never
PointerBindsToType: true
... ...
// main45.cc is a part of the PYTHIA event generator.
// Copyright (C) 2020 Torbjorn Sjostrand.
// PYTHIA is licenced under the GNU GPL v2 or later, see COPYING for details.
// Please respect the MCnet Guidelines, see GUIDELINES for details.
// Author: Stefan Prestel <stefan.prestel@thep.lu.se>.
// Keywords: LHE file; hepmc;
// This program (main45.cc) illustrates how a file with HepMC3 events can be
// generated by Pythia8. See main44.cc for how to ouput HepMC2 events instead.
// Note: both main44.cc and main45.cc can use the same main44.cmnd input card.
#include "Pythia8/Pythia.h" #include "Pythia8/Pythia.h"
#include "Pythia8Plugins/HepMC3.h" #include "Pythia8Plugins/HepMC3.h"
#include <unistd.h> #include <unistd.h>
using namespace Pythia8; using namespace Pythia8;
//========================================================================== #include "clipp.h"
using namespace clipp;
// Example main programm to illustrate merging. using std::string;
//______________________________________________________________________________
enum class mode { none, help, list, part };
struct settings {
double E_electron = 10.0; // GeV
double E_ion = 275.0; // GeV
std::string outfile = "dis.hepmc";
int ion_PID = 2212;
int electron_PID = 11;
bool help = false;
bool success = false;
double Q2_min = 4.0;
int N_events = 1000;
};
template <typename T>
void print_usage(T cli, const char* argv0)
{
// used default formatting
std::cout << "Usage:\n" << usage_lines(cli, argv0) << "\nOptions:\n" << documentation(cli) << '\n';
}
//______________________________________________________________________________
template <typename T>
void print_man_page(T cli, const char* argv0)
{
// all formatting options (with their default values)
auto fmt = clipp::doc_formatting{}
.start_column(8) // column where usage lines and documentation starts
.doc_column(20) // parameter docstring start col
.indent_size(4) // indent of documentation lines for children of a
// documented group
.line_spacing(0) // number of empty lines after single documentation lines
.paragraph_spacing(1) // number of empty lines before and after paragraphs
.flag_separator(", ") // between flags of the same parameter
.param_separator(" ") // between parameters
.group_separator(" ") // between groups (in usage)
.alternative_param_separator("|") // between alternative flags
.alternative_group_separator(" | ") // between alternative groups
.surround_group("(", ")") // surround groups with these
.surround_alternatives("(", ")") // surround group of alternatives with these
.surround_alternative_flags("", "") // surround alternative flags with these
.surround_joinable("(", ")") // surround group of joinable flags with these
.surround_optional("[", "]") // surround optional parameters with these
.surround_repeat("", "..."); // surround repeatable parameters with these
auto mp = make_man_page(cli, argv0, fmt);
mp.prepend_section("DESCRIPTION", "Simple pythia dis generator.");
mp.append_section("EXAMPLES", " $ pythia_dis [output_file]");
std::cout << mp << "\n";
}
//______________________________________________________________________________
settings cmdline_settings(int argc, char* argv[]) {
settings s;
auto lastOpt =
" options:" % (option("-h", "--help").set(s.selected, mode::help) % "show help",
option("-o", "--output") & value("out", s.outfile), value("file", s.infile).if_missing([] {
std::cout << "You need to provide an input xml filename as the last "
"argument!\n";
}) % "input xml file");
auto server_cli =
((option("-p", "--port") & value("http_port", s.http_port)) %
"port to which the http serve attaches. Default: 8090 ",
(option("-H", "--host") & value("http_host", s.http_host)) %
"Http server host name or IP address. Default: 127.0.0.1",
(option("-f", "--file") & value("io_file", s.in_out_file)) %
"File used to initialize and save plots. Default: top_folder.root");
auto cli =
(command("help").set(s.selected, mode::help) | (server_cli, lastOpt));
assert(cli.flags_are_prefix_free());
auto res = parse(argc, argv, cli);
// if( res.any_error() ) {
// s.success = false;
// std::cout << make_man_page(cli, argv[0]).prepend_section("error: ",
// " The best
// thing since
// sliced bread.");
// return s;
//}
s.success = true;
if (s.selected == mode::help) {
print_man_page<decltype(cli)>(cli, argv[0]);
};
return s;
}
//______________________________________________________________________________
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
// Check that correct number of command-line arguments settings s = cmdline_settings(argc, argv);
if (argc != 2) { if (!s.success) {
cerr << " Unexpected number of command-line arguments ("<<argc<<"). \n"
<< " You are expected to provide the arguments" << endl
<< " 1. Output file for HepMC events" << endl
<< " Program stopped. " << endl;
return 1; return 1;
} }
if (s.selected == mode::help) {
return 0;
}
// Beam energies, minimal Q2, number of events to generate. // Beam energies, minimal Q2, number of events to generate.
double eProton = 250.; double eProton = s.E_ion;
double eElectron = 10.0; double eElectron = s.E_electron;
double Q2min = 5.; double Q2min = s.Q2_min;
int nEvent = 10000; int nEvent = s.N_events;
// Generator. Shorthand for event. // Generator. Shorthand for event.
Pythia pythia; Pythia pythia;
...@@ -45,7 +127,7 @@ int main( int argc, char* argv[] ){ ...@@ -45,7 +127,7 @@ int main( int argc, char* argv[] ){
// Set up incoming beams, for frame with unequal beam energies. // Set up incoming beams, for frame with unequal beam energies.
pythia.readString("Beams:frameType = 2"); pythia.readString("Beams:frameType = 2");
// BeamA = proton. // BeamA = proton.
pythia.readString("Beams:idA = 2212"); pythia.readString("Beams:idA = " +std::to_string(s.ion_PID));
pythia.settings.parm("Beams:eA", eProton); pythia.settings.parm("Beams:eA", eProton);
// BeamB = electron. // BeamB = electron.
pythia.readString("Beams:idB = 11"); pythia.readString("Beams:idB = 11");
...@@ -176,8 +258,6 @@ int main( int argc, char* argv[] ){ ...@@ -176,8 +258,6 @@ int main( int argc, char* argv[] ){
// Write the HepMC event to file. Done with it. // Write the HepMC event to file. Done with it.
ascii_io.write_event(hepmcevt); ascii_io.write_event(hepmcevt);
// End of event loop. Statistics and histograms. // End of event loop. Statistics and histograms.
} }
pythia.stat(); pythia.stat();
...@@ -185,5 +265,4 @@ int main( int argc, char* argv[] ){ ...@@ -185,5 +265,4 @@ int main( int argc, char* argv[] ){
return 0; return 0;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment