LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
evgen::GENIEGen Class Reference

A module to check the results from the Monte Carlo generator. More...

Inheritance diagram for evgen::GENIEGen:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Types

using ModuleType = EDProducer
 
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 

Public Member Functions

 GENIEGen (fhicl::ParameterSet const &pset)
 
virtual ~GENIEGen ()
 
void produce (art::Event &evt)
 
void beginJob ()
 
void beginRun (art::Run &run)
 
void beginSubRun (art::SubRun &sr)
 
void endSubRun (art::SubRun &sr)
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
void fillProductDescriptions ()
 
void registerProducts (ProductDescriptions &productsToRegister)
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
std::unique_ptr< Worker > makeWorker (WorkerParams const &wp)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Protected Member Functions

ConsumesCollector & consumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Private Member Functions

std::string ParticleStatus (int StatusCode)
 
std::string ReactionChannel (int ccnc, int mode)
 
void FillHistograms (simb::MCTruth mc)
 

Private Attributes

evgb::GENIEHelperfGENIEHelp
 GENIEHelper object. More...
 
bool fDefinedVtxHistRange
 
std::vector< double > fVtxPosHistRange
 use defined hist range; it is useful to have for asymmetric ranges like in DP FD. More...
 
int fPassEmptySpills
 whether or not to kill evnets with no interactions More...
 
TStopwatch fStopwatch
 
double fGlobalTimeOffset
 keep track of how long it takes to run the job More...
 
double fRandomTimeOffset
 The start of a simulated "beam gate". More...
 
::sim::BeamType_t fBeamType
 The width of a simulated "beam gate". More...
 
double fPrevTotPOT
 The type of beam. More...
 
double fPrevTotGoodPOT
 Total good POT from subruns previous to current subrun. More...
 
TH1F * fGenerated [6]
 Spectra as generated. More...
 
TH1F * fVertexX
 vertex location of generated events in x More...
 
TH1F * fVertexY
 vertex location of generated events in y More...
 
TH1F * fVertexZ
 vertex location of generated events in z More...
 
TH2F * fVertexXY
 vertex location in xy More...
 
TH2F * fVertexXZ
 vertex location in xz More...
 
TH2F * fVertexYZ
 vertex location in yz More...
 
TH1F * fDCosX
 direction cosine in x More...
 
TH1F * fDCosY
 direction cosine in y More...
 
TH1F * fDCosZ
 direction cosine in z More...
 
TH1F * fMuMomentum
 momentum of outgoing muons More...
 
TH1F * fMuDCosX
 direction cosine of outgoing mu in x More...
 
TH1F * fMuDCosY
 direction cosine of outgoing mu in y More...
 
TH1F * fMuDCosZ
 direction cosine of outgoing mu in z More...
 
TH1F * fEMomentum
 momentum of outgoing electrons More...
 
TH1F * fEDCosX
 direction cosine of outgoing e in x More...
 
TH1F * fEDCosY
 direction cosine of outgoing e in y More...
 
TH1F * fEDCosZ
 direction cosine of outgoing e in z More...
 
TH1F * fCCMode
 CC interaction mode. More...
 
TH1F * fNCMode
 CC interaction mode. More...
 
TH1F * fDeltaE
 difference in neutrino energy from MCTruth::Enu() vs TParticle More...
 
TH1F * fECons
 histogram to determine if energy is conserved in the event More...
 

Detailed Description

A module to check the results from the Monte Carlo generator.

Note on random number generator

GENIE uses a TRandom generator for its purposes. Since art's RandomNumberGenerator service only provides CLHEP::HepRandomEngine, the standard LArSoft/art mechanism for handling the random stream can't be used. GENIEHelper, interface to GENIE provided by nugen, creates a TRandom that GENIE can use. It initializes it with a random seed read from RandomSeed configuration parameter. This and all the other parameters are inherited from the art module (that is, GENIEGen) configuration. LArSoft meddles with this mechanism to provide support for the standard "Seed" parameter and NuRandomService service.

Configuration parameters

  • RandomSeed (integer, optional): if specified, this value is used as seed for GENIE random number generator engine
  • Seed (unsigned integer, optional): if specified, this value is used as seed for GENIE random number generator engine; if RandomSeed is also specified, this value is ignored (but in the future this could turn into a configuration error)

As custom, if the random seed is not provided by the configuration, one is fetched from NuRandomService (if available), with the behaviour in lar::util::FetchRandomSeed().

Definition at line 91 of file GENIEGen_module.cc.

Member Typedef Documentation

Definition at line 17 of file EDProducer.h.

template<typename UserConfig , typename KeysToIgnore = void>
using art::detail::Producer::Table = Modifier::Table<UserConfig, KeysToIgnore>
inherited

Definition at line 26 of file Producer.h.

Constructor & Destructor Documentation

evgen::GENIEGen::GENIEGen ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 158 of file GENIEGen_module.cc.

References fBeamType, fDefinedVtxHistRange, fGENIEHelp, fGlobalTimeOffset, fPassEmptySpills, fRandomTimeOffset, fStopwatch, fVtxPosHistRange, geo::GeometryCore::GDMLFile(), fhicl::ParameterSet::get_if_present(), sim::kBNB, sim::kNuMI, geo::kUnknown, fhicl::ParameterSet::put(), geo::GeometryCore::ROOTGeoManager(), seed, and geo::GeometryCore::TotalMass().

159  : EDProducer{pset}
160  , fGENIEHelp(0)
161  , fDefinedVtxHistRange(pset.get<bool>("DefinedVtxHistRange"))
162  , fVtxPosHistRange(pset.get<std::vector<double>>("VtxPosHistRange"))
163  , fPassEmptySpills(pset.get<bool>("PassEmptySpills"))
164  , fGlobalTimeOffset(pset.get<double>("GlobalTimeOffset", 0))
165  , fRandomTimeOffset(pset.get<double>("RandomTimeOffset", 1600.)) // BNB default value
166  , fBeamType(::sim::kBNB)
167  {
168  fStopwatch.Start();
169 
170  produces<std::vector<simb::MCTruth>>();
171  produces<std::vector<simb::MCFlux>>();
172  produces<std::vector<simb::GTruth>>();
173  produces<sumdata::RunData, art::InRun>();
174  produces<sumdata::POTSummary, art::InSubRun>();
175  produces<art::Assns<simb::MCTruth, simb::MCFlux>>();
176  produces<art::Assns<simb::MCTruth, simb::GTruth>>();
177  produces<std::vector<sim::BeamGateInfo>>();
178 
179  // dk2nu additions
180  if (pset.get<std::string>("FluxType").find("dk2nu") != std::string::npos) {
181  produces<std::vector<bsim::Dk2Nu>>();
182  produces<std::vector<bsim::NuChoice>>();
183  produces<art::Assns<simb::MCTruth, bsim::Dk2Nu>>();
184  produces<art::Assns<simb::MCTruth, bsim::NuChoice>>();
185  }
186 
187  std::string beam_type_name = pset.get<std::string>("BeamName");
188 
189  if (beam_type_name == "numi")
190 
192 
193  else if (beam_type_name == "booster")
194 
196 
197  else
198 
200 
202 
203  signed int temp_seed; // the seed read by GENIEHelper is a signed integer...
204  fhicl::ParameterSet GENIEconfig(pset);
205  if (!GENIEconfig.get_if_present("RandomSeed",
206  temp_seed)) { // TODO use has_key() when it becomes available
207  // no RandomSeed specified; check for the LArSoft-style "Seed" instead:
208  // obtain the random seed from a service,
209  // unless overridden in configuration with key "Seed"
210  unsigned int seed;
211  if (!GENIEconfig.get_if_present("Seed", seed))
212  seed = art::ServiceHandle<rndm::NuRandomService>()->getSeed();
213 
214  // The seed is not passed to RandomNumberGenerator,
215  // since GENIE uses a TRandom generator that is owned by the GENIEHelper.
216  // Instead, we explicitly configure the random seed for GENIEHelper:
217  GENIEconfig.put("RandomSeed", seed);
218  } // if no RandomSeed present
219 
220  double detectorMass = 0;
221  // detectorMass is _only_ needed by GENIEHelper in the case of
222  // histogram flux and non-fixed # of event/spill (ie. POTPerSpill non-zero)
223  if (pset.get<std::string>("FluxType").find("histogram") == 0 &&
224  pset.get<double>("EventsPerSpill") == 0.0 && pset.get<double>("POTPerSpill") > 0.0) {
225  TStopwatch timer;
226  timer.Start();
227  detectorMass = geo->TotalMass(pset.get<std::string>("TopVolume").c_str());
228  timer.Stop();
229  mf::LogInfo("GENIEProductionTime")
230  << "real time to calculate TotalMass: " << timer.RealTime() << " sec";
231  }
232 
233  fGENIEHelp =
234  new evgb::GENIEHelper(GENIEconfig, geo->ROOTGeoManager(), geo->GDMLFile(), detectorMass);
235  }
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
Unknown view.
Definition: geo_types.h:138
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.cc:6
TGeoManager * ROOTGeoManager() const
Access to the ROOT geometry description manager.
::sim::BeamType_t fBeamType
The width of a simulated "beam gate".
NuMI.
Definition: BeamTypes.h:12
double TotalMass() const
Returns the total mass [kg] of the specified volume (default: world).
Definition: GeometryCore.h:255
long seed
Definition: chem4.cc:67
int fPassEmptySpills
whether or not to kill evnets with no interactions
evgb::GENIEHelper * fGENIEHelp
GENIEHelper object.
double fGlobalTimeOffset
keep track of how long it takes to run the job
std::vector< double > fVtxPosHistRange
use defined hist range; it is useful to have for asymmetric ranges like in DP FD. ...
BNB.
Definition: BeamTypes.h:11
std::string const & GDMLFile() const
Returns the full directory path to the GDML file source.
Definition: GeometryCore.h:130
TStopwatch fStopwatch
ROOT libraries.
double fRandomTimeOffset
The start of a simulated "beam gate".
evgen::GENIEGen::~GENIEGen ( )
virtual

Definition at line 238 of file GENIEGen_module.cc.

References fGENIEHelp, and fStopwatch.

239  {
240  if (fGENIEHelp) delete fGENIEHelp;
241  fStopwatch.Stop();
242  mf::LogInfo("GENIEProductionTime") << "real time to produce file: " << fStopwatch.RealTime();
243  }
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
evgb::GENIEHelper * fGENIEHelp
GENIEHelper object.
TStopwatch fStopwatch

Member Function Documentation

void evgen::GENIEGen::beginJob ( )
virtual

Reimplemented from art::EDProducer.

Definition at line 246 of file GENIEGen_module.cc.

References fCCMode, fDCosX, fDCosY, fDCosZ, fDefinedVtxHistRange, fDeltaE, fECons, fEDCosX, fEDCosY, fEDCosZ, fEMomentum, fGenerated, fGENIEHelp, fMuDCosX, fMuDCosY, fMuDCosZ, fMuMomentum, fNCMode, fPrevTotGoodPOT, fPrevTotPOT, fVertexX, fVertexXY, fVertexXZ, fVertexY, fVertexYZ, fVertexZ, fVtxPosHistRange, evgb::GENIEHelper::Initialize(), x, y, and z.

247  {
249 
250  fPrevTotPOT = 0.;
251  fPrevTotGoodPOT = 0.;
252 
253  // Get access to the TFile service.
255 
256  fGenerated[0] = tfs->make<TH1F>("fGenerated_necc", "", 100, 0.0, 20.0);
257  fGenerated[1] = tfs->make<TH1F>("fGenerated_nebcc", "", 100, 0.0, 20.0);
258  fGenerated[2] = tfs->make<TH1F>("fGenerated_nmcc", "", 100, 0.0, 20.0);
259  fGenerated[3] = tfs->make<TH1F>("fGenerated_nmbcc", "", 100, 0.0, 20.0);
260  fGenerated[4] = tfs->make<TH1F>("fGenerated_nnc", "", 100, 0.0, 20.0);
261  fGenerated[5] = tfs->make<TH1F>("fGenerated_nbnc", "", 100, 0.0, 20.0);
262 
263  fDCosX = tfs->make<TH1F>("fDCosX", ";dx/ds", 200, -1., 1.);
264  fDCosY = tfs->make<TH1F>("fDCosY", ";dy/ds", 200, -1., 1.);
265  fDCosZ = tfs->make<TH1F>("fDCosZ", ";dz/ds", 200, -1., 1.);
266 
267  fMuMomentum = tfs->make<TH1F>("fMuMomentum", ";p_{#mu} (GeV/c)", 500, 0., 50.);
268  fMuDCosX = tfs->make<TH1F>("fMuDCosX", ";dx/ds;", 200, -1., 1.);
269  fMuDCosY = tfs->make<TH1F>("fMuDCosY", ";dy/ds;", 200, -1., 1.);
270  fMuDCosZ = tfs->make<TH1F>("fMuDCosZ", ";dz/ds;", 200, -1., 1.);
271 
272  fEMomentum = tfs->make<TH1F>("fEMomentum", ";p_{e} (GeV/c)", 500, 0., 50.);
273  fEDCosX = tfs->make<TH1F>("fEDCosX", ";dx/ds;", 200, -1., 1.);
274  fEDCosY = tfs->make<TH1F>("fEDCosY", ";dy/ds;", 200, -1., 1.);
275  fEDCosZ = tfs->make<TH1F>("fEDCosZ", ";dz/ds;", 200, -1., 1.);
276 
277  fCCMode = tfs->make<TH1F>("fCCMode", ";CC Interaction Mode;", 4, 0., 4.);
278  fCCMode->GetXaxis()->SetBinLabel(1, "QE");
279  fCCMode->GetXaxis()->SetBinLabel(2, "Res");
280  fCCMode->GetXaxis()->SetBinLabel(3, "DIS");
281  fCCMode->GetXaxis()->SetBinLabel(4, "Coh");
282  fCCMode->GetXaxis()->CenterLabels();
283 
284  fNCMode = tfs->make<TH1F>("fNCMode", ";NC Interaction Mode;", 4, 0., 4.);
285  fNCMode->GetXaxis()->SetBinLabel(1, "QE");
286  fNCMode->GetXaxis()->SetBinLabel(2, "Res");
287  fNCMode->GetXaxis()->SetBinLabel(3, "DIS");
288  fNCMode->GetXaxis()->SetBinLabel(4, "Coh");
289  fNCMode->GetXaxis()->CenterLabels();
290 
291  fDeltaE = tfs->make<TH1F>("fDeltaE", ";#Delta E_{#nu} (GeV);", 200, -1., 1.);
292  fECons = tfs->make<TH1F>("fECons", ";#Delta E(#nu,lepton);", 500, -5., 5.);
293 
294  if (fDefinedVtxHistRange == false) {
295  auto const& tpc = art::ServiceHandle<geo::Geometry const>()->TPC();
296  double x = 2.1 * tpc.HalfWidth();
297  double y = 2.1 * tpc.HalfHeight();
298  double z = 2. * tpc.Length();
299  int xdiv = TMath::Nint(2 * x / 5.);
300  int ydiv = TMath::Nint(2 * y / 5.);
301  int zdiv = TMath::Nint(2 * z / 5.);
302 
303  fVertexX = tfs->make<TH1F>("fVertexX", ";x (cm)", xdiv, -0.1 * x, x);
304  fVertexY = tfs->make<TH1F>("fVertexY", ";y (cm)", ydiv, -y, y);
305  fVertexZ = tfs->make<TH1F>("fVertexZ", ";z (cm)", zdiv, -0.1 * z, z);
306 
307  fVertexXY = tfs->make<TH2F>("fVertexXY", ";x (cm);y (cm)", xdiv, -0.1 * x, x, ydiv, -y, y);
308  fVertexXZ =
309  tfs->make<TH2F>("fVertexXZ", ";z (cm);x (cm)", zdiv, -0.2 * z, z, xdiv, -0.1 * x, x);
310  fVertexYZ = tfs->make<TH2F>("fVertexYZ", ";z (cm);y (cm)", zdiv, -0.2 * z, z, ydiv, -y, y);
311  }
312  else {
313  int xdiv = TMath::Nint((fVtxPosHistRange[1] - fVtxPosHistRange[0]) / 5.);
314  int ydiv = TMath::Nint((fVtxPosHistRange[3] - fVtxPosHistRange[2]) / 5.);
315  int zdiv = TMath::Nint((fVtxPosHistRange[5] - fVtxPosHistRange[4]) / 5.);
316 
317  fVertexX =
318  tfs->make<TH1F>("fVertexX", ";x (cm)", xdiv, fVtxPosHistRange[0], fVtxPosHistRange[1]);
319  fVertexY =
320  tfs->make<TH1F>("fVertexY", ";y (cm)", ydiv, fVtxPosHistRange[2], fVtxPosHistRange[3]);
321  fVertexZ =
322  tfs->make<TH1F>("fVertexZ", ";z (cm)", zdiv, fVtxPosHistRange[4], fVtxPosHistRange[5]);
323 
324  fVertexXY = tfs->make<TH2F>("fVertexXY",
325  ";x (cm);y (cm)",
326  xdiv,
327  fVtxPosHistRange[0],
328  fVtxPosHistRange[1],
329  ydiv,
330  fVtxPosHistRange[2],
331  fVtxPosHistRange[3]);
332  fVertexXZ = tfs->make<TH2F>("fVertexXZ",
333  ";z (cm);x (cm)",
334  zdiv,
335  fVtxPosHistRange[4],
336  fVtxPosHistRange[5],
337  xdiv,
338  fVtxPosHistRange[0],
339  fVtxPosHistRange[1]);
340  fVertexYZ = tfs->make<TH2F>("fVertexYZ",
341  ";z (cm);y (cm)",
342  zdiv,
343  fVtxPosHistRange[4],
344  fVtxPosHistRange[5],
345  ydiv,
346  fVtxPosHistRange[2],
347  fVtxPosHistRange[3]);
348  }
349  }
TH1F * fVertexX
vertex location of generated events in x
Float_t x
Definition: compare.C:6
TH1F * fMuDCosZ
direction cosine of outgoing mu in z
TH2F * fVertexXZ
vertex location in xz
TH1F * fDeltaE
difference in neutrino energy from MCTruth::Enu() vs TParticle
TH2F * fVertexXY
vertex location in xy
TH1F * fMuDCosY
direction cosine of outgoing mu in y
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:276
TH1F * fNCMode
CC interaction mode.
TH1F * fDCosZ
direction cosine in z
TH1F * fEDCosY
direction cosine of outgoing e in y
TH1F * fCCMode
CC interaction mode.
double fPrevTotGoodPOT
Total good POT from subruns previous to current subrun.
evgb::GENIEHelper * fGENIEHelp
GENIEHelper object.
TH1F * fEDCosX
direction cosine of outgoing e in x
TH1F * fMuDCosX
direction cosine of outgoing mu in x
TH1F * fGenerated[6]
Spectra as generated.
std::vector< double > fVtxPosHistRange
use defined hist range; it is useful to have for asymmetric ranges like in DP FD. ...
double fPrevTotPOT
The type of beam.
TH1F * fDCosY
direction cosine in y
TH1F * fEMomentum
momentum of outgoing electrons
TH2F * fVertexYZ
vertex location in yz
TH1F * fECons
histogram to determine if energy is conserved in the event
TH1F * fEDCosZ
direction cosine of outgoing e in z
TH1F * fDCosX
direction cosine in x
TH1F * fMuMomentum
momentum of outgoing muons
TH1F * fVertexY
vertex location of generated events in y
TH1F * fVertexZ
vertex location of generated events in z
void evgen::GENIEGen::beginRun ( art::Run run)
virtual

Reimplemented from art::EDProducer.

Definition at line 352 of file GENIEGen_module.cc.

References geo::GeometryCore::DetectorName(), art::fullRun(), and art::Run::put().

353  {
355  run.put(std::make_unique<sumdata::RunData>(geo->DetectorName()), art::fullRun());
356  }
constexpr auto fullRun()
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: Run.h:121
std::string const & DetectorName() const
Returns a string with the name of the detector, as configured.
Definition: GeometryCore.h:140
ROOT libraries.
void evgen::GENIEGen::beginSubRun ( art::SubRun sr)
virtual

Reimplemented from art::EDProducer.

Definition at line 359 of file GENIEGen_module.cc.

References fGENIEHelp, fPrevTotGoodPOT, fPrevTotPOT, and evgb::GENIEHelper::TotalExposure().

360  {
363  }
double fPrevTotGoodPOT
Total good POT from subruns previous to current subrun.
evgb::GENIEHelper * fGENIEHelp
GENIEHelper object.
double fPrevTotPOT
The type of beam.
double TotalExposure() const
Definition: GENIEHelper.h:71
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::consumes ( InputTag const &  tag)
protectedinherited

Definition at line 61 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumes().

62  {
63  return collector_.consumes<T, BT>(tag);
64  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ProductToken< T > consumes(InputTag const &)
ConsumesCollector & art::ModuleBase::consumesCollector ( )
protectedinherited

Definition at line 57 of file ModuleBase.cc.

References art::ModuleBase::collector_.

58  {
59  return collector_;
60  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename T , BranchType BT>
void art::ModuleBase::consumesMany ( )
protectedinherited

Definition at line 75 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumesMany().

76  {
77  collector_.consumesMany<T, BT>();
78  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::consumesView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::consumesView ( InputTag const &  tag)
inherited

Definition at line 68 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumesView().

69  {
70  return collector_.consumesView<T, BT>(tag);
71  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ViewToken< Element > consumesView(InputTag const &)
void art::detail::Producer::doBeginJob ( SharedResources const &  resources)
inherited

Definition at line 22 of file Producer.cc.

References art::detail::Producer::beginJobWithFrame(), and art::detail::Producer::setupQueues().

23  {
24  setupQueues(resources);
25  ProcessingFrame const frame{ScheduleID{}};
26  beginJobWithFrame(frame);
27  }
virtual void setupQueues(SharedResources const &)=0
virtual void beginJobWithFrame(ProcessingFrame const &)=0
bool art::detail::Producer::doBeginRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited

Definition at line 65 of file Producer.cc.

References art::detail::Producer::beginRunWithFrame(), art::RangeSet::forRun(), art::RunPrincipal::makeRun(), r, art::RunPrincipal::runID(), and art::ModuleContext::scheduleID().

66  {
67  auto r = rp.makeRun(mc, RangeSet::forRun(rp.runID()));
68  ProcessingFrame const frame{mc.scheduleID()};
69  beginRunWithFrame(r, frame);
70  r.commitProducts();
71  return true;
72  }
TRandom r
Definition: spectrum.C:23
virtual void beginRunWithFrame(Run &, ProcessingFrame const &)=0
static RangeSet forRun(RunID)
Definition: RangeSet.cc:51
bool art::detail::Producer::doBeginSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited

Definition at line 85 of file Producer.cc.

References art::detail::Producer::beginSubRunWithFrame(), art::RangeSet::forSubRun(), art::SubRunPrincipal::makeSubRun(), art::ModuleContext::scheduleID(), and art::SubRunPrincipal::subRunID().

86  {
87  auto sr = srp.makeSubRun(mc, RangeSet::forSubRun(srp.subRunID()));
88  ProcessingFrame const frame{mc.scheduleID()};
89  beginSubRunWithFrame(sr, frame);
90  sr.commitProducts();
91  return true;
92  }
virtual void beginSubRunWithFrame(SubRun &, ProcessingFrame const &)=0
static RangeSet forSubRun(SubRunID)
Definition: RangeSet.cc:57
void art::detail::Producer::doEndJob ( )
inherited

Definition at line 30 of file Producer.cc.

References art::detail::Producer::endJobWithFrame().

31  {
32  ProcessingFrame const frame{ScheduleID{}};
33  endJobWithFrame(frame);
34  }
virtual void endJobWithFrame(ProcessingFrame const &)=0
bool art::detail::Producer::doEndRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited

Definition at line 75 of file Producer.cc.

References art::detail::Producer::endRunWithFrame(), art::RunPrincipal::makeRun(), r, art::ModuleContext::scheduleID(), and art::Principal::seenRanges().

76  {
77  auto r = rp.makeRun(mc, rp.seenRanges());
78  ProcessingFrame const frame{mc.scheduleID()};
79  endRunWithFrame(r, frame);
80  r.commitProducts();
81  return true;
82  }
TRandom r
Definition: spectrum.C:23
virtual void endRunWithFrame(Run &, ProcessingFrame const &)=0
bool art::detail::Producer::doEndSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited

Definition at line 95 of file Producer.cc.

References art::detail::Producer::endSubRunWithFrame(), art::SubRunPrincipal::makeSubRun(), art::ModuleContext::scheduleID(), and art::Principal::seenRanges().

96  {
97  auto sr = srp.makeSubRun(mc, srp.seenRanges());
98  ProcessingFrame const frame{mc.scheduleID()};
99  endSubRunWithFrame(sr, frame);
100  sr.commitProducts();
101  return true;
102  }
virtual void endSubRunWithFrame(SubRun &, ProcessingFrame const &)=0
bool art::detail::Producer::doEvent ( EventPrincipal ep,
ModuleContext const &  mc,
std::atomic< std::size_t > &  counts_run,
std::atomic< std::size_t > &  counts_passed,
std::atomic< std::size_t > &  counts_failed 
)
inherited

Definition at line 105 of file Producer.cc.

References art::detail::Producer::checkPutProducts_, e, art::EventPrincipal::makeEvent(), art::detail::Producer::produceWithFrame(), and art::ModuleContext::scheduleID().

110  {
111  auto e = ep.makeEvent(mc);
112  ++counts_run;
113  ProcessingFrame const frame{mc.scheduleID()};
114  produceWithFrame(e, frame);
115  e.commitProducts(checkPutProducts_, &expectedProducts<InEvent>());
116  ++counts_passed;
117  return true;
118  }
bool const checkPutProducts_
Definition: Producer.h:70
Float_t e
Definition: plot.C:35
virtual void produceWithFrame(Event &, ProcessingFrame const &)=0
void art::detail::Producer::doRespondToCloseInputFile ( FileBlock const &  fb)
inherited

Definition at line 44 of file Producer.cc.

References art::detail::Producer::respondToCloseInputFileWithFrame().

45  {
46  ProcessingFrame const frame{ScheduleID{}};
48  }
virtual void respondToCloseInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Producer::doRespondToCloseOutputFiles ( FileBlock const &  fb)
inherited

Definition at line 58 of file Producer.cc.

References art::detail::Producer::respondToCloseOutputFilesWithFrame().

59  {
60  ProcessingFrame const frame{ScheduleID{}};
62  }
virtual void respondToCloseOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Producer::doRespondToOpenInputFile ( FileBlock const &  fb)
inherited

Definition at line 37 of file Producer.cc.

References art::detail::Producer::respondToOpenInputFileWithFrame().

38  {
39  ProcessingFrame const frame{ScheduleID{}};
41  }
virtual void respondToOpenInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Producer::doRespondToOpenOutputFiles ( FileBlock const &  fb)
inherited

Definition at line 51 of file Producer.cc.

References art::detail::Producer::respondToOpenOutputFilesWithFrame().

52  {
53  ProcessingFrame const frame{ScheduleID{}};
55  }
virtual void respondToOpenOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void evgen::GENIEGen::endSubRun ( art::SubRun sr)
virtual

Reimplemented from art::EDProducer.

Definition at line 366 of file GENIEGen_module.cc.

References fGENIEHelp, fPrevTotGoodPOT, fPrevTotPOT, art::SubRun::put(), art::subRunFragment(), and evgb::GENIEHelper::TotalExposure().

367  {
368  auto p = std::make_unique<sumdata::POTSummary>();
369 
370  p->totpot = fGENIEHelp->TotalExposure() - fPrevTotPOT;
371  p->totgoodpot = fGENIEHelp->TotalExposure() - fPrevTotGoodPOT;
372 
373  sr.put(std::move(p), art::subRunFragment());
374  }
double fPrevTotGoodPOT
Total good POT from subruns previous to current subrun.
evgb::GENIEHelper * fGENIEHelp
GENIEHelper object.
double fPrevTotPOT
The type of beam.
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: SubRun.h:126
constexpr auto subRunFragment()
double TotalExposure() const
Definition: GENIEHelper.h:71
void evgen::GENIEGen::FillHistograms ( simb::MCTruth  mc)
private

< fill the vertex histograms from the neutrino - that is always particle 0 in the list

look for the outgoing lepton in the particle stack just interested in the first one

Definition at line 537 of file GENIEGen_module.cc.

References util::abs(), simb::MCNeutrino::CCNC(), DEFINE_ART_MODULE, simb::MCParticle::E(), energy, fCCMode, fDCosX, fDCosY, fDCosZ, fECons, fEDCosX, fEDCosY, fEDCosZ, fEMomentum, fGenerated, fMuDCosX, fMuDCosY, fMuDCosZ, fMuMomentum, fNCMode, fVertexX, fVertexXY, fVertexXZ, fVertexY, fVertexYZ, fVertexZ, simb::MCTruth::GetNeutrino(), simb::MCTruth::GetParticle(), simb::kCC, art::left(), MF_LOG_DEBUG, simb::MCNeutrino::Mode(), simb::MCTruth::NParticles(), simb::MCNeutrino::Nu(), simb::MCParticle::P(), part, ParticleStatus(), simb::MCParticle::PdgCode(), simb::MCParticle::Px(), simb::MCParticle::Py(), simb::MCParticle::Pz(), ReactionChannel(), simb::MCParticle::Vx(), simb::MCParticle::Vy(), and simb::MCParticle::Vz().

Referenced by produce().

538  {
539  // Decide which histograms to put the spectrum in
540  int id = -1;
541  if (mc.GetNeutrino().CCNC() == simb::kCC) {
542  fCCMode->Fill(mc.GetNeutrino().Mode());
543  if (mc.GetNeutrino().Nu().PdgCode() == 12)
544  id = 0;
545  else if (mc.GetNeutrino().Nu().PdgCode() == -12)
546  id = 1;
547  else if (mc.GetNeutrino().Nu().PdgCode() == 14)
548  id = 2;
549  else if (mc.GetNeutrino().Nu().PdgCode() == -14)
550  id = 3;
551  else
552  return;
553  }
554  else {
555  fNCMode->Fill(mc.GetNeutrino().Mode());
556  if (mc.GetNeutrino().Nu().PdgCode() > 0)
557  id = 4;
558  else
559  id = 5;
560  }
561  if (id == -1) abort();
562 
563  // Fill the specta histograms
564  fGenerated[id]->Fill(mc.GetNeutrino().Nu().E());
565 
568  simb::MCNeutrino mcnu = mc.GetNeutrino();
569  const simb::MCParticle nu = mcnu.Nu();
570 
571  fVertexX->Fill(nu.Vx());
572  fVertexY->Fill(nu.Vy());
573  fVertexZ->Fill(nu.Vz());
574 
575  fVertexXY->Fill(nu.Vx(), nu.Vy());
576  fVertexXZ->Fill(nu.Vz(), nu.Vx());
577  fVertexYZ->Fill(nu.Vz(), nu.Vy());
578 
579  double mom = nu.P();
580  if (std::abs(mom) > 0.) {
581  fDCosX->Fill(nu.Px() / mom);
582  fDCosY->Fill(nu.Py() / mom);
583  fDCosZ->Fill(nu.Pz() / mom);
584  }
585 
586  MF_LOG_DEBUG("GENIEInteractionInformation")
587  << std::endl
588  << "REACTION: " << ReactionChannel(mc.GetNeutrino().CCNC(), mc.GetNeutrino().Mode())
589  << std::endl
590  << "-----------> Particles in the Stack = " << mc.NParticles() << std::endl
591  << std::setiosflags(std::ios::left) << std::setw(20) << "PARTICLE"
592  << std::setiosflags(std::ios::left) << std::setw(32) << "STATUS" << std::setw(18) << "E (GeV)"
593  << std::setw(18) << "m (GeV/c2)" << std::setw(18) << "Ek (GeV)" << std::endl
594  << std::endl;
595 
596  const TDatabasePDG* databasePDG = TDatabasePDG::Instance();
597 
598  // Loop over the particle stack for this event
599  for (int i = 0; i < mc.NParticles(); ++i) {
601  std::string name = databasePDG->GetParticle(part.PdgCode())->GetName();
602  int code = part.StatusCode();
603  std::string status = ParticleStatus(code);
604  double mass = part.Mass();
605  double energy = part.E();
606  double Ek = (energy - mass); // Kinetic Energy (GeV)
607  if (status == "kIStStableFinalState" || status == "kIStHadronInTheNucleus")
608  MF_LOG_DEBUG("GENIEFinalState")
609  << std::setiosflags(std::ios::left) << std::setw(20) << name
610  << std::setiosflags(std::ios::left) << std::setw(32) << status << std::setw(18) << energy
611  << std::setw(18) << mass << std::setw(18) << Ek << std::endl;
612  else
613  MF_LOG_DEBUG("GENIEFinalState")
614  << std::setiosflags(std::ios::left) << std::setw(20) << name
615  << std::setiosflags(std::ios::left) << std::setw(32) << status << std::setw(18) << energy
616  << std::setw(18) << mass << std::endl;
617  }
618 
619  if (mc.GetNeutrino().CCNC() == simb::kCC) {
620 
623  for (int i = 0; i < mc.NParticles(); ++i) {
625  if (abs(part.PdgCode()) == 11) {
626  fEMomentum->Fill(part.P());
627  fEDCosX->Fill(part.Px() / part.P());
628  fEDCosY->Fill(part.Py() / part.P());
629  fEDCosZ->Fill(part.Pz() / part.P());
630  fECons->Fill(nu.E() - part.E());
631  break;
632  }
633  else if (abs(part.PdgCode()) == 13) {
634  fMuMomentum->Fill(part.P());
635  fMuDCosX->Fill(part.Px() / part.P());
636  fMuDCosY->Fill(part.Py() / part.P());
637  fMuDCosZ->Fill(part.Pz() / part.P());
638  fECons->Fill(nu.E() - part.E());
639  break;
640  }
641  } // end loop over particles
642  } //end if CC interaction
643  }
TH1F * fVertexX
vertex location of generated events in x
std::string ParticleStatus(int StatusCode)
double E(const int i=0) const
Definition: MCParticle.h:234
TH1F * fMuDCosZ
direction cosine of outgoing mu in z
TH2F * fVertexXZ
vertex location in xz
int PdgCode() const
Definition: MCParticle.h:213
int CCNC() const
Definition: MCNeutrino.h:148
const simb::MCNeutrino & GetNeutrino() const
Definition: MCTruth.h:77
double Py(const int i=0) const
Definition: MCParticle.h:232
TH2F * fVertexXY
vertex location in xy
std::string ReactionChannel(int ccnc, int mode)
TH1F * fMuDCosY
direction cosine of outgoing mu in y
const simb::MCParticle & Nu() const
Definition: MCNeutrino.h:146
double Px(const int i=0) const
Definition: MCParticle.h:231
constexpr auto abs(T v)
Returns the absolute value of the argument.
int NParticles() const
Definition: MCTruth.h:75
TH1F * fNCMode
CC interaction mode.
TH1F * fDCosZ
direction cosine in z
TString part[npart]
Definition: Style.C:32
TH1F * fEDCosY
direction cosine of outgoing e in y
TH1F * fCCMode
CC interaction mode.
double P(const int i=0) const
Definition: MCParticle.h:235
TH1F * fEDCosX
direction cosine of outgoing e in x
double energy
Definition: plottest35.C:25
TH1F * fMuDCosX
direction cosine of outgoing mu in x
TH1F * fGenerated[6]
Spectra as generated.
TH1F * fDCosY
direction cosine in y
const simb::MCParticle & GetParticle(int i) const
Definition: MCTruth.h:76
double Vx(const int i=0) const
Definition: MCParticle.h:222
constexpr auto const & left(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:94
TH1F * fEMomentum
momentum of outgoing electrons
TH2F * fVertexYZ
vertex location in yz
TH1F * fECons
histogram to determine if energy is conserved in the event
#define MF_LOG_DEBUG(id)
double Pz(const int i=0) const
Definition: MCParticle.h:233
double Vz(const int i=0) const
Definition: MCParticle.h:224
TH1F * fEDCosZ
direction cosine of outgoing e in z
TH1F * fDCosX
direction cosine in x
Event generator information.
Definition: MCNeutrino.h:18
TH1F * fMuMomentum
momentum of outgoing muons
int Mode() const
Definition: MCNeutrino.h:149
TH1F * fVertexY
vertex location of generated events in y
TH1F * fVertexZ
vertex location of generated events in z
double Vy(const int i=0) const
Definition: MCParticle.h:223
void art::Modifier::fillProductDescriptions ( )
inherited

Definition at line 10 of file Modifier.cc.

References art::ProductRegistryHelper::fillDescriptions(), and art::ModuleBase::moduleDescription().

11  {
13  }
void fillDescriptions(ModuleDescription const &md)
ModuleDescription const & moduleDescription() const
Definition: ModuleBase.cc:13
std::array< std::vector< ProductInfo >, NumBranchTypes > const & art::ModuleBase::getConsumables ( ) const
inherited

Definition at line 43 of file ModuleBase.cc.

References art::ModuleBase::collector_, and art::ConsumesCollector::getConsumables().

44  {
45  return collector_.getConsumables();
46  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables() const
std::unique_ptr< Worker > art::ModuleBase::makeWorker ( WorkerParams const &  wp)
inherited

Definition at line 37 of file ModuleBase.cc.

References art::ModuleBase::doMakeWorker(), and art::NumBranchTypes.

38  {
39  return doMakeWorker(wp);
40  }
virtual std::unique_ptr< Worker > doMakeWorker(WorkerParams const &wp)=0
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::mayConsume ( InputTag const &  tag)
protectedinherited

Definition at line 82 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsume().

83  {
84  return collector_.mayConsume<T, BT>(tag);
85  }
ProductToken< T > mayConsume(InputTag const &)
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename T , BranchType BT>
void art::ModuleBase::mayConsumeMany ( )
protectedinherited

Definition at line 96 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsumeMany().

97  {
98  collector_.mayConsumeMany<T, BT>();
99  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::mayConsumeView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::mayConsumeView ( InputTag const &  tag)
inherited

Definition at line 89 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsumeView().

90  {
91  return collector_.mayConsumeView<T, BT>(tag);
92  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ViewToken< Element > mayConsumeView(InputTag const &)
ModuleDescription const & art::ModuleBase::moduleDescription ( ) const
inherited

Definition at line 13 of file ModuleBase.cc.

References art::errors::LogicError.

Referenced by art::OutputModule::doRespondToOpenInputFile(), art::OutputModule::doWriteEvent(), art::Modifier::fillProductDescriptions(), art::OutputModule::makePlugins_(), art::OutputWorker::OutputWorker(), reco::shower::LArPandoraModularShowerCreation::produce(), art::Modifier::registerProducts(), and art::OutputModule::registerProducts().

14  {
15  if (md_.has_value()) {
16  return *md_;
17  }
18 
20  "There was an error while calling moduleDescription().\n"}
21  << "The moduleDescription() base-class member function cannot be called\n"
22  "during module construction. To determine which module is "
23  "responsible\n"
24  "for calling it, find the '<module type>:<module "
25  "label>@Construction'\n"
26  "tag in the message prefix above. Please contact artists@fnal.gov\n"
27  "for guidance.\n";
28  }
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::optional< ModuleDescription > md_
Definition: ModuleBase.h:55
std::string evgen::GENIEGen::ParticleStatus ( int  StatusCode)
private

Definition at line 488 of file GENIEGen_module.cc.

References sim::ParticleStatusName().

Referenced by FillHistograms().

489  {
490  int code = StatusCode;
491  std::string ParticleStatusName;
492 
493  switch (code) {
494  case -1: ParticleStatusName = "kIStUndefined"; break;
495  case 0: ParticleStatusName = "kIStInitialState"; break;
496  case 1: ParticleStatusName = "kIStStableFinalState"; break;
497  case 2: ParticleStatusName = "kIStIntermediateState"; break;
498  case 3: ParticleStatusName = "kIStDecayedState"; break;
499  case 11: ParticleStatusName = "kIStNucleonTarget"; break;
500  case 12: ParticleStatusName = "kIStDISPreFragmHadronicState"; break;
501  case 13: ParticleStatusName = "kIStPreDecayResonantState"; break;
502  case 14: ParticleStatusName = "kIStHadronInTheNucleus"; break;
503  case 15: ParticleStatusName = "kIStFinalStateNuclearRemnant"; break;
504  case 16: ParticleStatusName = "kIStNucleonClusterTarget"; break;
505  default: ParticleStatusName = "Status Unknown";
506  }
507  return ParticleStatusName;
508  }
std::string ParticleStatusName(int code)
Describes the status of a particle (simb::MCParticle::StatusCode()).
void evgen::GENIEGen::produce ( art::Event evt)
virtual

Implements art::EDProducer.

Definition at line 377 of file GENIEGen_module.cc.

References util::CreateAssn(), sim::dump::DumpGTruth(), sim::dump::DumpMCTruth(), fBeamType, fGENIEHelp, fGlobalTimeOffset, FillHistograms(), fPassEmptySpills, fRandomTimeOffset, evgb::GENIEHelper::GetFluxDriver(), simb::MCTruth::GetNeutrino(), simb::MCNeutrino::InteractionType(), simb::kNuanceOffset, MF_LOG_DEBUG, simb::MCTruth::NeutrinoSet(), art::Event::put(), evgb::GENIEHelper::Sample(), and evgb::GENIEHelper::Stop().

378  {
379  std::unique_ptr<std::vector<simb::MCTruth>> truthcol(new std::vector<simb::MCTruth>);
380  std::unique_ptr<std::vector<simb::MCFlux>> fluxcol(new std::vector<simb::MCFlux>);
381  std::unique_ptr<std::vector<simb::GTruth>> gtruthcol(new std::vector<simb::GTruth>);
382  std::unique_ptr<art::Assns<simb::MCTruth, simb::MCFlux>> tfassn(
384  std::unique_ptr<art::Assns<simb::MCTruth, simb::GTruth>> tgtassn(
386  std::unique_ptr<std::vector<sim::BeamGateInfo>> gateCollection(
387  new std::vector<sim::BeamGateInfo>);
388 
389  std::unique_ptr<std::vector<bsim::Dk2Nu>> dk2nucol(new std::vector<bsim::Dk2Nu>);
390  std::unique_ptr<std::vector<bsim::NuChoice>> nuchoicecol(new std::vector<bsim::NuChoice>);
391  std::unique_ptr<art::Assns<simb::MCTruth, bsim::Dk2Nu>> dk2nuassn(
393  std::unique_ptr<art::Assns<simb::MCTruth, bsim::NuChoice>> nuchoiceassn(
395 
396  genie::flux::GDk2NuFlux* dk2nuDriver =
397  dynamic_cast<genie::flux::GDk2NuFlux*>(fGENIEHelp->GetFluxDriver(true));
398  while (truthcol->size() < 1) {
399  while (!fGENIEHelp->Stop()) {
400 
401  simb::MCTruth truth;
402  simb::MCFlux flux;
403  simb::GTruth gTruth;
404 
405  // GENIEHelper returns a false in the sample method if
406  // either no neutrino was generated, or the interaction
407  // occurred beyond the detector's z extent - ie something we
408  // would never see anyway.
409  if (fGENIEHelp->Sample(truth, flux, gTruth)) {
410 
411  truthcol->push_back(truth);
412  fluxcol->push_back(flux);
413  gtruthcol->push_back(gTruth);
414  auto const truthPtr = art::PtrMaker<simb::MCTruth>{evt}(truthcol->size() - 1);
415  tfassn->addSingle(truthPtr, art::PtrMaker<simb::MCFlux>{evt}(fluxcol->size() - 1));
416  tgtassn->addSingle(truthPtr, art::PtrMaker<simb::GTruth>{evt}(gtruthcol->size() - 1));
417 
418  FillHistograms(truth);
419 
420  if (dk2nuDriver) {
421  const bsim::Dk2Nu& dk2nuObj = dk2nuDriver->GetDk2Nu();
422  dk2nucol->push_back(dk2nuObj);
423  const bsim::NuChoice& nuchoiceObj = dk2nuDriver->GetNuChoice();
424  nuchoicecol->push_back(nuchoiceObj);
426  evt, *truthcol, *dk2nucol, *dk2nuassn, dk2nucol->size() - 1, dk2nucol->size());
427  util::CreateAssn(evt,
428  *truthcol,
429  *nuchoicecol,
430  *nuchoiceassn,
431  nuchoicecol->size() - 1,
432  nuchoicecol->size());
433  }
434 
435  // check that the process code is not unsupported by GENIE
436  // (see issue #18025 for reference);
437  // if it is, print all the information we can about this truth record
438  if (truth.NeutrinoSet() &&
440  mf::LogWarning log("GENIEmissingProcessMapping");
441  log << "Found an interaction that is not represented by the interaction type code in "
442  "GENIE:"
443  "\nMCTruth record:"
444  "\n";
445  sim::dump::DumpMCTruth(log, truth, 2U); // 2 trajectory points per line
446  log << "\nGENIE truth record:"
447  "\n";
448  sim::dump::DumpGTruth(log, gTruth);
449  } // if
450 
451  } // end if genie was able to make an event
452 
453  } // end event generation loop
454 
455  // check to see if we are to pass empty spills
456  if (truthcol->size() < 1 && fPassEmptySpills) {
457  MF_LOG_DEBUG("GENIEGen") << "no events made for this spill but "
458  << "passing it on and ending the event anyway";
459  break;
460  }
461 
462  } // end loop while no interactions are made
463 
464  // Create a simulated "beam gate" for these neutrino events.
465  // We're creating a vector of these because, in a
466  // distant-but-possible future, we may be generating more than one
467  // beam gate within a simulated time window.
468  gateCollection->push_back(sim::BeamGateInfo(fGlobalTimeOffset, fRandomTimeOffset, fBeamType));
469 
470  // put the collections in the event
471  evt.put(std::move(truthcol));
472  evt.put(std::move(fluxcol));
473  evt.put(std::move(gtruthcol));
474  evt.put(std::move(tfassn));
475  evt.put(std::move(tgtassn));
476  evt.put(std::move(gateCollection));
477 
478  // dk2nu additions
479  if (dk2nuDriver) {
480  evt.put(std::move(dk2nucol));
481  evt.put(std::move(nuchoicecol));
482  evt.put(std::move(dk2nuassn));
483  evt.put(std::move(nuchoiceassn));
484  }
485  }
genie::GFluxI * GetFluxDriver(bool base=true)
Definition: GENIEHelper.h:91
const simb::MCNeutrino & GetNeutrino() const
Definition: MCTruth.h:77
void DumpGTruth(Stream &&out, simb::GTruth const &truth, std::string indent, std::string firstIndent)
Dumps the content of the GENIE truth in the output stream.
Definition: MCDumpers.h:377
bool Sample(simb::MCTruth &truth, simb::MCFlux &flux, simb::GTruth &gtruth)
offset to account for adding in Nuance codes to this enum
Definition: MCNeutrino.h:95
::sim::BeamType_t fBeamType
The width of a simulated "beam gate".
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: Event.h:77
int InteractionType() const
Definition: MCNeutrino.h:150
int fPassEmptySpills
whether or not to kill evnets with no interactions
evgb::GENIEHelper * fGENIEHelp
GENIEHelper object.
double fGlobalTimeOffset
keep track of how long it takes to run the job
void DumpMCTruth(Stream &&out, simb::MCTruth const &truth, unsigned int pointsPerLine, std::string indent, std::string firstIndent)
Dumps the content of the specified MC truth in the output stream.
Definition: MCDumpers.h:338
bool CreateAssn(art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t index=UINT_MAX)
Creates a single one-to-one association.
#define MF_LOG_DEBUG(id)
bool NeutrinoSet() const
Definition: MCTruth.h:78
Event generator information.
Definition: MCTruth.h:32
void FillHistograms(simb::MCTruth mc)
double fRandomTimeOffset
The start of a simulated "beam gate".
std::string evgen::GENIEGen::ReactionChannel ( int  ccnc,
int  mode 
)
private

Definition at line 511 of file GENIEGen_module.cc.

Referenced by FillHistograms().

512  {
513  std::string ReactionChannelName = " ";
514 
515  if (ccnc == 0)
516  ReactionChannelName = "kCC";
517  else if (ccnc == 1)
518  ReactionChannelName = "kNC";
519  else
520  std::cout << "Current mode unknown!! " << std::endl;
521 
522  if (mode == 0)
523  ReactionChannelName += "_kQE";
524  else if (mode == 1)
525  ReactionChannelName += "_kRes";
526  else if (mode == 2)
527  ReactionChannelName += "_kDIS";
528  else if (mode == 3)
529  ReactionChannelName += "_kCoh";
530  else
531  std::cout << "interaction mode unknown!! " << std::endl;
532 
533  return ReactionChannelName;
534  }
void art::Modifier::registerProducts ( ProductDescriptions productsToRegister)
inherited

Definition at line 16 of file Modifier.cc.

References art::ModuleBase::moduleDescription(), and art::ProductRegistryHelper::registerProducts().

17  {
18  ProductRegistryHelper::registerProducts(productsToRegister,
20  }
void registerProducts(ProductDescriptions &productsToRegister, ModuleDescription const &md)
ModuleDescription const & moduleDescription() const
Definition: ModuleBase.cc:13
void art::ModuleBase::setModuleDescription ( ModuleDescription const &  md)
inherited

Definition at line 31 of file ModuleBase.cc.

References art::ModuleBase::md_.

32  {
33  md_ = md;
34  }
std::optional< ModuleDescription > md_
Definition: ModuleBase.h:55
void art::ModuleBase::sortConsumables ( std::string const &  current_process_name)
inherited

Definition at line 49 of file ModuleBase.cc.

References art::ModuleBase::collector_, and art::ConsumesCollector::sortConsumables().

50  {
51  // Now that we know we have seen all the consumes declarations,
52  // sort the results for fast lookup later.
53  collector_.sortConsumables(current_process_name);
54  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
void sortConsumables(std::string const &current_process_name)

Member Data Documentation

::sim::BeamType_t evgen::GENIEGen::fBeamType
private

The width of a simulated "beam gate".

Definition at line 118 of file GENIEGen_module.cc.

Referenced by GENIEGen(), and produce().

TH1F* evgen::GENIEGen::fCCMode
private

CC interaction mode.

Definition at line 147 of file GENIEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH1F* evgen::GENIEGen::fDCosX
private

direction cosine in x

Definition at line 133 of file GENIEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH1F* evgen::GENIEGen::fDCosY
private

direction cosine in y

Definition at line 134 of file GENIEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH1F* evgen::GENIEGen::fDCosZ
private

direction cosine in z

Definition at line 135 of file GENIEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

bool evgen::GENIEGen::fDefinedVtxHistRange
private

Definition at line 110 of file GENIEGen_module.cc.

Referenced by beginJob(), and GENIEGen().

TH1F* evgen::GENIEGen::fDeltaE
private

difference in neutrino energy from MCTruth::Enu() vs TParticle

Definition at line 150 of file GENIEGen_module.cc.

Referenced by beginJob().

TH1F* evgen::GENIEGen::fECons
private

histogram to determine if energy is conserved in the event

Definition at line 151 of file GENIEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH1F* evgen::GENIEGen::fEDCosX
private

direction cosine of outgoing e in x

Definition at line 143 of file GENIEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH1F* evgen::GENIEGen::fEDCosY
private

direction cosine of outgoing e in y

Definition at line 144 of file GENIEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH1F* evgen::GENIEGen::fEDCosZ
private

direction cosine of outgoing e in z

Definition at line 145 of file GENIEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH1F* evgen::GENIEGen::fEMomentum
private

momentum of outgoing electrons

Definition at line 142 of file GENIEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH1F* evgen::GENIEGen::fGenerated[6]
private

Spectra as generated.

Definition at line 123 of file GENIEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

evgb::GENIEHelper* evgen::GENIEGen::fGENIEHelp
private

GENIEHelper object.

Definition at line 108 of file GENIEGen_module.cc.

Referenced by beginJob(), beginSubRun(), endSubRun(), GENIEGen(), produce(), and ~GENIEGen().

double evgen::GENIEGen::fGlobalTimeOffset
private

keep track of how long it takes to run the job

Definition at line 116 of file GENIEGen_module.cc.

Referenced by GENIEGen(), and produce().

TH1F* evgen::GENIEGen::fMuDCosX
private

direction cosine of outgoing mu in x

Definition at line 138 of file GENIEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH1F* evgen::GENIEGen::fMuDCosY
private

direction cosine of outgoing mu in y

Definition at line 139 of file GENIEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH1F* evgen::GENIEGen::fMuDCosZ
private

direction cosine of outgoing mu in z

Definition at line 140 of file GENIEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH1F* evgen::GENIEGen::fMuMomentum
private

momentum of outgoing muons

Definition at line 137 of file GENIEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH1F* evgen::GENIEGen::fNCMode
private

CC interaction mode.

Definition at line 148 of file GENIEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

int evgen::GENIEGen::fPassEmptySpills
private

whether or not to kill evnets with no interactions

Definition at line 113 of file GENIEGen_module.cc.

Referenced by GENIEGen(), and produce().

double evgen::GENIEGen::fPrevTotGoodPOT
private

Total good POT from subruns previous to current subrun.

Definition at line 121 of file GENIEGen_module.cc.

Referenced by beginJob(), beginSubRun(), and endSubRun().

double evgen::GENIEGen::fPrevTotPOT
private

The type of beam.

Total POT from subruns previous to current subrun

Definition at line 120 of file GENIEGen_module.cc.

Referenced by beginJob(), beginSubRun(), and endSubRun().

double evgen::GENIEGen::fRandomTimeOffset
private

The start of a simulated "beam gate".

Definition at line 117 of file GENIEGen_module.cc.

Referenced by GENIEGen(), and produce().

TStopwatch evgen::GENIEGen::fStopwatch
private

Definition at line 114 of file GENIEGen_module.cc.

Referenced by GENIEGen(), and ~GENIEGen().

TH1F* evgen::GENIEGen::fVertexX
private

vertex location of generated events in x

Definition at line 125 of file GENIEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH2F* evgen::GENIEGen::fVertexXY
private

vertex location in xy

Definition at line 129 of file GENIEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH2F* evgen::GENIEGen::fVertexXZ
private

vertex location in xz

Definition at line 130 of file GENIEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH1F* evgen::GENIEGen::fVertexY
private

vertex location of generated events in y

Definition at line 126 of file GENIEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH2F* evgen::GENIEGen::fVertexYZ
private

vertex location in yz

Definition at line 131 of file GENIEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH1F* evgen::GENIEGen::fVertexZ
private

vertex location of generated events in z

Definition at line 127 of file GENIEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

std::vector<double> evgen::GENIEGen::fVtxPosHistRange
private

use defined hist range; it is useful to have for asymmetric ranges like in DP FD.

Definition at line 111 of file GENIEGen_module.cc.

Referenced by beginJob(), and GENIEGen().


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