518 if ( ! RunOpt::Instance()->Tune() ) {
519 LOG(
"gmkspl",
pFATAL) <<
" No TuneId in RunOption";
522 RunOpt::Instance()->BuildTune();
532 GHepRecord::SetPrintLevel(RunOpt::Instance()->EventRecordPrintLevel());
538 double zmin=0, zmax=0;
553 TGeoVolume * topvol = rgeom->
GetGeometry()->GetTopVolume();
555 bounding_box->GetAxisRange(3, zmin, zmax);
562 LOG(
"gevgen_t2k",
pFATAL) <<
"Null top ROOT geometry volume!";
607 if(!beam_sim_data_success) {
609 <<
"The flux driver has not been properly configured. Exiting";
623 flux_driver =
dynamic_cast<GFluxI *
> (jparc_flux_driver);
631 TVector3 bdir (0,0,1);
632 TVector3 bspot(0,0,0);
639 int pdg_code = it->first;
640 TH1D * spectrum =
new TH1D(*(it->second));
644 flux_driver =
dynamic_cast<GFluxI *
> (hst_flux_driver);
668 bool success =
false;
674 string name = basename.substr(0, basename.rfind(
"."));
678 name +=
".master.flxprobs.root";
694 <<
"Successfully calculated/loaded flux interaction probabilities!";
699 double ntot_per_pot = 0.0;
700 double ntot_per_cycle = 0.0;
702 double pot_1cycle = jparc_flux_driver->
POT_1cycle();
704 "Expected event rates based on flux interaction probabilities:";
705 for(; sum_probs_it != sum_probs_map.end(); sum_probs_it++){
706 double sum_probs = sum_probs_it->second;
707 double nevts_per_cycle = sum_probs / pscale;
708 double nevts_per_pot = sum_probs/pot_1cycle;
709 ntot_per_pot += nevts_per_pot;
710 ntot_per_cycle += nevts_per_cycle;
712 " PDG "<< sum_probs_it->first <<
": " << nevts_per_cycle <<
713 " Events/Cycle, "<< nevts_per_pot <<
" Events/POT";
715 LOG(
"T2KProdInfo",
pNOTICE) <<
" -----------";
717 " All neutrino species: " << ntot_per_cycle <<
718 " Events/Cycle, "<< ntot_per_pot <<
" Events/POT";
720 "N.B. This assumes input flux file corresponds to "<< pot_1cycle <<
721 "POT, ensure this is correct if using these numbers!";
725 <<
"Failed to calculated/loaded flux interaction probabilities!";
732 <<
"Will not generate events - just pre-calculating flux interaction" 746 double fpot_1c = jparc_flux_driver->
POT_1cycle();
748 double pot_1c = fpot_1c / psc;
749 int ncycles = (
int) TMath::Max(1., TMath::Ceil(
gOptPOT/pot_1c));
752 <<
" *** POT/cycle: " << pot_1c;
754 <<
" *** Requested POT will be accumulated in: " 755 << ncycles <<
" flux ntuple cycles";
783 TBranch * flux = ntpw.EventTree()->Branch(
"flux",
784 "genie::flux::GJPARCNuFluxPassThroughInfo", &flux_info, 32000, 1);
786 flux->SetAutoDelete(kFALSE);
791 mcjmonitor.SetRefreshRate(RunOpt::Instance()->MCJobStatusRefreshRate());
801 <<
" *** Generating event............ " << ievent;
815 double pot = fpot / psc;
825 if(!
event && jparc_flux_driver->
End()) {
827 <<
"** The JPARC flux driver read all the input flux ntuple entries";
832 <<
"Got a null generated neutino event! Retrying ...";
836 <<
"Generated event: " << *
event;
847 <<
"Pass-through flux info associated with generated event: " 852 ntpw.AddEventRecord(ievent,
event);
853 mcjmonitor.Update(ievent,
event);
855 if(flux_info)
delete flux_info;
860 <<
"The GENIE MC job is done generaing events - Cleaning up & exiting...";
873 double pot = fpot / psc;
877 long int nflx_evg = mcj_driver -> NFluxNeutrinos();
878 long int nflx = jparc_flux_driver -> NFluxNeutrinos();
879 long int nev = ievent;
882 <<
"\n >> Actual JNUBEAM flux file normalization: " << fpot
884 <<
"\n >> Interaction probability scaling factor: " << psc
885 <<
"\n >> N of flux v read-in by flux driver: " << nflx
886 <<
"\n >> N of flux v thrown to event gen driver: " << nflx_evg
887 <<
"\n >> N of generated v interactions: " << nev
888 <<
"\n ** Normalization for generated sample: " << pot
891 ntpw.EventTree()->SetWeight(pot);
911 ntpw.EventTree()->GetUserInfo()->Add(metadata);
926 TH1D * spectrum = it->second;
927 if(spectrum)
delete spectrum;
map< int, TH1D * > gOptFluxHst
string gOptRootGeomTopVol
void RandGen(long int seed)
double POT_curravg(void)
current average POT
void XSecTable(string inpfile, bool require_table)
bool PreCalcFluxProbabilities(void)
map< int, double > SumFluxIntProbs(void) const
bool LoadBeamSimData(string filename, string det_loc)
load a jnubeam root flux ntuple
bool End(void)
true if no more flux nu's can be thrown (eg reaching end of beam sim ntuples)
void SetUpstreamZ(double z0)
set flux neutrino initial z position (upstream of the detector)
void SetEventGeneratorList(string listname)
double POT_1cycle(void)
flux POT per cycle
map< int, double > gOptTgtMix
string gOptDetectorLocation
NtpMCFormat_t kDefOptNtpFormat
void SetFluxParticles(const PDGCodeList &particles)
specify list of flux neutrino species
string gOptFluxProbFileName
A GENIE flux driver encapsulating the JPARC neutrino flux. It reads-in the official JPARC neutrino fl...
void UseFluxDriver(GFluxI *flux)
bool gOptRandomFluxOffset
Simple class to create & update MC job status files and env. vars. This is used to be able to keep tr...
A GENIE `MC Job Driver'. Can be used for setting up complicated event generation cases involving deta...
double GlobProbScale(void) const
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
void ForceSingleProbScale(void)
void SetFilePOT(double pot)
flux file norm is in /N POT/det [ND] or /N POT/cm^2 [FD]. Specify N (typically 1E+21) ...
virtual double LengthUnits(void) const
A generic GENIE flux driver. Generates a 'cylindrical' neutrino beam along the input direction...
bool UseMaxPathLengths(string xml_filename)
void Configure(bool calc_prob_scales=true)
A ROOT/GEANT4 geometry driver.
void GetCommandLineArgs(int argc, char **argv)
void SetTransverseRadius(double Rt)
void DisableOffset(void)
switch off random offset, must be called before LoadBeamSimData to have any effect ...
void SetNuDirection(const TVector3 &direction)
PDGCodeList gOptFluxNtpNuList(false)
string gOptSaveFluxProbsFileName
EventRecord * GenerateEvent(void)
Generated Event Record. It is a GHepRecord object that can accept / be visited by EventRecordVisitorI...
bool gOptSaveFluxProbsFile
A utility class to facilitate creating the GENIE MC Ntuple from the output GENIE GHEP event records...
bool LoadFluxProbabilities(string filename)
void SetNumOfCycles(int n)
set how many times to cycle through the ntuple (default: 1 / n=0 means 'infinite') ...
A vector of EventGeneratorI objects.
void SetBeamSpot(const TVector3 &spot)
void MesgThresholds(string inpfile)
void AddEnergySpectrum(int nu_pdgc, TH1D *spectrum)
bool gOptExitAtEndOfFullFluxCycles
Defines the GENIE Geometry Analyzer Interface.
void RecursiveExhaust(TGeoVolume *topvol, string volnames, bool exhaust)
void UseGeomAnalyzer(GeomAnalyzerI *geom)
void UseSplines(bool useLogE=true)
The PointGeomAnalyzer class is the simplest implementation of the GeomAnalyserI interface and defines...
void CacheFile(string inpfile)
void SaveFluxProbabilities(string outfilename)
const GJPARCNuFluxPassThroughInfo & PassThroughInfo(void)
GJPARCNuFluxPassThroughInfo.
Event finding and building.
virtual TGeoManager * GetGeometry(void) const
GENIE Interface for user-defined flux classes.