IAP GITLAB

Commit 004cdca2 authored by Colin Baus's avatar Colin Baus

added check on both particles having same momentum and some cout->cerr

git-svn-id: https://devel-ik.fzk.de/svn/mc/crmc/trunk@4613 c7a5e08c-de06-0410-9364-b41cf42a0b17
parent 192a106e
......@@ -64,7 +64,7 @@ void
CRMCoptions::ParseOptions(int argc, char** argv)
{
po::options_description desc("Options of CRMC");
ostringstream model_desc;
model_desc << "model [0=EPOS_LHC, 1=EPOS_1.99"
#ifdef __QGSJET01__
......@@ -114,7 +114,7 @@ CRMCoptions::ParseOptions(int argc, char** argv)
//("filter,F", po::value<string>(), "specify file with filter commands")
("Test,T", po::value<bool>()->implicit_value(1), "Test mode")
;
po::variables_map opt;
po::store(po::parse_command_line(argc, argv, desc), opt);
po::notify(opt);
......@@ -123,13 +123,13 @@ CRMCoptions::ParseOptions(int argc, char** argv)
cout << "crmc v" << CRMC_VERSION_MAJOR << "." << CRMC_VERSION_MINOR << endl;
exit(0);
}
// check if user needs help-printout
if (opt.count("help")) {
cout << endl << desc << endl;
exit(1);
exit(0);
}
if(opt.count("output")) {
const string om = opt["output"].as<string>();
......@@ -141,12 +141,12 @@ CRMCoptions::ParseOptions(int argc, char** argv)
#ifdef WITH_ROOT
fOutputMode = eROOT;
#else
cout << " Compile with ROOT first " << endl;
cerr << " Compile with ROOT first " << endl;
exit(1);
#endif
} else {
cout << " Wrong output type: " << om << endl;
cout << endl << desc << endl;
cerr << " Wrong output type: " << om << endl;
cerr << endl << desc << endl;
exit(1);
}
}
......@@ -163,13 +163,13 @@ CRMCoptions::ParseOptions(int argc, char** argv)
if (opt.count("seed")) {
fSeed = opt["seed"].as<int>();
if (fSeed < 0) {
cout << " Seed is negative: " << fSeed << endl;
cout << endl << desc << endl;
cerr << " Seed is negative: " << fSeed << endl;
cerr << endl << desc << endl;
exit(1);
}
if (fSeed > 1e9) {
cout << " Seed too large: " << fSeed << endl;
cout << endl << desc << endl;
cerr << " Seed too large (>1e9): " << fSeed << endl;
cerr << endl << desc << endl;
exit(1);
}
}
......@@ -223,6 +223,7 @@ CRMCoptions::ParseOptions(int argc, char** argv)
fSeed = abs(fSeed) % 999999999;
}
}
DumpConfig();
}
......@@ -269,6 +270,18 @@ const
void
CRMCoptions::DumpConfig() const
{
//if particles have same momentum the minus sign was probably forgotten
if(fTargetMomentum == fProjectileMomentum)
{
cerr << " Beam particles at rest in the centre-of-mass frame. Did you forget a (-) sign for the target momentum? " << endl;
cerr << " exit ..." << endl;
exit(1);
}
else
{
cout << fTargetMomentum << " " <<fProjectileMomentum << endl;
}
if ( fTest ) {
cout << "\n >> crmc Test mode <<\n\n" << endl;
}else{
......@@ -311,7 +324,7 @@ CRMCoptions::DumpConfig() const
case 11: cout << " (QGSJETII-03) \n"; break;
case 12: cout << " (DPMJet 3.0-6) \n"; break;
default:
cout << " (unknown model) \n";
cerr << " (unknown model) \n";
exit(1);
}
cout << endl;
......@@ -361,8 +374,8 @@ CRMCoptions::GetOutputFileName() const
//check compatibility of path with lhe files
if ( GetOutputTypeEnding().find("lhe") != string::npos && string(crmcOutDir).find(".lhe") != string::npos ) {
cout << " path error - path contains '.lhe' : " << crmcOutDir << endl;
cout << " exit ..." << endl;
cerr << " path error - path contains '.lhe' : " << crmcOutDir << endl;
cerr << " exit ..." << endl;
exit(1);
}
......@@ -370,8 +383,8 @@ CRMCoptions::GetOutputFileName() const
if (fOutputFileName != "") {
//check compatibility of file name with lhe files
if ( GetOutputTypeEnding().find("lhe") != string::npos && fOutputFileName.find(".lhe") == string::npos ) {
cout << " file name error - extension is not '.lhe' : " << fOutputFileName << endl;
cout << " exit ..." << endl;
cerr << " file name error - extension is not '.lhe' : " << fOutputFileName << endl;
cerr << " exit ..." << endl;
exit(1);
}{
return fOutputFileName;
......@@ -393,8 +406,8 @@ CRMCoptions::GetOutputFileName() const
case 11:crmcFileName << "qgsjetII03"; break;
case 12: crmcFileName << "dpmjet"; break;
default:
cout << " crmcOut: error - unknown model " << fHEModel << endl;
cout << " exit ..." << endl;
cerr << " crmcOut: error - unknown model " << fHEModel << endl;
cerr << " exit ..." << endl;
exit(1);
break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment