LArSoft  v09_90_00
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, fhicl::ParameterSet::get_if_present(), sim::kBNB, sim::kNuMI, geo::kUnknown, fhicl::ParameterSet::put(), geo::GeometryCore::ROOTFile(), 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->ROOTFile(), detectorMass);
235  }
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
Unknown view.
Definition: geo_types.h:142
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.cc:6
std::string const & ROOTFile() const
Returns the full directory path to the geometry file source.
Definition: GeometryCore.h:184
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:319
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
TStopwatch fStopwatch
Namespace collecting geometry-related classes utilities.
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 geo::GeometryCore::DetHalfHeight(), geo::GeometryCore::DetHalfWidth(), geo::GeometryCore::DetLength(), 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) {
296  double x = 2.1 * geo->DetHalfWidth();
297  double y = 2.1 * geo->DetHalfHeight();
298  double z = 2. * geo->DetLength();
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
Length_t DetHalfWidth(TPCID const &tpcid=tpc_zero) const
Returns the half width of the active volume of the specified TPC.
Double_t z
Definition: plot.C:276
Length_t DetLength(TPCID const &tpcid=tpc_zero) const
Returns the length of the active volume of the specified TPC.
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
Length_t DetHalfHeight(TPCID const &tpcid=tpc_zero) const
Returns the half height of the active volume of the specified TPC.
Namespace collecting geometry-related classes utilities.
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:203
Namespace collecting geometry-related classes utilities.
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  {
361 
364 
365  return;
366  }
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 369 of file GENIEGen_module.cc.

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

370  {
371 
372  auto p = std::make_unique<sumdata::POTSummary>();
373 
374  p->totpot = fGENIEHelp->TotalExposure() - fPrevTotPOT;
375  p->totgoodpot = fGENIEHelp->TotalExposure() - fPrevTotGoodPOT;
376 
377  sr.put(std::move(p), art::subRunFragment());
378 
379  return;
380  }
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 545 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().

546  {
547  // Decide which histograms to put the spectrum in
548  int id = -1;
549  if (mc.GetNeutrino().CCNC() == simb::kCC) {
550  fCCMode->Fill(mc.GetNeutrino().Mode());
551  if (mc.GetNeutrino().Nu().PdgCode() == 12)
552  id = 0;
553  else if (mc.GetNeutrino().Nu().PdgCode() == -12)
554  id = 1;
555  else if (mc.GetNeutrino().Nu().PdgCode() == 14)
556  id = 2;
557  else if (mc.GetNeutrino().Nu().PdgCode() == -14)
558  id = 3;
559  else
560  return;
561  }
562  else {
563  fNCMode->Fill(mc.GetNeutrino().Mode());
564  if (mc.GetNeutrino().Nu().PdgCode() > 0)
565  id = 4;
566  else
567  id = 5;
568  }
569  if (id == -1) abort();
570 
571  // Fill the specta histograms
572  fGenerated[id]->Fill(mc.GetNeutrino().Nu().E());
573 
576  simb::MCNeutrino mcnu = mc.GetNeutrino();
577  const simb::MCParticle nu = mcnu.Nu();
578 
579  fVertexX->Fill(nu.Vx());
580  fVertexY->Fill(nu.Vy());
581  fVertexZ->Fill(nu.Vz());
582 
583  fVertexXY->Fill(nu.Vx(), nu.Vy());
584  fVertexXZ->Fill(nu.Vz(), nu.Vx());
585  fVertexYZ->Fill(nu.Vz(), nu.Vy());
586 
587  double mom = nu.P();
588  if (std::abs(mom) > 0.) {
589  fDCosX->Fill(nu.Px() / mom);
590  fDCosY->Fill(nu.Py() / mom);
591  fDCosZ->Fill(nu.Pz() / mom);
592  }
593 
594  MF_LOG_DEBUG("GENIEInteractionInformation")
595  << std::endl
596  << "REACTION: " << ReactionChannel(mc.GetNeutrino().CCNC(), mc.GetNeutrino().Mode())
597  << std::endl
598  << "-----------> Particles in the Stack = " << mc.NParticles() << std::endl
599  << std::setiosflags(std::ios::left) << std::setw(20) << "PARTICLE"
600  << std::setiosflags(std::ios::left) << std::setw(32) << "STATUS" << std::setw(18) << "E (GeV)"
601  << std::setw(18) << "m (GeV/c2)" << std::setw(18) << "Ek (GeV)" << std::endl
602  << std::endl;
603 
604  const TDatabasePDG* databasePDG = TDatabasePDG::Instance();
605 
606  // Loop over the particle stack for this event
607  for (int i = 0; i < mc.NParticles(); ++i) {
609  std::string name = databasePDG->GetParticle(part.PdgCode())->GetName();
610  int code = part.StatusCode();
611  std::string status = ParticleStatus(code);
612  double mass = part.Mass();
613  double energy = part.E();
614  double Ek = (energy - mass); // Kinetic Energy (GeV)
615  if (status == "kIStStableFinalState" || status == "kIStHadronInTheNucleus")
616  MF_LOG_DEBUG("GENIEFinalState")
617  << std::setiosflags(std::ios::left) << std::setw(20) << name
618  << std::setiosflags(std::ios::left) << std::setw(32) << status << std::setw(18) << energy
619  << std::setw(18) << mass << std::setw(18) << Ek << std::endl;
620  else
621  MF_LOG_DEBUG("GENIEFinalState")
622  << std::setiosflags(std::ios::left) << std::setw(20) << name
623  << std::setiosflags(std::ios::left) << std::setw(32) << status << std::setw(18) << energy
624  << std::setw(18) << mass << std::endl;
625  }
626 
627  if (mc.GetNeutrino().CCNC() == simb::kCC) {
628 
631  for (int i = 0; i < mc.NParticles(); ++i) {
633  if (abs(part.PdgCode()) == 11) {
634  fEMomentum->Fill(part.P());
635  fEDCosX->Fill(part.Px() / part.P());
636  fEDCosY->Fill(part.Py() / part.P());
637  fEDCosZ->Fill(part.Pz() / part.P());
638  fECons->Fill(nu.E() - part.E());
639  break;
640  }
641  else if (abs(part.PdgCode()) == 13) {
642  fMuMomentum->Fill(part.P());
643  fMuDCosX->Fill(part.Px() / part.P());
644  fMuDCosY->Fill(part.Py() / part.P());
645  fMuDCosZ->Fill(part.Pz() / part.P());
646  fECons->Fill(nu.E() - part.E());
647  break;
648  }
649  } // end loop over particles
650  } //end if CC interaction
651 
652  return;
653  }
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 496 of file GENIEGen_module.cc.

References sim::ParticleStatusName().

Referenced by FillHistograms().

497  {
498  int code = StatusCode;
499  std::string ParticleStatusName;
500 
501  switch (code) {
502  case -1: ParticleStatusName = "kIStUndefined"; break;
503  case 0: ParticleStatusName = "kIStInitialState"; break;
504  case 1: ParticleStatusName = "kIStStableFinalState"; break;
505  case 2: ParticleStatusName = "kIStIntermediateState"; break;
506  case 3: ParticleStatusName = "kIStDecayedState"; break;
507  case 11: ParticleStatusName = "kIStNucleonTarget"; break;
508  case 12: ParticleStatusName = "kIStDISPreFragmHadronicState"; break;
509  case 13: ParticleStatusName = "kIStPreDecayResonantState"; break;
510  case 14: ParticleStatusName = "kIStHadronInTheNucleus"; break;
511  case 15: ParticleStatusName = "kIStFinalStateNuclearRemnant"; break;
512  case 16: ParticleStatusName = "kIStNucleonClusterTarget"; break;
513  default: ParticleStatusName = "Status Unknown";
514  }
515  return ParticleStatusName;
516  }
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 383 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().

384  {
385  std::unique_ptr<std::vector<simb::MCTruth>> truthcol(new std::vector<simb::MCTruth>);
386  std::unique_ptr<std::vector<simb::MCFlux>> fluxcol(new std::vector<simb::MCFlux>);
387  std::unique_ptr<std::vector<simb::GTruth>> gtruthcol(new std::vector<simb::GTruth>);
388  std::unique_ptr<art::Assns<simb::MCTruth, simb::MCFlux>> tfassn(
390  std::unique_ptr<art::Assns<simb::MCTruth, simb::GTruth>> tgtassn(
392  std::unique_ptr<std::vector<sim::BeamGateInfo>> gateCollection(
393  new std::vector<sim::BeamGateInfo>);
394 
395  std::unique_ptr<std::vector<bsim::Dk2Nu>> dk2nucol(new std::vector<bsim::Dk2Nu>);
396  std::unique_ptr<std::vector<bsim::NuChoice>> nuchoicecol(new std::vector<bsim::NuChoice>);
397  std::unique_ptr<art::Assns<simb::MCTruth, bsim::Dk2Nu>> dk2nuassn(
399  std::unique_ptr<art::Assns<simb::MCTruth, bsim::NuChoice>> nuchoiceassn(
401 
402  genie::flux::GDk2NuFlux* dk2nuDriver =
403  dynamic_cast<genie::flux::GDk2NuFlux*>(fGENIEHelp->GetFluxDriver(true));
404  while (truthcol->size() < 1) {
405  while (!fGENIEHelp->Stop()) {
406 
407  simb::MCTruth truth;
408  simb::MCFlux flux;
409  simb::GTruth gTruth;
410 
411  // GENIEHelper returns a false in the sample method if
412  // either no neutrino was generated, or the interaction
413  // occurred beyond the detector's z extent - ie something we
414  // would never see anyway.
415  if (fGENIEHelp->Sample(truth, flux, gTruth)) {
416 
417  truthcol->push_back(truth);
418  fluxcol->push_back(flux);
419  gtruthcol->push_back(gTruth);
420  auto const truthPtr = art::PtrMaker<simb::MCTruth>{evt}(truthcol->size() - 1);
421  tfassn->addSingle(truthPtr, art::PtrMaker<simb::MCFlux>{evt}(fluxcol->size() - 1));
422  tgtassn->addSingle(truthPtr, art::PtrMaker<simb::GTruth>{evt}(gtruthcol->size() - 1));
423 
424  FillHistograms(truth);
425 
426  if (dk2nuDriver) {
427  const bsim::Dk2Nu& dk2nuObj = dk2nuDriver->GetDk2Nu();
428  dk2nucol->push_back(dk2nuObj);
429  const bsim::NuChoice& nuchoiceObj = dk2nuDriver->GetNuChoice();
430  nuchoicecol->push_back(nuchoiceObj);
432  evt, *truthcol, *dk2nucol, *dk2nuassn, dk2nucol->size() - 1, dk2nucol->size());
433  util::CreateAssn(evt,
434  *truthcol,
435  *nuchoicecol,
436  *nuchoiceassn,
437  nuchoicecol->size() - 1,
438  nuchoicecol->size());
439  }
440 
441  // check that the process code is not unsupported by GENIE
442  // (see issue #18025 for reference);
443  // if it is, print all the information we can about this truth record
444  if (truth.NeutrinoSet() &&
446  mf::LogWarning log("GENIEmissingProcessMapping");
447  log << "Found an interaction that is not represented by the interaction type code in "
448  "GENIE:"
449  "\nMCTruth record:"
450  "\n";
451  sim::dump::DumpMCTruth(log, truth, 2U); // 2 trajectory points per line
452  log << "\nGENIE truth record:"
453  "\n";
454  sim::dump::DumpGTruth(log, gTruth);
455  } // if
456 
457  } // end if genie was able to make an event
458 
459  } // end event generation loop
460 
461  // check to see if we are to pass empty spills
462  if (truthcol->size() < 1 && fPassEmptySpills) {
463  MF_LOG_DEBUG("GENIEGen") << "no events made for this spill but "
464  << "passing it on and ending the event anyway";
465  break;
466  }
467 
468  } // end loop while no interactions are made
469 
470  // Create a simulated "beam gate" for these neutrino events.
471  // We're creating a vector of these because, in a
472  // distant-but-possible future, we may be generating more than one
473  // beam gate within a simulated time window.
474  gateCollection->push_back(sim::BeamGateInfo(fGlobalTimeOffset, fRandomTimeOffset, fBeamType));
475 
476  // put the collections in the event
477  evt.put(std::move(truthcol));
478  evt.put(std::move(fluxcol));
479  evt.put(std::move(gtruthcol));
480  evt.put(std::move(tfassn));
481  evt.put(std::move(tgtassn));
482  evt.put(std::move(gateCollection));
483 
484  // dk2nu additions
485  if (dk2nuDriver) {
486  evt.put(std::move(dk2nucol));
487  evt.put(std::move(nuchoicecol));
488  evt.put(std::move(dk2nuassn));
489  evt.put(std::move(nuchoiceassn));
490  }
491 
492  return;
493  }
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 519 of file GENIEGen_module.cc.

Referenced by FillHistograms().

520  {
521  std::string ReactionChannelName = " ";
522 
523  if (ccnc == 0)
524  ReactionChannelName = "kCC";
525  else if (ccnc == 1)
526  ReactionChannelName = "kNC";
527  else
528  std::cout << "Current mode unknown!! " << std::endl;
529 
530  if (mode == 0)
531  ReactionChannelName += "_kQE";
532  else if (mode == 1)
533  ReactionChannelName += "_kRes";
534  else if (mode == 2)
535  ReactionChannelName += "_kDIS";
536  else if (mode == 3)
537  ReactionChannelName += "_kCoh";
538  else
539  std::cout << "interaction mode unknown!! " << std::endl;
540 
541  return ReactionChannelName;
542  }
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: