LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
GENIEGen_module.cc
Go to the documentation of this file.
1 //
3 //
4 // GENIE neutrino event generator
5 //
6 // brebel@fnal.gov
7 //
9 #ifndef EVGEN_GENIEGEN_H
10 #define EVGEN_GENIEGEN_H
11 
12 #include <cstdlib>
13 #include <string>
14 #include <iostream>
15 #include <iomanip>
16 #include <sstream>
17 #include <vector>
18 #include <map>
19 #include <memory>
20 #include <unistd.h>
21 
22 // ROOT includes
23 #include "TH1.h"
24 #include "TH2.h"
25 #include "TDatabasePDG.h"
26 #include "TSystem.h"
27 #include "TStopwatch.h"
28 
29 // Framework includes
33 #include "fhiclcpp/ParameterSet.h"
41 
42 // art extensions
44 
45 // LArSoft includes
46 #include "larsim/MCDumpers/MCDumpers.h" // sim::dump namespace
56 
58 namespace evgen {
90  class GENIEGen : public art::EDProducer {
91  public:
92  explicit GENIEGen(fhicl::ParameterSet const &pset);
93  virtual ~GENIEGen();
94 
95  void produce(art::Event& evt);
96  void beginJob();
97  void beginRun(art::Run& run);
98  void endSubRun(art::SubRun& sr);
99 
100  private:
101 
102  std::string ParticleStatus(int StatusCode);
103  std::string ReactionChannel(int ccnc,int mode);
104 
105  void FillHistograms(simb::MCTruth mc);
106 
109  std::vector< double > fVtxPosHistRange;
110 
112  TStopwatch fStopwatch;
113 
117 
118  TH1F* fGenerated[6];
119 
120  TH1F* fVertexX;
121  TH1F* fVertexY;
122  TH1F* fVertexZ;
123 
124  TH2F* fVertexXY;
125  TH2F* fVertexXZ;
126  TH2F* fVertexYZ;
127 
128  TH1F* fDCosX;
129  TH1F* fDCosY;
130  TH1F* fDCosZ;
131 
132  TH1F* fMuMomentum;
133  TH1F* fMuDCosX;
134  TH1F* fMuDCosY;
135  TH1F* fMuDCosZ;
136 
137  TH1F* fEMomentum;
138  TH1F* fEDCosX;
139  TH1F* fEDCosY;
140  TH1F* fEDCosZ;
141 
142  TH1F* fCCMode;
143  TH1F* fNCMode;
144 
145  TH1F* fDeltaE;
146  TH1F* fECons;
147 
148  };
149 }
150 
151 namespace evgen{
152 
153  //____________________________________________________________________________
155  : fGENIEHelp(0)
156  , fDefinedVtxHistRange (pset.get< bool >("DefinedVtxHistRange"))
157  , fVtxPosHistRange (pset.get< std::vector<double> >("VtxPosHistRange"))
158  , fPassEmptySpills (pset.get< bool >("PassEmptySpills"))
159  , fGlobalTimeOffset(pset.get< double >("GlobalTimeOffset",0))
160  , fRandomTimeOffset(pset.get< double >("RandomTimeOffset",1600.)) // BNB default value
161  , fBeamType(::sim::kBNB)
162  {
163  fStopwatch.Start();
164 
165  produces< std::vector<simb::MCTruth> >();
166  produces< std::vector<simb::MCFlux> >();
167  produces< std::vector<simb::GTruth> >();
168  produces< sumdata::RunData, art::InRun >();
169  produces< sumdata::POTSummary, art::InSubRun >();
170  produces< art::Assns<simb::MCTruth, simb::MCFlux> >();
171  produces< art::Assns<simb::MCTruth, simb::GTruth> >();
172  produces< std::vector<sim::BeamGateInfo> >();
173 
174  std::string beam_type_name = pset.get<std::string>("BeamName");
175 
176  if(beam_type_name == "numi")
177 
179 
180  else if(beam_type_name == "booster")
181 
183 
184  else
185 
187 
189 
190  signed int temp_seed; // the seed read by GENIEHelper is a signed integer...
191  fhicl::ParameterSet GENIEconfig(pset);
192  if (!GENIEconfig.get_if_present("RandomSeed", temp_seed)) { // TODO use has_key() when it becomes available
193  // no RandomSeed specified; check for the LArSoft-style "Seed" instead:
194  // obtain the random seed from a service,
195  // unless overridden in configuration with key "Seed"
196  unsigned int seed;
197  if (!GENIEconfig.get_if_present("Seed", seed))
198  seed = art::ServiceHandle<rndm::NuRandomService>()->getSeed();
199 
200  // The seed is not passed to RandomNumberGenerator,
201  // since GENIE uses a TRandom generator that is owned by the GENIEHelper.
202  // Instead, we explicitly configure the random seed for GENIEHelper:
203  GENIEconfig.put("RandomSeed", seed);
204  } // if no RandomSeed present
205 
206  fGENIEHelp = new evgb::GENIEHelper(GENIEconfig,
207  geo->ROOTGeoManager(),
208  geo->ROOTFile(),
209  geo->TotalMass(pset.get< std::string>("TopVolume").c_str()));
210 
211  }
212 
213  //____________________________________________________________________________
215  {
216  if(fGENIEHelp) delete fGENIEHelp;
217  fStopwatch.Stop();
218  mf::LogInfo("GENIEProductionTime") << "real time to produce file: " << fStopwatch.RealTime();
219  }
220 
221  //____________________________________________________________________________
224 
225  // Get access to the TFile service.
227 
228  fGenerated[0] = tfs->make<TH1F>("fGenerated_necc","", 100, 0.0, 20.0);
229  fGenerated[1] = tfs->make<TH1F>("fGenerated_nebcc","", 100, 0.0, 20.0);
230  fGenerated[2] = tfs->make<TH1F>("fGenerated_nmcc","", 100, 0.0, 20.0);
231  fGenerated[3] = tfs->make<TH1F>("fGenerated_nmbcc","", 100, 0.0, 20.0);
232  fGenerated[4] = tfs->make<TH1F>("fGenerated_nnc","", 100, 0.0, 20.0);
233  fGenerated[5] = tfs->make<TH1F>("fGenerated_nbnc","", 100, 0.0, 20.0);
234 
235  fDCosX = tfs->make<TH1F>("fDCosX", ";dx/ds", 200, -1., 1.);
236  fDCosY = tfs->make<TH1F>("fDCosY", ";dy/ds", 200, -1., 1.);
237  fDCosZ = tfs->make<TH1F>("fDCosZ", ";dz/ds", 200, -1., 1.);
238 
239  fMuMomentum = tfs->make<TH1F>("fMuMomentum", ";p_{#mu} (GeV/c)", 500, 0., 50.);
240  fMuDCosX = tfs->make<TH1F>("fMuDCosX", ";dx/ds;", 200, -1., 1.);
241  fMuDCosY = tfs->make<TH1F>("fMuDCosY", ";dy/ds;", 200, -1., 1.);
242  fMuDCosZ = tfs->make<TH1F>("fMuDCosZ", ";dz/ds;", 200, -1., 1.);
243 
244  fEMomentum = tfs->make<TH1F>("fEMomentum", ";p_{e} (GeV/c)", 500, 0., 50.);
245  fEDCosX = tfs->make<TH1F>("fEDCosX", ";dx/ds;", 200, -1., 1.);
246  fEDCosY = tfs->make<TH1F>("fEDCosY", ";dy/ds;", 200, -1., 1.);
247  fEDCosZ = tfs->make<TH1F>("fEDCosZ", ";dz/ds;", 200, -1., 1.);
248 
249  fCCMode = tfs->make<TH1F>("fCCMode", ";CC Interaction Mode;", 4, 0., 4.);
250  fCCMode->GetXaxis()->SetBinLabel(1, "QE");
251  fCCMode->GetXaxis()->SetBinLabel(2, "Res");
252  fCCMode->GetXaxis()->SetBinLabel(3, "DIS");
253  fCCMode->GetXaxis()->SetBinLabel(4, "Coh");
254  fCCMode->GetXaxis()->CenterLabels();
255 
256  fNCMode = tfs->make<TH1F>("fNCMode", ";NC Interaction Mode;", 4, 0., 4.);
257  fNCMode->GetXaxis()->SetBinLabel(1, "QE");
258  fNCMode->GetXaxis()->SetBinLabel(2, "Res");
259  fNCMode->GetXaxis()->SetBinLabel(3, "DIS");
260  fNCMode->GetXaxis()->SetBinLabel(4, "Coh");
261  fNCMode->GetXaxis()->CenterLabels();
262 
263  fDeltaE = tfs->make<TH1F>("fDeltaE", ";#Delta E_{#nu} (GeV);", 200, -1., 1.);
264  fECons = tfs->make<TH1F>("fECons", ";#Delta E(#nu,lepton);", 500, -5., 5.);
265 
267  double x = 2.1*geo->DetHalfWidth();
268  double y = 2.1*geo->DetHalfHeight();
269  double z = 2.*geo->DetLength();
270  int xdiv = TMath::Nint(2*x/5.);
271  int ydiv = TMath::Nint(2*y/5.);
272  int zdiv = TMath::Nint(2*z/5.);
273 
274  if (fDefinedVtxHistRange == false)
275  {
276  fVertexX = tfs->make<TH1F>("fVertexX", ";x (cm)", xdiv, -0.1*x, x);
277  fVertexY = tfs->make<TH1F>("fVertexY", ";y (cm)", ydiv, -y, y);
278  fVertexZ = tfs->make<TH1F>("fVertexZ", ";z (cm)", zdiv, -0.1*z, z);
279 
280  fVertexXY = tfs->make<TH2F>("fVertexXY", ";x (cm);y (cm)", xdiv, -0.1*x, x, ydiv, -y, y);
281  fVertexXZ = tfs->make<TH2F>("fVertexXZ", ";z (cm);x (cm)", zdiv, -0.2*z, z, xdiv, -0.1*x, x);
282  fVertexYZ = tfs->make<TH2F>("fVertexYZ", ";z (cm);y (cm)", zdiv, -0.2*z, z, ydiv, -y, y);
283  }
284  else
285  {
286  fVertexX = tfs->make<TH1F>("fVertexX", ";x (cm)", xdiv, fVtxPosHistRange[0], fVtxPosHistRange[1]);
287  fVertexY = tfs->make<TH1F>("fVertexY", ";y (cm)", ydiv, fVtxPosHistRange[2], fVtxPosHistRange[3]);
288  fVertexZ = tfs->make<TH1F>("fVertexZ", ";z (cm)", zdiv, fVtxPosHistRange[4], fVtxPosHistRange[5]);
289 
290  fVertexXY = tfs->make<TH2F>("fVertexXY", ";x (cm);y (cm)", xdiv, fVtxPosHistRange[0], fVtxPosHistRange[1], ydiv, fVtxPosHistRange[2], fVtxPosHistRange[3]);
291  fVertexXZ = tfs->make<TH2F>("fVertexXZ", ";z (cm);x (cm)", zdiv, fVtxPosHistRange[4], fVtxPosHistRange[5], xdiv, fVtxPosHistRange[0], fVtxPosHistRange[1]);
292  fVertexYZ = tfs->make<TH2F>("fVertexYZ", ";z (cm);y (cm)", zdiv, fVtxPosHistRange[4], fVtxPosHistRange[5], ydiv, fVtxPosHistRange[2], fVtxPosHistRange[3]);
293  }
294 
295  }
296 
297  //____________________________________________________________________________
299  {
300 
301  // grab the geometry object to see what geometry we are using
303  std::unique_ptr<sumdata::RunData> runcol(new sumdata::RunData(geo->DetectorName()));
304 
305  run.put(std::move(runcol));
306 
307  return;
308  }
309 
310  //____________________________________________________________________________
312  {
313 
314  std::unique_ptr<sumdata::POTSummary> p(new sumdata::POTSummary());
315 
318 
319  sr.put(std::move(p));
320 
321  return;
322  }
323 
324  //____________________________________________________________________________
326  {
327  std::unique_ptr< std::vector<simb::MCTruth> > truthcol (new std::vector<simb::MCTruth>);
328  std::unique_ptr< std::vector<simb::MCFlux> > fluxcol (new std::vector<simb::MCFlux >);
329  std::unique_ptr< std::vector<simb::GTruth> > gtruthcol (new std::vector<simb::GTruth >);
330  std::unique_ptr< art::Assns<simb::MCTruth, simb::MCFlux> > tfassn(new art::Assns<simb::MCTruth, simb::MCFlux>);
331  std::unique_ptr< art::Assns<simb::MCTruth, simb::GTruth> > tgtassn(new art::Assns<simb::MCTruth, simb::GTruth>);
332  std::unique_ptr< std::vector<sim::BeamGateInfo> > gateCollection(new std::vector<sim::BeamGateInfo>);
333 
334  while(truthcol->size() < 1){
335  while(!fGENIEHelp->Stop()){
336 
337  simb::MCTruth truth;
338  simb::MCFlux flux;
339  simb::GTruth gTruth;
340 
341  // GENIEHelper returns a false in the sample method if
342  // either no neutrino was generated, or the interaction
343  // occurred beyond the detector's z extent - ie something we
344  // would never see anyway.
345  if(fGENIEHelp->Sample(truth, flux, gTruth)){
346 
347  truthcol ->push_back(truth);
348  fluxcol ->push_back(flux);
349  gtruthcol->push_back(gTruth);
350  util::CreateAssn(*this, evt, *truthcol, *fluxcol, *tfassn, fluxcol->size()-1, fluxcol->size());
351  util::CreateAssn(*this, evt, *truthcol, *gtruthcol, *tgtassn, gtruthcol->size()-1, gtruthcol->size());
352 
353  FillHistograms(truth);
354 
355  // check that the process code is not unsupported by GENIE
356  // (see issue #18025 for reference);
357  // if it is, print all the information we can about this truth record
358  if (truth.NeutrinoSet() && (truth.GetNeutrino().InteractionType() == simb::kNuanceOffset)) {
359  mf::LogWarning log("GENIEmissingProcessMapping");
360  log << "Found an interaction that is not represented by the interaction type code in GENIE:"
361  "\nMCTruth record:"
362  "\n"
363  ;
364  sim::dump::DumpMCTruth(log, truth, 2U); // 2 trajectory points per line
365  log <<
366  "\nGENIE truth record:"
367  "\n"
368  ;
369  sim::dump::DumpGTruth(log, gTruth);
370  } // if
371 
372  }// end if genie was able to make an event
373 
374  }// end event generation loop
375 
376  // check to see if we are to pass empty spills
377  if(truthcol->size() < 1 && fPassEmptySpills){
378  LOG_DEBUG("GENIEGen") << "no events made for this spill but "
379  << "passing it on and ending the event anyway";
380  break;
381  }
382 
383  }// end loop while no interactions are made
384 
385  // Create a simulated "beam gate" for these neutrino events.
386  // We're creating a vector of these because, in a
387  // distant-but-possible future, we may be generating more than one
388  // beam gate within a simulated time window.
389  gateCollection->push_back(sim::BeamGateInfo( fGlobalTimeOffset, fRandomTimeOffset, fBeamType ));
390 
391  // put the collections in the event
392  evt.put(std::move(truthcol));
393  evt.put(std::move(fluxcol));
394  evt.put(std::move(gtruthcol));
395  evt.put(std::move(tfassn));
396  evt.put(std::move(tgtassn));
397  evt.put(std::move(gateCollection));
398 
399  return;
400  }
401 
402  //......................................................................
403  std::string GENIEGen::ParticleStatus(int StatusCode)
404  {
405  int code = StatusCode;
406  std::string ParticleStatusName;
407 
408  switch(code)
409  {
410  case -1:
411  ParticleStatusName = "kIStUndefined";
412  break;
413  case 0:
414  ParticleStatusName = "kIStInitialState";
415  break;
416  case 1:
417  ParticleStatusName = "kIStStableFinalState";
418  break;
419  case 2:
420  ParticleStatusName = "kIStIntermediateState";
421  break;
422  case 3:
423  ParticleStatusName = "kIStDecayedState";
424  break;
425  case 11:
426  ParticleStatusName = "kIStNucleonTarget";
427  break;
428  case 12:
429  ParticleStatusName = "kIStDISPreFragmHadronicState";
430  break;
431  case 13:
432  ParticleStatusName = "kIStPreDecayResonantState";
433  break;
434  case 14:
435  ParticleStatusName = "kIStHadronInTheNucleus";
436  break;
437  case 15:
438  ParticleStatusName = "kIStFinalStateNuclearRemnant";
439  break;
440  case 16:
441  ParticleStatusName = "kIStNucleonClusterTarget";
442  break;
443  default:
444  ParticleStatusName = "Status Unknown";
445  }
446  return ParticleStatusName;
447  }
448 
449  //......................................................................
450  std::string GENIEGen::ReactionChannel(int ccnc,int mode)
451  {
452  std::string ReactionChannelName=" ";
453 
454  if(ccnc==0)
455  ReactionChannelName = "kCC";
456  else if(ccnc==1)
457  ReactionChannelName = "kNC";
458  else std::cout<<"Current mode unknown!! "<<std::endl;
459 
460  if(mode==0)
461  ReactionChannelName += "_kQE";
462  else if(mode==1)
463  ReactionChannelName += "_kRes";
464  else if(mode==2)
465  ReactionChannelName += "_kDIS";
466  else if(mode==3)
467  ReactionChannelName += "_kCoh";
468  else std::cout<<"interaction mode unknown!! "<<std::endl;
469 
470  return ReactionChannelName;
471  }
472 
473  //......................................................................
475  {
476  // Decide which histograms to put the spectrum in
477  int id = -1;
478  if (mc.GetNeutrino().CCNC()==simb::kCC) {
479  fCCMode->Fill(mc.GetNeutrino().Mode());
480  if (mc.GetNeutrino().Nu().PdgCode() == 12) id = 0;
481  else if (mc.GetNeutrino().Nu().PdgCode() == -12) id = 1;
482  else if (mc.GetNeutrino().Nu().PdgCode() == 14) id = 2;
483  else if (mc.GetNeutrino().Nu().PdgCode() == -14) id = 3;
484  else return;
485  }
486  else {
487  fNCMode->Fill(mc.GetNeutrino().Mode());
488  if (mc.GetNeutrino().Nu().PdgCode() > 0) id = 4;
489  else id = 5;
490  }
491  if (id==-1) abort();
492 
493  // Fill the specta histograms
494  fGenerated[id]->Fill(mc.GetNeutrino().Nu().E() );
495 
498  simb::MCNeutrino mcnu = mc.GetNeutrino();
499  const simb::MCParticle nu = mcnu.Nu();
500 
501  fVertexX->Fill(nu.Vx());
502  fVertexY->Fill(nu.Vy());
503  fVertexZ->Fill(nu.Vz());
504 
505  fVertexXY->Fill(nu.Vx(), nu.Vy());
506  fVertexXZ->Fill(nu.Vz(), nu.Vx());
507  fVertexYZ->Fill(nu.Vz(), nu.Vy());
508 
509  double mom = nu.P();
510  if(std::abs(mom) > 0.){
511  fDCosX->Fill(nu.Px()/mom);
512  fDCosY->Fill(nu.Py()/mom);
513  fDCosZ->Fill(nu.Pz()/mom);
514  }
515 
516 
517  LOG_DEBUG("GENIEInteractionInformation")
518  << std::endl
519  << "REACTION: " << ReactionChannel(mc.GetNeutrino().CCNC(),mc.GetNeutrino().Mode())
520  << std::endl
521  << "-----------> Particles in the Stack = " << mc.NParticles() << std::endl
522  << std::setiosflags(std::ios::left)
523  << std::setw(20) << "PARTICLE"
524  << std::setiosflags(std::ios::left)
525  << std::setw(32) << "STATUS"
526  << std::setw(18) << "E (GeV)"
527  << std::setw(18) << "m (GeV/c2)"
528  << std::setw(18) << "Ek (GeV)"
529  << std::endl << std::endl;
530 
531  const TDatabasePDG* databasePDG = TDatabasePDG::Instance();
532 
533  // Loop over the particle stack for this event
534  for(int i = 0; i < mc.NParticles(); ++i){
536  std::string name = databasePDG->GetParticle(part.PdgCode())->GetName();
537  int code = part.StatusCode();
538  std::string status = ParticleStatus(code);
539  double mass = part.Mass();
540  double energy = part.E();
541  double Ek = (energy-mass); // Kinetic Energy (GeV)
542  if(status=="kIStStableFinalState"||status=="kIStHadronInTheNucleus")
543  LOG_DEBUG("GENIEFinalState")
544  << std::setiosflags(std::ios::left) << std::setw(20) << name
545  << std::setiosflags(std::ios::left) << std::setw(32) <<status
546  << std::setw(18)<< energy
547  << std::setw(18)<< mass
548  << std::setw(18)<< Ek <<std::endl;
549  else
550  LOG_DEBUG("GENIEFinalState")
551  << std::setiosflags(std::ios::left) << std::setw(20) << name
552  << std::setiosflags(std::ios::left) << std::setw(32) << status
553  << std::setw(18) << energy
554  << std::setw(18) << mass <<std::endl;
555  }
556 
557 
558  if(mc.GetNeutrino().CCNC() == simb::kCC){
559 
562  for(int i = 0; i < mc.NParticles(); ++i){
564  if(abs(part.PdgCode()) == 11){
565  fEMomentum->Fill(part.P());
566  fEDCosX->Fill(part.Px()/part.P());
567  fEDCosY->Fill(part.Py()/part.P());
568  fEDCosZ->Fill(part.Pz()/part.P());
569  fECons->Fill(nu.E() - part.E());
570  break;
571  }
572  else if(abs(part.PdgCode()) == 13){
573  fMuMomentum->Fill(part.P());
574  fMuDCosX->Fill(part.Px()/part.P());
575  fMuDCosY->Fill(part.Py()/part.P());
576  fMuDCosZ->Fill(part.Pz()/part.P());
577  fECons->Fill(nu.E() - part.E());
578  break;
579  }
580  }// end loop over particles
581  }//end if CC interaction
582 
583  return;
584  }
585 
586 }
587 
588 namespace evgen{
589 
591 
592 }
593 
594 #endif
TH1F * fVertexX
vertex location of generated events in x
std::string ParticleStatus(int StatusCode)
Float_t x
Definition: compare.C:6
double E(const int i=0) const
Definition: MCParticle.h:237
TH1F * fMuDCosZ
direction cosine of outgoing mu in z
TH2F * fVertexXZ
vertex location in xz
int PdgCode() const
Definition: MCParticle.h:216
int CCNC() const
Definition: MCNeutrino.h:152
const simb::MCNeutrino & GetNeutrino() const
Definition: MCTruth.h:74
double Py(const int i=0) const
Definition: MCParticle.h:235
geo::Length_t DetHalfWidth(geo::TPCID const &tpcid) const
Returns the half width of the active volume of the specified TPC.
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:379
TH1F * fDeltaE
difference in neutrino energy from MCTruth::Enu() vs TParticle
TH2F * fVertexXY
vertex location in xy
std::string ReactionChannel(int ccnc, int mode)
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
void beginRun(art::Run &run)
Unknown view.
Definition: geo_types.h:83
TH1F * fMuDCosY
direction cosine of outgoing mu in y
Float_t y
Definition: compare.C:6
const simb::MCParticle & Nu() const
Definition: MCNeutrino.h:150
bool Sample(simb::MCTruth &truth, simb::MCFlux &flux, simb::GTruth &gtruth)
Double_t z
Definition: plot.C:279
double Px(const int i=0) const
Definition: MCParticle.h:234
STL namespace.
offset to account for adding in Nuance codes to this enum
Definition: MCNeutrino.h:99
void endSubRun(art::SubRun &sr)
int NParticles() const
Definition: MCTruth.h:72
art::ProductID put(std::unique_ptr< PROD > &&)
Definition: Run.h:148
TGeoManager * ROOTGeoManager() const
Access to the ROOT geometry description manager.
TH1F * fNCMode
CC interaction mode.
object containing MC flux information
std::string ROOTFile() const
Returns the full directory path to the geometry file source.
Definition: Run.h:30
::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).
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
TH1F * fDCosZ
direction cosine in z
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
int InteractionType() const
Definition: MCNeutrino.h:154
void produce(art::Event &evt)
geo::Length_t DetHalfHeight(geo::TPCID const &tpcid) const
Returns the half height of the active volume of the specified TPC.
TH1F * fEDCosY
direction cosine of outgoing e in y
Utility functions to print MC truth information.
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:42
GENIEGen(fhicl::ParameterSet const &pset)
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
long seed
Definition: chem4.cc:68
int fPassEmptySpills
whether or not to kill evnets with no interactions
TH1F * fCCMode
CC interaction mode.
evgb::GENIEHelper * fGENIEHelp
GENIEHelper object.
double P(const int i=0) const
Definition: MCParticle.h:238
T get(std::string const &key) const
Definition: ParameterSet.h:231
TString part[npart]
Definition: Style.C:32
double fGlobalTimeOffset
keep track of how long it takes to run the job
TH1F * fEDCosX
direction cosine of outgoing e in x
double energy
Definition: plottest35.C:25
TH1F * fMuDCosX
direction cosine of outgoing mu in x
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:346
TH1F * fGenerated[6]
The type of beam.
geo::Length_t DetLength(geo::TPCID const &tpcid) const
Returns the length of the active volume of the specified TPC.
bool get_if_present(std::string const &key, T &value) const
Definition: ParameterSet.h:208
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.
Wrapper for generating neutrino interactions with GENIE.
Monte Carlo Simulation.
An art service to assist in the distribution of guaranteed unique seeds to all engines within an art ...
TH1F * fDCosY
direction cosine in y
const simb::MCParticle & GetParticle(int i) const
Definition: MCTruth.h:73
double Vx(const int i=0) const
Definition: MCParticle.h:225
constexpr auto const & left(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:104
TH1F * fEMomentum
momentum of outgoing electrons
T * make(ARGS...args) const
BNB.
Definition: BeamTypes.h:11
TH2F * fVertexYZ
vertex location in yz
Utility object to perform functions of association.
double TotalExposure() const
Definition: GENIEHelper.h:66
TH1F * fECons
histogram to determine if energy is conserved in the event
ProductID put(std::unique_ptr< PROD > &&)
double Pz(const int i=0) const
Definition: MCParticle.h:236
double Vz(const int i=0) const
Definition: MCParticle.h:227
#define LOG_DEBUG(id)
TH1F * fEDCosZ
direction cosine of outgoing e in z
TH1F * fDCosX
direction cosine in x
bool NeutrinoSet() const
Definition: MCTruth.h:75
Event generator information.
Definition: MCTruth.h:30
TStopwatch fStopwatch
Event generator information.
Definition: MCNeutrino.h:18
Namespace collecting geometry-related classes utilities.
TH1F * fMuMomentum
momentum of outgoing muons
int Mode() const
Definition: MCNeutrino.h:153
Event Generation using GENIE, cosmics or single particles.
std::string ParticleStatusName(int code)
Describes the status of a particle (simb::MCParticle::StatusCode()).
TH1F * fVertexY
vertex location of generated events in y
BeamType_t
Defines category of beams to be stored in sim::BeamGateInfo.
Definition: BeamTypes.h:9
void FillHistograms(simb::MCTruth mc)
std::vector< double > fVtxPosHistRange
use defined hist range; it is useful to have for asymmetric ranges like in DP FD. ...
TH1F * fVertexZ
vertex location of generated events in z
double Vy(const int i=0) const
Definition: MCParticle.h:226
void put(std::string const &key)
art framework interface to geometry description
A module to check the results from the Monte Carlo generator.
double fRandomTimeOffset
The start of a simulated "beam gate".