26 #include "TDirectory.h" 28 #include "TLorentzVector.h" 29 #include "TCollection.h" 35 #include "TStopwatch.h" 36 #include "TRotation.h" 40 #include "GENIE/Messenger/Messenger.h" 41 #include "GENIE/Conventions/GVersion.h" 42 #include "GENIE/Conventions/Units.h" 43 #include "GENIE/EVGCore/EventRecord.h" 44 #include "GENIE/EVGDrivers/GMCJDriver.h" 45 #include "GENIE/GHEP/GHepUtils.h" 46 #include "GENIE/FluxDrivers/GCylindTH1Flux.h" 47 #include "GENIE/FluxDrivers/GMonoEnergeticFlux.h" 48 #include "GENIE/FluxDrivers/GNuMIFlux.h" 49 #include "GENIE/FluxDrivers/GSimpleNtpFlux.h" 50 #include "GENIE/FluxDrivers/GFluxDriverFactory.h" 51 #if __GENIE_RELEASE_CODE__ >= GRELCODE(2,11,0) 52 #include "GENIE/FluxDrivers/GBGLRSAtmoFlux.h" 53 #include "GENIE/FluxDrivers/GFLUKAAtmoFlux.h" 55 #include "GENIE/FluxDrivers/GBartolAtmoFlux.h" 56 #include "GENIE/FluxDrivers/GFlukaAtmo3DFlux.h" 58 #if __GENIE_RELEASE_CODE__ >= GRELCODE(2,12,2) 59 #include "GENIE/FluxDrivers/GHAKKMAtmoFlux.h" 61 #include "GENIE/FluxDrivers/GAtmoFlux.h" 63 #pragma GCC diagnostic push 64 #pragma GCC diagnostic ignored "-Wunused-variable" 65 #include "GENIE/Conventions/Constants.h" 66 #pragma GCC diagnostic pop 68 #include "GENIE/PDG/PDGLibrary.h" 69 #include "GENIE/PDG/PDGCodes.h" 70 #include "GENIE/Utils/AppInit.h" 71 #include "GENIE/Utils/RunOpt.h" 73 #include "GENIE/Geo/ROOTGeomAnalyzer.h" 74 #include "GENIE/Geo/GeomVolSelectorFiducial.h" 75 #include "GENIE/Geo/GeomVolSelectorRockBox.h" 76 #include "GENIE/Utils/StringUtils.h" 77 #include "GENIE/Utils/XmlParserUtils.h" 78 #include "GENIE/Interaction/InitialState.h" 79 #include "GENIE/Interaction/Interaction.h" 80 #include "GENIE/Interaction/Kinematics.h" 81 #include "GENIE/Interaction/KPhaseSpace.h" 82 #include "GENIE/Interaction/ProcessInfo.h" 83 #include "GENIE/Interaction/XclsTag.h" 84 #include "GENIE/GHEP/GHepParticle.h" 85 #include "GENIE/PDG/PDGCodeList.h" 87 #include "GENIE/FluxDrivers/GFluxBlender.h" 88 #include "GENIE/FluxDrivers/GFlavorMixerI.h" 89 #include "GENIE/FluxDrivers/GFlavorMap.h" 90 #include "GENIE/FluxDrivers/GFlavorMixerFactory.h" 94 #include "GENIE/Framework/Messenger/Messenger.h" 95 #include "GENIE/Framework/Conventions/GVersion.h" 96 #include "GENIE/Framework/Utils/StringUtils.h" 97 #include "GENIE/Framework/Utils/XmlParserUtils.h" 98 #include "GENIE/Framework/Messenger/Messenger.h" 100 #pragma GCC diagnostic push 101 #pragma GCC diagnostic ignored "-Wunused-variable" 103 #include "GENIE/Framework/Conventions/Constants.h" 104 #pragma GCC diagnostic pop 106 #include "GENIE/Framework/Conventions/Units.h" 107 #include "GENIE/Framework/ParticleData/PDGCodes.h" 108 #include "GENIE/Framework/ParticleData/PDGCodeList.h" 109 #include "GENIE/Framework/ParticleData/PDGLibrary.h" 111 #include "GENIE/Framework/GHEP/GHepParticle.h" 112 #include "GENIE/Framework/GHEP/GHepUtils.h" 114 #include "GENIE/Framework/Interaction/InitialState.h" 115 #include "GENIE/Framework/Interaction/Interaction.h" 116 #include "GENIE/Framework/Interaction/Kinematics.h" 117 #include "GENIE/Framework/Interaction/KPhaseSpace.h" 118 #include "GENIE/Framework/Interaction/ProcessInfo.h" 119 #include "GENIE/Framework/Interaction/XclsTag.h" 121 #include "GENIE/Framework/EventGen/GFluxI.h" 122 #include "GENIE/Framework/EventGen/EventRecord.h" 123 #include "GENIE/Framework/EventGen/GMCJDriver.h" 125 #include "GENIE/Framework/Utils/AppInit.h" 126 #include "GENIE/Framework/Utils/RunOpt.h" 128 #include "GENIE/Tools/Geometry/ROOTGeomAnalyzer.h" 129 #include "GENIE/Tools/Geometry/GeomVolSelectorFiducial.h" 130 #include "GENIE/Tools/Geometry/GeomVolSelectorRockBox.h" 132 #include "GENIE/Tools/Flux/GFluxBlender.h" 133 #include "GENIE/Tools/Flux/GFlavorMixerI.h" 134 #include "GENIE/Tools/Flux/GFlavorMap.h" 135 #include "GENIE/Tools/Flux/GFlavorMixerFactory.h" 136 #include "GENIE/Tools/Flux/GFluxDriverFactory.h" 138 #include "GENIE/Tools/Flux/GCylindTH1Flux.h" 139 #include "GENIE/Tools/Flux/GMonoEnergeticFlux.h" 140 #include "GENIE/Tools/Flux/GNuMIFlux.h" 141 #include "GENIE/Tools/Flux/GSimpleNtpFlux.h" 142 #include "GENIE/Tools/Flux/GAtmoFlux.h" 143 #include "GENIE/Tools/Flux/GBGLRSAtmoFlux.h" 144 #include "GENIE/Tools/Flux/GFLUKAAtmoFlux.h" 145 #include "GENIE/Tools/Flux/GHAKKMAtmoFlux.h" 151 #include "dk2nu/tree/dk2nu.h" 152 #include "dk2nu/tree/dkmeta.h" 153 #include "dk2nu/tree/NuChoice.h" 154 #include "dk2nu/genie/GDk2NuFlux.h" 158 #include "nutools/EventGeneratorBase/GENIE/GENIEHelper.h" 160 #include "nutools/EventGeneratorBase/GENIE/GENIE2ART.h" 161 #include "nutools/EventGeneratorBase/GENIE/EvtTimeShiftFactory.h" 162 #include "nutools/EventGeneratorBase/GENIE/EvtTimeShiftI.h" 176 #include "cetlib_except/exception.h" 180 #include "cetlib_except/exception.h" 187 #define USE_IFDH_SERVICE 1 189 #ifdef USE_IFDH_SERVICE 196 #undef USE_IFDH_SERVICE 218 TGeoManager* geoManager,
220 double const& detectorMass)
221 : fGeoManager (geoManager)
222 , fGeoFile (rootFile)
223 , fGenieEventRecord (0)
230 , fUseHelperRndGen4GENIE(pset.
get<
bool >(
"UseHelperRndGen4GENIE",true))
233 , fFluxSearchPaths (pset.
get<
std::
string >(
"FluxSearchPaths",
"") )
235 , fMaxFluxFileMB (pset.
get<
int >(
"MaxFluxFileMB", 2000) )
236 , fMaxFluxFileNumber (pset.
get<
int >(
"MaxFluxFileNumber",9999) )
237 , fFluxCopyMethod (pset.
get<
std::
string >(
"FluxCopyMethod",
"DIRECT"))
238 , fFluxCleanup (pset.
get<
std::
string >(
"FluxCleanup",
"/var/tmp") )
240 , fFluxRotCfg (pset.
get<
std::
string >(
"FluxRotCfg",
"none") )
241 , fFluxRotValues (pset.
get<
std::
vector<double> >(
"FluxRotValues", {} ) )
248 ,
fPOTPerSpill (pset.get<
double >(
"POTPerSpill", 0.0) )
253 ,
fMonoEnergy (pset.get<
double >(
"MonoEnergy", 2.0) )
256 ,
fEmin (pset.get<
double >(
"FluxEmin", 0) )
257 ,
fEmax (pset.get<
double >(
"FluxEmax", 10) )
258 ,
fBeamRadius (pset.get<
double >(
"BeamRadius", 3.0) )
264 ,
fGenFlavors (pset.get< std::vector<int> >(
"GenFlavors") )
265 ,
fAtmoEmin (pset.get<
double >(
"AtmoEmin", 0.1) )
266 ,
fAtmoEmax (pset.get<
double >(
"AtmoEmax", 10.0) )
267 ,
fAtmoRl (pset.get<
double >(
"Rl", 20.0) )
268 ,
fAtmoRt (pset.get<
double >(
"Rt", 20.0) )
269 ,
fEnvironment (pset.get< std::vector<std::string> >(
"Environment") )
281 ,
fDebugFlags (pset.get<
unsigned int >(
"DebugFlags", 0) )
289 std::ostringstream fenvout, fenvfatal;
290 fenvout <<
" fEnviroment.size() = " <<
fEnvironment.size();
297 if ( fEnvironment[i] ==
"GEVGL" ||
298 fEnvironment[i] ==
"GSPLOAD" ) {
301 if ( fEnvironment[i] ==
"GEVGL" ) altparam =
"EventGeneratorList";
302 if ( fEnvironment[i] ==
"GSPLOAD" ) altparam =
"XSecTable";
304 fenvfatal <<
std::endl <<
"use of \"" << fEnvironment[i] <<
"\"" 305 <<
" is no longer supported as a Environment fcl parameter pair key," 307 <<
" please remove it from from the list and use" 308 <<
" the appropriate direct fcl parameter \"" 313 <<
" Use of fEnvironment parameters is deprecated:\n" 318 <<
" bad use of Environment fcl parameter";
323 std::vector<double> beamCenter (pset.get< std::vector<double> >(
"BeamCenter") );
324 std::vector<double> beamDirection(pset.get< std::vector<double> >(
"BeamDirection"));
325 fBeamCenter.SetXYZ(beamCenter[0], beamCenter[1], beamCenter[2]);
326 fBeamDirection.SetXYZ(beamDirection[0], beamDirection[1], beamDirection[2]);
335 dfltseed = strtol(gseedstr,NULL,0);
339 int seedval = pset.get<
int >(
"RandomSeed", dfltseed);
341 mf::LogInfo(
"GENIEHelper") <<
"Init HelperRandom with seed " << seedval;
391 <<
"Init genie::utils::app_init::RandGen() with seed " << seedval;
402 flvlist += Form(
" %d",*itr);
408 <<
" GeV) neutrinos with the following flavors: " 410 }
else if (
fFluxType.find(
"function") == 0 ) {
413 <<
"Generating neutrinos using the functional form: " 416 <<
"with the following flavors: " << flvlist;
422 fileliststr =
"NO FLUX FILES FOUND!";
428 fileliststr +=
"\n\t";
429 fileliststr += *sitr;
433 <<
"Generating flux with the following flavors: " << flvlist
434 <<
"\nand these file patterns: " << fileliststr;
442 <<
"one or the other of EventsPerSpill (" 450 <<
" events for each spill";
454 <<
" pot for each spill";
464 timeShiftFactory.
Print();
479 string filename =
"maxpathlength.xml";
481 <<
"Saving MaxPathLengths as: \"" << filename <<
"\"";
487 std::ofstream mpfile(filename.c_str(), std::ios_base::app);
490 <<
"<!-- this file is only relevant for a setup compatible with:" 503 <<
"~GENIEHelper called, but previously failed to construct " 504 << ( (
fDriver) ?
"":
" genie::GMCJDriver" )
505 << ( (
fFluxD) ?
"":
" genie::GFluxI" );
527 <<
" GMCJDriver GlobProbScale " << probscale
528 <<
" FluxDriver base pots " << rawpots
529 <<
" corrected POTS " << rawpots/TMath::Max(probscale,1.0
e-100);
538 #ifdef USE_IFDH_SERVICE 546 if ( ff.find(
"/var/tmp") == 0 ) {
560 if ( ff.find(
"/var/tmp") == 0 ) {
595 mf::LogInfo(
"GENIEHelper") <<
"GENIE EventGeneratorList using \"" 609 mf::LogInfo(
"GENIEHelper") <<
" EventGeneratorList name changed from \"" 611 << currentEvtGenListName <<
"\"" 612 <<
" by evgb::SetEventGeneratorListAndTune";
618 mf::LogInfo(
"GENIEHelper") <<
" TuneName name changed from \"" 620 << currentTuneName <<
"\"" 621 <<
" by evgb::SetEventGeneratorListAndTune";
665 mf::LogInfo(
"GENIEHelper") <<
"Number of events per spill will be based on poisson mean of " 694 size_t ftlead = tmpFluxType.find_first_not_of(
" \t\n");
695 if ( ftlead ) tmpFluxType.erase( 0, ftlead );
696 size_t ftlen = tmpFluxType.length();
697 size_t fttrail = tmpFluxType.find_last_not_of(
" \t\n");
698 if ( fttrail != ftlen ) tmpFluxType.erase( fttrail+1, ftlen );
702 if ( tmpFluxType.find(
"atmos_") == 0 ) tmpFluxType.erase(0,6);
703 if ( tmpFluxType.find(
"atmo_") == 0 ) tmpFluxType.erase(0,5);
704 if ( tmpFluxType.find(
"tree_") == 0 ) tmpFluxType.erase(0,5);
709 if ( tmpFluxType.find(
"hist") != std::string::npos ) tmpFluxType =
"histogram";
710 if ( tmpFluxType.find(
"func") != std::string::npos ) tmpFluxType =
"function";
711 if ( tmpFluxType.find(
"mono") != std::string::npos ) tmpFluxType =
"mono";
714 if ( tmpFluxType.find(
"FLUKA") != std::string::npos ) tmpFluxType =
"atmo_FLUKA";
715 if ( tmpFluxType.find(
"BARTOL") != std::string::npos ) tmpFluxType =
"atmo_BGLRS";
716 if ( tmpFluxType.find(
"BGLRS") != std::string::npos ) tmpFluxType =
"atmo_BGLRS";
717 if ( tmpFluxType.find(
"HONDA") != std::string::npos ) tmpFluxType =
"atmo_HAKKM";
718 if ( tmpFluxType.find(
"HAKKM") != std::string::npos ) tmpFluxType =
"atmo_HAKKM";
721 if ( tmpFluxType.find(
"simple") != std::string::npos ) tmpFluxType =
"tree_simple";
722 if ( tmpFluxType.find(
"ntuple") != std::string::npos ) tmpFluxType =
"tree_numi";
723 if ( tmpFluxType.find(
"numi") != std::string::npos ) tmpFluxType =
"tree_numi";
724 if ( tmpFluxType.find(
"dk2nu") != std::string::npos ) tmpFluxType =
"tree_dk2nu";
743 std::copy(fluxpattset.begin(),fluxpattset.end(),
754 <<
"ERROR: The number of generated neutrino flavors (" 756 <<
") doesn't correspond to the number of files (" 759 <<
"ERROR: atmo_ flavors != files";
761 std::ostringstream atmofluxmatch;
762 for (
size_t indx=0; indx <
fGenFlavors.size(); ++indx ) {
767 <<
"atmo flux assignment : \n" << atmofluxmatch.str();
772 <<
"ERROR: For Atmospheric Neutrino generation," 773 <<
" EventPerSpill need to be 1!!";
775 <<
"ERROR: " <<
fFluxType <<
" EventsPerSpill wasn't 1 (" 779 std::ostringstream atmofluxinfo;
781 if (
fFluxType.find(
"FLUKA") != std::string::npos ){
782 atmofluxinfo <<
" The fluxes are from FLUKA";
784 else if (
fFluxType.find(
"BARTOL") != std::string::npos ||
785 fFluxType.find(
"BGLRS") != std::string::npos ){
786 atmofluxinfo <<
" The fluxes are from BARTOL/BGLRS";
788 else if (
fFluxType.find(
"HONDA") != std::string::npos ||
789 fFluxType.find(
"HAKKM") != std::string::npos ){
790 atmofluxinfo <<
" The fluxes are from HONDA/HAKKM";
794 <<
"Unknown atmo_ flux simulation: " <<
fFluxType;
796 <<
"ERROR: bad atmo_ flux type " <<
fFluxType;
801 <<
" The energy range is between: " <<
fAtmoEmin <<
" GeV and " 804 <<
" Generation surface of: (" <<
fAtmoRl <<
"," 816 <<
"setting beam direction and center at " 823 TDirectory *savedir = gDirectory;
831 const char* histname =
"none";
833 case 12: histname =
"nue";
break;
834 case -12: histname =
"nuebar";
break;
835 case 14: histname =
"numu";
break;
836 case -14: histname =
"numubar";
break;
837 case 16: histname =
"nutau";
break;
838 case -16: histname =
"nutaubar";
break;
841 <<
"ERROR: no support for histogram flux with flavor PDG=" 854 <<
"total histogram flux over desired flavors = " 868 int keep = ( geomFlags >> 7 );
870 <<
"InitializeGeometry set debug 0x" 872 <<
" keepSegPath " << keep;
886 <<
"GENIEHelper::InitializeGeometry using TopVolume '" 901 if( fidcut.find_first_not_of(
" \t\n") != 0)
902 fidcut.erase( 0, fidcut.find_first_not_of(
" \t\n") );
905 std::transform(fidcut.begin(),fidcut.end(),fidcut.begin(),::tolower);
907 if (
"" == fidcut ||
"none" == fidcut )
return;
909 if ( fidcut.find(
"rock") != string::npos ) {
948 <<
"Can not create GeomVolSelectorFiduction," 949 <<
" geometry driver is not ROOTGeomAnalyzer";
953 mf::LogInfo(
"GENIEHelper") <<
"fiducial cut: " << fidcut;
962 if ( strtok.
size() != 2 ) {
964 <<
"Can not create GeomVolSelectorFiduction," 965 <<
" no \":\" separating type from values. nsplit=" << strtok.
size();
966 for (
unsigned int i=0; i < strtok.
size(); ++i )
968 <<
"strtok[" << i <<
"] = \"" << strtok[i] <<
"\"";
973 string stype = strtok[0];
974 bool reverse = ( stype.find(
"0") != string::npos );
975 bool master = ( stype.find(
"m") != string::npos );
981 for ( ; iter != valstrs.end(); ++iter ) {
982 const string& valstr1 = *iter;
983 if ( valstr1 !=
"" ) vals.push_back(atof(valstr1.c_str()));
985 size_t nvals = vals.
size();
987 for (
size_t nadd = 0; nadd < 7-nvals; ++nadd ) vals.push_back(0);
998 if ( stype.find(
"zcyl") != string::npos ) {
1001 mf::LogError(
"GENIEHelper") <<
"MakeZCylinder needs 5 values, not " << nvals
1002 <<
" fidcut=\"" << fidcut <<
"\"";
1003 fidsel->
MakeZCylinder(vals[0],vals[1],vals[2],vals[3],vals[4]);
1005 }
else if ( stype.find(
"box") != string::npos ) {
1008 mf::LogError(
"GENIEHelper") <<
"MakeBox needs 6 values, not " << nvals
1009 <<
" fidcut=\"" << fidcut <<
"\"";
1010 double xyzmin[3] = { vals[0], vals[1], vals[2] };
1011 double xyzmax[3] = { vals[3], vals[4], vals[5] };
1012 fidsel->
MakeBox(xyzmin,xyzmax);
1014 }
else if ( stype.find(
"zpoly") != string::npos ) {
1017 mf::LogError(
"GENIEHelper") <<
"MakeZPolygon needs 7 values, not " << nvals
1018 <<
" fidcut=\"" << fidcut <<
"\"";
1019 int nfaces = (
int)vals[0];
1021 mf::LogError(
"GENIEHelper") <<
"MakeZPolygon needs nfaces>=3, not " << nfaces
1022 <<
" fidcut=\"" << fidcut <<
"\"";
1023 fidsel->
MakeZPolygon(nfaces,vals[1],vals[2],vals[3],vals[4],vals[5],vals[6]);
1025 }
else if ( stype.find(
"sphere") != string::npos ) {
1028 mf::LogError(
"GENIEHelper") <<
"MakeZSphere needs 4 values, not " << nvals
1029 <<
" fidcut=\"" << fidcut <<
"\"";
1030 fidsel->
MakeSphere(vals[0],vals[1],vals[2],vals[3]);
1034 <<
"Can not create GeomVolSelectorFiduction for shape \"" << stype <<
"\"";
1039 mf::LogInfo(
"GENIEHelper") <<
"Convert fiducial volume from master to topvol coords";
1043 mf::LogInfo(
"GENIEHelper") <<
"Reverse sense of fiducial volume cut";
1056 if( fidcut.find_first_not_of(
" \t\n") != 0)
1057 fidcut.erase( 0, fidcut.find_first_not_of(
" \t\n") );
1060 std::transform(fidcut.begin(),fidcut.end(),fidcut.begin(),::tolower);
1066 <<
"Can not create GeomVolSelectorRockBox," 1067 <<
" geometry driver is not ROOTGeomAnalyzer";
1071 mf::LogInfo(
"GENIEHelper") <<
"fiducial (rock) cut: " << fidcut;
1078 if ( strtok.
size() != 2 ) {
1080 <<
"Can not create GeomVolSelectorRockBox," 1081 <<
" no \":\" separating type from values. nsplit=" << strtok.
size();
1082 for (
unsigned int i=0; i < strtok.
size(); ++i )
1084 <<
"strtok[" << i <<
"] = \"" << strtok[i] <<
"\"";
1088 string stype = strtok[0];
1094 for ( ; iter != valstrs.end(); ++iter ) {
1095 const string& valstr1 = *iter;
1096 if ( valstr1 !=
"" ) {
1097 double aval = atof(valstr1.c_str());
1100 vals.push_back(aval);
1103 size_t nvals = vals.
size();
1114 <<
"least 6 values, found " 1116 << strtok[1] <<
"\"";
1119 double xyzmin[3] = { vals[0], vals[1], vals[2] };
1120 double xyzmax[3] = { vals[3], vals[4], vals[5] };
1122 bool rockonly =
true;
1123 double wallmin = 800.;
1124 double dedx = 2.5 * 1.7e-3;
1125 double fudge = 1.05;
1127 if ( nvals >= 7 ) rockonly = vals[6];
1128 if ( nvals >= 8 ) wallmin = vals[7];
1129 if ( nvals >= 9 ) dedx = vals[8];
1130 if ( nvals >= 10 ) fudge = vals[9];
1139 if ( ! rockonly ) rocksel->
MakeSphere(0,0,0,1.0
e-10);
1140 else rocksel->
MakeBox(xyzmin,xyzmax);
1142 rgeom->AdoptGeomVolSelector(rocksel);
1160 if (
fFluxType.find(
"genie::flux::") != std::string::npos )
1162 else if (
fFluxType.find(
"tree_numi") == 0 )
1163 fluxName =
"genie::flux::GNuMIFlux";
1164 else if (
fFluxType.find(
"tree_simple") == 0 )
1165 fluxName =
"genie::flux::GSimpleNtpFlux";
1166 else if (
fFluxType.find(
"tree_dk2nu") == 0 )
1167 fluxName =
"genie::flux::GDk2NuFlux";
1169 if ( fluxName !=
"" ) {
1176 <<
"genie::flux::GFluxDriverFactory had not result for '" 1177 << fluxName <<
"' (fFluxType was '" <<
fFluxType <<
"'";
1185 if ( ffileconfig ) {
1198 if (
fFluxType.find(
"histogram") == 0 ) {
1217 else if (
fFluxType.find(
"mono") == 0 ) {
1222 std::map<int, double> pdgwmap;
1224 pdgwmap[*i] = weight;
1232 else if (
fFluxType.find(
"function") == 0 ) {
1237 spectrum->Add(input_func);
1252 else if (
fFluxType.find(
"atmo_") == 0 ) {
1257 if (
fFluxType.find(
"FLUKA") != std::string::npos ) {
1258 #if __GENIE_RELEASE_CODE__ >= GRELCODE(2,11,0) 1262 genie::flux::GFlukaAtmo3DFlux * fluka_flux =
1263 new genie::flux::GFlukaAtmo3DFlux;
1267 if (
fFluxType.find(
"BARTOL") != std::string::npos ||
1268 fFluxType.find(
"BGLRS") != std::string::npos ) {
1269 #if __GENIE_RELEASE_CODE__ >= GRELCODE(2,11,0) 1273 genie::flux::GBartolAtmoFlux * bartol_flux =
1274 new genie::flux::GBartolAtmoFlux;
1278 #if __GENIE_RELEASE_CODE__ >= GRELCODE(2,12,2) 1279 if (
fFluxType.find(
"atmo_HONDA") != std::string::npos ||
1280 fFluxType.find(
"atmo_HAKKM") != std::string::npos ) {
1291 std::ostringstream atmoCfgText;
1292 atmoCfgText <<
"Configuration for " <<
fFluxType 1294 for (
size_t j = 0; j <
fGenFlavors.size(); ++j ) {
1298 atmoCfgText <<
"\n FLAVOR: " <<
std::setw(3) << flavor
1299 <<
" FLUX FILE: " << flxfile;
1302 const int w=13,
p=6;
1303 auto old_p = atmoCfgText.precision(
p);
1304 atmoCfgText <<
"\n UserCoordSystem rotation:\n" 1317 atmoCfgText.precision(old_p);
1326 fFluxD = atmo_flux_driver;
1332 <<
"Failed to contruct base flux driver for FluxType '" 1335 <<
"Failed to contruct base flux driver for FluxType '" 1337 << __FILE__ <<
":" << __LINE__ <<
"\n";
1347 if ( keyword !=
"none" && keyword !=
"" ) {
1352 if ( keyword ==
"map" || keyword ==
"swap" || keyword ==
"fixedfrac" )
1368 const std::vector<std::string>& knownMixers =
1370 std::ostringstream mixers;
1371 for (
unsigned int j=0; j < knownMixers.size(); ++j ) {
1372 mixers <<
"\n [" <<
std::setw(2) << j <<
"] " << knownMixers[j];
1375 <<
" GFlavorMixerFactory known mixers: " << mixers.str();
1382 <<
"GENIEHelper MixerConfig keyword was \"" << keyword
1383 <<
"\" but that did not map to a class; " <<
std::endl 1384 <<
"GFluxBlender in use, but no mixer";
1408 if(
fGeomScan.find_first_not_of(
" \t\n") != 0)
1411 if (
fGeomScan.find(
"default") == 0 )
return;
1418 <<
"genie::geometry::ROOTGeomAnalyzer*";
1426 string scanmethod = strtok[0];
1429 std::transform(scanmethod.begin(),scanmethod.end(),scanmethod.begin(),::tolower);
1431 if ( scanmethod.find(
"file") == 0 ) {
1436 <<
"ConfigGeomScan getting MaxPathLengths from \"" << fullname <<
"\"";
1442 for (
size_t indx=1; indx < strtok.
size(); ++indx ) {
1443 const string& valstr1 = strtok[indx];
1444 if ( valstr1 !=
"" ) vals.push_back(atof(valstr1.c_str()));
1446 size_t nvals = vals.
size();
1448 for (
size_t nadd = 0; nadd < 4-nvals; ++nadd ) vals.push_back(0);
1450 double safetyfactor = 0;
1452 if ( scanmethod.find(
"box") == 0 ) {
1454 int np = (
int)vals[0];
1455 int nr = (
int)vals[1];
1456 if ( nvals >= 3 ) safetyfactor = vals[2];
1457 if ( nvals >= 4 ) writeout = vals[3];
1462 <<
"ConfigGeomScan scan using box " << np <<
" points, " 1466 }
else if ( scanmethod.find(
"flux") == 0 ) {
1468 int np = (
int)vals[0];
1469 if ( nvals >= 2 ) safetyfactor = vals[1];
1470 if ( nvals >= 3 ) writeout = vals[2];
1473 if (
abs(np) <= 100 ) {
1475 if ( np < 0 ) npnew = -
abs(npnew);
1477 <<
"Too few rays requested for geometry scan: " << np
1478 <<
", use: " << npnew <<
"instead";
1482 <<
"ConfigGeomScan scan using " << np <<
" flux particles" 1483 << ( (np>0) ?
"" :
" with ray energy pushed to flux driver maximum" );
1489 throw cet::exception(
"GENIEHelper") <<
"fGeomScan unknown method: \"" 1492 if ( safetyfactor > 0 ) {
1494 <<
"ConfigGeomScan setting safety factor to " << safetyfactor;
1506 mf::LogInfo(
"GENIEHelper") <<
"about to create MaxPathOutInfo";
1523 mf::LogInfo(
"GENIEHelper") <<
"MaxPathOutInfo: \"" 1548 else if (
fFluxType.find(
"histogram") == 0 ) {
1587 TRandom* old_gRandom = gRandom;
1595 bool viableInteraction =
true;
1602 #if __GENIE_RELEASE_CODE__ >= GRELCODE(2,11,0) 1613 if (
fFluxType.find(
"tree_numi") == 0 ) {
1618 else if (
fFluxType.find(
"tree_simple") == 0 ) {
1627 if ( ! viableInteraction )
return false;
1629 #if __GENIE_RELEASE_CODE__ >= GRELCODE(2,11,0) 1659 if (
fFluxType.find(
"histogram") == 0 ) {
1668 std::vector<double> fluxes(6, 0.);
1680 flux.
SetFluxGen(fluxes[kNue], fluxes[kNueBar],
1681 fluxes[kNuMu], fluxes[kNuMuBar],
1682 fluxes[kNuTau], fluxes[kNuTauBar]);
1686 else if (
fFluxType.find(
"mono") == 0 ||
1690 else if (
fFluxType.find(
"atmo_FLUKA") == 0 ||
1704 TVector3 ray2vtx = nuray_pos.Vect() - vertex->Vect();
1705 flux.
fgenx = nuray_pos.X();
1706 flux.
fgeny = nuray_pos.Y();
1707 flux.
fgenz = nuray_pos.Z();
1719 mf::LogInfo(
"GENIEHelper") <<
"vertex loc " << vertex->X() <<
"," 1720 << vertex->Y() <<
"," << vertex->Z() <<
std::endl 1721 <<
" flux ray start " << nuray_pos.X() <<
"," 1722 << nuray_pos.Y() <<
"," << nuray_pos.Z() <<
std::endl 1724 <<
" dk2ray = " << flux.
fdk2gen;
1749 mf::LogWarning(
"GENIEHelper") <<
"either wrong particle codes or units " 1750 <<
"from flux object - beware!!";
1772 flux.
fvx = nflux.
vx;
1773 flux.
fvy = nflux.
vy;
1774 flux.
fvz = nflux.
vz;
1846 TIter partitr(record);
1854 while( (part = dynamic_cast<genie::GHepParticle *>(partitr.Next())) ){
1862 double vtx[4] = {part->
Vx(), part->
Vy(), part->
Vz(), part->
Vt()};
1869 vtx[0] = 100.*(part->
Vx()*1.e-15 + vertex->X());
1870 vtx[1] = 100.*(part->
Vy()*1.e-15 + vertex->Y());
1871 vtx[2] = 100.*(part->
Vz()*1.e-15 + vertex->Z());
1872 vtx[3] = part->
Vt() + spillTime;
1874 TLorentzVector
pos(vtx[0], vtx[1], vtx[2], vtx[3]);
1875 TLorentzVector mom(part->
Px(), part->
Py(), part->
Pz(), part->
E());
1876 tpart.AddTrajectoryPoint(pos,mom);
1880 tpart.SetPolarization(polz);
1897 else if(procInfo.IsCoherent() ) mode =
simb::kCoh;
1916 #ifdef OLD_KINE_CALC 1923 TLorentzVector pdummy(0, 0, 0, 0);
1924 const TLorentzVector & k1 = *((record->
Probe())->P4());
1929 TLorentzVector q = k1-k2;
1930 double Q2 = -1 * q.M2();
1931 double v = (hitnucl) ? q.Energy() : -1;
1932 double x = (hitnucl) ? 0.5*Q2/(M*v) : -1;
1933 double y = (hitnucl) ? v/k1.Energy() : -1;
1934 double W2 = (hitnucl) ? M*M + 2*M*v - Q2 : -1;
1935 double W = (hitnucl) ? std::sqrt(W2) : -1;
1944 const TLorentzVector & k1 = *((record->
Probe())->P4());
1949 TLorentzVector q = k1-k2;
1951 double Q2 = -1 * q.M2();
1953 double y = v/k1.Energy();
1957 if ( hitnucl || procInfo.IsCoherent() ) {
1964 W2 = M*M + 2*M*v -
Q2;
1999 TLorentzVector *erVtx = record->
Vertex();
2000 vtx.SetXYZT(erVtx->X(), erVtx->Y(), erVtx->Z(), erVtx->T() );
2018 for (
int idx = 0; idx < record->GetEntries(); idx++) {
2024 int pdg = particle->
Pdg();
2041 truth.
fgQ2 = kine.
Q2(
true);
2042 truth.
fgq2 = kine.
q2(
true);
2043 truth.
fgW = kine.
W(
true);
2047 truth.
fgT = kine.
t(
true);
2049 truth.
fgX = kine.
x(
true);
2050 truth.
fgY = kine.
y(
true);
2104 flux.
fvx = nflux_numi->
vx;
2105 flux.
fvy = nflux_numi->
vy;
2106 flux.
fvz = nflux_numi->
vz;
2115 double apppz = nflux_numi->
pppz;
2116 if ( TMath::Abs(nflux_numi->
pppz) < 1.0e-30 ) apppz = 1.0e-30;
2130 if ( nflux_aux && nflux_meta ) {
2133 const std::vector<std::string>& auxdblname = nflux_meta->
auxdblname;
2134 const std::vector<std::string>& auxintname = nflux_meta->
auxintname;
2135 const std::vector<int>& auxint = nflux_aux->
auxint;
2136 const std::vector<double>& auxdbl = nflux_aux->
auxdbl;
2138 for (
size_t id=0;
id<auxdblname.size(); ++id) {
2139 if (
"muparpx" == auxdblname[
id]) flux.
fmuparpx = auxdbl[id];
2140 if (
"muparpy" == auxdblname[
id]) flux.
fmuparpy = auxdbl[id];
2141 if (
"muparpz" == auxdblname[
id]) flux.
fmuparpz = auxdbl[id];
2142 if (
"mupare" == auxdblname[
id]) flux.
fmupare = auxdbl[id];
2143 if (
"necm" == auxdblname[
id]) flux.
fnecm = auxdbl[id];
2144 if (
"nimpwt" == auxdblname[
id]) flux.
fnimpwt = auxdbl[id];
2145 if (
"fgXYWgt" == auxdblname[
id]) {
2149 for (
size_t ii=0; ii<auxintname.size(); ++ii) {
2150 if (
"tgen" == auxintname[ii]) flux.
ftgen = auxint[ii];
2151 if (
"tgptype" == auxintname[ii]) flux.
ftgptype = auxint[ii];
2158 static bool first =
true;
2162 <<
"GSimpleNtpMeta:\n" 2163 << *nflux_meta <<
"\n";
2166 <<
"simb::MCFlux:\n" 2168 <<
"GSimpleNtpFlux:\n" 2169 << *nflux_entry <<
"\n" 2170 << *nflux_numi <<
"\n" 2171 << *nflux_aux <<
"\n";
2235 (
fFluxRotCfg.find(
"none") != std::string::npos ) )
return;
2241 std::ostringstream indata;
2242 indata <<
"BuildFluxRotation: Cfg \"" <<
fFluxRotCfg <<
"\"\n" 2243 <<
" " << nval <<
" values\n";
2244 for (
size_t i=0; i<nval; ++i) {
2251 if (
fFluxRotCfg.find(
"newxyz") != std::string::npos ||
2264 fTempRot.RotateAxes(newX,newY,newZ);
2271 <<
" but nval=" << nval <<
", need 9";
2276 if (
fFluxRotCfg.find(
"series") != std::string::npos ) {
2281 for (
size_t j=0; j<strs.size(); ++j) {
2283 if ( what ==
"" )
continue;
2285 std::transform(what.begin(),what.end(),what.begin(),::tolower);
2286 if ( what ==
"series" )
continue;
2287 if ( what ==
"verbose" )
continue;
2288 if ( what.find(
"rot") != 0 ) {
2290 <<
"processing series rotation saw keyword \"" << what <<
"\" -- ignoring";
2293 char axis = what[3];
2295 if ( axis !=
'x' && axis !=
'y' && axis !=
'z' ) {
2298 <<
" keyword '" << what <<
"': bad axis '" << axis <<
"'";
2302 if (units.size() > 3) units.erase(3);
2303 if ( units !=
"" && units !=
"rad" && units !=
"deg" ) {
2306 <<
" keyword '" << what <<
"': bad units '" << units <<
"'";
2309 double scale = (( units ==
"rad" ) ? 1.0 : TMath::DegToRad() );
2312 if ( nrot >= nval ) {
2316 <<
" asking for rotation [" << nrot <<
"] " 2317 << what <<
" but nval=" << nval;
2320 if ( axis ==
'x' ) fTempRot.RotateX(rot);
2321 if ( axis ==
'y' ) fTempRot.RotateY(rot);
2322 if ( axis ==
'z' ) fTempRot.RotateZ(rot);
2329 if ( nrot+1 != nval ) {
2332 <<
"BuildFluxRotation only used " << nrot+1 <<
" of " 2333 << nval <<
" FluxRotValues";
2342 <<
" nval=" << nval <<
", but don't know how to interpret that";
2360 <<
"ExpandFluxPaths initially: \"" << initial <<
"\"\n" 2382 bool randomizeFiles =
false;
2383 if (
fFluxType.find(
"tree_") == 0 ) randomizeFiles =
true;
2385 std::vector<std::string> dirs;
2387 if ( dirs.empty() ) dirs.push_back(
std::string());
2390 int flags = GLOB_TILDE;
2392 std::ostringstream patterntext;
2393 std::ostringstream dirstext;
2400 patterntext <<
"\n\t" << userpattern;
2403 for ( ; ditr != dirs.end(); ++ditr ) {
2406 size_t len = dalt.size();
2407 if ( len > 0 && dalt.rfind(
'/') != len-1 ) dalt.append(
"/");
2412 glob(filepatt.c_str(),flags,NULL,&
g);
2413 if ( g.gl_pathc > 0 ) flags |= GLOB_APPEND;
2418 std::ostringstream paretext;
2419 std::ostringstream flisttext;
2421 int nfiles = g.gl_pathc;
2423 if ( nfiles == 0 ) {
2424 paretext <<
"\n expansion resulted in a null list for flux files";
2426 }
else if ( ! randomizeFiles ) {
2430 paretext <<
"\n list of files will be processed in order";
2431 for (
int i=0; i<nfiles; ++i) {
2435 flisttext <<
"[" <<
setw(3) << i <<
"] " 2444 paretext <<
"list of " << nfiles
2445 <<
" will be randomized and pared down to " 2449 double* order =
new double[nfiles];
2450 int*
indices =
new int[nfiles];
2454 TMath::Sort((
int)nfiles,order,indices,
false);
2456 long long int sumBytes = 0;
2460 for (
int i=0; i < TMath::Min(nfiles,fMaxFluxFileNumber); ++i) {
2461 int indx = indices[i];
2465 gSystem->GetPathInfo(afile.c_str(),fstat);
2466 sumBytes += fstat.fSize;
2469 if ( sumBytes > maxBytes && i != 0 ) keep =
false;
2471 flisttext <<
"[" <<
setw(3) << i <<
"] " 2472 <<
"=> g[" <<
setw(3) << indx <<
"] " 2473 << ((keep)?
"keep":
"skip") <<
" " 2474 <<
setw(6) << (sumBytes/(1024ll*1024ll)) <<
" " 2487 <<
"ExpandFluxFilePatternsDirect initially found " << nfiles
2488 <<
" files for user patterns:" 2489 << patterntext.str() <<
"\n using FluxSearchPaths of: " 2490 << dirstext.str() <<
"\n" << paretext.str();
2493 mf::LogDebug(
"GENIEHelper") <<
"\n" << flisttext.str();
2501 if ( nfiles == 0 ) {
2504 <<
"(e.g. \"dk2nu\', \"ntuple\" (\"numi\") or \"simple\") " 2505 <<
" specification must resolve to at least one file" 2506 <<
"\n none were found. DIRECT user pattern(s): " 2507 << patterntext.str()
2508 <<
"\n using FluxSearchPaths of: " 2512 <<
"no flux files found for: " << patterntext.str() <<
"\n" 2513 <<
" in: " << dirstext.str();
2537 std::ostringstream fmesg;
2538 std::string marker =
"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
2540 << __FILE__ <<
":" << __LINE__
2541 <<
"\nno IFDH implemented on this platform\n" 2545 std::cerr << fmesg.str();
2546 throw cet::exception(
"Attempt to use ifdh class") << fmesg.str();
2552 bool randomizeFiles =
false;
2553 if (
fFluxType.find(
"tree_") == 0 ) randomizeFiles =
true;
2555 #ifdef USE_IFDH_SERVICE 2563 const char* ifdh_debug_env =
std::getenv(
"IFDH_DEBUG_LEVEL");
2564 if ( ifdh_debug_env ) {
2565 mf::LogInfo(
"GENIEHelper") <<
"IFDH_DEBUG_LEVEL: " << ifdh_debug_env;
2566 fIFDH->set_debug(ifdh_debug_env);
2570 std::vector<std::pair<std::string,long>>
2571 partiallist, fulllist, selectedlist, locallist;
2573 std::ostringstream patterntext;
2574 std::ostringstream fulltext;
2575 std::ostringstream selectedtext;
2576 std::ostringstream localtext;
2577 fulltext <<
"search paths: " << spaths;
2587 patterntext <<
"\npattern [" <<
std::setw(3) << ipatt <<
"] " << userpattern;
2588 fulltext <<
"\npattern [" <<
std::setw(3) << ipatt <<
"] " << userpattern;
2590 #ifdef USE_IFDH_SERVICE 2591 partiallist = ifdhp->findMatchingFiles(spaths,userpattern);
2593 partiallist =
fIFDH->findMatchingFiles(spaths,userpattern);
2595 fulllist.insert(fulllist.end(),partiallist.begin(),partiallist.end());
2598 fulltext <<
" found " << partiallist.size() <<
" files";
2599 for (
auto pitr = partiallist.begin(); pitr != partiallist.end(); ++pitr) {
2600 fulltext <<
"\n " <<
std::setw(10) << pitr->second <<
" " << pitr->first;
2603 partiallist.clear();
2606 size_t nfiles = fulllist.size();
2609 <<
"ExpandFluxFilePatternsIFDH initially found " << nfiles <<
" files";
2613 if ( nfiles == 0 ) {
2614 selectedtext <<
"\n expansion resulted in a null list for flux files";
2615 }
else if ( ! randomizeFiles ) {
2619 selectedtext <<
"\n list of files will be processed in order";
2620 selectedlist.insert(selectedlist.end(),fulllist.begin(),fulllist.end());
2629 selectedtext <<
"list of " << nfiles
2630 <<
" will be randomized and pared down to " 2634 double* order =
new double[nfiles];
2635 int*
indices =
new int[nfiles];
2639 TMath::Sort((
int)nfiles,order,indices,
false);
2641 long long int sumBytes = 0;
2644 for (
size_t i=0; i < TMath::Min(nfiles,
size_t(fMaxFluxFileNumber)); ++i) {
2645 int indx = indices[i];
2648 auto p = fulllist[indx];
2649 sumBytes +=
p.second;
2652 if ( sumBytes > maxBytes && i != 0 ) keep =
false;
2654 selectedtext <<
"\n[" <<
setw(3) << i <<
"] " 2655 <<
"=> [" <<
setw(3) << indx <<
"] " 2656 << ((keep)?
"keep":
"SKIP") <<
" " 2657 <<
std::setw(6) << (sumBytes/(1024ll*1024ll)) <<
" MB " 2660 if ( keep ) selectedlist.push_back(
p);
2669 << selectedtext.str();
2673 #ifdef USE_IFDH_SERVICE 2679 localtext <<
"final list of files:";
2681 for (
auto litr = locallist.begin(); litr != locallist.end(); ++litr, ++i) {
2683 localtext <<
"\n\t[" <<
std::setw(3) << i <<
"]\t" << litr->first;
2692 if ( nfiles == 0 ) {
2695 <<
"(e.g. \"dk2nu\', \"ntuple\" (\"numi\") or \"simple\") " 2696 <<
"specification must resolve to at least one file" 2697 <<
"\n none were found. IFDH user pattern(s): " 2698 << patterntext.str()
2699 <<
"\n using FluxSearchPaths of: " 2703 <<
"no flux files found for: " << patterntext.str() <<
"\n" 2704 <<
" in " << spaths;
2708 #endif // 'else' code only if NO_IFDH_LIB not defined 2727 int indxGXMLPATH = -1;
2743 const char* gxmlpath_env =
std::getenv(
"GXMLPATH");
2744 if ( gxmlpath_env ) {
2748 const char* fwpath_env =
std::getenv(
"FW_SEARCH_PATH");
2755 if ( indxGXMLPATH < 0 ) {
2766 gSystem->Setenv(
"GXMLPATH",
fGXMLPATH.c_str());
2790 gSystem->Setenv(
"GMSGLAYOUT",
fGMSGLAYOUT.c_str());
2805 int indxGPRODMODE = -1;
2806 int indxGMSGCONF = -1;
2819 if ( indxGMSGCONF >= 0 ) {
2830 if ( indxGPRODMODE >= 0 ) {
2839 #if __GENIE_RELEASE_CODE__ >= GRELCODE(2,9,0) 2852 if ( indxGMSGCONF >= 0 ) {
2857 <<
"StartGENIEMessenger ProdMode=" << ((prodmode)?
"yes":
"no")
2879 if ( ! gspload_alt ) {
2880 const char* gspload_dflt =
"gxspl-FNALsmall.xml";
2881 gspload_alt = gspload_dflt;
2884 <<
"using env variable $GSPLOAD: " << gspload_alt
2885 <<
", use fcl parameter 'XSecTable' instead.";
2891 int indxGSPLOAD = -1;
2896 <<
"using Environment fcl parameter GSPLOAD: " 2898 <<
", use fcl parameter 'XSecTable' instead. " 2899 << __FILE__ <<
":" << __LINE__ <<
"\n";
2904 if ( indxGSPLOAD < 0 ) {
2927 if ( fullpath ==
"" ) {
2929 <<
"could not resolve full path for spline file XSecTable/GSPLOAD " 2933 <<
"can't find XSecTable/GSPLOAD file: " <<
fXSecTable;
2939 <<
"XSecTable/GSPLOAD full path \"" <<
fXSecTable <<
"\"";
2945 unsetenv(
"GSPLOAD");
2950 <<
"Time to read GENIE XSecTable: " 2951 <<
" Real " << xtime.RealTime() <<
" s," 2952 <<
" CPU " << xtime.CpuTime() <<
" s" 2960 if (v ==
"true")
return true;
2961 if (v ==
"false")
return false;
2962 if (v ==
"kTRUE")
return true;
2963 if (v ==
"kFALSE")
return false;
2964 if (v ==
"TRUE")
return true;
2965 if (v ==
"FALSE")
return false;
2966 if (v ==
"True")
return true;
2967 if (v ==
"False")
return false;
2968 if (v ==
"on")
return true;
2969 if (v ==
"off")
return false;
2970 if (v ==
"On")
return true;
2971 if (v ==
"Off")
return false;
2972 if (v ==
"ON")
return true;
2973 if (v ==
"OFF")
return false;
2974 if (v ==
"YES")
return true;
2975 if (v ==
"NO")
return false;
2976 if (v ==
"Yes")
return true;
2977 if (v ==
"No")
return false;
2978 if (v ==
"yes")
return true;
2979 if (v ==
"no")
return false;
2980 if (v ==
"1")
return true;
2981 if (v ==
"0")
return false;
double E(const int i=0) const
int fGint
interaction code
void MakeSphere(Double_t x0, Double_t y0, Double_t z0, Double_t radius)
virtual int ScannerNParticles(void) const
bool IsResonant(void) const
virtual void SetMaxPlSafetyFactor(double sf)
Double_t E
energy in lab frame
void RandGen(long int seed)
static void SetPrintLevel(int print_level)
GENIE Interface for user-defined volume selector functors Trim path segments based on the intersectio...
std::vector< std::string > fFluxFilePatterns
wildcard patterns files containing histograms or ntuples, or txt
static const int kNuTauBar
double W(bool selected=false) const
void XSecTable(string inpfile, bool require_table)
virtual GeomVolSelectorI * AdoptGeomVolSelector(GeomVolSelectorI *selector)
configure processing to perform path segment trimming
string EventGeneratorList(void) const
int RescatterCode(void) const
virtual GHepParticle * Particle(int position) const
TuneId * Tune(void) const
bool fUseHelperRndGen4GENIE
use fHelperRandom for gRandom during Sample()
bool IsWeakMix(void) const
bool HitSeaQrk(void) const
const simb::MCNeutrino & GetNeutrino() const
std::string fDetLocation
name of flux window location
virtual void LoadBeamSimData(const std::vector< std::string > &filenames, const std::string &det_loc)=0
double fAtmoEmax
atmo: Maximum energy of neutrinos in GeV
int fMaxFluxFileNumber
maximum # of flux files
InteractionType_t InteractionTypeId(void) const
static GFlavorMixerFactory & Instance()
double fMixerBaseline
baseline distance if genie flux can't calculate it
std::string fTuneName
GENIE R-3 Tune name (defines model configuration)
Double_t pdpx
nu parent momentum at time of decay
double E(void) const
Get energy.
static const double kNucleonMass
double Q2(const Interaction *const i)
Full flux simulation ntuple.
void SetOrigin(simb::Origin_t origin)
void MakeZCylinder(Double_t x0, Double_t y0, Double_t radius, Double_t zmin, Double_t zmax)
neutrino electron elastic scatter
virtual Interaction * Summary(void) const
void SetEventGeneratorList(string listname)
int HitNucPdg(void) const
double fTotalHistFlux
total flux of neutrinos from flux histograms for used flavors
A GENIE flux driver using a simple ntuple format.
double fgen2vtx
distance from ray origin to event vtx
virtual void SetDebugFlags(int flgs)
void PackSimpleFlux(simb::MCFlux &flux)
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
virtual void PrintConfig()=0
print the current configuration
ifdh_ns::ifdh * fIFDH
(optional) flux file handling
void FillMCFlux(genie::GFluxI *fdriver, simb::MCFlux &mcflux)
std::string fGXMLPATH
locations for GENIE XML files
int HitQrkPdg(void) const
bool IsInverseMuDecay(void) const
Double_t vx
vertex position of hadron/muon decay
bool IsQuasiElastic(void) const
std::string fFiducialCut
configuration for geometry selector
void PackNuMIFlux(simb::MCFlux &flux)
const simb::MCParticle & Nu() const
GENIE interface for flavor modification.
int NuanceReactionCode(const GHepRecord *evrec)
double fgenx
origin of ray from flux generator
bool Sample(simb::MCTruth &truth, simb::MCFlux &flux, simb::GTruth >ruth)
virtual const TLorentzVector & Position(void)=0
returns the flux neutrino 4-position (note: expect SI rather than physical units) ...
void PrintState(bool verbose=true)
bool IsElectronScattering(void) const
simb::flux_code_ fFluxType
virtual const PathLengthList & GetMaxPathLengths(void) const
unsigned int GetRandomNumberSeed()
double fRandomTimeOffset
additional random time shift (ns) added to every particle time
TVector3 fBeamCenter
center of beam for histogram fluxes - must be in meters
double fGlobalTimeOffset
overall time shift (ns) added to every particle time
int fNumNeutron
number of neutrons after reaction, before FSI
std::string fSpillTimeConfig
alternative to flat spill distribution
Generated/set kinematical variables for an event.
std::string fEventGeneratorList
control over event topologies, was $GEVGL [Default]
TGeoManager * fGeoManager
pointer to ROOT TGeoManager
bool IsInverseBetaDecay(void) const
virtual void ConvertShapeMaster2Top(const ROOTGeomAnalyzer *rgeom)
double fXsec
cross section of interaction
virtual double Weight(void) const
double x(bool selected=false) const
const TLorentzVector & HadSystP4(void) const
std::string fGENIEMsgThresholds
additional XML file setting Messager level thresholds (":" separated)
int fNumPiPlus
number of pi pluses after reaction, before FSI
offset to account for adding in Nuance codes to this enum
int fNumPiMinus
number of pi minuses after reaction, before FSI
std::vector< int > fGenFlavors
pdg codes for flavors to generate
virtual int ScannerNPoints(void) const
retrieve geometry driver's configuration options
bool IsDiffractive(void) const
Int_t tptype
parent particle type at target exit
std::vector< Double_t > auxdbl
additional doubles associated w/ entry
double Mass(void) const
Mass that corresponds to the PDG code.
bool IsIMDAnnihilation(void) const
void SetNeutrino(int CCNC, int mode, int interactionType, int target, int nucleon, int quark, double w, double x, double y, double qsqr)
QTextStream & hex(QTextStream &s)
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
void SetMinimumWall(Double_t w)
evgb::EvtTimeShiftI * fTimeShifter
generator for time offset within a spill
void SetRadii(double Rlongitudinal, double Rtransverse)
double fdk2gen
distance from decay to ray origin
virtual void SetScannerNParticles(int np)
genie::GMCJDriver * fDriver
double fXSecMassPOT
product of cross section, mass and POT/spill for histogram fluxes
std::vector< Int_t > auxint
additional ints associated w/ entry
double Pz(void) const
Get Pz.
virtual void SetDensityUnits(double du)
GFluxI * AdoptFluxGenerator(GFluxI *generator)
return previous
GHepStatus_t Status(void) const
double Energy(void) const
Get energy.
void ExpandFluxFilePatternsDirect()
void SqueezeFilePatterns()
std::vector< std::string > fSelectedFluxFiles
flux files selected after wildcard expansion and subset selection
object containing MC flux information
Contains minimal information for tagging exclusive processes.
genie::EventRecord * fGenieEventRecord
last generated event
virtual TLorentzVector * Vertex(void) const
void SetDirectionCos(double dx, double dy, double dz)
double Px(void) const
Get Px.
std::string fXSecTable
cross section file (was $GSPLOAD)
double fFluxUpstreamZ
z where flux starts from (if non-default, simple/ntuple only)
std::vector< TH1D * > fFluxHistograms
histograms for each nu species
Flux for positive horn focus.
virtual GHepParticle * Probe(void) const
double y(bool selected=false) const
virtual void SetUpstreamZ(double z0)
bool IsCharmEvent(void) const
double Vt(void) const
Get production time.
void UseFluxDriver(GFluxI *flux)
int FirstMother(void) const
genie::flux::GFlavorMixerI * GetFlavorMixer(const std::string &)
A GENIE flux driver encapsulating the NuMI neutrino flux. It reads-in the official GNUMI neutrino flu...
Object to be filled with the neutrino path-length, for all detector geometry materials, when starting from a position x and travelling along the direction of the neutrino 4-momentum.
const genie::flux::GSimpleNtpEntry * GetCurrentEntry(void)
GSimpleNtpEntry.
int fResNum
resonance number
Some common run-time GENIE options.
Summary information for an interaction.
Double_t pppx
nu parent momentum at production point
int fNumProton
number of protons after reaction, before FSI
const genie::flux::GSimpleNtpMeta * GetCurrentMeta(void)
GSimpleNtpMeta.
const TLorentzVector & HitNucP4(void) const
A GENIE `MC Job Driver'. Can be used for setting up complicated event generation cases involving deta...
double GlobProbScale(void) const
void SaveAsXml(string filename) const
double q2(bool selected=false) const
double fprobability
interaction probability
void SetDeDx(Double_t dedx)
void SetRayOrigin(double x, double y, double z)
void HistogramFluxCheck()
bool IsWeakNC(void) const
A flux driver for the FLUKA 3-D Atmospheric Neutrino Flux.
void ForceMaxEnergy(double emax)
bool KVSet(KineVar_t kv) const
int fGHepPrintLevel
GHepRecord::SetPrintLevel(), -1=no-print.
std::string fFluxRotCfg
how to interpret fFluxRotValues
TVector3 fBeamDirection
direction of the beam for histogram fluxes
bool IsNuElectronElastic(void) const
std::string fBeamName
name of the beam we are simulating
std::string fWorldVolume
name of the world volume in the ROOT geometry
const GNuMIFluxPassThroughInfo & PassThroughInfo(void)
GNuMIFluxPassThroughInfo.
int fGscatter
neutrino scattering code
void ForceSingleProbScale(void)
void InitializeFluxDriver()
double fTotalExposure
pot used from flux ntuple
A class encapsulating an enumeration of interaction types (EM, Weak-CC, Weak-NC) and scattering types...
bool IsAMNuGamma(void) const
TRandom3 * fHelperRandom
random # generator for GENIEHelper
std::string getenv(std::string const &name)
virtual void SetScannerNRays(int nr)
int fNumPi0
number of pi0 after reaction, before FSI
A generic GENIE flux driver. Generates a 'cylindrical' neutrino beam along the input direction...
GFlavorMixerI * AdoptFlavorMixer(GFlavorMixerI *mixer)
return previous
std::string fTopVolume
top volume in the ROOT geometry in which to generate events
A simple GENIE flux driver for monoenergetic neutrinos along the z direction. Can handle a mix of neu...
GENIE interface for flavor modification.
bool UseMaxPathLengths(string xml_filename)
static const double gram_centimeter3
constexpr std::array< std::size_t, geo::vect::dimension< Vector >)> indices()
Returns a sequence of indices valid for a vector of the specified type.
virtual GHepParticle * FinalStatePrimaryLepton(void) const
QTextStream & flush(QTextStream &s)
const Kinematics & Kine(void) const
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
GENIE interface for uniform flux exposure iterface.
string GetXMLFilePath(string basename)
GENIE Interface for limiting vertex selection in the rock to a volume that depends (in part) on the n...
void SetRemoveEntries(bool rmset)
virtual void PrintConfig(bool verbose=true)=0
provide a means of printing the configuration
bool fIsCharm
did the interaction produce a charmed hadron?
void Configure(bool calc_prob_scales=true)
Int_t ppmedium
tracking medium where parent was produced
void RegularizeFluxType()
virtual void Config(std::string config)=0
double fweight
event interaction weight (genie internal)
void MakeZPolygon(Int_t n, Double_t x0, Double_t y0, Double_t inradius, Double_t phi0deg, Double_t zmin, Double_t zmax)
A ROOT/GEANT4 geometry driver.
virtual double DiffXSec(void) const
static const int kNuMuBar
genie::GeomAnalyzerI * fGeomD
std::string fFluxSearchPaths
colon separated set of path stems
Double_t tpx
parent particle px at target exit
ScatteringType_t ScatteringTypeId(void) const
std::string fGMSGLAYOUT
format for GENIE log message [BASIC]|SIMPLE (SIMPLE=no timestamps)
void InitializeGeometry()
void fatal(const char *msg,...)
void SetTransverseRadius(double Rt)
Resonance_t Resonance(void) const
void SetNuDirection(const TVector3 &direction)
void SetBaselineDist(double dist)
bool PolzIsSet(void) const
virtual double Probability(void) const
QTextStream & dec(QTextStream &s)
EventRecord * GenerateEvent(void)
Q_EXPORT QTSManip setw(int w)
double fBeamRadius
radius of cylindar for histogram fluxes - must be in meters
virtual void Clear(Option_t *opt)=0
reset state variables based on opt
GENIE interface for uniform flux exposure iterface.
std::string fMixerConfig
configuration string for genie GFlavorMixerI
bool StringToBool(std::string v)
A more convenient interface to the log4cpp Message Service.
genie::GFluxI * fFluxD
real flux driver
void GetPolarization(TVector3 &polz)
Generated Event Record. It is a GHepRecord object that can accept / be visited by EventRecordVisitorI...
double GetDecayDist() const
dist (user units) from dk to current pos
void SetUserCoordSystem(TRotation &rotation)
Rotation: Topocentric Horizontal -> User-defined Topocentric Coord System.
bool IsDeepInelastic(void) const
void StartGENIEMessenger(std::string prodmode)
const genie::flux::GSimpleNtpAux * GetCurrentAux(void)
GSimpleNtpAux.
void SetFluxGen(double nue, double nuebar, double numu, double numubar, double nutau, double nutaubar)
double fMonoEnergy
energy of monoenergetic neutrinos
double fDetectorMass
mass of the detector in kg
std::vector< double > fFluxRotValues
parameters for rotation
void FillMCTruth(const genie::EventRecord *grec, double spillTime, simb::MCTruth &mctruth)
void PackGTruth(genie::EventRecord *record, simb::GTruth &truth)
void Add(simb::MCParticle const &part)
n.b.: this group is similar but not quite, entirely unlike GENIE ScatteringType convention ...
static PDGLibrary * Instance(void)
virtual void SetTopVolName(string nm)
void InitializeFiducialSelection()
void SetEventGeneratorListAndTune(const std::string &evtlistname="", const std::string &tunename="${GENIE_XSEC_TUNE}")
static RunOpt * Instance(void)
vector< string > Split(string input, string delim)
std::vector< std::string > fEnvironment
environmental variables and settings used by genie
virtual void PrintConfig(bool verbose=true)=0
provide a means of printing the configuration
double Vz(void) const
Get production z.
int ftgtPDG
PDG of Target Nucleus, nucleon only if free.
static unsigned int reverse(QString &chars, unsigned char *level, unsigned int a, unsigned int b)
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
const XclsTag & ExclTag(void) const
std::string fMaxPathOutInfo
output info if writing PathLengthList from GeomScan
double fSpillExposure
total exposure (i.e. pot) for this spill
virtual GHepParticle * HitNucleon(void) const
virtual void SetScannerNPoints(int np)
set geometry driver's configuration options
virtual void SetKeepSegPath(bool keep)
virtual void SetScannerFlux(GFluxI *f)
virtual void SetMixtureWeightsSum(double sum)
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
static GFluxDriverFactory & Instance()
virtual double GetTotalExposure() const =0
TLorentzVector fFShadSystP4
generated final state hadronic system (LAB frame)
double fAtmoEmin
atmo: Minimum energy of neutrinos in GeV
void AddFluxFile(int neutrino_pdg, string filename)
static EvtTimeShiftFactory & Instance()
std::string fGeoFile
name of file containing the Geometry description
QTextStream & bin(QTextStream &s)
std::string find_file(std::string const &filename) const
void InitializeRockBoxSelection()
double fAtmoRl
atmo: radius of the sphere on where the neutrinos are generated
virtual double XSec(void) const
void SetReverseFiducial(Bool_t reverse=true)
A driver for the HAKKM 3-D atmospheric neutrino flux (commonly known as the `Honda flux') ...
const InitialState & InitState(void) const
const std::vector< std::string > & AvailableFlavorMixers() const
virtual void SetFluxParticles(const PDGCodeList &particles)
specify list of flux neutrino species
void ExpandFluxFilePatternsIFDH()
const ProcessInfo & ProcInfo(void) const
unsigned int fDebugFlags
set bits to enable debug info
void split_path(std::string const &path, std::vector< std::string > &components)
double t(bool selected=false) const
void SetBeamSpot(const TVector3 &spot)
static const double centimeter
Double_t dist
distance from hadron decay
virtual void SetLengthUnits(double lu)
virtual double TimeOffset()=0
void MesgThresholds(string inpfile)
void AddEnergySpectrum(int nu_pdgc, TH1D *spectrum)
Physics generators for neutrinos, cosmic rays, and others.
std::string fFluxCopyMethod
"DIRECT" = old direct access method, otherwise = ifdh approach schema ("" okay)
void FillGTruth(const genie::EventRecord *grec, simb::GTruth >ruth)
double Vy(void) const
Get production y.
double Q2(bool selected=false) const
double GetDecayDist() const
dist (user units) from dk to current pos
void SetRockBoxMinimal(Double_t *xyzmin, Double_t *xyzmax)
const Target & Tgt(void) const
void MakeBox(Double_t *xyzmin, Double_t *xyzmax)
const genie::flux::GSimpleNtpNuMI * GetCurrentNuMI(void)
GSimpleNtpNuMI.
std::string fFluxCleanup
"ALWAYS", "/var/tmp", "NEVER"
Event generator information.
Defines the GENIE Geometry Analyzer Interface.
auto const & get(AssnsNode< L, R, D > const &r)
A base class for the FLUKA, BGLRS and ATMNC atmo. nu. flux drivers. The driver depends on data files ...
double fHistEventsPerSpill
number of events per spill for histogram fluxes - changes each spill
TRotation * fFluxRotation
rotation for atmos / astro flux coord systems
void ForceMinEnergy(double emin)
std::string fGeomScan
configuration for geometry scan to determine max pathlengths
bool IsGlashowResonance(void) const
int fSpillEvents
total events for this spill
A flux driver for the Bartol Atmospheric Neutrino Flux.
genie::GFluxI * fFluxD2GMCJD
flux driver passed to genie GMCJDriver, might be GFluxBlender
STDHEP-like event record entry that can fit a particle or a nucleus.
void UseGeomAnalyzer(GeomAnalyzerI *geom)
void UseSplines(bool useLogE=true)
double fDiffXsec
differential cross section of interaction
std::string fFunctionalFlux
int fMaxFluxFileMB
maximum size of flux files (MB)
void PackMCTruth(genie::EventRecord *record, simb::MCTruth &truth)
double fPOTPerSpill
number of pot per spill
A simplified flux ntuple for quick running.
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)
TLorentzVector * GetProbeP4(RefFrame_t rf=kRfHitNucRest) const
void push_back(int pdg_code)
virtual int ScannerNRays(void) const
genie::GFluxI * GetFluxDriver(const std::string &)
GENIEHelper(fhicl::ParameterSet const &pset, TGeoManager *rootGeom, std::string const &rootFile, double const &detectorMass)
double Vx(void) const
Get production x.
double TravelDist(void)
returns the distance used in the flavor mixing
Initial State information.
GENIE Interface for user-defined flux classes.
evgb::EvtTimeShiftI * GetEvtTimeShift(const std::string &name, const std::string &config="") const
double Py(void) const
Get Py.
Int_t ptype
parent type (PDG)