LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
evgen::TestGENIEHelper Class Reference

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

Inheritance diagram for evgen::TestGENIEHelper:
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

 TestGENIEHelper (fhicl::ParameterSet const &pset)
 
virtual ~TestGENIEHelper ()
 
void produce (art::Event &evt)
 
void beginJob ()
 
void beginRun (art::Run &run)
 
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 Attributes

evgb::GENIEHelperfGENIEHelp
 GENIEHelper object. More...
 
TStopwatch fStopwatch
 
int fEventsPerSpill
 negative for Poisson() More...
 
unsigned int fDebugFlags
 

Detailed Description

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

Definition at line 63 of file TestGENIEHelper_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::TestGENIEHelper::TestGENIEHelper ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 88 of file TestGENIEHelper_module.cc.

References fDebugFlags, fEventsPerSpill, fGENIEHelp, and fStopwatch.

89  : EDProducer{pset}
90  , fGENIEHelp (0)
91  //, fPassEmptySpills (pset.get< bool >("PassEmptySpills"))
92  //, fSpillCounter (0)
93  //, fPOTPerSpill (pset.get< double >("POTPerSpill", 5.0e13))
94  , fEventsPerSpill (pset.get< double >("EventsPerSpill", 1))
95  //, fTotalExposure (0)
96  //, fTotalPOTLimit (pset.get< double >("TotalPOTLimit"))
97  , fDebugFlags (pset.get< unsigned int >("DebugFlags", 0))
98  {
99  fStopwatch.Start();
100 
101  produces< std::vector<simb::MCTruth> >();
102  produces< std::vector<simb::MCFlux> >();
103  produces< std::vector<simb::GTruth> >();
104  //produces< sumdata::SpillData >();
105  //produces< sumdata::POTSum, art::InSubRun >();
106  //produces< sumdata::RunData, art::InRun >();
107  // Associate every truth with the flux it came from
108  produces< art::Assns<simb::MCTruth, simb::MCFlux> >();
109  produces< art::Assns<simb::MCTruth, simb::GTruth> >();
110 
111  //--- Dk2Nu additions
112  //--- BEGIN
113  produces< std::vector<bsim::Dk2Nu> >();
114  produces< std::vector<bsim::NuChoice> >();
115 #ifdef PUT_DK2NU_ASSN
116  produces< art::Assns<simb::MCTruth, bsim::Dk2Nu> >();
117  produces< art::Assns<simb::MCTruth, bsim::NuChoice> >();
118 #endif
119  //--- END
120 
121  //art::ServiceHandle<geo::Geometry> geo;
122  std::string geomFileName =
123  pset.get<std::string>("GeomFileName");
124  mf::LogInfo("TestGENIEHelper") << "using GeomFileName '"
125  << geomFileName << "'";
126  TGeoManager::Import(geomFileName.c_str());
127  double detectorMass = 1; // no generally used (except for histogram)
128 
129  fGENIEHelp = new evgb::GENIEHelper(pset,
130  gGeoManager,
131  geomFileName,
132  detectorMass);
133  /*
134  geo->ROOTGeoManager(),
135  geo->ROOTFile(),
136  geo->TotalMass(pset.get< std::string>("TopVolume").c_str()));
137  */
138  }
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.cc:6
int fEventsPerSpill
negative for Poisson()
evgb::GENIEHelper * fGENIEHelp
GENIEHelper object.
evgen::TestGENIEHelper::~TestGENIEHelper ( )
virtual

Definition at line 141 of file TestGENIEHelper_module.cc.

References fGENIEHelp, and fStopwatch.

142  {
143  fStopwatch.Stop();
144  mf::LogInfo("TestGENIEHelper") << "real time to produce file: "
145  << fStopwatch.RealTime();
146  delete fGENIEHelp; // clean up, and let dtor do its thing
147  }
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
evgb::GENIEHelper * fGENIEHelp
GENIEHelper object.

Member Function Documentation

void evgen::TestGENIEHelper::beginJob ( )
virtual

Reimplemented from art::EDProducer.

Definition at line 150 of file TestGENIEHelper_module.cc.

151  {
152  }
void evgen::TestGENIEHelper::beginRun ( art::Run run)
virtual

Reimplemented from art::EDProducer.

Definition at line 155 of file TestGENIEHelper_module.cc.

References fGENIEHelp, and evgb::GENIEHelper::Initialize().

156  {
157  // grab the geometry object to see what geometry we are using
158  // art::ServiceHandle<geo::Geometry> geo;
159 
160  /*
161  std::unique_ptr<sumdata::RunData>
162  runcol(new sumdata::RunData(geo->DetId(),
163  geo->FileBaseName(),
164  geo->ExtractGDML()));
165 
166  run.put(std::move(runcol));
167  */
168 
169  std::cerr << " *** TestGENIEHelper::beginRun() begin "
170  << std::endl << std::flush;
171 
172 
173  // initialize the GENIEHelper here rather than in beginJob to
174  // avoid problems with the Geometry reloading at a run boundary.
175  // If we ever make more than one run in a single job we will have
176  // to re-evaluate
178  //fTotalExposure = 0.0;
179 
180  std::cerr << " *** TestGENIEHelper::beginRun() done "
181  << std::endl << std::flush;
182 
183  return;
184  }
evgb::GENIEHelper * fGENIEHelp
GENIEHelper object.
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::TestGENIEHelper::endSubRun ( art::SubRun sr)
virtual

Reimplemented from art::EDProducer.

Definition at line 187 of file TestGENIEHelper_module.cc.

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

188  {
189  /*
190  std::unique_ptr< sumdata::POTSum > p(new sumdata::POTSum);
191 
192  // p->totpot = fGENIEHelp->TotalExposure();
193  // p->totgoodpot = fGENIEHelp->TotalExposure();
194  p->totpot = fTotalExposure;
195  p->totgoodpot = fTotalExposure;
196  p->totspills = fSpillCounter;
197  p->goodspills = fSpillCounter;
198  p->Print(std::cout);
199 
200  sr.put(std::move(p));
201  */
202 
203  mf::LogInfo("TestGENIEHelper") << "Total Exposure was "
205 
206  }
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
double TotalExposure() const
Definition: GENIEHelper.h:71
evgb::GENIEHelper * fGENIEHelp
GENIEHelper object.
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
void evgen::TestGENIEHelper::produce ( art::Event evt)
virtual

Implements art::EDProducer.

Definition at line 209 of file TestGENIEHelper_module.cc.

References evgb::util::CreateAssn(), DEFINE_ART_MODULE, art::Event::event(), fDebugFlags, fGENIEHelp, fStopwatch, evgb::GENIEHelper::GetFluxDriver(), evgb::GENIEHelper::GetGenieEventRecord(), art::Event::put(), evgb::GENIEHelper::Sample(), and evgb::GENIEHelper::Stop().

210  {
211  // A temporary value is needed to store the spill exposure that GENIEHelper uses. TestGENIEHelper
212  // needs to remember the number after GENIEHelper has reset it to zero for the purposes of
213  // updating fTotalExposure.
214  //double SpillExpTemp = 0.0;
215 
216  std::unique_ptr< std::vector<simb::MCTruth> > truthcol(new std::vector<simb::MCTruth>);
217  std::unique_ptr< std::vector<simb::MCFlux> > fluxcol (new std::vector<simb::MCFlux >);
218  std::unique_ptr< std::vector<simb::GTruth> > gtruthcol (new std::vector<simb::GTruth >);
219  std::unique_ptr< art::Assns<simb::MCTruth, simb::GTruth> > tgtassn(new art::Assns<simb::MCTruth, simb::GTruth>);
220  std::unique_ptr< art::Assns<simb::MCTruth, simb::MCFlux> > assns(new art::Assns<simb::MCTruth, simb::MCFlux>);
221 
222  std::cerr << " ******************************* TestGENIEHelper::produce() " << std::endl << std::flush;
223  std::cout << " stopwatch at produce() ";
224  fStopwatch.Print("um"); fStopwatch.Continue();
225  std::cout << std::flush;
226 
227  //--- Dk2Nu additions
228  //--- BEGIN
229  std::unique_ptr< std::vector<bsim::Dk2Nu> >
230  dk2nucol(new std::vector<bsim::Dk2Nu>);
231  std::unique_ptr< std::vector<bsim::NuChoice> >
232  nuchoicecol(new std::vector<bsim::NuChoice>);
233 
234  std::unique_ptr< art::Assns<simb::MCTruth, bsim::Dk2Nu> >
236  std::unique_ptr< art::Assns<simb::MCTruth, bsim::NuChoice> >
238  //--- END
239 
240  while ( ! fGENIEHelp->Stop() ) {
241 
242  simb::MCTruth truth;
243  simb::MCFlux flux;
244  simb::GTruth gTruth;
245 
246  std::cerr << " *** TestGENIEHelper::produce() about to sample "
247  << truthcol->size()
248  << std::endl << std::flush;
249  std::cout << " stopwatch before Sample() ";
250  fStopwatch.Print("um"); fStopwatch.Continue();
251  std::cout << std::flush;
252 
253 
254  // GENIEHelper returns a false in the sample method if
255  // either no neutrino was generated, or the interaction
256  // occurred beyond the detector's z extent - ie something we
257  // would never see anyway.
258  if ( fGENIEHelp->Sample(truth, flux, gTruth ) ) {
259 
260  std::cout << " stopwatch after Sample() ";
261  fStopwatch.Print("um"); fStopwatch.Continue();
262  std::cout << std::flush;
263 
264  truthcol ->push_back(truth);
265  gtruthcol->push_back(gTruth);
266  fluxcol ->push_back(flux);
267 
268  evgb::util::CreateAssn(*this, evt, *truthcol, *fluxcol, *assns,
269  fluxcol->size()-1, fluxcol->size());
270 
271  evgb::util::CreateAssn(*this, evt, *truthcol, *gtruthcol, *tgtassn,
272  gtruthcol->size()-1, gtruthcol->size());
273 
274  //--- Dk2Nu additions
275  //--- BEGIN
276  genie::GFluxI* fdriver = fGENIEHelp->GetFluxDriver(true);
277  genie::flux::GDk2NuFlux* dk2nuDriver =
278  dynamic_cast<genie::flux::GDk2NuFlux*>(fdriver);
279  if ( dk2nuDriver ) {
280  const bsim::Dk2Nu& dk2nuObj = dk2nuDriver->GetDk2Nu();
281  dk2nucol ->push_back(dk2nuObj);
282  const bsim::NuChoice& nuchoiceObj = dk2nuDriver->GetNuChoice();
283  nuchoicecol->push_back(nuchoiceObj);
284 
285  if ( (fDebugFlags & 0x10 ) != 0 ) {
286  std::cout << "---------==== creation dump" << std::endl;
287  genie::EventRecord* gevtrec = fGENIEHelp->GetGenieEventRecord();
288  if ( gevtrec ) std::cout << *gevtrec << std::endl;
289  std::cout << dk2nuObj << std::endl;
290  const bsim::Decay& decay = dk2nuObj.decay;
291  std::cout << " necm " << decay.necm
292  << " muparp4 " << decay.muparpx << " "
293  << decay.muparpy << " " << decay.muparpz << " "
294  << decay.mupare << std::endl;
295  std::cout << nuchoiceObj << std::endl;
296  }
297 
298 #ifdef PUT_DK2NU_ASSN
299  evgb::util::CreateAssn(*this, evt, *truthcol, *dk2nucol, *dk2nuassn,
300  dk2nucol->size()-1, dk2nucol->size());
301  evgb::util::CreateAssn(*this, evt, *truthcol, *nuchoicecol, *nuchoiceassn,
302  nuchoicecol->size()-1, nuchoicecol->size());
303 #endif
304  }
305  //--- END
306 
307  std::cerr << " *** TestGENIEHelper::produce() sample success size "
308  << truthcol->size()
309  << std::endl << std::flush;
310  //RWH//if ( dk2nuDriver ) { std::cout << dk2nuDriver->GetDk2Nu() << std::endl; }
311  std::cout << " stopwatch after push_back + CreateAssn ";
312  fStopwatch.Print("um"); fStopwatch.Continue();
313  std::cout << std::flush;
314 
315 
316  } // end if genie was able to make an event
317 
318  } // end event generation loop
319 
320  // put the collections in the event
321  evt.put(std::move(truthcol));
322  evt.put(std::move(fluxcol));
323  evt.put(std::move(gtruthcol));
324  evt.put(std::move(assns));
325  evt.put(std::move(tgtassn));
326 
327  std::cerr << " *** TestGENIEHelper::produce() done "
328  << " event " << evt.event()
329  << std::endl << std::flush;
330 
331  //--- Dk2Nu additions
332  //--- BEGIN
333  // in the constructor we said these were produced ...
334  // ... so we have to put them in the record, even if just empty
335  evt.put(std::move(dk2nucol));
336  evt.put(std::move(nuchoicecol));
337 
338 #ifdef PUT_DK2NU_ASSN
339  std::cerr << " *** TestGENIEHelper::produce()"
340  << " put dk2nuAssn + nuchoiceAssn ** "
341  << " event " << evt.event()
342  << std::endl << std::flush;
343 
344  evt.put(std::move(dk2nuassn));
345  evt.put(std::move(nuchoiceassn));
346 
347  std::cerr << " *** TestGENIEHelper::produce() finished put "
348  << " event " << evt.event()
349  << std::endl << std::flush;
350 
351 #endif
352  //--- END
353 
354  } // end of produce method
genie::GFluxI * GetFluxDriver(bool base=true)
Definition: GENIEHelper.h:91
genie::EventRecord * GetGenieEventRecord()
Definition: GENIEHelper.h:84
bool Sample(simb::MCTruth &truth, simb::MCFlux &flux, simb::GTruth &gtruth)
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: Event.h:77
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.
EventNumber_t event() const
Definition: Event.cc:41
evgb::GENIEHelper * fGENIEHelp
GENIEHelper object.
Event generator information.
Definition: MCTruth.h:32
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

unsigned int evgen::TestGENIEHelper::fDebugFlags
private

Definition at line 80 of file TestGENIEHelper_module.cc.

Referenced by produce(), and TestGENIEHelper().

int evgen::TestGENIEHelper::fEventsPerSpill
private

negative for Poisson()

Definition at line 79 of file TestGENIEHelper_module.cc.

Referenced by TestGENIEHelper().

evgb::GENIEHelper* evgen::TestGENIEHelper::fGENIEHelp
private

GENIEHelper object.

Definition at line 77 of file TestGENIEHelper_module.cc.

Referenced by beginRun(), endSubRun(), produce(), TestGENIEHelper(), and ~TestGENIEHelper().

TStopwatch evgen::TestGENIEHelper::fStopwatch
private

Definition at line 78 of file TestGENIEHelper_module.cc.

Referenced by produce(), TestGENIEHelper(), and ~TestGENIEHelper().


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