LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
evgb::GiBUUHelper Class Reference

#include "GiBUUHelper.h"

Inheritance diagram for evgb::GiBUUHelper:
evgb::GENIEHelper

Public Member Functions

 GiBUUHelper (fhicl::ParameterSet const &pset, TGeoManager *rootGeom, std::string const &rootFile, double const &detectorMass)
 
 ~GiBUUHelper ()
 
genie::EventRecord * GetGiBUUEventRecord ()
 
void Initialize ()
 
bool Stop ()
 
bool Sample (simb::MCTruth &truth, simb::MCFlux &flux, simb::GTruth &gtruth)
 
double TotalHistFlux ()
 
double TotalExposure () const
 
double SpillExposure () const
 
std::string FluxType () const
 
std::string DetectorLocation () const
 
std::vector< TH1D * > FluxHistograms () const
 
double TotalMass () const
 
genie::EventRecord * GetGenieEventRecord ()
 
TRandom3 * GetHelperRandom ()
 
genie::GFluxI * GetFluxDriver (bool base=true)
 
std::string GetTuneName () const
 
std::string GetEventGeneratorList () const
 

Private Attributes

genie::EventRecord * fGiBUUEventRecord
 

Detailed Description

Definition at line 20 of file GiBUUHelper.h.

Constructor & Destructor Documentation

evgb::GiBUUHelper::GiBUUHelper ( fhicl::ParameterSet const &  pset,
TGeoManager *  rootGeom,
std::string const &  rootFile,
double const &  detectorMass 
)
explicit

Definition at line 54 of file GiBUUHelper.cxx.

58  : GENIEHelper(pset, geoManager, rootFile, detectorMass),
60  {
61  }
genie::EventRecord * fGiBUUEventRecord
Definition: GiBUUHelper.h:34
GENIEHelper(fhicl::ParameterSet const &pset, TGeoManager *rootGeom, std::string const &rootFile, double const &detectorMass)
evgb::GiBUUHelper::~GiBUUHelper ( )

Definition at line 64 of file GiBUUHelper.cxx.

References fGiBUUEventRecord.

65  {
66  // clean up owned genie object (other genie obj are ref ptrs)
67  delete fGiBUUEventRecord;
68 
69  }
genie::EventRecord * fGiBUUEventRecord
Definition: GiBUUHelper.h:34

Member Function Documentation

std::string evgb::GENIEHelper::DetectorLocation ( ) const
inlineinherited

Definition at line 77 of file GENIEHelper.h.

77 { return fDetLocation; }
std::string fDetLocation
name of flux window location
Definition: GENIEHelper.h:156
std::vector<TH1D*> evgb::GENIEHelper::FluxHistograms ( ) const
inlineinherited

Definition at line 81 of file GENIEHelper.h.

81 { return fFluxHistograms; }
std::vector< TH1D * > fFluxHistograms
histograms for each nu species
Definition: GENIEHelper.h:157
std::string evgb::GENIEHelper::FluxType ( ) const
inlineinherited

Definition at line 76 of file GENIEHelper.h.

76 { return fFluxType; }
std::string fFluxType
Definition: GENIEHelper.h:139
std::string evgb::GENIEHelper::GetEventGeneratorList ( ) const
inlineinherited

Definition at line 96 of file GENIEHelper.h.

96 { return fEventGeneratorList; }
std::string fEventGeneratorList
control over event topologies, was $GEVGL [Default]
Definition: GENIEHelper.h:197
genie::GFluxI* evgb::GENIEHelper::GetFluxDriver ( bool  base = true)
inlineinherited

Definition at line 91 of file GENIEHelper.h.

Referenced by evgen::TestGENIEHelper::produce(), and evgen::GENIEGen::produce().

92  { return ( (base) ? fFluxD : fFluxD2GMCJD ); }
genie::GFluxI * fFluxD
real flux driver
Definition: GENIEHelper.h:128
genie::GFluxI * fFluxD2GMCJD
flux driver passed to genie GMCJDriver, might be GFluxBlender
Definition: GENIEHelper.h:129
genie::EventRecord* evgb::GENIEHelper::GetGenieEventRecord ( )
inlineinherited

Definition at line 84 of file GENIEHelper.h.

Referenced by evgen::TestGENIEHelper::produce().

84 { return fGenieEventRecord; }
genie::EventRecord * fGenieEventRecord
last generated event
Definition: GENIEHelper.h:126
genie::EventRecord* evgb::GiBUUHelper::GetGiBUUEventRecord ( )
inline

Definition at line 30 of file GiBUUHelper.h.

References fGiBUUEventRecord.

30 { return fGiBUUEventRecord; }
genie::EventRecord * fGiBUUEventRecord
Definition: GiBUUHelper.h:34
TRandom3* evgb::GENIEHelper::GetHelperRandom ( )
inlineinherited

Definition at line 87 of file GENIEHelper.h.

87 { return fHelperRandom; }
TRandom3 * fHelperRandom
random # generator for GENIEHelper
Definition: GENIEHelper.h:135
std::string evgb::GENIEHelper::GetTuneName ( ) const
inlineinherited

Definition at line 95 of file GENIEHelper.h.

95 { return fTuneName; }
std::string fTuneName
GENIE R-3 Tune name (defines model configuration)
Definition: GENIEHelper.h:196
void evgb::GENIEHelper::Initialize ( )
inherited

Definition at line 606 of file GENIEHelper.cxx.

References evgb::GENIEHelper::ConfigGeomScan(), e, evgb::GENIEHelper::fDetectorMass, evgb::GENIEHelper::fDriver, evgb::GENIEHelper::fEventGeneratorList, evgb::GENIEHelper::fEventsPerSpill, evgb::GENIEHelper::fFluxD, evgb::GENIEHelper::fFluxD2GMCJD, evgb::GENIEHelper::fFluxType, evgb::GENIEHelper::fGeomD, evgb::GENIEHelper::fHelperRandom, evgb::GENIEHelper::fHistEventsPerSpill, evgb::GENIEHelper::fPOTPerSpill, evgb::GENIEHelper::fSpillEvents, evgb::GENIEHelper::fSpillExposure, evgb::GENIEHelper::fSurroundingMass, evgb::GENIEHelper::fTotalExposure, evgb::GENIEHelper::fTotalHistFlux, evgb::GENIEHelper::fTuneName, evgb::GENIEHelper::fXSecMassPOT, evgb::GENIEHelper::InitializeFluxDriver(), evgb::GENIEHelper::InitializeGeometry(), evgb::GENIEHelper::ReadXSecTable(), and evgb::SetEventGeneratorListAndTune().

Referenced by evgen::GENIEGen::beginJob(), and evgen::TestGENIEHelper::beginRun().

607  {
608 #ifdef GENIE_PRE_R3
609  // trigger early initialization of PDG database & GENIE message service
610  // just to get it out of the way and not intermixed with other output
611  genie::PDGLibrary::Instance();
612 #else
613  // get the GENIE banner out of the way
614  // no longer can use genie::PDGLibrary::Instance() to do this
615  // because that must happen, in some cases in v3_02_xx, after the tune
616  // is determined
617  // banner is triggered by first use of GENIE Messenger
618  // avoid using GENIE macros (possible conflict with mf macros)
619  // LOG("GENIE",pInfo) << "Trigger GENIE banner";
620  (*genie::Messenger::Instance())("GENIE") << log4cpp::Priority::INFO
621  << "Trigger GENIE banner";
622 #endif
623 
624 
625  mf::LogInfo("GENIEHelper") << "GENIE EventGeneratorList using \""
626  << fEventGeneratorList << "\"";
627 
629 
630 #ifdef GENIE_PRE_R3
631  // no tunes ... so can report current setting if different from fcl
632 #else
633  genie::RunOpt* grunopt = genie::RunOpt::Instance();
634 
635  // RunOpt's SetEventGeneratorList() wasn't introduced until R-3
636  // so above call could not have modified it in RunOpt
637  std::string currentEvtGenListName = grunopt->EventGeneratorList();
638  if ( currentEvtGenListName != fEventGeneratorList ) {
639  mf::LogInfo("GENIEHelper") << " EventGeneratorList name changed from \""
640  << fEventGeneratorList << "\" to \""
641  << currentEvtGenListName << "\""
642  << " by evgb::SetEventGeneratorListAndTune";
643  fEventGeneratorList = currentEvtGenListName;
644  }
645 
646  std::string currentTuneName = grunopt->Tune()->Name();
647  if ( currentTuneName != fTuneName ) {
648  mf::LogInfo("GENIEHelper") << " TuneName name changed from \""
649  << fTuneName << "\" to \""
650  << currentTuneName << "\""
651  << " by evgb::SetEventGeneratorListAndTune";
652  fTuneName = currentTuneName;
653  }
654 #endif
655 
656 
657  fDriver = new genie::GMCJDriver(); // this needs to be before ConfigGeomScan
658  // let the driver know which list
659  // (for R-3 this is in _addition_ to setting it in RunOpt)
660  // pre-R-3 one could not set it in RunOpt directly (ie. without parsing
661  // command line args), thus don't try to fetch it from there.
662  // post-R-3 one *-could-* use
663  // fDriver->SetEventGeneratorList(RunOpt::Instance()->EventGeneratorList());
664  fDriver->SetEventGeneratorList(fEventGeneratorList);
665 
666  // Figure out which cross section file to use
667  // post R-2_8_0 this actually triggers reading the file
668  ReadXSecTable();
669 
670  // initialize the Geometry and Flux drivers
673 
674  fDriver->UseFluxDriver(fFluxD2GMCJD);
675  fDriver->UseGeomAnalyzer(fGeomD);
676 
677  // must come after creation of Geom, Flux and GMCJDriver
678  ConfigGeomScan(); // could trigger fDriver->UseMaxPathLengths(*xmlfile*)
679 
680  fDriver->Configure(); // could trigger GeomDriver::ComputeMaxPathLengths()
681  fDriver->UseSplines();
682  fDriver->ForceSingleProbScale();
683 
684  if ( fFluxType.find("histogram") == 0 && fEventsPerSpill < 0.01 ) {
685  // fluxes are assumed to be given in units of neutrinos/cm^2/1e20POT/energy
686  // integral over all fluxes removes energy dependence
687  // histograms should have bin width that reflects the value of the /energy bit
688  // ie if /energy = /50MeV then the bin width should be 50 MeV
689 
690  // determine product of pot/spill, mass, and cross section
691  // events = flux * pot * 10^-38 cm^2 (xsec) * (mass detector (in kg) / nucleon mass (in kg))
692  fXSecMassPOT = 1.e-38*1.e-20;
694 
695  mf::LogInfo("GENIEHelper") << "Number of events per spill will be based on poisson mean of "
697 
698  fHistEventsPerSpill = fHelperRandom->Poisson(fXSecMassPOT*fTotalHistFlux);
699  }
700 
701  // set the pot/event counters to zero
702  fSpillEvents = 0;
703  fSpillExposure = 0.;
704  fTotalExposure = 0.;
705 
706  // If the flux driver knows how to keep track of exposure (time,pots)
707  // reset it now as some might have been used in determining
708  // the geometry maxpathlength or internally scanning for weights.
709  // Should be happen for all cases since R-2_8_0 .. but no harm doing it ourselves
710 
711  fFluxD->Clear("CycleHistory");
712 
713  return;
714  }
double fEventsPerSpill
Definition: GENIEHelper.h:160
std::string fTuneName
GENIE R-3 Tune name (defines model configuration)
Definition: GENIEHelper.h:196
double fTotalHistFlux
total flux of neutrinos from flux histograms for used flavors
Definition: GENIEHelper.h:173
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
std::string fEventGeneratorList
control over event topologies, was $GEVGL [Default]
Definition: GENIEHelper.h:197
genie::GMCJDriver * fDriver
Definition: GENIEHelper.h:130
double fXSecMassPOT
product of cross section, mass and POT/spill for histogram fluxes
Definition: GENIEHelper.h:172
double fSurroundingMass
Definition: GENIEHelper.h:178
double fTotalExposure
pot used from flux ntuple
Definition: GENIEHelper.h:166
TRandom3 * fHelperRandom
random # generator for GENIEHelper
Definition: GENIEHelper.h:135
genie::GeomAnalyzerI * fGeomD
Definition: GENIEHelper.h:127
genie::GFluxI * fFluxD
real flux driver
Definition: GENIEHelper.h:128
double fDetectorMass
mass of the detector in kg
Definition: GENIEHelper.h:177
void SetEventGeneratorListAndTune(const std::string &evtlistname="", const std::string &tunename="${GENIE_XSEC_TUNE}")
Definition: GENIE2ART.cxx:128
double fSpillExposure
total exposure (i.e. pot) for this spill
Definition: GENIEHelper.h:165
double fHistEventsPerSpill
number of events per spill for histogram fluxes - changes each spill
Definition: GENIEHelper.h:163
Float_t e
Definition: plot.C:35
int fSpillEvents
total events for this spill
Definition: GENIEHelper.h:164
genie::GFluxI * fFluxD2GMCJD
flux driver passed to genie GMCJDriver, might be GFluxBlender
Definition: GENIEHelper.h:129
double fPOTPerSpill
number of pot per spill
Definition: GENIEHelper.h:162
std::string fFluxType
Definition: GENIEHelper.h:139
bool evgb::GENIEHelper::Sample ( simb::MCTruth truth,
simb::MCFlux flux,
simb::GTruth gtruth 
)
inherited

Definition at line 1662 of file GENIEHelper.cxx.

References bin, simb::MCParticle::E(), evgb::GENIEHelper::fAddGenieVtxTime, evgb::GENIEHelper::fAtmoSpectralIndex, evgb::GENIEHelper::fDebugFlags, simb::MCFlux::fdk2gen, evgb::GENIEHelper::fDriver, evgb::GENIEHelper::fEventsPerSpill, evgb::GENIEHelper::fFluxD, evgb::GENIEHelper::fFluxD2GMCJD, evgb::GENIEHelper::fFluxHistograms, simb::MCFlux::fFluxType, evgb::GENIEHelper::fFluxType, evgb::GENIEHelper::fForceApplyFlxWgt, simb::MCFlux::fgen2vtx, evgb::GENIEHelper::fGenFlavors, evgb::GENIEHelper::fGenieEventRecord, simb::MCFlux::fgenx, simb::MCFlux::fgeny, simb::MCFlux::fgenz, evgb::GENIEHelper::fGeoManager, evgb::GENIEHelper::fGHepPrintLevel, evgb::GENIEHelper::fGlobalTimeOffset, evgb::GENIEHelper::fHelperRandom, evgb::FillGTruth(), evgb::FillMCFlux(), evgb::FillMCTruth(), evgb::GENIEHelper::fRandomTimeOffset, evgb::GENIEHelper::fSpillEvents, evgb::GENIEHelper::fSpillExposure, evgb::GENIEHelper::fTimeShifter, evgb::GENIEHelper::fTopVolume, evgb::GENIEHelper::fTotalExposure, evgb::GENIEHelper::fTuneName, evgb::GENIEHelper::fUseBlenderDist, evgb::GENIEHelper::fUseHelperRndGen4GENIE, evgb::GENIEHelper::fWorldVolume, simb::MCTruth::GetNeutrino(), simb::kHistPlusFocus, evgb::kNue, evgb::kNueBar, evgb::kNuMu, evgb::kNuMuBar, evgb::kNuTau, evgb::kNuTauBar, simb::MCNeutrino::Nu(), simb::MCFlux::SetFluxGen(), evgb::EvtTimeShiftI::TimeOffset(), and util::to_string().

Referenced by evgen::TestGENIEHelper::produce(), and evgen::GENIEGen::produce().

1663  {
1664  // set the top volume for the geometry
1665  fGeoManager->SetTopVolume(fGeoManager->FindVolumeFast(fTopVolume.c_str()));
1666 
1667  if ( fGenieEventRecord ) delete fGenieEventRecord;
1668 
1669  // ART Framework plays games with gRandom, undo that if requested
1670  TRandom* old_gRandom = gRandom;
1671  if (fUseHelperRndGen4GENIE) gRandom = fHelperRandom;
1672 
1673  fGenieEventRecord = fDriver->GenerateEvent();
1674 
1675  if (fForceApplyFlxWgt) {
1676  //const issue: double flxweight = fDriver->FluxDriver().Weight();
1677  //genie::GFluxI& flx = const_cast<genie::GFluxI&>(fDriver->FluxDriver());
1678  //double flxweight = flx.Weight();
1679  // use the flux driver handle we already have, rather than fetch const one
1680  // from the GMCJDriver fDriver
1681  double flxweight = fFluxD->Weight();
1682  double curweight = fGenieEventRecord->Weight();
1683  fGenieEventRecord->SetWeight(flxweight*curweight);
1684  }
1685 
1686  if (fUseHelperRndGen4GENIE) gRandom = old_gRandom;
1687 
1688  // now check if we produced a viable event record
1689  bool viableInteraction = true;
1690  if ( ! fGenieEventRecord ) viableInteraction = false;
1691 
1692  // update the spill total information, then check to see
1693  // if we got an event record that was valid
1694 
1695  genie::flux::GFluxExposureI* fexposure =
1696  dynamic_cast<genie::flux::GFluxExposureI*>(fFluxD);
1697  if ( fexposure ) {
1698  fSpillExposure =
1699  (fexposure->GetTotalExposure()/fDriver->GlobProbScale()) - fTotalExposure;
1700  }
1701  // use GENIE2ART code to fill MCFlux
1702  evgb::FillMCFlux(fFluxD,flux);
1703 
1704  // if no interaction generated return false
1705  if ( ! viableInteraction ) return false;
1706 
1707  // fill the MCTruth & GTruth information as we have a good interaction
1708  // these two objects are enough to reconstruct the GENIE record
1709  // use the new external functions in GENIE2ART
1710 
1711  // choose a time within the spill (ns) to shift the vertex times by:
1712  double timeoffset = 0;
1713  if ( ! fTimeShifter ) {
1714  timeoffset = fHelperRandom->Uniform()*fRandomTimeOffset;
1715  } else {
1716  timeoffset = fTimeShifter->TimeOffset();
1717  }
1718  // mf::LogInfo("GENIEHelper") << "TimeShifter adding " << timeoffset;
1719  double spilltime = fGlobalTimeOffset + timeoffset;
1720 
1721  std::unordered_map<std::string, std::string> genConfig;
1722 
1723  if(fFluxType.find("PowerSpectrum") != std::string::npos){
1724  genConfig.emplace("SpectralIndex", std::to_string(fAtmoSpectralIndex));
1725  }
1726 
1727  evgb::FillMCTruth(fGenieEventRecord, spilltime, truth,
1728  __GENIE_RELEASE__, fTuneName, fAddGenieVtxTime );
1730 
1731  // check to see if we are using flux ntuples but want to
1732  // make n events per spill
1733  if ( ( fEventsPerSpill > 0 ) &&
1734  ( fFluxType.find("tree_") == 0 ) ) ++fSpillEvents;
1735 
1736  // now check if using either histogram or mono fluxes, using
1737  // either n events per spill or basing events on POT per spill for the
1738  // histogram case
1739  if ( fFluxType.find("histogram") == 0 ) {
1740  // set the flag in the parent object that says the
1741  // fluxes came from histograms and fill related values
1743 
1744  // save the fluxes - fluxes were added to the vector in the same
1745  // order that the flavors appear in fGenFlavors
1746  int ctr = 0;
1747  int bin = fFluxHistograms[0]->FindBin(truth.GetNeutrino().Nu().E());
1748  std::vector<double> fluxes(6, 0.);
1749  for(std::vector<int>::iterator i = fGenFlavors.begin(); i != fGenFlavors.end(); i++){
1750  if(*i == 12) fluxes[kNue] = fFluxHistograms[ctr]->GetBinContent(bin);
1751  if(*i == -12) fluxes[kNueBar] = fFluxHistograms[ctr]->GetBinContent(bin);
1752  if(*i == 14) fluxes[kNuMu] = fFluxHistograms[ctr]->GetBinContent(bin);
1753  if(*i == -14) fluxes[kNuMuBar] = fFluxHistograms[ctr]->GetBinContent(bin);
1754  if(*i == 16) fluxes[kNuTau] = fFluxHistograms[ctr]->GetBinContent(bin);
1755  if(*i == -16) fluxes[kNuTauBar] = fFluxHistograms[ctr]->GetBinContent(bin);
1756  ++ctr;
1757  }
1758 
1759  // get the flux for each neutrino flavor of this energy
1760  flux.SetFluxGen(fluxes[kNue], fluxes[kNueBar],
1761  fluxes[kNuMu], fluxes[kNuMuBar],
1762  fluxes[kNuTau], fluxes[kNuTauBar]);
1763 
1764  ++fSpillEvents;
1765  }
1766  else if ( fFluxType.find("mono") == 0 ||
1767  fFluxType.find("function") == 0 ){
1768  ++fSpillEvents;
1769  }
1770  else if ( fFluxType.find("atmo_FLUKA") == 0 ||
1771  fFluxType.find("atmo_BARTOL") == 0 ||
1772  fFluxType.find("atmo_PowerSpectrum") == 0 ||
1773  fFluxType.find("atmo_BGLRS") == 0 ||
1774  fFluxType.find("atmo_HAKKM") == 0 ||
1775  fFluxType.find("atmo_HONDA") == 0 ) {
1776  if ( fEventsPerSpill > 0 ) ++fSpillEvents;
1778  }
1779 
1780 
1781  // fill these after the Pack[NuMI|Simple]Flux because those
1782  // will Reset() the values at the start
1783  TLorentzVector *vertex = fGenieEventRecord->Vertex();
1784  TLorentzVector nuray_pos = fFluxD->Position();
1785  TVector3 ray2vtx = nuray_pos.Vect() - vertex->Vect();
1786  flux.fgenx = nuray_pos.X();
1787  flux.fgeny = nuray_pos.Y();
1788  flux.fgenz = nuray_pos.Z();
1789  flux.fgen2vtx = ray2vtx.Mag();
1790 
1791  genie::flux::GFluxBlender* blender =
1792  dynamic_cast<genie::flux::GFluxBlender*>(fFluxD2GMCJD);
1793  if ( blender ) {
1794  if ( fUseBlenderDist ) flux.fdk2gen = blender->TravelDist();
1795  // / if mixing flavors print the state of the blender
1796  if ( fDebugFlags & 0x02 ) blender->PrintState();
1797  }
1798 
1799  if ( fDebugFlags & 0x04 ) {
1800  mf::LogInfo("GENIEHelper") << "vertex loc " << vertex->X() << ","
1801  << vertex->Y() << "," << vertex->Z() << std::endl
1802  << " flux ray start " << nuray_pos.X() << ","
1803  << nuray_pos.Y() << "," << nuray_pos.Z() << std::endl
1804  << " ray2vtx = " << flux.fgen2vtx
1805  << " dk2ray = " << flux.fdk2gen;
1806  }
1807  if ( fGHepPrintLevel >= 0 ) {
1808  std::cout << *fGenieEventRecord;
1809  }
1810 
1811  // set the top volume of the geometry back to the world volume
1812  fGeoManager->SetTopVolume(fGeoManager->FindVolumeFast(fWorldVolume.c_str()));
1813 
1814  return true;
1815  }
double E(const int i=0) const
Definition: MCParticle.h:234
double fgenz
Definition: MCFlux.h:102
intermediate_table::iterator iterator
static const int kNuTauBar
bool fUseHelperRndGen4GENIE
use fHelperRandom for gRandom during Sample()
Definition: GENIEHelper.h:136
double fEventsPerSpill
Definition: GENIEHelper.h:160
const simb::MCNeutrino & GetNeutrino() const
Definition: MCTruth.h:77
std::string fTuneName
GENIE R-3 Tune name (defines model configuration)
Definition: GENIEHelper.h:196
void FillMCTruth(const genie::EventRecord *grec, double spillTime, simb::MCTruth &mctruth, const std::string &genieVersion="unknown", const std::string &genieTune="unknown", bool addGenieVtxTime=false, const std::unordered_map< std::string, std::string > genConfig={})
Definition: GENIE2ART.cxx:182
double fgeny
Definition: MCFlux.h:101
double fgen2vtx
distance from ray origin to event vtx
Definition: MCFlux.h:104
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
void FillMCFlux(genie::GFluxI *fdriver, simb::MCFlux &mcflux)
Definition: GENIE2ART.cxx:834
const simb::MCParticle & Nu() const
Definition: MCNeutrino.h:146
double fgenx
origin of ray from flux generator
Definition: MCFlux.h:100
simb::flux_code_ fFluxType
Definition: MCFlux.h:98
static const int kNuTau
double fRandomTimeOffset
additional random time shift (ns) added to every particle time
Definition: GENIEHelper.h:181
double fGlobalTimeOffset
overall time shift (ns) added to every particle time
Definition: GENIEHelper.h:180
TGeoManager * fGeoManager
pointer to ROOT TGeoManager
Definition: GENIEHelper.h:123
static const int kNue
std::vector< int > fGenFlavors
pdg codes for flavors to generate
Definition: GENIEHelper.h:186
evgb::EvtTimeShiftI * fTimeShifter
generator for time offset within a spill
Definition: GENIEHelper.h:137
double fdk2gen
distance from decay to ray origin
Definition: MCFlux.h:103
genie::GMCJDriver * fDriver
Definition: GENIEHelper.h:130
genie::EventRecord * fGenieEventRecord
last generated event
Definition: GENIEHelper.h:126
std::vector< TH1D * > fFluxHistograms
histograms for each nu species
Definition: GENIEHelper.h:157
Flux for positive horn focus.
Definition: MCFlux.h:18
int fGHepPrintLevel
GHepRecord::SetPrintLevel(), -1=no-print.
Definition: GENIEHelper.h:201
std::string fWorldVolume
name of the world volume in the ROOT geometry
Definition: GENIEHelper.h:155
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
bool fForceApplyFlxWgt
apply GFluxI::Weight() before returning event
Definition: GENIEHelper.h:184
double fTotalExposure
pot used from flux ntuple
Definition: GENIEHelper.h:166
TRandom3 * fHelperRandom
random # generator for GENIEHelper
Definition: GENIEHelper.h:135
std::string fTopVolume
top volume in the ROOT geometry in which to generate events
Definition: GENIEHelper.h:154
bool fUseBlenderDist
get neutrino&#39;s travel distance from blender (default: true)
Definition: GENIEHelper.h:204
static const int kNuMuBar
float bin[41]
Definition: plottest35.C:14
genie::GFluxI * fFluxD
real flux driver
Definition: GENIEHelper.h:128
void SetFluxGen(double nue, double nuebar, double numu, double numubar, double nutau, double nutaubar)
Definition: MCFlux.cxx:214
bool fAddGenieVtxTime
incorporate time from flux window to interaction point and (possibily) proton-on-target to flux windo...
Definition: GENIEHelper.h:183
double fAtmoSpectralIndex
atmo: Spectral index for power spectrum generation
Definition: GENIEHelper.h:192
double fSpillExposure
total exposure (i.e. pot) for this spill
Definition: GENIEHelper.h:165
unsigned int fDebugFlags
set bits to enable debug info
Definition: GENIEHelper.h:208
virtual double TimeOffset()=0
void FillGTruth(const genie::EventRecord *grec, simb::GTruth &gtruth)
Definition: GENIE2ART.cxx:391
int fSpillEvents
total events for this spill
Definition: GENIEHelper.h:164
genie::GFluxI * fFluxD2GMCJD
flux driver passed to genie GMCJDriver, might be GFluxBlender
Definition: GENIEHelper.h:129
static const int kNueBar
static const int kNuMu
std::string fFluxType
Definition: GENIEHelper.h:139
vertex reconstruction
double evgb::GENIEHelper::SpillExposure ( ) const
inlineinherited

Definition at line 75 of file GENIEHelper.h.

75 { return fSpillExposure; }
double fSpillExposure
total exposure (i.e. pot) for this spill
Definition: GENIEHelper.h:165
bool evgb::GENIEHelper::Stop ( )
inherited

Definition at line 1599 of file GENIEHelper.cxx.

References evgb::GENIEHelper::fAtmoRt, evgb::GENIEHelper::fDriver, evgb::GENIEHelper::fEventsPerSpill, evgb::GENIEHelper::fFluxD, evgb::GENIEHelper::fFluxType, evgb::GENIEHelper::fGenFlavors, evgb::GENIEHelper::fHelperRandom, evgb::GENIEHelper::fHistEventsPerSpill, evgb::GENIEHelper::fPOTPerSpill, evgb::GENIEHelper::fSpillEvents, evgb::GENIEHelper::fSpillExposure, evgb::GENIEHelper::fTotalExposure, evgb::GENIEHelper::fTotalHistFlux, and evgb::GENIEHelper::fXSecMassPOT.

Referenced by evgen::TestGENIEHelper::produce(), and evgen::GENIEGen::produce().

1600  {
1601  // std::cout << "in GENIEHelper::Stop(), fEventsPerSpill = " << fEventsPerSpill
1602  // << " fPOTPerSpill = " << fPOTPerSpill << " fSpillExposure = " << fSpillExposure
1603  // << " fSpillEvents = " << fSpillEvents
1604  // << " fHistEventsPerSpill = " << fHistEventsPerSpill << std::endl;
1605 
1606  // determine if we should keep throwing neutrinos for
1607  // this spill or move on
1608 
1609  if ( fEventsPerSpill > 0 ) {
1610  if ( fSpillEvents < fEventsPerSpill ) return false;
1611  } else {
1612  // exposure (POT) based
1613  if ( fFluxType.find("tree_") == 0 ) {
1614  if ( fSpillExposure < fPOTPerSpill ) {
1615  return false;
1616  }
1617  }
1618  else if ( fFluxType.find("histogram") == 0 ) {
1619  if ( fSpillEvents < fHistEventsPerSpill ) return false;
1621  }
1622  }
1623 
1624  if ( fFluxType.find("atmo_") == 0 ) {
1625  // the exposure for atmo is in SECONDS. In order to get seconds,
1626  // it needs to be normalized by 1e4 to take into account the units
1627  // discrepency between AtmoFluxDriver(/m2) and Generate(/cm2)
1628  // and it need to be normalized by the generation surface area since
1629  // it's not taken into accoutn in the flux driver
1630 
1631  long int nNeutrinos;
1632 
1633  if(fFluxType.find("PowerSpectrum") != std::string::npos){
1634  nNeutrinos = dynamic_cast<genie::flux::GPowerSpectrumAtmoFlux *>(fFluxD)->NFluxNeutrinos();
1635  fTotalExposure = nNeutrinos/fGenFlavors.size()/fDriver->GlobProbScale();
1636  mf::LogInfo("GENIEHelper")
1637  << "===> Atmo Pscale*Ngen/Nflavours = " << fTotalExposure;
1638  }
1639  else{
1640  nNeutrinos = dynamic_cast<genie::flux::GAtmoFlux *>(fFluxD)->NFluxNeutrinos();
1641  fTotalExposure = nNeutrinos * 1.0e4 / (TMath::Pi() * fAtmoRt*fAtmoRt);
1642  mf::LogInfo("GENIEHelper")
1643  << "===> Atmo EXPOSURE = " << fTotalExposure << " seconds.";
1644  }
1645 
1646 
1647 
1648 
1649 
1650  } else {
1652  }
1653 
1654  // made it to here, means need to reset the counters
1655  fSpillEvents = 0;
1656  fSpillExposure = 0.;
1658  return true;
1659  }
double fEventsPerSpill
Definition: GENIEHelper.h:160
double fTotalHistFlux
total flux of neutrinos from flux histograms for used flavors
Definition: GENIEHelper.h:173
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
A driver for a power spectrum atmospheric neutrino flux. Elements extensively reused from GAtmoFlux...
std::vector< int > fGenFlavors
pdg codes for flavors to generate
Definition: GENIEHelper.h:186
genie::GMCJDriver * fDriver
Definition: GENIEHelper.h:130
double fXSecMassPOT
product of cross section, mass and POT/spill for histogram fluxes
Definition: GENIEHelper.h:172
double fTotalExposure
pot used from flux ntuple
Definition: GENIEHelper.h:166
TRandom3 * fHelperRandom
random # generator for GENIEHelper
Definition: GENIEHelper.h:135
genie::GFluxI * fFluxD
real flux driver
Definition: GENIEHelper.h:128
double fSpillExposure
total exposure (i.e. pot) for this spill
Definition: GENIEHelper.h:165
double fHistEventsPerSpill
number of events per spill for histogram fluxes - changes each spill
Definition: GENIEHelper.h:163
int fSpillEvents
total events for this spill
Definition: GENIEHelper.h:164
double fPOTPerSpill
number of pot per spill
Definition: GENIEHelper.h:162
std::string fFluxType
Definition: GENIEHelper.h:139
double evgb::GENIEHelper::TotalExposure ( ) const
inlineinherited

Definition at line 71 of file GENIEHelper.h.

Referenced by evgen::GENIEGen::beginSubRun(), evgen::TestGENIEHelper::endSubRun(), and evgen::GENIEGen::endSubRun().

71 { return fTotalExposure; }
double fTotalExposure
pot used from flux ntuple
Definition: GENIEHelper.h:166
double evgb::GENIEHelper::TotalHistFlux ( )
inherited

Definition at line 591 of file GENIEHelper.cxx.

References evgb::GENIEHelper::fFluxType, and evgb::GENIEHelper::fTotalHistFlux.

592  {
593  if ( fFluxType.find("mono") == 0 ||
594  fFluxType.find("function") == 0 ||
595  fFluxType.find("tree_") == 0 ||
596  fFluxType.find("atmo_") == 0 ) {
597  // shouldn't be asking for this for any of the above
598  // perhaps not-not "function"?
599  return -999.;
600  }
601 
602  return fTotalHistFlux;
603  }
double fTotalHistFlux
total flux of neutrinos from flux histograms for used flavors
Definition: GENIEHelper.h:173
std::string fFluxType
Definition: GENIEHelper.h:139
double evgb::GENIEHelper::TotalMass ( ) const
inlineinherited

Definition at line 82 of file GENIEHelper.h.

double fSurroundingMass
Definition: GENIEHelper.h:178
double fDetectorMass
mass of the detector in kg
Definition: GENIEHelper.h:177

Member Data Documentation

genie::EventRecord* evgb::GiBUUHelper::fGiBUUEventRecord
private

Definition at line 34 of file GiBUUHelper.h.

Referenced by GetGiBUUEventRecord(), and ~GiBUUHelper().


The documentation for this class was generated from the following files: