340 LOG(
"gevgen_nosc",
pINFO) <<
"Parsing command line arguments";
343 RunOpt::Instance()->ReadFromCommandLine(argc,
argv);
357 if(
parser.OptionExists(
'r') ) {
358 LOG(
"gevgen_nosc",
pDEBUG) <<
"Reading MC run number";
361 LOG(
"gevgen_nosc",
pDEBUG) <<
"Unspecified run number - Using default";
367 if(
parser.OptionExists(
'n') ) {
369 <<
"Reading number of events to generate";
373 <<
"You need to specify the number of events";
380 if(
parser.OptionExists(
'm') ) {
382 <<
"Reading annihilation mode";
383 mode =
parser.ArgAsInt(
'm');
389 <<
"You need to specify a valid annihilation mode";
399 string lunits, dunits;
400 if(
parser.OptionExists(
'g') ) {
401 LOG(
"gevgen_nosc",
pDEBUG) <<
"Getting input geometry";
402 geom =
parser.ArgAsString(
'g');
405 bool accessible_geom_file =
406 ! (gSystem->AccessPathName(geom.c_str()));
407 if (accessible_geom_file) {
413 <<
"No geometry option specified - Exiting";
422 if(
parser.OptionExists(
'L') ) {
424 <<
"Checking for input geometry length units";
425 lunits =
parser.ArgAsString(
'L');
427 LOG(
"gevgen_nosc",
pDEBUG) <<
"Using default geometry length units";
431 if(
parser.OptionExists(
'D') ) {
433 <<
"Checking for input geometry density units";
434 dunits =
parser.ArgAsString(
'D');
436 LOG(
"gevgen_nosc",
pDEBUG) <<
"Using default geometry density units";
444 if(
parser.OptionExists(
't') ) {
445 LOG(
"gevgen_nosc",
pDEBUG) <<
"Checking for input volume name";
448 LOG(
"gevgen_nosc",
pDEBUG) <<
"Using the <master volume>";
461 if(tgtmix.size()==1) {
462 int pdg = atoi(tgtmix[0].c_str());
464 gOptTgtMix.insert(map<int, double>::value_type(pdg, wgt));
467 for( ; tgtmix_iter != tgtmix.end(); ++tgtmix_iter) {
468 string tgt_with_wgt = *tgtmix_iter;
469 string::size_type open_bracket = tgt_with_wgt.find(
"[");
470 string::size_type close_bracket = tgt_with_wgt.find(
"]");
471 if (open_bracket ==string::npos ||
472 close_bracket==string::npos)
475 <<
"You made an error in specifying the target mix";
479 string::size_type ibeg = 0;
480 string::size_type iend = open_bracket;
481 string::size_type jbeg = open_bracket+1;
482 string::size_type jend = close_bracket;
483 int pdg = atoi(tgt_with_wgt.substr(ibeg,iend-ibeg).c_str());
484 double wgt = atof(tgt_with_wgt.substr(jbeg,jend-jbeg).c_str());
486 <<
"Adding to target mix: pdg = " << pdg <<
", wgt = " << wgt;
487 gOptTgtMix.insert(map<int, double>::value_type(pdg, wgt));
494 if(
parser.OptionExists(
'o') ) {
495 LOG(
"gevgen_nosc",
pDEBUG) <<
"Reading the event filename prefix";
499 <<
"Will set the default event filename prefix";
505 if(
parser.OptionExists(
"seed") ) {
506 LOG(
"gevgen_nosc",
pINFO) <<
"Reading random number seed";
509 LOG(
"gevgen_nosc",
pINFO) <<
"Unspecified random number seed - Using default";
519 ostringstream gminfo;
521 gminfo <<
"Using ROOT geometry - file: " <<
gOptRootGeom 524 <<
", length units: " << lunits
525 <<
", density units: " << dunits;
527 gminfo <<
"Using target mix - ";
530 int pdg_code = iter->first;
531 double wgt = iter->second;
532 TParticlePDG *
p = pdglib->
Find(pdg_code);
534 string name = p->GetName();
535 gminfo <<
"(" << name <<
") -> " << 100*wgt <<
"% / ";
548 <<
"\n @@ Geometry $ " << gminfo.str()
549 <<
"\n @@ Statistics $ " <<
gOptNev <<
" events";
556 <<
"\n ** ROOT geometries not supported yet in neutron oscillation mode" 557 <<
"\n ** (they will be in the very near future)" 558 <<
"\n ** Please specify a `target mix' instead.";
std::string AsString(TrkPoint_t trkpt)
NeutronOscMode_t gOptDecayMode
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
bool IsValidMode(NeutronOscMode_t ndm)
string kDefOptEvFilePrefix
double UnitFromString(string u)
string gOptRootGeomTopVol
vector< string > Split(string input, string delim)
Singleton class to load & serve a TDatabasePDG.
TParticlePDG * Find(int pdgc)
map< int, double > gOptTgtMix
string PrintFramedMesg(string mesg, unsigned int nl=1, const char f='*')
Command line argument parser.
enum genie::ENeutronOscMode NeutronOscMode_t