LArSoft  v06_85_00
Liquid Argon Software toolkit - http://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)
 

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 50 of file GiBUUHelper.cxx.

54  : GENIEHelper(pset, geoManager, rootFile, detectorMass),
56  {
57  }
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 60 of file GiBUUHelper.cxx.

References fGiBUUEventRecord.

61  {
62  // clean up owned genie object (other genie obj are ref ptrs)
63  delete fGiBUUEventRecord;
64 
65  }
genie::EventRecord * fGiBUUEventRecord
Definition: GiBUUHelper.h:34

Member Function Documentation

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

Definition at line 72 of file GENIEHelper.h.

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

Definition at line 76 of file GENIEHelper.h.

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

Definition at line 71 of file GENIEHelper.h.

71 { return fFluxType; }
std::string fFluxType
Definition: GENIEHelper.h:132
genie::GFluxI* evgb::GENIEHelper::GetFluxDriver ( bool  base = true)
inlineinherited

Definition at line 86 of file GENIEHelper.h.

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

Definition at line 79 of file GENIEHelper.h.

79 { return fGenieEventRecord; }
genie::EventRecord * fGenieEventRecord
last generated event
Definition: GENIEHelper.h:119
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 82 of file GENIEHelper.h.

82 { return fHelperRandom; }
TRandom3 * fHelperRandom
random # generator for GENIEHelper
Definition: GENIEHelper.h:128
void evgb::GENIEHelper::Initialize ( )
inherited

Definition at line 601 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::fXSecMassPOT, evgb::GENIEHelper::InitializeFluxDriver(), and evgb::GENIEHelper::InitializeGeometry().

Referenced by evgen::GENIEGen::beginJob().

602  {
603  fDriver = new genie::GMCJDriver(); // needs to be before ConfigGeomScan
604 #ifndef GENIE_USE_ENVVAR
605  // this configuration happened via $GEVGL beore R-2_8_0
606  fDriver->SetEventGeneratorList(fEventGeneratorList);
607 #endif
608 
609  // initialize the Geometry and Flux drivers
612 
613  fDriver->UseFluxDriver(fFluxD2GMCJD);
614  fDriver->UseGeomAnalyzer(fGeomD);
615 
616  // must come after creation of Geom, Flux and GMCJDriver
617  ConfigGeomScan(); // could trigger fDriver->UseMaxPathLengths(*xmlfile*)
618 
619  fDriver->Configure(); // trigger GeomDriver::ComputeMaxPathLengths()
620  fDriver->UseSplines();
621  fDriver->ForceSingleProbScale();
622 
623  if ( fFluxType.compare("histogram") == 0 && fEventsPerSpill < 0.01 ) {
624  // fluxes are assumed to be given in units of neutrinos/cm^2/1e20POT/energy
625  // integral over all fluxes removes energy dependence
626  // histograms should have bin width that reflects the value of the /energy bit
627  // ie if /energy = /50MeV then the bin width should be 50 MeV
628 
629  // determine product of pot/spill, mass, and cross section
630  // events = flux * pot * 10^-38 cm^2 (xsec) * (mass detector (in kg) / nucleon mass (in kg))
631  fXSecMassPOT = 1.e-38*1.e-20;
633 
634  mf::LogInfo("GENIEHelper") << "Number of events per spill will be based on poisson mean of "
636 
637  fHistEventsPerSpill = fHelperRandom->Poisson(fXSecMassPOT*fTotalHistFlux);
638  }
639 
640  // set the pot/event counters to zero
641  fSpillEvents = 0;
642  fSpillExposure = 0.;
643  fTotalExposure = 0.;
644 
645  // If the flux driver knows how to keep track of exposure (time,pots)
646  // reset it now as some might have been used in determining
647  // the geometry maxpathlength or internally scanning for weights.
648  // This should not be necessary (GENIE should do it automagically)
649  // but the current version (as of 3665) doesn't.
650 
651  // alas, at this time there is no "unified" interface for Clear()
652  // as there is for GetTotalExposure (replacing UsedPOTs())
653  double preUsedFluxPOTs = 0;
654  bool wasCleared = true;
655  bool doprintpre = false;
656  if( fFluxType.compare("numi") == 0 ) {
657  genie::flux::GNuMIFlux* gnumiflux =
658  dynamic_cast<genie::flux::GNuMIFlux *>(fFluxD);
659  preUsedFluxPOTs = gnumiflux->UsedPOTs();
660  if ( preUsedFluxPOTs > 0 ) {
661  doprintpre = true;
662  gnumiflux->Clear("CycleHistory");
663  if ( gnumiflux->UsedPOTs() != 0 ) wasCleared = false;
664  }
665  } else if ( fFluxType.compare("simple") == 0 ) {
666  genie::flux::GSimpleNtpFlux* gsimpleflux =
667  dynamic_cast<genie::flux::GSimpleNtpFlux *>(fFluxD);
668  preUsedFluxPOTs = gsimpleflux->UsedPOTs();
669  if ( preUsedFluxPOTs > 0 ) {
670  doprintpre = true;
671  gsimpleflux->Clear("CycleHistory");
672  if ( gsimpleflux->UsedPOTs() != 0 ) wasCleared = false;
673  }
674 #if __GENIE_RELEASE_CODE__ >= GRELCODE(2,11,0)
675  } else if ( fFluxType.compare("dk2nu") == 0 ) {
676  genie::flux::GDk2NuFlux* dk2nuflux =
677  dynamic_cast<genie::flux::GDk2NuFlux *>(fFluxD);
678  preUsedFluxPOTs = dk2nuflux->UsedPOTs();
679  if ( preUsedFluxPOTs > 0 ) {
680  doprintpre = true;
681  dk2nuflux->Clear("CycleHistory");
682  if ( dk2nuflux->UsedPOTs() != 0 ) wasCleared = false;
683  }
684 #endif
685  }
686  if ( doprintpre ) {
687  double probscale = fDriver->GlobProbScale();
688  mf::LogInfo("GENIEHelper")
689  << "Pre-Event Generation: "
690  << " FluxDriver base " << preUsedFluxPOTs
691  << " / GMCJDriver GlobProbScale " << probscale
692  << " = used POTS " << preUsedFluxPOTs/TMath::Max(probscale,1.0e-100)
693  << " "
694  << (wasCleared?"successfully":"failed to") << " cleared count for "
695  << fFluxType;
696  }
697  return;
698  }
double fEventsPerSpill
Definition: GENIEHelper.h:153
double fTotalHistFlux
total flux of neutrinos from flux histograms for used flavors
Definition: GENIEHelper.h:166
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
std::string fEventGeneratorList
control over event topologies, was $GEVGL [Default]
Definition: GENIEHelper.h:184
genie::GMCJDriver * fDriver
Definition: GENIEHelper.h:123
double fXSecMassPOT
product of cross section, mass and POT/spill for histogram fluxes
Definition: GENIEHelper.h:165
double fSurroundingMass
Definition: GENIEHelper.h:171
void InitializeFluxDriver()
double fTotalExposure
pot used from flux ntuple
Definition: GENIEHelper.h:159
TRandom3 * fHelperRandom
random # generator for GENIEHelper
Definition: GENIEHelper.h:128
genie::GeomAnalyzerI * fGeomD
Definition: GENIEHelper.h:120
genie::GFluxI * fFluxD
real flux driver
Definition: GENIEHelper.h:121
double fDetectorMass
mass of the detector in kg
Definition: GENIEHelper.h:170
double fSpillExposure
total exposure (i.e. pot) for this spill
Definition: GENIEHelper.h:158
double fHistEventsPerSpill
number of events per spill for histogram fluxes - changes each spill
Definition: GENIEHelper.h:156
Float_t e
Definition: plot.C:34
int fSpillEvents
total events for this spill
Definition: GENIEHelper.h:157
genie::GFluxI * fFluxD2GMCJD
flux driver passed to genie GMCJDriver, might be GFluxBlender
Definition: GENIEHelper.h:122
double fPOTPerSpill
number of pot per spill
Definition: GENIEHelper.h:155
std::string fFluxType
Definition: GENIEHelper.h:132
bool evgb::GENIEHelper::Sample ( simb::MCTruth truth,
simb::MCFlux flux,
simb::GTruth gtruth 
)
inherited

Definition at line 1486 of file GENIEHelper.cxx.

References bin, simb::MCParticle::E(), 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, 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::fUseHelperRndGen4GENIE, evgb::GENIEHelper::fWorldVolume, simb::MCTruth::GetNeutrino(), simb::kHistPlusFocus, simb::kNtuple, evgb::kNue, evgb::kNueBar, evgb::kNuMu, evgb::kNuMuBar, evgb::kNuTau, evgb::kNuTauBar, simb::kSimple_Flux, simb::MCNeutrino::Nu(), evgb::GENIEHelper::PackGTruth(), evgb::GENIEHelper::PackMCTruth(), evgb::GENIEHelper::PackNuMIFlux(), evgb::GENIEHelper::PackSimpleFlux(), simb::MCFlux::SetFluxGen(), and evgb::EvtTimeShiftI::TimeOffset().

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

1487  {
1488  // set the top volume for the geometry
1489  fGeoManager->SetTopVolume(fGeoManager->FindVolumeFast(fTopVolume.c_str()));
1490 
1491  if ( fGenieEventRecord ) delete fGenieEventRecord;
1492 
1493  // ART Framework plays games with gRandom, undo that if requested
1494  TRandom* old_gRandom = gRandom;
1495  if (fUseHelperRndGen4GENIE) gRandom = fHelperRandom;
1496 
1497  fGenieEventRecord = fDriver->GenerateEvent();
1498 
1499  if (fUseHelperRndGen4GENIE) gRandom = old_gRandom;
1500 
1501  // now check if we produced a viable event record
1502  bool viableInteraction = true;
1503  if ( ! fGenieEventRecord ) viableInteraction = false;
1504 
1505  // update the spill total information, then check to see
1506  // if we got an event record that was valid
1507 
1508 
1509 #if __GENIE_RELEASE_CODE__ >= GRELCODE(2,11,0)
1510  genie::flux::GFluxExposureI* fexposure =
1511  dynamic_cast<genie::flux::GFluxExposureI*>(fFluxD);
1512  if ( fexposure ) {
1513  fSpillExposure =
1514  (fexposure->GetTotalExposure()/fDriver->GlobProbScale()) - fTotalExposure;
1515  }
1516  // use GENIE2ART code to fill MCFlux
1517  evgb::FillMCFlux(fFluxD,flux);
1518 #else
1519  // pack the flux information no support for dk2nu
1520  if ( fFluxType.compare("numi") == 0){
1521  fSpillExposure = (dynamic_cast<genie::flux::GNuMIFlux *>(fFluxD)->UsedPOTs()/fDriver->GlobProbScale() - fTotalExposure);
1522  flux.fFluxType = simb::kNtuple;
1523  PackNuMIFlux(flux);
1524  }
1525  else if ( fFluxType.compare("simple")==0 ) {
1526  // pack the flux information
1527  fSpillExposure = (dynamic_cast<genie::flux::GSimpleNtpFlux *>(fFluxD)->UsedPOTs()/fDriver->GlobProbScale() - fTotalExposure);
1529  PackSimpleFlux(flux);
1530  }
1531 #endif
1532 
1533  // if no interaction generated return false
1534  if ( ! viableInteraction ) return false;
1535 
1536 #if __GENIE_RELEASE_CODE__ >= GRELCODE(2,11,0)
1537  // fill the MCTruth & GTruth information as we have a good interaction
1538  // these two objects are enough to reconstruct the GENIE record
1539  // use the new external functions in GENIE2ART
1540 
1541  //choose a spill time (ns) to shift the vertex times by:
1542  double spilltime = fGlobalTimeOffset;
1543  if ( ! fTimeShifter ) {
1544  spilltime += fHelperRandom->Uniform()*fRandomTimeOffset;
1545  } else {
1546  spilltime += fTimeShifter->TimeOffset();
1547  }
1548 
1549  evgb::FillMCTruth(fGenieEventRecord, spilltime, truth);
1551 #else
1552  // fill the MC truth information as we have a good interaction
1554  // fill the Generator (genie) truth information
1555  PackGTruth(fGenieEventRecord, gtruth);
1556 #endif
1557 
1558  // check to see if we are using flux ntuples but want to
1559  // make n events per spill
1560  if ( fEventsPerSpill > 0 &&
1561  ( fFluxType.compare("numi") == 0 ||
1562  fFluxType.compare("simple") == 0 ||
1563  fFluxType.compare("dk2nu") == 0 )
1564  ) ++fSpillEvents;
1565 
1566  // now check if using either histogram or mono fluxes, using
1567  // either n events per spill or basing events on POT per spill for the
1568  // histogram case
1569  if(fFluxType.compare("histogram") == 0){
1570  // set the flag in the parent object that says the
1571  // fluxes came from histograms and fill related values
1573 
1574  // save the fluxes - fluxes were added to the vector in the same
1575  // order that the flavors appear in fGenFlavors
1576  int ctr = 0;
1577  int bin = fFluxHistograms[0]->FindBin(truth.GetNeutrino().Nu().E());
1578  std::vector<double> fluxes(6, 0.);
1579  for(std::vector<int>::iterator i = fGenFlavors.begin(); i != fGenFlavors.end(); i++){
1580  if(*i == 12) fluxes[kNue] = fFluxHistograms[ctr]->GetBinContent(bin);
1581  if(*i == -12) fluxes[kNueBar] = fFluxHistograms[ctr]->GetBinContent(bin);
1582  if(*i == 14) fluxes[kNuMu] = fFluxHistograms[ctr]->GetBinContent(bin);
1583  if(*i == -14) fluxes[kNuMuBar] = fFluxHistograms[ctr]->GetBinContent(bin);
1584  if(*i == 16) fluxes[kNuTau] = fFluxHistograms[ctr]->GetBinContent(bin);
1585  if(*i == -16) fluxes[kNuTauBar] = fFluxHistograms[ctr]->GetBinContent(bin);
1586  ++ctr;
1587  }
1588 
1589  // get the flux for each neutrino flavor of this energy
1590  flux.SetFluxGen(fluxes[kNue], fluxes[kNueBar],
1591  fluxes[kNuMu], fluxes[kNuMuBar],
1592  fluxes[kNuTau], fluxes[kNuTauBar]);
1593 
1594  ++fSpillEvents;
1595  }
1596  else if(fFluxType.compare("mono") == 0 || fFluxType.compare("function") == 0){
1597  ++fSpillEvents;
1598  }
1599 
1600  else if(fFluxType.compare("atmo_FLUKA") == 0 || fFluxType.compare("atmo_BARTOL") == 0 ||
1601  fFluxType.compare("atmo_HAKKM") == 0 || fFluxType.compare("atmo_HONDA") == 0 ){
1602  if(fEventsPerSpill > 0) ++fSpillEvents;
1604  }
1605 
1606 
1607  // fill these after the Pack[NuMI|Simple]Flux because those
1608  // will Reset() the values at the start
1609  TLorentzVector *vertex = fGenieEventRecord->Vertex();
1610  TLorentzVector nuray_pos = fFluxD->Position();
1611  TVector3 ray2vtx = nuray_pos.Vect() - vertex->Vect();
1612  flux.fgenx = nuray_pos.X();
1613  flux.fgeny = nuray_pos.Y();
1614  flux.fgenz = nuray_pos.Z();
1615  flux.fgen2vtx = ray2vtx.Mag();
1616 
1617  genie::flux::GFluxBlender* blender =
1618  dynamic_cast<genie::flux::GFluxBlender*>(fFluxD2GMCJD);
1619  if ( blender ) {
1620  flux.fdk2gen = blender->TravelDist();
1621  // / if mixing flavors print the state of the blender
1622  if ( fDebugFlags & 0x02 ) blender->PrintState();
1623  }
1624 
1625  if ( fDebugFlags & 0x04 ) {
1626  mf::LogInfo("GENIEHelper") << "vertex loc " << vertex->X() << ","
1627  << vertex->Y() << "," << vertex->Z() << std::endl
1628  << " flux ray start " << nuray_pos.X() << ","
1629  << nuray_pos.Y() << "," << nuray_pos.Z() << std::endl
1630  << " ray2vtx = " << flux.fgen2vtx
1631  << " dk2ray = " << flux.fdk2gen;
1632  }
1633  if ( fGHepPrintLevel >= 0 ) {
1634  std::cout << *fGenieEventRecord;
1635  }
1636 
1637  // set the top volume of the geometry back to the world volume
1638  fGeoManager->SetTopVolume(fGeoManager->FindVolumeFast(fWorldVolume.c_str()));
1639 
1640  return true;
1641  }
double E(const int i=0) const
Definition: MCParticle.h:237
double fgenz
Definition: MCFlux.h:102
static const int kNuTauBar
bool fUseHelperRndGen4GENIE
use fHelperRandom for gRandom during Sample()
Definition: GENIEHelper.h:129
double fEventsPerSpill
Definition: GENIEHelper.h:153
const simb::MCNeutrino & GetNeutrino() const
Definition: MCTruth.h:74
double fgeny
Definition: MCFlux.h:101
Full flux simulation ntuple.
Definition: MCFlux.h:21
double fgen2vtx
distance from ray origin to event vtx
Definition: MCFlux.h:104
intermediate_table::iterator iterator
void PackSimpleFlux(simb::MCFlux &flux)
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
void FillMCFlux(genie::GFluxI *fdriver, simb::MCFlux &mcflux)
Definition: GENIE2ART.cxx:635
void PackNuMIFlux(simb::MCFlux &flux)
const simb::MCParticle & Nu() const
Definition: MCNeutrino.h:150
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:174
double fGlobalTimeOffset
overall time shift (ns) added to every particle time
Definition: GENIEHelper.h:173
TGeoManager * fGeoManager
pointer to ROOT TGeoManager
Definition: GENIEHelper.h:116
static const int kNue
std::vector< int > fGenFlavors
pdg codes for flavors to generate
Definition: GENIEHelper.h:176
evgb::EvtTimeShiftI * fTimeShifter
generator for time offset within a spill
Definition: GENIEHelper.h:130
double fdk2gen
distance from decay to ray origin
Definition: MCFlux.h:103
genie::GMCJDriver * fDriver
Definition: GENIEHelper.h:123
genie::EventRecord * fGenieEventRecord
last generated event
Definition: GENIEHelper.h:119
std::vector< TH1D * > fFluxHistograms
histograms for each nu species
Definition: GENIEHelper.h:150
Flux for positive horn focus.
Definition: MCFlux.h:18
int fGHepPrintLevel
GHepRecord::SetPrintLevel(), -1=no-print.
Definition: GENIEHelper.h:188
std::string fWorldVolume
name of the world volume in the ROOT geometry
Definition: GENIEHelper.h:148
double fTotalExposure
pot used from flux ntuple
Definition: GENIEHelper.h:159
TRandom3 * fHelperRandom
random # generator for GENIEHelper
Definition: GENIEHelper.h:128
std::string fTopVolume
top volume in the ROOT geometry in which to generate events
Definition: GENIEHelper.h:147
static const int kNuMuBar
float bin[41]
Definition: plottest35.C:14
genie::GFluxI * fFluxD
real flux driver
Definition: GENIEHelper.h:121
void SetFluxGen(double nue, double nuebar, double numu, double numubar, double nutau, double nutaubar)
Definition: MCFlux.cxx:214
void FillMCTruth(const genie::EventRecord *grec, double spillTime, simb::MCTruth &mctruth)
Definition: GENIE2ART.cxx:73
void PackGTruth(genie::EventRecord *record, simb::GTruth &truth)
double fSpillExposure
total exposure (i.e. pot) for this spill
Definition: GENIEHelper.h:158
unsigned int fDebugFlags
set bits to enable debug info
Definition: GENIEHelper.h:194
virtual double TimeOffset()=0
void FillGTruth(const genie::EventRecord *grec, simb::GTruth &gtruth)
Definition: GENIE2ART.cxx:243
int fSpillEvents
total events for this spill
Definition: GENIEHelper.h:157
genie::GFluxI * fFluxD2GMCJD
flux driver passed to genie GMCJDriver, might be GFluxBlender
Definition: GENIEHelper.h:122
static const int kNueBar
static const int kNuMu
void PackMCTruth(genie::EventRecord *record, simb::MCTruth &truth)
A simplified flux ntuple for quick running.
Definition: MCFlux.h:22
std::string fFluxType
Definition: GENIEHelper.h:132
vertex reconstruction
double evgb::GENIEHelper::SpillExposure ( ) const
inlineinherited

Definition at line 70 of file GENIEHelper.h.

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

Definition at line 1431 of file GENIEHelper.cxx.

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

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

1432  {
1433  // std::cout << "in GENIEHelper::Stop(), fEventsPerSpill = " << fEventsPerSpill
1434  // << " fPOTPerSpill = " << fPOTPerSpill << " fSpillExposure = " << fSpillExposure
1435  // << " fSpillEvents = " << fSpillEvents
1436  // << " fHistEventsPerSpill = " << fHistEventsPerSpill << std::endl;
1437 
1438  // determine if we should keep throwing neutrinos for
1439  // this spill or move on
1440 
1441  if ( fFluxType.compare("atmo_FLUKA") == 0 || fFluxType.compare("atmo_BARTOL") == 0 ||
1442  fFluxType.compare("atmo_HONDA") == 0 || fFluxType.compare("atmo_HAKKM") == 0 ) {
1443  if ( (fEventsPerSpill > 0) && (fSpillEvents < fEventsPerSpill) ) {
1444  return false;
1445  }
1446  }
1447 
1448  else if ( fEventsPerSpill > 0 ) {
1449  if ( fSpillEvents < fEventsPerSpill )
1450  return false;
1451  } else {
1452  if ( ( fFluxType.compare("numi") == 0 ||
1453  fFluxType.compare("simple") == 0 ||
1454  fFluxType.compare("dk2nu") == 0 ) &&
1455  fSpillExposure < fPOTPerSpill ) return false;
1456  else if ( fFluxType.compare("histogram") == 0 ){
1457  if ( fSpillEvents < fHistEventsPerSpill ) return false;
1459  }
1460  }
1461 
1462  // made it to here, means need to reset the counters
1463 
1464  if(fFluxType.compare("atmo_FLUKA") == 0 || fFluxType.compare("atmo_BARTOL") == 0 ||
1465  fFluxType.compare("atmo_HONDA") == 0 || fFluxType.compare("atmo_HAKKM") == 0 ){
1466  //the exposure for atmo is in SECONDS. In order to get seconds, it needs to
1467  //be normalized by 1e4 to take into account the units discrepency between
1468  //AtmoFluxDriver(/m2) and Generate(/cm2) and it need to be normalized by
1469  //the generation surface area since it's not taken into accoutn in the flux driver
1470  fTotalExposure = (1e4 * (dynamic_cast<genie::flux::GAtmoFlux *>(fFluxD)->NFluxNeutrinos())) / (TMath::Pi() * fAtmoRt*fAtmoRt);
1471 
1472  LOG_DEBUG("GENIEHelper") << "===> Atmo EXPOSURE = " << fTotalExposure << " seconds";
1473  }
1474 
1475  else{
1477  }
1478 
1479  fSpillEvents = 0;
1480  fSpillExposure = 0.;
1482  return true;
1483  }
double fEventsPerSpill
Definition: GENIEHelper.h:153
double fTotalHistFlux
total flux of neutrinos from flux histograms for used flavors
Definition: GENIEHelper.h:166
double fXSecMassPOT
product of cross section, mass and POT/spill for histogram fluxes
Definition: GENIEHelper.h:165
double fTotalExposure
pot used from flux ntuple
Definition: GENIEHelper.h:159
TRandom3 * fHelperRandom
random # generator for GENIEHelper
Definition: GENIEHelper.h:128
genie::GFluxI * fFluxD
real flux driver
Definition: GENIEHelper.h:121
double fSpillExposure
total exposure (i.e. pot) for this spill
Definition: GENIEHelper.h:158
#define LOG_DEBUG(id)
double fHistEventsPerSpill
number of events per spill for histogram fluxes - changes each spill
Definition: GENIEHelper.h:156
int fSpillEvents
total events for this spill
Definition: GENIEHelper.h:157
double fPOTPerSpill
number of pot per spill
Definition: GENIEHelper.h:155
std::string fFluxType
Definition: GENIEHelper.h:132
double evgb::GENIEHelper::TotalExposure ( ) const
inlineinherited

Definition at line 66 of file GENIEHelper.h.

Referenced by evgen::GENIEGen::endSubRun().

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

Definition at line 586 of file GENIEHelper.cxx.

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

587  {
588  if ( fFluxType.compare("mono") == 0 ||
589  fFluxType.compare("function") == 0 ||
590  fFluxType.compare("numi") == 0 ||
591  fFluxType.compare("simple") == 0 ||
592  fFluxType.compare("dk2nu") == 0 ) {
593  // shouldn't be asking for this for any of the above
594  return -999.;
595  }
596 
597  return fTotalHistFlux;
598  }
double fTotalHistFlux
total flux of neutrinos from flux histograms for used flavors
Definition: GENIEHelper.h:166
std::string fFluxType
Definition: GENIEHelper.h:132
double evgb::GENIEHelper::TotalMass ( ) const
inlineinherited

Definition at line 77 of file GENIEHelper.h.

double fSurroundingMass
Definition: GENIEHelper.h:171
double fDetectorMass
mass of the detector in kg
Definition: GENIEHelper.h:170

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: