LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
evg::AddGenieEventsToArt Class Reference
Inheritance diagram for evg::AddGenieEventsToArt:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Types

using Parameters = art::EDProducer::Table< evg::AddGenieEventsToArtParams >
 
using ModuleType = EDProducer
 
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 

Public Member Functions

 AddGenieEventsToArt (const Parameters &p)
 
 ~AddGenieEventsToArt ()
 
 AddGenieEventsToArt (AddGenieEventsToArt const &)=delete
 
 AddGenieEventsToArt (AddGenieEventsToArt &&)=delete
 
AddGenieEventsToArtoperator= (AddGenieEventsToArt const &)=delete
 
AddGenieEventsToArtoperator= (AddGenieEventsToArt &&)=delete
 
void produce (art::Event &e) override
 
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 Types

enum  EDistrib {
  kUnknownDist, kFixed, kFlat, kPoisson,
  kPoissonMinus1, kGaussian, kRootino
}
 
typedef enum evg::AddGenieEventsToArt::EDistrib RndDist_t
 

Private Member Functions

void ParseCountConfig ()
 
size_t GetNumToAdd () const
 
void ParseTimeConfig ()
 
void ParseVtxOffsetConfig ()
 

Private Attributes

Parameters fParams
 
std::vector< std::string > fFileList
 
double fGlobalTimeOffset
 
evgb::EvtTimeShiftIfTimeShifter
 
double fXlo
 
double fYlo
 
double fZlo
 
double fXhi
 
double fYhi
 
double fZhi
 
bool fAddMCFlux
 
bool fRandomEntries
 
std::string fMyModuleType
 
std::string fMyModuleLabel
 
int fOutputPrintLevel
 
std::string fOutputDumpFileName
 
std::ostream * fOutputStream
 
std::string fDistName
 
RndDist_t fRndDist
 
double fRndP1
 
double fRndP2
 
TChain * fGTreeChain
 
genie::NtpMCEventRecord * fMCRec
 
size_t fNumMCRec
 
size_t fLastUsedMCRec
 
genie::flux::GNuMIFluxPassThroughInfo * fGNuMIFluxPassThroughInfo
 
genie::flux::GSimpleNtpEntry * fGSimpleNtpEntry
 
genie::flux::GSimpleNtpNuMI * fGSimpleNtpNuMI
 
genie::flux::GSimpleNtpAux * fGSimpleNtpAux
 
bsim::Dk2Nu * fDk2Nu
 
bsim::NuChoice * fNuChoice
 
unsigned int const fSeed
 
CLHEP::HepRandomEngine & fEngine
 

Detailed Description

Definition at line 193 of file AddGenieEventsToArt_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.

Member Enumeration Documentation

Constructor & Destructor Documentation

evg::AddGenieEventsToArt::AddGenieEventsToArt ( const Parameters p)
explicit

gtree->GetBranch("flux")->GetClassName() (const char* 0x31f41c0)"genie::flux::GNuMIFluxPassThroughInfo"

gtree->GetBranch("simple")->GetClassName() (const char* 0x2a2a8e0)"genie::flux::GSimpleNtpEntry" gtree->GetBranch("numi")->GetClassName() (const char* 0x2a33d40)"genie::flux::GSimpleNtpNuMI gtree->GetBranch("aux")->GetClassName() (const char* 0x2a35320)"genie::flux::GSimpleNtpAux"

gtree->GetBranch("dk2nu")->GetClassName() (const char* 0x3457d59)"bsim::Dk2Nu" gtree->GetBranch("nuchoice")->GetClassName() (const char* 0x3479329)"bsim::NuChoice"

Definition at line 299 of file AddGenieEventsToArt_module.cc.

References art::detail::EngineCreator::createEngine(), fAddMCFlux, fDk2Nu, fEngine, fFileList, fGlobalTimeOffset, fGNuMIFluxPassThroughInfo, fGSimpleNtpAux, fGSimpleNtpEntry, fGSimpleNtpNuMI, fGTreeChain, fLastUsedMCRec, fMCRec, fMyModuleLabel, fMyModuleType, fNuChoice, fNumMCRec, fOutputDumpFileName, fOutputPrintLevel, fOutputStream, fParams, fRandomEntries, fSeed, art::ProducerTable< UserConfig, ImplicitConfig, UserKeysToIgnore >::get_PSet(), evgb::GetRandomNumberSeed(), ParseCountConfig(), ParseTimeConfig(), and ParseVtxOffsetConfig().

300  : EDProducer(params)
301  , fParams(params)
302  , fGlobalTimeOffset(0)
303  , fTimeShifter(0)
304  , fXlo(0), fYlo(0), fZlo(0)
305  , fXhi(0), fYhi(0), fZhi(0)
306  , fAddMCFlux(false)
307  , fRandomEntries(false)
308  , fOutputPrintLevel(-1)
309  , fOutputStream(0)
310  //
311  , fDistName("")
313  , fRndP1(-1)
314  , fRndP2(-1)
315  , fGTreeChain(new TChain("gtree"))
316  , fMCRec(new genie::NtpMCEventRecord)
317  , fNumMCRec(0)
318  , fLastUsedMCRec(0)
320  , fGSimpleNtpEntry(0)
321  , fGSimpleNtpNuMI(0)
322  , fGSimpleNtpAux(0)
323  , fDk2Nu(0)
324  , fNuChoice(0)
325  // get the random number seed, use a random default if not specified
326  // in the configuration file.
327  , fSeed{fParams().seed() == 0 ? evgb::GetRandomNumberSeed() : fParams().seed()}
328  // only need sub-label if using more than one engine for each
329  // instance of this module (already tagged by equiv of fMyModuleLabel)
330  , fEngine{createEngine(fSeed/*, "HepJamesRandom", sub-label*/)}
331 {
332 
333 #ifdef GENIE_PRE_R3
334  // trigger early initialization of PDG database & GENIE message service
335  // just to get it out of the way and not intermixed with other output
336  genie::PDGLibrary::Instance();
337 #else
338  // get the GENIE banner out of the way
339  // no longer can use genie::PDGLibrary::Instance() to do this
340  // because that must happen, in some cases in v3_02_xx, after the tune
341  // is determined
342  // banner is triggered by first use of GENIE Messenger
343  // avoid using GENIE macros (possible conflict with mf macros)
344  // LOG("GENIE",pInfo) << "Trigger GENIE banner";
345  (*genie::Messenger::Instance())("GENIE") << log4cpp::Priority::INFO
346  << "Trigger GENIE banner";
347 #endif
348 
349  fMyModuleType = fParams.get_PSet().get<std::string>("module_type");
350  fMyModuleLabel = fParams.get_PSet().get<std::string>("module_label");
351 
352  mf::LogDebug("AddGenieEventsToArt")
353  << " ctor start " << fMyModuleLabel
354  << " (" << fMyModuleType << ") " << std::endl << std::flush;
355 
356  fFileList = fParams().fileList();
357  fGlobalTimeOffset = fParams().globalTimeOffset();
358  fAddMCFlux = fParams().addMCFlux();
359  fRandomEntries = fParams().randomEntries();
360 
361  ParseCountConfig();
362  ParseVtxOffsetConfig();
363  ParseTimeConfig();
364 
365  produces< std::vector<simb::MCTruth> >();
366  produces< std::vector<simb::GTruth> >();
367  produces< art::Assns<simb::MCTruth, simb::GTruth> >();
368  if ( fAddMCFlux ) {
369  produces< std::vector<simb::MCFlux> >();
370  // Associate every truth with the flux it came from
371  produces< art::Assns<simb::MCTruth, simb::MCFlux> >();
372  }
373 
374  //produces< sumdata::SpillData >();
375  //produces< sumdata::POTSum, art::InSubRun >();
376  //produces< sumdata::RunData, art::InRun >();
377 
378  std::string outFileList = "adding file pattern: ";
379  for (size_t i=0; i < fFileList.size(); ++i) {
380  outFileList += "\n\t";
381  outFileList += fFileList[i];
382  fGTreeChain->Add(fFileList[i].c_str());
383  }
384  mf::LogDebug("AddGenieEventsToArt") << outFileList;
385 
386  fNumMCRec = fGTreeChain->GetEntries();
387  // fLastUsedMCRec is size_t so, unsigned we can't set it to -1
388  // which we'd like to so that the first pre-increment gives us "0"
389  size_t skip = fParams().numberToSkip();
390  fLastUsedMCRec = (skip==0) ? fNumMCRec : skip - 1;
391 
392  // attach flux branches ...
409  TObjArray* blist = fGTreeChain->GetListOfBranches();
410  TIter next(blist);
411  TObject* obj;
412  while ( ( obj = next() ) ) {
413  std::string bname = obj->GetName();
414  // should be a list of TBranchElement or TBranchObject items
415  // TBranchObject are ancient ... should have been replaced by Elements
416  const TBranchElement* belement = dynamic_cast<const TBranchElement*>(obj);
417  const TBranchObject* bobject = dynamic_cast<const TBranchObject*>(obj);
418  if ( ! belement && ! bobject ) {
419  std::string reallyIsA = obj->ClassName();
420  mf::LogError("AddGenieEventsToArt")
421  << "### supposed branch element '" << bname
422  << "' wasn't a TBranchElement/TBranchObject but instead a "
423  << reallyIsA << std::endl;
424  if ( bname == "gmcrec" ) {
425  mf::LogError("AddGenieEventsToArt")
426  << "### since this is '" << bname
427  << "' this is likely to end very badly badly" << std::endl;
428  }
429  continue;
430  }
431  std::string bclass = (belement) ? belement->GetClassName()
432  : bobject->GetClassName();
433  if ( bclass == "genie::NtpMCEventRecord" ) {
434  fGTreeChain->SetBranchAddress(bname.c_str(),&fMCRec);
435  } else if ( bclass == "genie::flux::GNuMIFluxPassThroughInfo" ) {
436  fGNuMIFluxPassThroughInfo = new genie::flux::GNuMIFluxPassThroughInfo;
437  fGTreeChain->SetBranchAddress(bname.c_str(),&fGNuMIFluxPassThroughInfo);
438  } else if ( bclass == "genie::flux::GSimpleNtpEntry" ) {
439  fGSimpleNtpEntry = new genie::flux::GSimpleNtpEntry;
440  fGTreeChain->SetBranchAddress(bname.c_str(),&fGSimpleNtpEntry);
441  } else if ( bclass == "genie::flux::GSimpleNtpNuMI" ) {
442  fGSimpleNtpNuMI = new genie::flux::GSimpleNtpNuMI;
443  fGTreeChain->SetBranchAddress(bname.c_str(),&fGSimpleNtpNuMI);
444  } else if ( bclass == "genie::flux::GSimpleNtpAux" ) {
445  fGSimpleNtpAux = new genie::flux::GSimpleNtpAux;
446  fGTreeChain->SetBranchAddress(bname.c_str(),&fGSimpleNtpAux);
447  } else if ( bclass == "bsim::Dk2Nu" ) {
448  fDk2Nu = new bsim::Dk2Nu;
449  fGTreeChain->SetBranchAddress(bname.c_str(),&fDk2Nu);
450  } else if ( bclass == "bsim::NuChoice" ) {
451  fNuChoice = new bsim::NuChoice;
452  fGTreeChain->SetBranchAddress(bname.c_str(),&fNuChoice);
453  } else {
454  mf::LogError("AddGenieEventsToArt")
455  << "### branch element '" << bname
456  << "' was unhandled '" << bclass << "' class" << std::endl;
457  }
458  } // while ( next )
459 
460  mf::LogInfo("AddGenieEventsToArt")
461  << fMyModuleLabel
462  << " (" << fMyModuleType << ") "
463  << "chain has " << fNumMCRec << " entries"
464  << std::endl;
465  if ( fNumMCRec == 0 ) {
466  throw cet::exception("badInput")
467  << "input files have zero entries "
468  << __FILE__ << ":" << __LINE__;
469  }
470 
471  // setup to write out file, if requested
472  if ( fOutputPrintLevel > 0 ) {
473  if ( fOutputDumpFileName == "" ||
474  fOutputDumpFileName == "--" ||
475  fOutputDumpFileName == "cout" ||
476  fOutputDumpFileName == "std::cout" ) {
477  // standardize so we don't check all these again
478  fOutputDumpFileName = "std::cout";
479  fOutputStream = &(std::cout);
480  } else {
481  size_t posl = fOutputDumpFileName.find("%l");
482  if ( posl != std::string::npos ) {
483  fOutputDumpFileName.replace(posl,2,fMyModuleLabel);
484  }
485  mf::LogDebug("AddGenieEventToArt")
486  << "#### AddGenieEventsToArt::ctor open "
487  << fOutputDumpFileName
488  << std::endl << std::flush;
489  fOutputStream =
490  new std::ofstream(fOutputDumpFileName.c_str(),
491  std::ios_base::trunc|std::ios_base::out);
492  }
493  } // if ( fOutputPrintLevel > 0 )
494 
495 }
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.cc:6
genie::flux::GSimpleNtpEntry * fGSimpleNtpEntry
unsigned int GetRandomNumberSeed()
Definition: evgenbase.h:22
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
CLHEP::HepRandomEngine & fEngine
genie::flux::GSimpleNtpAux * fGSimpleNtpAux
long seed
Definition: chem4.cc:67
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
genie::NtpMCEventRecord * fMCRec
genie::flux::GSimpleNtpNuMI * fGSimpleNtpNuMI
genie::flux::GNuMIFluxPassThroughInfo * fGNuMIFluxPassThroughInfo
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
evg::AddGenieEventsToArt::~AddGenieEventsToArt ( )

Definition at line 497 of file AddGenieEventsToArt_module.cc.

References fGTreeChain, fOutputDumpFileName, and fOutputStream.

498 {
499  // release resources
500  if ( fGTreeChain ) delete fGTreeChain;
501  if ( fOutputStream && ( fOutputDumpFileName != "std::cout" ) ) {
502  std::ofstream* ofs = dynamic_cast<std::ofstream*>(fOutputStream);
503  if ( ofs ) {
504  mf::LogDebug("AddGenieEventToArt")
505  << "#### AddGenieEventsToArt::dtor close "
507  << std::endl << std::flush;
508  ofs->flush();
509  ofs->close();
510  }
511  delete fOutputStream;
512  }
513 }
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
evg::AddGenieEventsToArt::AddGenieEventsToArt ( AddGenieEventsToArt const &  )
delete
evg::AddGenieEventsToArt::AddGenieEventsToArt ( AddGenieEventsToArt &&  )
delete

Member Function Documentation

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 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
size_t evg::AddGenieEventsToArt::GetNumToAdd ( ) const
private

Definition at line 842 of file AddGenieEventsToArt_module.cc.

References fEngine, fParams, fRndDist, fRndP1, fRndP2, kFixed, kFlat, kGaussian, kPoisson, kPoissonMinus1, kRootino, and tmp.

Referenced by produce().

843 {
844 
845  size_t nchosen = 0;
846 
847  switch ( fRndDist ) {
848  case kFixed:
849  {
850  nchosen = fRndP1; // nothing random about it
851  }
852  break;
853  case kFlat:
854  {
855  CLHEP::RandFlat flat(fEngine); // pass by ref, doesn't own
856  // couldn't find good documentation on how this worked ... empirically
857  // fireInt(0) & fireInt(1) give 0 always
858  // fireInt(2) gives 0 or 1
859  // fireInt(3) gives 0, 1, 2
860  // fireInt(4) gives 0, 1, 2, 3
861  // ...
862  // so for p1=5, p2=7 we want 5 + [0:2] i.e 5+0=5, 5+1=6, 5+2=7
863  // and thus range should be 3
864  int range = (int)(fRndP2-fRndP1) + 1;
865  nchosen = fRndP1 + flat.fireInt(range);
866  }
867  break;
868  case kPoisson:
869  case kPoissonMinus1:
870  {
871  CLHEP::RandPoisson poisson(fEngine);
872  nchosen = poisson.fire(fRndP1);
873  if ( fRndDist == kPoissonMinus1 ) {
874  if ( nchosen > 0 ) --nchosen;
875  else {
876  mf::LogError("AddGenieEventsToArt")
877  << "fRndDist[type=" << (int)fRndDist
878  << "] '" << fParams().timeConfig() << "' "
879  << " nchosen " << nchosen
880  << " can't subtract 1 for kPoissonMinus1"
881  << std::endl;
882  }
883  }
884  }
885  break;
886  case kGaussian:
887  {
888  CLHEP::RandGauss gauss(fEngine);
889  double tmp = gauss.fire(fRndP1,fRndP2);
890  if ( tmp > 0 ) nchosen = (size_t)(tmp);
891  else {
892  nchosen = 0;
893  mf::LogError("AddGenieEventsToArt")
894  << "fRndDist[type=" << (int)fRndDist
895  << "] '" << fParams().timeConfig() << "' "
896  << " tmp " << tmp
897  << "; can't return < 0 for kGaussian, return 0"
898  << std::endl;
899  }
900  }
901  break;
902  case kRootino:
903  {
904  nchosen = fRndP1; // pre-chosen maximum
905  }
906  break;
907  default:
908  {
909  nchosen = 0;
910  mf::LogError("AddGenieEventsToArt")
911  << "fRndDist[type=" << (int)fRndDist
912  << "] '" << fParams().timeConfig() << "' not handled"
913  << std::endl;
914  }
915  }
916 
917  /*
918  mf::LogInfo("AddGenieEventsToArt")
919  << "fRndDist[type=" << (int)fRndDist
920  << "] '" << fParams().timeConfig() << "' "
921  << " nchosen " << nchosen << std::endl;
922  */
923 
924  return nchosen;
925 }
Float_t tmp
Definition: plot.C:35
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
CLHEP::HepRandomEngine & fEngine
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
AddGenieEventsToArt& evg::AddGenieEventsToArt::operator= ( AddGenieEventsToArt const &  )
delete
AddGenieEventsToArt& evg::AddGenieEventsToArt::operator= ( AddGenieEventsToArt &&  )
delete
void evg::AddGenieEventsToArt::ParseCountConfig ( )
private

Definition at line 723 of file AddGenieEventsToArt_module.cc.

References fDistName, fEngine, fMyModuleLabel, fParams, fRandomEntries, fRndDist, fRndP1, fRndP2, kFixed, kFlat, kGaussian, kPoisson, kPoissonMinus1, and kRootino.

Referenced by AddGenieEventsToArt().

724 {
725  // Parse countConfig to get parameters on how many to add
726  // Should be one of these:
727  // "fixed:" <N>
728  // "flat: <Nmin> <Nmax>"
729  // "poisson: <Nmean>"
730  // "poisson-1: <Nmean>"
731  // "gauss: <mean> <rms>"
732  // "rootino: <maxentries>" # pick an upper limit
733 
734  std::string str = fParams().countConfig();
735 
736  // let user use whatever case they like
737  std::transform(str.begin(),str.end(),str.begin(),::tolower);
738  // trim any leading whitespace
739  if( str.find_first_not_of(" \t\n") != 0)
740  str.erase( 0, str.find_first_not_of(" \t\n") );
741 
742  size_t i = str.find_first_of(" \t\n");
743  fDistName = str.substr(0,i);
744  str.erase(0,i);
745 
746  // now 'str' should have 1 or 2 numerical values
747  // special case rootino allowed to have no numerical values
748 
749  int nf = sscanf(str.c_str(),"%lf %lf",&fRndP1,&fRndP2);
750 
751  if ( nf == 0 && fDistName.find("rootino") != 0 ) {
752  mf::LogError("AddGenieEventsToArt")
753  << "ParseCountConfig " << str
754  << " had " << nf << " args, expected something '"
755  << str << "'"<< std::endl;
756  throw cet::exception("badDist countConfig")
757  << __FILE__ << ":" << __LINE__
758  << " badDist '" << str << "'";
759  }
760 
761  if ( fDistName.find("fix") == 0 || fDistName == "n" || fDistName == "n:" ) {
762  fRndDist = kFixed;
763  if ( nf != 1 ) {
764  mf::LogError("AddGenieEventsToArt")
765  << "ParseCountConfig " << fDistName
766  << " had 2 args, expected 1: '"
767  << str << "', ignoring 2nd" << std::endl;
768  }
769  } else if ( fDistName.find("flat") == 0 ) {
770  fRndDist = kFlat;
771  if ( nf == 1 ) fRndP2 = fRndP1;
772  // make sure they're ordered
773  if ( fRndP2 < fRndP1 ) std::swap(fRndP1,fRndP2);
774 
775  } else if ( fDistName.find("poiss") == 0 ) {
776  fRndDist = kPoisson;
777  if ( fDistName.find("-1") != std::string::npos ) fRndDist = kPoissonMinus1;
778  if ( nf != 1 ) {
779  mf::LogError("AddGenieEventsToArt")
780  << "ParseCountConfig " << fDistName
781  << " had 2 args, expected 1: '"
782  << str << "', ignoring 2nd" << std::endl;
783  }
784  } else if ( fDistName.find("gaus") == 0 ) {
786  if ( nf != 2 ) {
787  mf::LogError("AddGenieEventsToArt")
788  << "ParseCountConfig " << fDistName
789  << " had " << nf << " args, expected 2: '"
790  << str << "'"<< std::endl;
791  throw cet::exception("badDist countConfig")
792  << __FILE__ << ":" << __LINE__
793  << " badDist '" << fDistName << "'";
794  }
795  } else if ( fDistName.find("rootino") == 0 ) {
796  fRndDist = kRootino;
797  if ( fRndP1 < 1 ) fRndP1 = 9999;
798  if ( fRandomEntries ) {
799  mf::LogError("AddGenieEventsToArt")
800  << "ParseCountConfig " << fDistName
801  << " 'distribution' is incompatible with randomEntries=true"
802  << std::endl;
803  throw cet::exception("badDist incompatible DistConfig")
804  << __FILE__ << ":" << __LINE__
805  << " badDist '" << fDistName << "' w/ randomEntries=true";
806  }
807  } else {
808  mf::LogError("AddGenieEventsToArt")
809  << "ParseCountConfig unknown fDistName " << fDistName
810  << " had' " << nf << " args '"
811  << str << "'"<< std::endl;
812  throw cet::exception("unknownDist countConfig")
813  << __FILE__ << ":" << __LINE__
814  << " unknown '" << fDistName << "'";
815  }
816 
817  mf::LogInfo("AddGenieEventsToArt")
818  << "ParseCountConfig label='" << fMyModuleLabel << "'"
819  << " fDistName='" << fDistName << "' (int)"
820  << (int)fRndDist << "; cfgstr '" << str << "' --> "
821  << " p1 " << fRndP1 << " p2 " << fRndP2 << " nf " << nf
822  << std::endl;
823 
824 #if 0
825  // test how fireInt() works ...
826  static bool first = true;
827  if ( first ) {
828  CLHEP::RandFlat flatTest(fEngine); // pass by ref, doesn't own
829  first = false;
830  for (int rtest = 0; rtest < 5; ++rtest ) {
831  std::cout << " ======= testing CLHEP::RandFlat::fireInt("
832  << rtest << ") =======" << std::endl;
833  for (int i=0; i<100; ++i)
834  std::cout << " " << flatTest.fireInt(rtest);
835  std::cout << std::endl;
836  }
837  }
838 #endif
839 
840 }
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
CLHEP::HepRandomEngine & fEngine
void swap(lar::deep_const_fwd_iterator_nested< CITER, INNERCONTEXTRACT > &a, lar::deep_const_fwd_iterator_nested< CITER, INNERCONTEXTRACT > &b)
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void evg::AddGenieEventsToArt::ParseTimeConfig ( )
private

Definition at line 928 of file AddGenieEventsToArt_module.cc.

References fMyModuleLabel, fParams, fTimeShifter, evgb::EvtTimeShiftFactory::GetEvtTimeShift(), evgb::EvtTimeShiftFactory::Instance(), evgb::EvtTimeShiftFactory::Print(), and evgb::EvtTimeShiftI::PrintConfig().

Referenced by AddGenieEventsToArt().

929 {
930  std::string timeConfig = fParams().timeConfig();
931  // trim any leading whitespace
932  if( timeConfig.find_first_not_of(" \t\n") != 0)
933  timeConfig.erase( 0, timeConfig.find_first_not_of(" \t\n") );
934 
935  size_t i = timeConfig.find_first_of(": \t\n");
936  std::string timeName = timeConfig.substr(0,i);
937  timeConfig.erase(0,i);
938 
939  mf::LogInfo("AddGenieEventsToArt")
940  << "ParseTimeConfig label='" << fMyModuleLabel << "'"
941  << " name='" << timeName << "'"
942  << " cfg='" << timeConfig << "'" << std::endl;
943  if ( timeName == "none" ) timeName = "evgb::EvtTimeNone";
944  if ( timeName == "flat" ) timeName = "evgb::EvtTimeFlat";
945  if ( timeName == "numi" || timeName == "NuMI" ||
946  timeName == "fnal" || timeName == "FNAL" )
947  timeName = "evgb::EvtTimeFNALBeam";
948  if ( timeName == "Booster" || timeName == "booster" )
949  timeName = "evgb::EvtTimeFNALBeam Booster";
950 
951  evgb::EvtTimeShiftFactory& timeFactory =
953  fTimeShifter = timeFactory.GetEvtTimeShift(timeName,timeConfig);
954 
955  if ( fTimeShifter ) {
957  } else {
958  timeFactory.Print();
959  throw cet::exception("BAD TimeShifter")
960  << __FILE__ << ":" << __LINE__
961  << " unknown '" << timeName << "'";
962  }
963 }
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
virtual void PrintConfig(bool verbose=true)=0
provide a means of printing the configuration
static EvtTimeShiftFactory & Instance()
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
evgb::EvtTimeShiftI * GetEvtTimeShift(const std::string &name, const std::string &config="") const
void evg::AddGenieEventsToArt::ParseVtxOffsetConfig ( )
private

Definition at line 966 of file AddGenieEventsToArt_module.cc.

References DEFINE_ART_MODULE, fMyModuleLabel, fParams, fXhi, fXlo, fYhi, fYlo, fZhi, and fZlo.

Referenced by AddGenieEventsToArt().

967 {
968  fXlo = fParams().vtxOffsets().xlo();
969  fYlo = fParams().vtxOffsets().ylo();
970  fZlo = fParams().vtxOffsets().zlo();
971  fXhi = fParams().vtxOffsets().xhi();
972  fYhi = fParams().vtxOffsets().yhi();
973  fZhi = fParams().vtxOffsets().zhi();
974 
975  if ( fXlo != 0 && fYlo != 0 && fZlo != 0 &&
976  fXhi != 0 && fYhi != 0 && fZhi != 0 ) {
977  mf::LogInfo("AddGenieEventsToArt")
978  << "ParseVtxOffsetConfig label='" << fMyModuleLabel << "' \n"
979  << " x [" << std::setw(11) << fXlo << " "
980  << std::setw(11) << fXhi << " ]\n"
981  << " y [" << std::setw(11) << fYlo << " "
982  << std::setw(11) << fYhi << " ]\n"
983  << " z [" << std::setw(11) << fZlo << " "
984  << std::setw(11) << fZhi << " ]";
985  }
986 
987 }
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
void evg::AddGenieEventsToArt::produce ( art::Event e)
overridevirtual

Implements art::EDProducer.

Definition at line 515 of file AddGenieEventsToArt_module.cc.

References evgb::util::CreateAssn(), fAddMCFlux, fDistName, fDk2Nu, fEngine, fGlobalTimeOffset, fGNuMIFluxPassThroughInfo, fGSimpleNtpAux, fGSimpleNtpEntry, fGSimpleNtpNuMI, fGTreeChain, evgb::FillGTruth(), evgb::FillMCFlux(), evgb::FillMCTruth(), fLastUsedMCRec, fMCRec, fNuChoice, fNumMCRec, fOutputPrintLevel, fOutputStream, fParams, fRandomEntries, fRndDist, fTimeShifter, fXhi, fXlo, fYhi, fYlo, fZhi, fZlo, GetNumToAdd(), kRootino, n, art::Event::put(), and evgb::EvtTimeShiftI::TimeOffset().

516 {
517 
518  //std::cerr << "AddGenieEventsToArt::produce start" << std::endl << std::flush;
519 
520  std::unique_ptr< std::vector<simb::MCTruth> >
521  mctruthcol(new std::vector<simb::MCTruth>);
522 
523  std::unique_ptr< std::vector<simb::GTruth> >
524  gtruthcol(new std::vector<simb::GTruth>);
525 
526  std::unique_ptr< std::vector<simb::MCFlux> >
527  mcfluxcol(new std::vector<simb::MCFlux>);
528 
529  std::unique_ptr< art::Assns<simb::MCTruth, simb::MCFlux> >
531  std::unique_ptr< art::Assns<simb::MCTruth, simb::GTruth> >
533 
534  // number of interactions to add to _this_ record/"event"
535  size_t n = GetNumToAdd();
536 
537  // make a list of entries in TChain to use for this overlay
538  // same entry should never be in the list twice ...
539  std::vector<size_t> entries;
540 
541  CLHEP::RandFlat flat(fEngine);
542 
543  mf::LogDebug("AddGeniEventsToArt") << "#### AddGenieEventsToArt::produce "
544  << "attempt to get " << n << " entries "
545  << "from " << fDistName << " distribution";
546  //std::ostringstream msg;
547  //msg << "add indx to list: \n";
548  while ( entries.size() != n ) {
549  if ( ! fRandomEntries ) {
550  // going through file sequentially
551  ++fLastUsedMCRec;
552  // fLsatUseMCRec is size_t so never less than zero
554  entries.push_back(fLastUsedMCRec);
555  //msg << " [" << entries.size()-1 << "] = "
556  // << fLastUsedMCRec << '\n';
557  } else {
558  size_t indx = flat.fireInt(fNumMCRec);
559  // ensure it isn't already there ..
560  if ( std::find(entries.begin(),entries.end(),indx) != entries.end() ) {
561  // mf::LogInfo("AddGeniEventsToArt") << "rejecting "
562  // << indx << " as already there";
563  } else {
564  entries.push_back(indx);
565  //msg << " [" << entries.size()-1 << "] = "
566  // << indx << '\n';
567  }
568  }
569  }
570  //mf::LogInfo("AddGeniEventsToArt") << "entries.size " << entries.size()
571  // << " " << msg.str();
572 
573  for (size_t i=0; i<n; ++i) {
574  simb::MCTruth mctruth;
575  simb::GTruth gtruth;
576  simb::MCFlux mcflux;
577 
578  size_t ientry = entries[i];
579  mf::LogDebug("AddGenieEventsToArt")
580  << "Event: " << i << " - Using entry " << ientry << std::endl;
581  fMCRec->Clear(); // don't leak previously fetched info
582  // fetch a single entry from GENIE input file
583  fGTreeChain->GetEntry(ientry);
584  genie::EventRecord* grec = fMCRec->event;
585 
586  if (fRndDist == kRootino) {
587  // check for end-condition
588  // exactly 1 particle which is a rootino (pdg=0)
589  if ( grec->GetEntries() == 1 ) {
590  genie::GHepParticle* p = grec->Particle(0);
591  if ( p && p->Pdg() == 0 ) {
592  // update where we left off
593  fLastUsedMCRec = ientry;
594  // we're done with the loop, don't go on
595  // and don't add this marker to the art event record
596  break;
597  }
598  }
599  }
600 
601  /*
602  mf::LogInfo("AddGenieEventsToArt")
603  << "#### AddGenieEventsToArt::produce " << i+1 << " of " << n
604  << " using entry " << ientry
605  << std::endl;
606  */
607 
608  if ( fOutputStream ) {
609  // alas not currently able to get current setting
610 #if __GENIE_RELEASE_CODE__ >= GRELCODE(3,0,2)
611  int plevel = genie::GHepRecord::GetPrintLevel(); //
612 #endif
613  genie::GHepRecord::SetPrintLevel(fOutputPrintLevel); //
614  //std::cerr << "#### AddGenieEventsToArt::produce() writing to "
615  // << fOutputDumpFileName
616  // << std::endl << std::flush;
617  *fOutputStream << *fMCRec;
618  fOutputStream->flush();
619 #if __GENIE_RELEASE_CODE__ >= GRELCODE(3,0,2)
620  genie::GHepRecord::SetPrintLevel(plevel);
621 #endif
622  }
623 
624  // generate offset in time
625  double evtTimeOffset = fGlobalTimeOffset + fTimeShifter->TimeOffset();
626 
627  // offset vertex position
628  double xoff = flat.fire(fXlo,fXhi);
629  double yoff = flat.fire(fYlo,fYhi);
630  double zoff = flat.fire(fZlo,fZhi);
631 
632  TLorentzVector vtxOffset(xoff,yoff,zoff,evtTimeOffset);
633 
634  // convert to simb:: ART objects using GENIE2ART functions
635  evgb::FillMCTruth(grec,vtxOffset,mctruth,
636  fParams().inputGenieVersion(),
637  fParams().inputGenieTune(),
638  fParams().addGenieVtxTime());
639  evgb::FillGTruth(grec,gtruth);
640 
641  if ( fAddMCFlux ) {
643  double dk2gen = -99999.;
645  } else if ( fGSimpleNtpEntry ) {
646  // cheat at meta data for now ...
647  // should be pulling this from input file ... no sure that
648  // it is being copied correctly
649  // (TChain isn't made of GSimpleNtpMeta objs ... )
650  // we need to know how to interpret the Aux variablees
651  static genie::flux::GSimpleNtpMeta* meta = 0;
652  if ( ! meta ) {
653  meta = new genie::flux::GSimpleNtpMeta;
654  // hopefully this is the layout
655  // aux ints: tgen
656  // aux doubles: fgXYWgt nimpwt muparpx muparpy muparpz mupare necm
657  meta->auxintname.push_back("tgen");
658  meta->auxdblname.push_back("fgXYWgt");
659  meta->auxdblname.push_back("nimpwt");
660  meta->auxdblname.push_back("muparpx");
661  meta->auxdblname.push_back("muparpy");
662  meta->auxdblname.push_back("muparpz");
663  meta->auxdblname.push_back("mupare");
664  meta->auxdblname.push_back("necm");
665  }
667  fGSimpleNtpAux,meta,mcflux);
668  } else if ( fDk2Nu ) {
670  }
671  }
672 
673  /*
674  genie::NtpMCRecHeader rec_header = fMCRec->hdr;
675  //LOG("gevdump", pNOTICE)
676  std::cout
677  << " ** Event: " << rec_header.ievent // implicit newline in print
678  << *grec;
679  // add to our collections
680  */
681 
682  mctruthcol->push_back(mctruth);
683  gtruthcol->push_back(gtruth);
684  if (fAddMCFlux) {
685  // deterimine if there is something to fetch
686  mcfluxcol->push_back(mcflux);
687  }
688 
689  // LArSoft #include "lardata/Utilities/AssociationUtil.h"
690  // NOVA #include "Utilities/AssociationUtil.h"
691  // these util::CreateAssn are taken from LArSoft's GENIEGen_module
692  // ~/Work/DUNE/code/larsim/larsim/EventGenerator/GENIE/GENIEGen_module.cc
693  // this seems to be MARK CreateAssn_07 ?? but that's one-to-many
694  // implicit in this is a indx=UNIT_MAX arg so this is only acting
695  // on the last element of truthcol
696 
697  evgb::util::CreateAssn(*this, evt, *mctruthcol, *gtruthcol, *tgassn,
698  gtruthcol->size()-1, gtruthcol->size());
699 
700  if (fAddMCFlux) {
701  evgb::util::CreateAssn(*this, evt, *mctruthcol, *mcfluxcol, *tfassn,
702  mcfluxcol->size()-1, mcfluxcol->size());
703  }
704  //
705 
706  } // done collecting input
707 
708  //std::cerr << "AddGenieEventsToArt::produce put into event"
709  // << std::endl << std::flush;
710 
711  // put the collections in the event
712  evt.put(std::move(mctruthcol));
713  evt.put(std::move(gtruthcol));
714  evt.put(std::move(tgassn));
715  if ( fAddMCFlux ) {
716  evt.put(std::move(mcfluxcol));
717  evt.put(std::move(tfassn));
718  }
719 
720 }
void FillMCTruth(const genie::EventRecord *grec, double spillTime, simb::MCTruth &mctruth, const std::string &genieVersion="unknown", const std::string &genieTune="unknown", bool addGenieVtxTime=false, const std::unordered_map< std::string, std::string > genConfig={})
Definition: GENIE2ART.cxx:182
void FillMCFlux(genie::GFluxI *fdriver, simb::MCFlux &mcflux)
Definition: GENIE2ART.cxx:834
genie::flux::GSimpleNtpEntry * fGSimpleNtpEntry
CLHEP::HepRandomEngine & fEngine
genie::flux::GSimpleNtpAux * fGSimpleNtpAux
bool CreateAssn(PRODUCER const &prod, art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t indx=UINT_MAX)
Creates a single one-to-one association.
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
genie::NtpMCEventRecord * fMCRec
genie::flux::GSimpleNtpNuMI * fGSimpleNtpNuMI
Char_t n[5]
virtual double TimeOffset()=0
void FillGTruth(const genie::EventRecord *grec, simb::GTruth &gtruth)
Definition: GENIE2ART.cxx:391
TCEvent evt
Definition: DataStructs.cxx:8
Event generator information.
Definition: MCTruth.h:32
genie::flux::GNuMIFluxPassThroughInfo * fGNuMIFluxPassThroughInfo
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

bool evg::AddGenieEventsToArt::fAddMCFlux
private

Definition at line 260 of file AddGenieEventsToArt_module.cc.

Referenced by AddGenieEventsToArt(), and produce().

std::string evg::AddGenieEventsToArt::fDistName
private

Definition at line 272 of file AddGenieEventsToArt_module.cc.

Referenced by ParseCountConfig(), and produce().

bsim::Dk2Nu* evg::AddGenieEventsToArt::fDk2Nu
private

Definition at line 290 of file AddGenieEventsToArt_module.cc.

Referenced by AddGenieEventsToArt(), and produce().

CLHEP::HepRandomEngine& evg::AddGenieEventsToArt::fEngine
private
std::vector<std::string> evg::AddGenieEventsToArt::fFileList
private

Definition at line 251 of file AddGenieEventsToArt_module.cc.

Referenced by AddGenieEventsToArt().

double evg::AddGenieEventsToArt::fGlobalTimeOffset
private

Definition at line 252 of file AddGenieEventsToArt_module.cc.

Referenced by AddGenieEventsToArt(), and produce().

genie::flux::GNuMIFluxPassThroughInfo* evg::AddGenieEventsToArt::fGNuMIFluxPassThroughInfo
private

Definition at line 284 of file AddGenieEventsToArt_module.cc.

Referenced by AddGenieEventsToArt(), and produce().

genie::flux::GSimpleNtpAux* evg::AddGenieEventsToArt::fGSimpleNtpAux
private

Definition at line 288 of file AddGenieEventsToArt_module.cc.

Referenced by AddGenieEventsToArt(), and produce().

genie::flux::GSimpleNtpEntry* evg::AddGenieEventsToArt::fGSimpleNtpEntry
private

Definition at line 286 of file AddGenieEventsToArt_module.cc.

Referenced by AddGenieEventsToArt(), and produce().

genie::flux::GSimpleNtpNuMI* evg::AddGenieEventsToArt::fGSimpleNtpNuMI
private

Definition at line 287 of file AddGenieEventsToArt_module.cc.

Referenced by AddGenieEventsToArt(), and produce().

TChain* evg::AddGenieEventsToArt::fGTreeChain
private
size_t evg::AddGenieEventsToArt::fLastUsedMCRec
private

Definition at line 280 of file AddGenieEventsToArt_module.cc.

Referenced by AddGenieEventsToArt(), and produce().

genie::NtpMCEventRecord* evg::AddGenieEventsToArt::fMCRec
private

Definition at line 278 of file AddGenieEventsToArt_module.cc.

Referenced by AddGenieEventsToArt(), and produce().

std::string evg::AddGenieEventsToArt::fMyModuleLabel
private
std::string evg::AddGenieEventsToArt::fMyModuleType
private

Definition at line 263 of file AddGenieEventsToArt_module.cc.

Referenced by AddGenieEventsToArt().

bsim::NuChoice* evg::AddGenieEventsToArt::fNuChoice
private

Definition at line 291 of file AddGenieEventsToArt_module.cc.

Referenced by AddGenieEventsToArt(), and produce().

size_t evg::AddGenieEventsToArt::fNumMCRec
private

Definition at line 279 of file AddGenieEventsToArt_module.cc.

Referenced by AddGenieEventsToArt(), and produce().

std::string evg::AddGenieEventsToArt::fOutputDumpFileName
private

Definition at line 266 of file AddGenieEventsToArt_module.cc.

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

int evg::AddGenieEventsToArt::fOutputPrintLevel
private

Definition at line 265 of file AddGenieEventsToArt_module.cc.

Referenced by AddGenieEventsToArt(), and produce().

std::ostream* evg::AddGenieEventsToArt::fOutputStream
private
Parameters evg::AddGenieEventsToArt::fParams
private
bool evg::AddGenieEventsToArt::fRandomEntries
private

Definition at line 261 of file AddGenieEventsToArt_module.cc.

Referenced by AddGenieEventsToArt(), ParseCountConfig(), and produce().

RndDist_t evg::AddGenieEventsToArt::fRndDist
private

Definition at line 273 of file AddGenieEventsToArt_module.cc.

Referenced by GetNumToAdd(), ParseCountConfig(), and produce().

double evg::AddGenieEventsToArt::fRndP1
private

Definition at line 274 of file AddGenieEventsToArt_module.cc.

Referenced by GetNumToAdd(), and ParseCountConfig().

double evg::AddGenieEventsToArt::fRndP2
private

Definition at line 275 of file AddGenieEventsToArt_module.cc.

Referenced by GetNumToAdd(), and ParseCountConfig().

unsigned int const evg::AddGenieEventsToArt::fSeed
private

Definition at line 292 of file AddGenieEventsToArt_module.cc.

Referenced by AddGenieEventsToArt().

evgb::EvtTimeShiftI* evg::AddGenieEventsToArt::fTimeShifter
private

Definition at line 253 of file AddGenieEventsToArt_module.cc.

Referenced by ParseTimeConfig(), and produce().

double evg::AddGenieEventsToArt::fXhi
private

Definition at line 257 of file AddGenieEventsToArt_module.cc.

Referenced by ParseVtxOffsetConfig(), and produce().

double evg::AddGenieEventsToArt::fXlo
private

Definition at line 254 of file AddGenieEventsToArt_module.cc.

Referenced by ParseVtxOffsetConfig(), and produce().

double evg::AddGenieEventsToArt::fYhi
private

Definition at line 258 of file AddGenieEventsToArt_module.cc.

Referenced by ParseVtxOffsetConfig(), and produce().

double evg::AddGenieEventsToArt::fYlo
private

Definition at line 255 of file AddGenieEventsToArt_module.cc.

Referenced by ParseVtxOffsetConfig(), and produce().

double evg::AddGenieEventsToArt::fZhi
private

Definition at line 259 of file AddGenieEventsToArt_module.cc.

Referenced by ParseVtxOffsetConfig(), and produce().

double evg::AddGenieEventsToArt::fZlo
private

Definition at line 256 of file AddGenieEventsToArt_module.cc.

Referenced by ParseVtxOffsetConfig(), and produce().


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