567 RunOpt::Instance()->ReadFromCommandLine(argc,
argv);
569 LOG(
"gevgen_atmo",
pNOTICE) <<
"Parsing command line arguments";
583 if(
parser.OptionExists(
'r') ) {
584 LOG(
"gevgen_atmo",
pDEBUG) <<
"Reading MC run number";
587 LOG(
"gevgen_atmo",
pDEBUG) <<
"Unspecified run number - Using default";
596 bool have_required_statistics =
false;
597 if(
parser.OptionExists(
'n') ) {
599 <<
"Reading number of events to generate";
601 have_required_statistics =
true;
604 if(
parser.OptionExists(
'e') ) {
605 if(have_required_statistics) {
607 <<
"Can't request exposure both in terms of number of events and kton*yrs" 608 <<
"\nUse just one of the -n and -e options";
614 <<
"Reading requested exposure in kton*yrs";
616 have_required_statistics =
true;
619 if (
parser.OptionExists(
'T')) {
620 if (have_required_statistics) {
622 <<
"Can't request exposure both in terms of number of events or kton*yrs and time" 623 <<
"\nUse just one of the -n, -e, or -T options";
629 <<
"Reading requested exposure in seconds";
631 have_required_statistics =
true;
634 if(!have_required_statistics) {
636 <<
"You must request exposure either in terms of number of events and kton*yrs" 637 <<
"\nUse any of the -n, -e options";
646 if(
parser.OptionExists(
'o') ) {
647 LOG(
"gevgen_atmo",
pDEBUG) <<
"Reading the event filename prefix";
651 <<
"Will set the default event filename prefix";
658 if(
parser.OptionExists(
'E') ) {
659 LOG(
"gevgen_atmo",
pINFO) <<
"Reading neutrino energy range";
660 string nue =
parser.ArgAsString(
'E');
663 if(nue.find(
",") != string::npos) {
666 assert(nurange.size() == 2);
667 double emin = atof(nurange[0].c_str());
668 double emax = atof(nurange[1].c_str());
669 assert(emax>emin && emin>=0.);
674 <<
"Invalid energy range. Use `-E emin,emax', eg `-E 0.5,100.";
681 <<
"No -e option. Using default energy range";
692 if(
parser.OptionExists(
'f') ) {
693 LOG(
"gevgen_atmo",
pDEBUG) <<
"Getting input flux files";
694 string flux =
parser.ArgAsString(
'f');
698 string::size_type jsimend = flux.find_first_of(
":",0);
699 if(jsimend==string::npos) {
701 <<
"You need to specify the flux file source";
707 for(string::size_type i=0; i<
gOptFluxSim.size(); i++) {
714 <<
"The flux file source needs to be one of <FLUKA,BGLRS,HAKKM>";
720 flux.erase(0,jsimend+1);
723 for( ; fluxiter != fluxv.end(); ++fluxiter) {
724 string filename_and_pdg = *fluxiter;
725 string::size_type open_bracket = filename_and_pdg.find(
"[");
726 string::size_type close_bracket = filename_and_pdg.find(
"]");
727 if (open_bracket ==string::npos ||
728 close_bracket==string::npos)
731 <<
"You made an error in specifying the flux info";
736 string::size_type ibeg = 0;
737 string::size_type iend = open_bracket;
738 string::size_type jbeg = open_bracket+1;
739 string::size_type jend = close_bracket;
740 string flux_filename = filename_and_pdg.substr(ibeg,iend-ibeg);
741 string neutrino_pdg = filename_and_pdg.substr(jbeg,jend-jbeg);
743 map<int,string>::value_type(atoi(neutrino_pdg.c_str()), flux_filename));
747 <<
"You must specify at least one flux file!";
754 LOG(
"gevgen_atmo",
pFATAL) <<
"No flux info was specified! Use the -f option.";
762 if(
parser.OptionExists(
"flux-ray-generation-surface-distance") ) {
764 <<
"Reading distance of flux ray generation surface";
765 gOptRL =
parser.ArgAsDouble(
"flux-ray-generation-surface-distance");
768 <<
"Unspecified distance of flux ray generation surface - Using default";
771 if(
parser.OptionExists(
"flux-ray-generation-surface-radius") ) {
773 <<
"Reading radius of flux ray generation surface";
774 gOptRT =
parser.ArgAsDouble(
"flux-ray-generation-surface-radius");
777 <<
"Unspecified radius of flux ray generation surface - Using default";
784 string lunits, dunits;
785 if(
parser.OptionExists(
'g') ) {
786 LOG(
"gevgen_atmo",
pDEBUG) <<
"Getting input geometry";
787 geom =
parser.ArgAsString(
'g');
790 bool accessible_geom_file =
792 if (accessible_geom_file) {
798 <<
"No geometry option specified - Exiting";
808 if(
parser.OptionExists(
'L') ) {
810 <<
"Checking for input geometry length units";
811 lunits =
parser.ArgAsString(
'L');
813 LOG(
"gevgen_atmo",
pDEBUG) <<
"Using default geometry length units";
817 if(
parser.OptionExists(
'D') ) {
819 <<
"Checking for input geometry density units";
820 dunits =
parser.ArgAsString(
'D');
822 LOG(
"gevgen_atmo",
pDEBUG) <<
"Using default geometry density units";
830 if(
parser.OptionExists(
't') ) {
831 LOG(
"gevgen_atmo",
pDEBUG) <<
"Checking for input volume name";
834 LOG(
"gevgen_atmo",
pDEBUG) <<
"Using the <master volume>";
840 if(
parser.OptionExists(
'm') ) {
842 <<
"Checking for maximum path lengths XML file";
846 <<
"Will compute the maximum path lengths at job init";
859 if(tgtmix.size()==1) {
860 int pdg = atoi(tgtmix[0].c_str());
862 gOptTgtMix.insert(map<int, double>::value_type(pdg, wgt));
865 for( ; tgtmix_iter != tgtmix.end(); ++tgtmix_iter) {
866 string tgt_with_wgt = *tgtmix_iter;
867 string::size_type open_bracket = tgt_with_wgt.find(
"[");
868 string::size_type close_bracket = tgt_with_wgt.find(
"]");
869 if (open_bracket ==string::npos ||
870 close_bracket==string::npos)
873 <<
"You made an error in specifying the target mix";
878 string::size_type ibeg = 0;
879 string::size_type iend = open_bracket;
880 string::size_type jbeg = open_bracket+1;
881 string::size_type jend = close_bracket;
882 int pdg = atoi(tgt_with_wgt.substr(ibeg,iend-ibeg).c_str());
883 double wgt = atof(tgt_with_wgt.substr(jbeg,jend-jbeg).c_str());
885 <<
"Adding to target mix: pdg = " << pdg <<
", wgt = " << wgt;
886 gOptTgtMix.insert(map<int, double>::value_type(pdg, wgt));
896 if(
parser.OptionExists(
'R') ) {
897 string rotarg =
parser.ArgAsString(
'R');
899 string::size_type j = rotarg.find_first_of(
":",0);
900 string convention =
"";
901 if(j==string::npos) { convention =
"X"; }
902 else { convention = rotarg.substr(0,j); }
906 if(euler_angles.size() != 3) {
908 <<
"You didn't specify all 3 Euler angles using the -R option";
913 double phi = atof(euler_angles[0].c_str());
914 double theta = atof(euler_angles[1].c_str());
915 double psi = atof(euler_angles[2].c_str());
917 if(convention.find(
"X")!=string::npos ||
918 convention.find(
"x")!=string::npos)
920 LOG(
"gevgen_atmo",
pNOTICE) <<
"Using X-convention for input Euler angles";
921 gOptRot.SetXEulerAngles(phi,theta,psi);
923 if(convention.find(
"Y")!=string::npos ||
924 convention.find(
"y")!=string::npos)
926 LOG(
"gevgen_atmo",
pNOTICE) <<
"Using Y-convention for input Euler angles";
927 gOptRot.SetYEulerAngles(phi,theta,psi);
930 <<
"Unknown Euler angle convention. Please use the X- or Y-convention";
936 if(convention.find(
"^-1")!=string::npos) {
937 LOG(
"gevgen_atmo",
pNOTICE) <<
"Inverting rotation matrix";
945 if(
parser.OptionExists(
"seed") ) {
946 LOG(
"gevgen_atmo",
pINFO) <<
"Reading random number seed";
949 LOG(
"gevgen_atmo",
pINFO) <<
"Unspecified random number seed - Using default";
956 if(
parser.OptionExists(
"cross-sections") ) {
957 LOG(
"gevgen_atmo",
pINFO) <<
"Reading cross-section file";
960 LOG(
"gevgen_atmo",
pINFO) <<
"Unspecified cross-section file";
970 ostringstream gminfo;
972 gminfo <<
"Using ROOT geometry - file: " <<
gOptRootGeom 975 <<
", max{PL} file: " 977 <<
", length units: " << lunits
978 <<
", density units: " << dunits;
980 gminfo <<
"Using target mix - ";
983 int pdg_code = iter->first;
984 double wgt = iter->second;
985 TParticlePDG *
p = pdglib->
Find(pdg_code);
987 string name = p->GetName();
988 gminfo <<
"(" << name <<
") -> " << 100*wgt <<
"% / ";
993 ostringstream fluxinfo;
994 fluxinfo <<
"Using " <<
gOptFluxSim <<
" flux files: ";
997 int neutrino_code = file_iter->first;
998 string filename = file_iter->second;
999 TParticlePDG * p = pdglib->
Find(neutrino_code);
1001 string name = p->GetName();
1002 fluxinfo <<
"(" << name <<
") -> " << filename <<
" / ";
1005 fluxinfo <<
"Flux ray generation surface - Distance = " 1008 ostringstream expinfo;
1012 ostringstream rotation;
1027 <<
"\n\t" << gminfo.str()
1029 <<
"\n\t" << fluxinfo.str()
1031 <<
"\n\t" << expinfo.str()
1034 <<
"\n @@ Coordinate transformation (Rotation THZ -> User-defined coordinate system)" 1035 <<
"\n" << rotation.str()
1043 <<
"\n Option to set exposure in terms of kton*yrs not supported just yet!" 1044 <<
"\n Try the -n option instead";
map< int, string > gOptFluxFiles
bool FileExists(string filename)
map< int, double > gOptTgtMix
string kDefOptEvFilePrefix
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
string gOptRootGeomTopVol
double UnitFromString(string u)
vector< string > Split(string input, string delim)
Singleton class to load & serve a TDatabasePDG.
string PrintFramedMesg(string mesg, unsigned int nl=1, const char f='*')
TParticlePDG * Find(int pdgc, bool must_exist=true)
Command line argument parser.
double gOptKtonYrExposure