341 LOG(
"gevgen_nnbar_osc",
pINFO) <<
"Parsing command line arguments";
344 RunOpt::Instance()->ReadFromCommandLine(argc,
argv);
358 if(
parser.OptionExists(
'r') ) {
359 LOG(
"gevgen_nnbar_osc",
pDEBUG) <<
"Reading MC run number";
362 LOG(
"gevgen_nnbar_osc",
pDEBUG) <<
"Unspecified run number - Using default";
368 if(
parser.OptionExists(
'n') ) {
370 <<
"Reading number of events to generate";
374 <<
"You need to specify the number of events";
381 if(
parser.OptionExists(
'm') ) {
383 <<
"Reading annihilation mode";
384 mode =
parser.ArgAsInt(
'm');
390 <<
"You need to specify a valid annihilation mode";
400 string lunits, dunits;
401 if(
parser.OptionExists(
'g') ) {
402 LOG(
"gevgen_nnbar_osc",
pDEBUG) <<
"Getting input geometry";
403 geom =
parser.ArgAsString(
'g');
406 bool accessible_geom_file =
407 ! (gSystem->AccessPathName(geom.c_str()));
408 if (accessible_geom_file) {
414 <<
"No geometry option specified - Exiting";
423 if(
parser.OptionExists(
'L') ) {
425 <<
"Checking for input geometry length units";
426 lunits =
parser.ArgAsString(
'L');
428 LOG(
"gevgen_nnbar_osc",
pDEBUG) <<
"Using default geometry length units";
432 if(
parser.OptionExists(
'D') ) {
434 <<
"Checking for input geometry density units";
435 dunits =
parser.ArgAsString(
'D');
437 LOG(
"gevgen_nnbar_osc",
pDEBUG) <<
"Using default geometry density units";
445 if(
parser.OptionExists(
't') ) {
446 LOG(
"gevgen_nnbar_osc",
pDEBUG) <<
"Checking for input volume name";
449 LOG(
"gevgen_nnbar_osc",
pDEBUG) <<
"Using the <master volume>";
462 if(tgtmix.size()==1) {
463 int pdg = atoi(tgtmix[0].c_str());
465 gOptTgtMix.insert(map<int, double>::value_type(pdg, wgt));
468 for( ; tgtmix_iter != tgtmix.end(); ++tgtmix_iter) {
469 string tgt_with_wgt = *tgtmix_iter;
470 string::size_type open_bracket = tgt_with_wgt.find(
"[");
471 string::size_type close_bracket = tgt_with_wgt.find(
"]");
472 if (open_bracket ==string::npos ||
473 close_bracket==string::npos)
476 <<
"You made an error in specifying the target mix";
480 string::size_type ibeg = 0;
481 string::size_type iend = open_bracket;
482 string::size_type jbeg = open_bracket+1;
483 string::size_type jend = close_bracket;
484 int pdg = atoi(tgt_with_wgt.substr(ibeg,iend-ibeg).c_str());
485 double wgt = atof(tgt_with_wgt.substr(jbeg,jend-jbeg).c_str());
487 <<
"Adding to target mix: pdg = " << pdg <<
", wgt = " << wgt;
488 gOptTgtMix.insert(map<int, double>::value_type(pdg, wgt));
495 if(
parser.OptionExists(
'o') ) {
496 LOG(
"gevgen_nnbar_osc",
pDEBUG) <<
"Reading the event filename prefix";
500 <<
"Will set the default event filename prefix";
506 if(
parser.OptionExists(
"seed") ) {
507 LOG(
"gevgen_nnbar_osc",
pINFO) <<
"Reading random number seed";
510 LOG(
"gevgen_nnbar_osc",
pINFO) <<
"Unspecified random number seed - Using default";
520 ostringstream gminfo;
522 gminfo <<
"Using ROOT geometry - file: " <<
gOptRootGeom 525 <<
", length units: " << lunits
526 <<
", density units: " << dunits;
528 gminfo <<
"Using target mix - ";
531 int pdg_code = iter->first;
532 double wgt = iter->second;
533 TParticlePDG *
p = pdglib->
Find(pdg_code);
535 string name = p->GetName();
536 gminfo <<
"(" << name <<
") -> " << 100*wgt <<
"% / ";
549 <<
"\n @@ Geometry $ " << gminfo.str()
550 <<
"\n @@ Statistics $ " <<
gOptNev <<
" events";
557 <<
"\n ** ROOT geometries not supported yet in neutron oscillation mode" 558 <<
"\n ** (they will be in the very near future)" 559 <<
"\n ** Please specify a `target mix' instead.";
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
enum genie::ENNBarOscMode NNBarOscMode_t
double UnitFromString(string u)
NNBarOscMode_t gOptDecayMode
string kDefOptEvFilePrefix
map< int, double > gOptTgtMix
vector< string > Split(string input, string delim)
Singleton class to load & serve a TDatabasePDG.
bool IsValidMode(NNBarOscMode_t ndm)
string PrintFramedMesg(string mesg, unsigned int nl=1, const char f='*')
const char * AsString(Resonance_t res)
resonance id -> string
TParticlePDG * Find(int pdgc, bool must_exist=true)
Command line argument parser.
string gOptRootGeomTopVol