307#include <TGeoVolume.h>
308#include <TGeoShape.h>
331#ifdef __GENIE_FLUX_DRIVERS_ENABLED__
348#ifdef __GENIE_GEOM_DRIVERS_ENABLED__
359using std::ostringstream;
361using namespace genie;
422 std::cerr <<
"Caught SIGTERM" << std::endl;
426int main(
int argc,
char ** argv)
432 LOG(
"gmkspl",
pFATAL) <<
" No TuneId in RunOption";
461 TGeoVolume * topvol = rgeom->
GetGeometry()->GetTopVolume();
463 LOG(
"gevgen_fnal",
pFATAL) <<
"Null top ROOT geometry volume!";
497 if (
gOptFidCut.find(
"rock") != std::string::npos )
520 if ( ! flux_driver ) {
522 std::ostringstream s;
523 s <<
"Known FluxDrivers:\n";
524 const std::vector<std::string>& known =
526 std::vector<std::string>::const_iterator itr = known.begin();
527 for ( ; itr != known.end(); ++itr ) s <<
" " << (*itr) <<
"\n";
529 <<
"Failed to get any flux driver from GFluxDriverFactory\n"
537 if ( ! flux_file_config ) {
539 <<
"Failed to get GFluxFileConfigI driver from GFluxDriverFactory\n"
554 std::ostringstream s;
555 PDGCodeList::const_iterator itr =
gOptFluxPdg.begin();
556 for ( ; itr !=
gOptFluxPdg.end(); ++itr) s << (*itr) <<
" ";
558 <<
"Limiting to nu PDGs: " << s.str();
567 if ( ! hist_flux_driver ) {
569 <<
"Failed to get GCylinderTH1Flux driver from GFluxDriverFactory\n"
582 int pdg_code = it->first;
583 TH1D * spectrum = it->second;
608 if ( ! rgeom ) assert(0);
615 <<
"Using ROOTGeomAnalyzer: geom scan using flux: nparticles=" <<
gOptNScan;
621 <<
"Using ROOTGeomAnalyzer: geom scan using box: npoints=nrays=" << nabs;
649 std::ofstream mpfile(maxplfile.c_str(), std::ios_base::app);
652 <<
"<!-- this file is only relevant for a setup compatible with:"
662 <<
"nscan: " <<
gOptNScan <<
" (0>= use flux, <0 use box |nscan| points/rays)"
664 <<
"zmin: " <<
gOptZmin <<
" (if |zmin| > 1e30, leave ray on flux window)"
682 std::vector<TBranch*> extraBranches;
683 std::vector<std::string> branchNames;
684 std::vector<std::string> branchClassNames;
685 std::vector<void**> branchObjPointers;
689 if ( fluxFileConfigI ) {
692 size_t nn = branchNames.size();
693 size_t nc = branchClassNames.size();
694 size_t np = branchObjPointers.size();
695 if ( nn != nc || nc != np ) {
698 <<
"for branch info: " << nn <<
" " << nc <<
" " << np;
700 for (
size_t ii = 0; ii < nn; ++ii) {
701 const char* bname = branchNames[ii].c_str();
702 const char* cname = branchClassNames[ii].c_str();
703 void**& optr = branchObjPointers[ii];
704 if ( ! optr || ! *optr )
continue;
707 <<
"Adding extra branch \"" << bname <<
"\" of type \""
708 << cname <<
"\" (" << optr <<
") to output tree";
709 TBranch* bptr = ntpw.
EventTree()->Branch(bname,cname,optr,32000,split);
710 extraBranches.push_back(bptr);
714 bptr->SetAutoDelete(
false);
717 <<
"FAILED to add extra branch \"" << bname <<
"\" of type \""
718 << cname <<
"\" to output tree";
739 <<
" *** Generating event............ " << ievent;
743 if ( ievent ==
gOptNev )
break;
747 if (
gOptPOT > 0 && fluxExposureI ) {
750 double pot = fpot / psc;
760 if ( ! event && flux_driver->
End() ) {
762 <<
"** The flux driver read all the input flux entries: End()==true";
767 <<
"Got a null generated neutino event! Retrying ...";
770 if ( print_level >= 0 ) {
772 <<
"Generated event: " << *event;
780 mcjmonitor.
Update(ievent,event);
787 if ( fluxFileConfigI ) {
790 TTree* t2 = (TTree*)t1->CloneTree();
796 <<
"The GENIE MC job is done generating events - Cleaning up & exiting...";
810 long int nflx_evg = mcj_driver-> NFluxNeutrinos();
812 const char* exposureUnits =
"(unknown units)";
813 if ( fluxExposureI ) {
820 if ( fluxFileConfigI ) {
825 LOG(
"gevgen_fnal",
pFATAL) <<
"MCJobDriver GlobalProbScale was " << psc;
827 double pot = fpot / psc;
828 long int nev = ievent;
831 <<
"\n >> Interaction probability scaling factor: " << psc
833 <<
"\n >> N of flux v read-in by flux driver: " << nflx
834 <<
"\n >> N of flux v thrown to event gen driver: " << nflx_evg
835 <<
"\n >> N of generated v interactions: " << nev
836 <<
"\n ** Normalization for generated sample: " << pot
837 <<
" " << exposureUnits <<
" * detector";
858 TH1D * spectrum = it->second;
859 if(spectrum)
delete spectrum;
876 vector<string> extraLibs;
881 extraLibs.push_back(
"libdk2nuTree");
882 extraLibs.push_back(
"libdk2nuGenie");
901 Int_t prevErrorLevel = gErrorIgnoreLevel;
902 gErrorIgnoreLevel = kFatal;
903 for (
size_t ilib=0; ilib < extraLibs.size(); ++ilib) {
906 int loadStatus = gSystem->Load(extraLibs[ilib].c_str());
907 const char* statWords =
"failed to load";
908 if ( loadStatus == 0 ) { statWords =
"successfully loaded"; }
909 else if ( loadStatus == 1 ) { statWords =
"already had loaded"; }
910 else if ( loadStatus == -1 ) { statWords =
"couldn't find library"; }
911 else if ( loadStatus == -2 ) { statWords =
"mismatched version"; }
914 << statWords <<
" (" << loadStatus <<
") " << extraLibs[ilib];
917 gErrorIgnoreLevel = prevErrorLevel;
924 LOG(
"gevgen_fnal",
pINFO) <<
"Parsing command line arguments";
943 LOG(
"gevgen_fnal",
pDEBUG) <<
"Reading MC run number";
947 <<
"Unspecified run number - Using default";
958 LOG(
"gevgen_fnal",
pDEBUG) <<
"Getting input geometry";
962 bool accessible_geom_file =
963 ! (gSystem->AccessPathName(
geom.c_str()));
964 if (accessible_geom_file) {
970 <<
"No geometry option specified - Exiting";
981 <<
"Checking for input geometry length units";
984 LOG(
"gevgen_fnal",
pDEBUG) <<
"Using default geometry length units";
990 <<
"Checking for input geometry density units";
993 LOG(
"gevgen_fnal",
pDEBUG) <<
"Using default geometry density units";
1002 LOG(
"gevgen_fnal",
pDEBUG) <<
"Checking for input volume name";
1005 LOG(
"gevgen_fnal",
pDEBUG) <<
"Using the <master volume>";
1014 <<
"Checking for maximum path lengths XML file";
1025 <<
"Will compute the maximum path lengths at job init";
1031 LOG(
"gevgen_fnal",
pDEBUG) <<
"Using Fiducial cut?";
1034 LOG(
"gevgen_fnal",
pDEBUG) <<
"No fiducial volume cut";
1041 LOG(
"gevgen_fnal",
pDEBUG) <<
"Reading requested geom scan count";
1044 LOG(
"gevgen_fnal",
pDEBUG) <<
"No geom scan count was requested";
1050 LOG(
"gevgen_fnal",
pDEBUG) <<
"Reading requested zmin";
1053 LOG(
"gevgen_fnal",
pDEBUG) <<
"No zmin was requested";
1059 LOG(
"gevgen_fnal",
pDEBUG) <<
"Reading debug flag value";
1062 LOG(
"gevgen_fnal",
pDEBUG) <<
"Unspecified debug flags - Using default";
1078 if(tgtmix.size()==1) {
1079 int pdg = atoi(tgtmix[0].c_str());
1083 vector<string>::const_iterator tgtmix_iter = tgtmix.begin();
1084 for( ; tgtmix_iter != tgtmix.end(); ++tgtmix_iter) {
1085 string tgt_with_wgt = *tgtmix_iter;
1086 string::size_type open_bracket = tgt_with_wgt.find(
"[");
1087 string::size_type close_bracket = tgt_with_wgt.find(
"]");
1088 if (open_bracket ==string::npos ||
1089 close_bracket==string::npos)
1092 <<
"You made an error in specifying the target mix";
1096 string::size_type ibeg = 0;
1097 string::size_type iend = open_bracket;
1098 string::size_type jbeg = open_bracket+1;
1099 string::size_type jend = close_bracket;
1100 int pdg = atoi(tgt_with_wgt.substr(ibeg,iend-ibeg).c_str());
1101 double wgt = atof(tgt_with_wgt.substr(jbeg,jend-jbeg).c_str());
1103 <<
"Adding to target mix: pdg = " <<
pdg <<
", wgt = " << wgt;
1114 LOG(
"gevgen_fnal",
pDEBUG) <<
"Getting input flux";
1117 LOG(
"gevgen_fnal",
pFATAL) <<
"No flux info was specified - Exiting";
1125 <<
"Reading limit on number of events to generate";
1129 <<
"Will keep on generating events till the flux driver stops";
1135 LOG(
"gevgen_fnal",
pDEBUG) <<
"Reading requested exposure in POT";
1138 LOG(
"gevgen_fnal",
pDEBUG) <<
"No POT exposure was requested";
1144 LOG(
"gevgen_fnal",
pDEBUG) <<
"Reading the event filename prefix";
1148 <<
"Will set the default event filename prefix";
1155 LOG(
"gevgen_fnal",
pINFO) <<
"Reading random number seed";
1158 LOG(
"gevgen_fnal",
pINFO) <<
"Unspecified random number seed - Using default";
1164 LOG(
"gevgen_fnal",
pINFO) <<
"Reading cross-section file";
1167 LOG(
"gevgen_fnal",
pINFO) <<
"Unspecified cross-section file";
1186 <<
"** To use a gNuMI flux ntuple you need to specify an exposure, "
1187 <<
"either via the -e or -n options";
1193 <<
"You can not specify more than one of the -e or -n options";
1203 <<
"If you're using flux from histograms you need to specify the -n option";
1215 <<
"You may not use the -e option without a detector geometry description";
1226 ostringstream gminfo;
1228 gminfo <<
"Using ROOT geometry - file = " <<
gOptRootGeom
1229 <<
", top volume = "
1231 <<
", max{PL} file = "
1233 <<
", length units = " <<
lunits
1234 <<
", density units = " << dunits;
1236 gminfo <<
"Using target mix: ";
1237 map<int,double>::const_iterator iter;
1239 int pdg_code = iter->first;
1240 double wgt = iter->second;
1241 TParticlePDG * p = pdglib->
Find(pdg_code);
1243 string name = p->GetName();
1244 gminfo <<
"(" << name <<
") -> " << 100*wgt <<
"% / ";
1249 ostringstream fluxinfo;
1251 fluxinfo <<
"Using histograms: ";
1252 map<int,TH1D*>::const_iterator iter;
1254 int pdg_code = iter->first;
1255 TH1D * spectrum = iter->second;
1256 TParticlePDG * p = pdglib->
Find(pdg_code);
1258 string name = p->GetName();
1259 fluxinfo <<
"(" << name <<
") -> " << spectrum->GetName() <<
" / ";
1268 ostringstream exposure;
1270 exposure <<
"Number of POTs = " <<
gOptPOT;
1272 exposure <<
"Number of events = " <<
gOptNev;
1283 <<
"\n - Flux @ " << fluxinfo.str()
1284 <<
"\n - Geometry @ " << gminfo.str()
1285 <<
"\n - Exposure @ " << exposure.str();
1294 <<
"\n gevgen_fnal [-h] [-r run#]"
1295 <<
"\n -f flux -g geometry"
1296 <<
"\n [-t top_volume_name_at_geom] [-m max_path_lengths_xml_file]"
1297 <<
"\n [-L length_units_at_geom] [-D density_units_at_geom]"
1298 <<
"\n [-n n_of_events] [-e exposure_in_POTs]"
1299 <<
"\n [-o output_event_file_prefix]"
1300 <<
"\n [-F fid_cut_string] [-S nrays_scan]"
1301 <<
"\n [-z zmin_start]"
1302 <<
"\n [--seed random_number_seed]"
1303 <<
"\n --cross-sections xml_file"
1306 <<
" Please also read the detailed documentation at "
1307 <<
"$GENIE/src/Apps/gFNALExptEvGen.cxx"
1347 <<
"Can not create GeomVolSelectorFiduction,"
1348 <<
" geometry driver is not ROOTGeomAnalyzer";
1352 LOG(
"gevgen_fnal",
pNOTICE) <<
"-F " << fidcut;
1360 std::transform(fidcut.begin(),fidcut.end(),fidcut.begin(),::tolower);
1363 if ( strtok.size() != 2 ) {
1365 <<
"Can not create GeomVolSelectorFiduction,"
1366 <<
" no \":\" separating type from values. nsplit=" << strtok.size();
1367 for (
unsigned int i=0; i < strtok.size(); ++i )
1369 <<
"strtok[" << i <<
"] = \"" << strtok[i] <<
"\"";
1374 string stype = strtok[0];
1375 bool reverse = ( stype.find(
"0") != string::npos );
1376 bool master = ( stype.find(
"m") != string::npos );
1379 vector<double> vals;
1381 vector<string>::const_iterator iter = valstrs.begin();
1382 for ( ; iter != valstrs.end(); ++iter ) {
1383 const string& valstr1 = *iter;
1384 if ( valstr1 !=
"" ) vals.push_back(atof(valstr1.c_str()));
1386 size_t nvals = vals.size();
1388 std::cout <<
"ivals = [";
1389 for (
unsigned int i=0; i < nvals; ++i) {
1390 if (i>0) cout <<
",";
1391 std::cout << vals[i];
1393 std::cout <<
"]" << std::endl;
1397 if ( stype.find(
"zcyl") != string::npos ) {
1400 LOG(
"gevgen_fnal",
pFATAL) <<
"MakeZCylinder needs 5 values, not " << nvals
1401 <<
" fidcut=\"" << fidcut <<
"\"";
1402 fidsel->
MakeZCylinder(vals[0],vals[1],vals[2],vals[3],vals[4]);
1404 }
else if ( stype.find(
"xcyl") != string::npos ) {
1407 LOG(
"gevgen_fnal",
pFATAL) <<
"MakeXCylinder needs 5 values, not " << nvals
1408 <<
" fidcut=\"" << fidcut <<
"\"";
1409 fidsel->
MakeXCylinder(vals[0],vals[1],vals[2],vals[3],vals[4]);
1411 }
else if ( stype.find(
"ycyl") != string::npos ) {
1414 LOG(
"gevgen_fnal",
pFATAL) <<
"MakeYCylinder needs 5 values, not " << nvals
1415 <<
" fidcut=\"" << fidcut <<
"\"";
1416 fidsel->
MakeYCylinder(vals[0],vals[1],vals[2],vals[3],vals[4]);
1418 }
else if ( stype.find(
"gcyl") != string::npos ) {
1421 LOG(
"gevgen_fnal",
pFATAL) <<
"MakeYCylinder needs 14 values, not " << nvals
1422 <<
" fidcut=\"" << fidcut <<
"\"";
1423 Double_t base[3] = { vals[0], vals[1], vals[2] };
1424 Double_t axis[3] = { vals[3], vals[4], vals[5] };
1425 Double_t radius = vals[6];
1426 Double_t cap1[4] = { vals[ 7], vals[ 8], vals[ 9], vals[10] };
1427 Double_t cap2[4] = { vals[11], vals[12], vals[13], vals[14] };
1431 }
else if ( stype.find(
"box") != string::npos ) {
1434 LOG(
"gevgen_fnal",
pFATAL) <<
"MakeBox needs 6 values, not " << nvals
1435 <<
" fidcut=\"" << fidcut <<
"\"";
1436 double xyzmin[3] = { vals[0], vals[1], vals[2] };
1437 double xyzmax[3] = { vals[3], vals[4], vals[5] };
1438 fidsel->
MakeBox(xyzmin,xyzmax);
1440 }
else if ( stype.find(
"zpoly") != string::npos ) {
1443 LOG(
"gevgen_fnal",
pFATAL) <<
"MakeZPolygon needs 7 values, not " << nvals
1444 <<
" fidcut=\"" << fidcut <<
"\"";
1445 int nfaces = (int)vals[0];
1447 LOG(
"gevgen_fnal",
pFATAL) <<
"MakeZPolygon needs nfaces>=3, not " << nfaces
1448 <<
" fidcut=\"" << fidcut <<
"\"";
1449 fidsel->
MakeZPolygon(nfaces,vals[1],vals[2],vals[3],vals[4],vals[5],vals[6]);
1451 }
else if ( stype.find(
"sphere") != string::npos ) {
1454 LOG(
"gevgen_fnal",
pFATAL) <<
"MakeZSphere needs 4 values, not " << nvals
1455 <<
" fidcut=\"" << fidcut <<
"\"";
1456 fidsel->
MakeSphere(vals[0],vals[1],vals[2],vals[3]);
1460 <<
"Can not create GeomVolSelectorFiduction for shape \"" << stype <<
"\"";
1465 LOG(
"gevgen_fnal",
pNOTICE) <<
"Convert fiducial volume from master to topvol coords";
1469 LOG(
"gevgen_fnal",
pNOTICE) <<
"Reverse sense of fiducial volume cut";
1478 if( fidcut.find_first_not_of(
" \t\n") != 0)
1479 fidcut.erase( 0, fidcut.find_first_not_of(
" \t\n") );
1482 std::transform(fidcut.begin(),fidcut.end(),fidcut.begin(),::tolower);
1488 <<
"Can not create GeomVolSelectorRockBox,"
1489 <<
" geometry driver is not ROOTGeomAnalyzer";
1493 LOG(
"gevgen_fnal",
pWARN) <<
"fiducial (rock) cut: " << fidcut;
1500 if ( strtok.size() != 2 ) {
1502 <<
"Can not create GeomVolSelectorRockBox,"
1503 <<
" no \":\" separating type from values. nsplit=" << strtok.size();
1504 for (
unsigned int i=0; i < strtok.size(); ++i )
1506 <<
"strtok[" << i <<
"] = \"" << strtok[i] <<
"\"";
1510 string stype = strtok[0];
1513 vector<double> vals;
1515 vector<string>::const_iterator iter = valstrs.begin();
1516 for ( ; iter != valstrs.end(); ++iter ) {
1517 const string& valstr1 = *iter;
1518 if ( valstr1 !=
"" ) {
1519 double aval = atof(valstr1.c_str());
1520 LOG(
"gevgen_fnal",
pWARN) <<
"rock value [" << vals.size() <<
"] "
1522 vals.push_back(aval);
1525 size_t nvals = vals.size();
1537 LOG(
"gevgen_fnal",
pFATAL) <<
"rockbox needs at "
1538 <<
"least 6 values, found "
1540 << strtok[1] <<
"\"";
1544 double xyzmin[3] = { vals[0], vals[1], vals[2] };
1545 double xyzmax[3] = { vals[3], vals[4], vals[5] };
1547 bool rockonly =
true;
1548 double wallmin = 800.;
1549 double dedx = 2.5 * 1.7e-3;
1550 double fudge = 1.05;
1552 if ( nvals >= 7 ) rockonly = vals[6];
1553 if ( nvals >= 8 ) wallmin = vals[7];
1554 if ( nvals >= 9 ) dedx = vals[8];
1555 if ( nvals >= 10 ) fudge = vals[9];
1566 if ( ! rockonly ) rocksel->
MakeSphere(0,0,0,1.0e-10);
1567 else rocksel->
MakeBox(xyzmin,xyzmax);
1585 for ( ; mitr != mitr_end; ++mitr ) {
1586 string proto = mitr->first + string(
":");
1587 string gproto = string(
"g") + proto;
1588 string protor = proto +
".root,";
1589 string full = mitr->second;
1590 if ( fopt.find(proto) == 0 ) {
1591 fopt.erase(0,proto.size());
1594 }
else if ( fopt.find(gproto) == 0 ) {
1595 fopt.erase(0,gproto.size());
1598 }
else if ( fopt.find(protor) != std::string::npos ) {
1609 if ( fopt.find(
"gsimple") != std::string::npos ) {
1613 }
else if ( fopt.find(
"dk2nu") != std::string::npos ) {
1617 const char* hstrings[] = {
",12[",
",+12[",
",-12[",
1618 ",14[",
",+14[",
",-14[",
1619 ",16[",
",+16[",
",-16[" };
1620 size_t nh =
sizeof(hstrings)/
sizeof(
const char*);
1621 for (
size_t ih=0; ih<nh; ++ih) {
1622 if ( fopt.find(hstrings[ih]) != std::string::npos ) {
1654 string beamsettings;
1655 string histosettings;
1656 if ( fluxtop.size() == 1 ) {
1657 histosettings = fluxtop[0];
1659 <<
"ParseFluxHst: no settings for radius, direction, spot position"
1661 }
else if ( fluxtop.size() > 2 ) {
1663 <<
"ParseFluxHst: too many ';' separated fields";
1668 string::size_type eqpos0 = fluxtop[0].find(
"=");
1669 string::size_type eqpos1 = fluxtop[1].find(
"=");
1670 if (eqpos0 == string::npos && eqpos1 != string::npos ) {
1671 histosettings = fluxtop[0];
1672 beamsettings = fluxtop[1];
1673 }
else if (eqpos0 != string::npos && eqpos1 == string::npos ) {
1674 beamsettings = fluxtop[0];
1675 histosettings = fluxtop[1];
1678 <<
"ParseFluxHst: too many / not enough fields with '=' "
1679 <<
"\n" << fluxtop[0] <<
"\n" << fluxtop[1];
1684 double r=-1, dx=0, dy=0, dz=1, x=0, y=0, z=0;
1685 int nscan = sscanf(beamsettings.c_str(),
1686 "r=%lf,dir=(%lf,%lf,%lf),spot=(%lf,%lf,%lf)",
1687 &r,&dx,&dy,&dz,&x,&y,&z);
1688 cout <<
"nscan = " << nscan << endl;
1708 if(fluxv.size()<2) {
1710 <<
"You need to specify both a flux histogram ROOT file "
1711 <<
" _AND_ at least one histogram[pdg] mapping";
1716 bool accessible_flux_file = !(gSystem->AccessPathName(
gOptFluxFile.c_str()));
1717 if (!accessible_flux_file) {
1725 for(
unsigned int inu=1; inu<fluxv.size(); inu++) {
1726 string nutype_and_histo = fluxv[inu];
1727 string::size_type open_bracket = nutype_and_histo.find(
"[");
1728 string::size_type close_bracket = nutype_and_histo.find(
"]");
1729 if (open_bracket ==string::npos ||
1730 close_bracket==string::npos)
1733 <<
"You made an error in specifying the flux histograms";
1737 string::size_type ibeg = 0;
1738 string::size_type iend = open_bracket;
1739 string::size_type jbeg = open_bracket+1;
1740 string::size_type jend = close_bracket;
1741 string nutype = nutype_and_histo.substr(ibeg,iend-ibeg);
1742 string histo = nutype_and_histo.substr(jbeg,jend-jbeg);
1743 string extra = nutype_and_histo.substr(jend+1,string::npos);
1744 std::transform(extra.begin(),extra.end(),extra.begin(),::toupper);
1746 <<
" =======> nutype " << nutype <<
" histo " << histo <<
" extra " << extra;
1748 TH1D * ihst = (TH1D*) flux_file.Get(histo.c_str());
1751 <<
"Can not find histogram: " << histo
1759 TH1D* spectrum = (TH1D*)ihst->Clone();
1760 spectrum->SetNameTitle(
"spectrum",
"neutrino_flux");
1761 spectrum->SetDirectory(0);
1765 bool force_binwidth =
false;
1766#if ROOT_VERSION_CODE <= ROOT_VERSION(9,99,99)
1771 TAxis* xaxis = spectrum->GetXaxis();
1772 if (xaxis->IsVariableBinSize()) force_binwidth =
true;
1774 if ( extra ==
"WIDTH" ) force_binwidth =
true;
1775 if ( extra ==
"NOWIDTH" ) force_binwidth =
false;
1776 if ( force_binwidth ) {
1778 <<
"multiplying by bin width for histogram " << histo
1779 <<
" as " << spectrum->GetName() <<
" for nutype " << nutype
1781 for(
int ibin = 1; ibin <= spectrum->GetNbinsX(); ++ibin) {
1782 double data = spectrum->GetBinContent(ibin);
1783 double width = spectrum->GetBinWidth(ibin);
1784 spectrum->SetBinContent(ibin,data*width);
1789 int pdg = atoi(nutype.c_str());
1792 <<
"Unknown neutrino type: " << nutype;
1798 <<
"Adding energy spectrum for flux neutrino: pdg = " <<
pdg;
1804 <<
"You have not specified any flux histogram!";
1819 if(fluxv.size()<2) {
1821 <<
"You need to specify both a flux ntuple ROOT file "
1822 <<
" _AND_ a detector location";
1829 for (
size_t j = 2; j < fluxv.size(); ++j ) {
1830 int ipdg = atoi(fluxv[j].c_str());
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils.
Command line argument parser.
string ArgAsString(char opt)
double ArgAsDouble(char opt)
bool OptionExists(char opt)
was option set?
A vector of EventGeneratorI objects.
Generated Event Record. It is a GHepRecord object that can accept / be visited by EventRecordVisitorI...
GENIE Interface for user-defined flux classes.
virtual bool End(void)=0
true if no more flux nu's can be thrown (eg reaching end of beam sim ntuples)
static void SetPrintLevel(int print_level)
A GENIE ‘MC Job Driver’. Can be used for setting up complicated event generation cases involving deta...
double GlobProbScale(void) const
void ForceSingleProbScale(void)
void UseFluxDriver(GFluxI *flux)
void UseGeomAnalyzer(GeomAnalyzerI *geom)
void Configure(bool calc_prob_scales=true)
bool UseMaxPathLengths(string xml_filename)
void UseSplines(bool useLogE=true)
void SetEventGeneratorList(string listname)
EventRecord * GenerateEvent(void)
Simple class to create & update MC job status files and env. vars. This is used to be able to keep tr...
void Update(int iev, const EventRecord *event)
void SetRefreshRate(int rate)
Defines the GENIE Geometry Analyzer Interface.
A utility class to facilitate creating the GENIE MC Ntuple from the output GENIE GHEP event records.
void Initialize(void)
add event
void Save(void)
get the even tree
void AddEventRecord(int ievent, const EventRecord *ev_rec)
save the event tree
void CustomizeFilenamePrefix(string prefix)
Singleton class to load & serve a TDatabasePDG.
static PDGLibrary * Instance(void)
TParticlePDG * Find(int pdgc, bool must_exist=true)
Object to be filled with the neutrino path-length, for all detector geometry materials,...
void SaveAsXml(string filename) const
void ReadFromCommandLine(int argc, char **argv)
static std::string RunOptSyntaxString(bool include_generator_specific)
void BuildTune()
build tune and inform XSecSplineList
void EnableBareXSecPreCalc(bool flag)
static RunOpt * Instance(void)
int EventRecordPrintLevel(void) const
A generic GENIE flux driver. Generates a 'cylindrical' neutrino beam along the input direction,...
void SetNuDirection(const TVector3 &direction)
void AddEnergySpectrum(int nu_pdgc, TH1D *spectrum)
void SetTransverseRadius(double Rt)
void SetBeamSpot(const TVector3 &spot)
const std::vector< std::string > & AvailableFluxDrivers() const
genie::GFluxI * GetFluxDriver(const std::string &)
static GFluxDriverFactory & Instance()
GENIE interface for uniform flux exposure iterface.
const char * GetExposureUnits() const
what units are returned by GetTotalExposure?
virtual double GetTotalExposure() const =0
virtual long int NFluxNeutrinos() const =0
virtual void PrintConfig()=0
print the current configuration
virtual void LoadBeamSimData(const std::vector< std::string > &filenames, const std::string &det_loc)=0
virtual void SetNumOfCycles(long int ncycle)
limit cycling through input files
virtual void SetUpstreamZ(double z0)
virtual void GetBranchInfo(std::vector< std::string > &branchNames, std::vector< std::string > &branchClassNames, std::vector< void ** > &branchObjPointers)
virtual TTree * GetMetaDataTree()
virtual void SetFluxParticles(const PDGCodeList &particles)
specify list of flux neutrino species
GENIE Interface for user-defined volume selector functors Trim path segments based on the intersectio...
void MakeZCylinder(Double_t x0, Double_t y0, Double_t radius, Double_t zmin, Double_t zmax)
void MakeXCylinder(Double_t y0, Double_t z0, Double_t radius, Double_t xmin, Double_t xmax)
void MakeYCylinder(Double_t x0, Double_t z0, Double_t radius, Double_t ymin, Double_t ymax)
void MakeZPolygon(Int_t n, Double_t x0, Double_t y0, Double_t inradius, Double_t phi0deg, Double_t zmin, Double_t zmax)
void MakeCylinder(Double_t *base, Double_t *axis, Double_t radius, Double_t *cap1, Double_t *cap2)
virtual void ConvertShapeMaster2Top(const ROOTGeomAnalyzer *rgeom)
void MakeSphere(Double_t x0, Double_t y0, Double_t z0, Double_t radius)
void SetReverseFiducial(Bool_t reverse=true)
void MakeBox(Double_t *xyzmin, Double_t *xyzmax)
void SetRemoveEntries(bool rmset)
GENIE Interface for limiting vertex selection in the rock to a volume that depends (in part) on the n...
void SetExpandFromInclusion(bool how=false)
void SetDeDx(Double_t dedx)
void SetMinimumWall(Double_t w)
void SetRockBoxMinimal(Double_t *xyzmin, Double_t *xyzmax)
The PointGeomAnalyzer class is the simplest implementation of the GeomAnalyserI interface and defines...
A ROOT/GEANT4 geometry driver.
virtual void SetTopVolName(string nm)
virtual void SetScannerNPoints(int np)
set geometry driver's configuration options
virtual TGeoManager * GetGeometry(void) const
virtual void SetScannerNRays(int nr)
virtual void SetScannerFlux(GFluxI *f)
virtual GeomVolSelectorI * AdoptGeomVolSelector(GeomVolSelectorI *selector)
configure processing to perform path segment trimming
virtual const PathLengthList & GetMaxPathLengths(void) const
virtual void SetScannerNParticles(int np)
string kDefOptEvFilePrefix
NtpMCFormat_t kDefOptNtpFormat
map< int, double > gOptTgtMix
string gOptRootGeomTopVol
static void gsSIGTERMhandler(int)
string gOptRootGeomMasterVol
map< string, string > gOptFluxShortNames
string gOptBeamRtDependence
void ParseFluxHst(string fopt)
void DetermineFluxDriver(string fopt)
map< int, TH1D * > gOptFluxHst
void CreateRockBoxSelection(string fidcut, GeomAnalyzerI *geom_driver)
void GetCommandLineArgs(int argc, char **argv)
void CreateFidSelection(string fidcut, GeomAnalyzerI *geom_driver)
static void gsSIGTERMhandler(int)
string gOptDetectorLocation
void ParseFluxFileConfig(string fopt)
void LoadExtraOptions(void)
Utilities for improving the code readability when using PDG codes.
bool IsNeutrino(int pdgc)
bool IsAntiNeutrino(int pdgc)
void XSecTable(string inpfile, bool require_table)
void RandGen(long int seed)
void MesgThresholds(string inpfile)
void CacheFile(string inpfile)
void RecursiveExhaust(TGeoVolume *topvol, string volnames, bool exhaust)
string PrintFramedMesg(string mesg, unsigned int nl=1, const char f=' *')
vector< string > Split(string input, string delim)
double UnitFromString(string u)
THE MAIN GENIE PROJECT NAMESPACE
enum genie::ENtpMCFormat NtpMCFormat_t