GENIEGen_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // $Id: GENIEGen_plugin.cc,v 1.4 2010/04/27 19:48:46 brebel Exp $
3 //
4 //
5 // GENIE neutrino event generator
6 //
7 // brebel@fnal.gov
8 //
9 ////////////////////////////////////////////////////////////////////////
10 #ifndef EVGEN_GENIEGEN_H
11 #define EVGEN_GENIEGEN_H
12 
13 #include <cstdlib>
14 #include <string>
15 #include <iostream>
16 #include <iomanip>
17 #include <sstream>
18 #include <vector>
19 #include <map>
20 #include <memory>
21 #include <unistd.h>
22 
23 // ROOT includes
24 #include "TH1.h"
25 #include "TH2.h"
26 #include "TDatabasePDG.h"
27 #include "TSystem.h"
28 #include "TStopwatch.h"
29 
30 // Framework includes
34 #include "fhiclcpp/ParameterSet.h"
37 #include "art_root_io/TFileService.h"
38 #include "art_root_io/TFileDirectory.h"
42 
43 #include "GENIE/Framework/Ntuple/NtpMCEventRecord.h"
44 #include "GENIE/Framework/Ntuple/NtpMCTreeHeader.h"
47 
51 #include "nugen/EventGeneratorBase/GENIE/GENIEHelper.h"
52 #include "nurandom/RandomUtils/NuRandomService.h"
53 
54 // GArSoft includes
55 #include "Geometry/GeometryGAr.h"
62 #include "Utilities/AssociationUtil.h"
63 #include "CoreUtils/ServiceUtil.h"
64 
65 ///Event Generation using GENIE, cosmics or single particles
66 namespace gar {
67  namespace evgen {
68  /**
69  * @brief A module to check the results from the Monte Carlo generator
70  *
71  * Note on random number generator
72  * --------------------------------
73  *
74  * GENIE uses a TRandom generator for its purposes.
75  * Since art's RandomNumberGenerator service only provides
76  * `CLHEP::HepRandomEngine`, the standard GArSoft/art mechanism for handling
77  * the random stream can't be used.
78  * GENIEHelper, interface to GENIE provided by nutools, creates a TRandom
79  * that GENIE can use. It initializes it with a random seed read from
80  * *RandomSeed* configuration parameter. This and all the other parameters
81  * are inherited from the art module (that is, `GENIEGen`) configuration.
82  * GArSoft meddles with this mechanism to provide support for the standard
83  * "Seed" parameter and NuRandomService service.
84  *
85  * Configuration parameters
86  * -------------------------
87  *
88  * - *RandomSeed* (integer, optional): if specified, this value is used as
89  * seed for GENIE random number generator engine
90  * - *Seed* (unsigned integer, optional): if specified, this value is used as
91  * seed for GENIE random number generator engine; if *RandomSeed* is also
92  * specified, this value is ignored (but in the future this could turn into
93  * a configuration error)
94  *
95  * As custom, if the random seed is not provided by the configuration, one is
96  * fetched from `NuRandomService` (if available), with the behaviour in
97  * gar::rndm::FetchRandomSeed().
98  */
99  class GENIEGen : public ::art::EDProducer {
100  public:
101  explicit GENIEGen(fhicl::ParameterSet const &pset);
102  virtual ~GENIEGen();
103 
104  void produce(::art::Event& evt);
105  void beginJob();
106  void beginRun(::art::Run& run);
107  void endRun(::art::Run& run);
108 
109  private:
110 
111  std::string ParticleStatus(int StatusCode);
112  std::string ReactionChannel(int ccnc,int mode);
113 
114  void FillHistograms(simb::MCTruth mc);
115 
116  evgb::GENIEHelper *fGENIEHelp; ///< GENIEHelper object
117  int fPassEmptySpills; ///< whether or not to kill evnets with no interactions
118  TStopwatch fStopwatch; ///keep track of how long it takes to run the job
119 
120  double fGlobalTimeOffset; /// The start of a simulated "beam gate".
121  double fRandomTimeOffset; /// The width of a simulated "beam gate".
122  gar::sdp::BeamType_t fBeamType; /// The type of beam
123 
124  TH1F* fGenerated[6]; ///< Spectra as generated
125 
126  TH1F* fVertexX; ///< vertex location of generated events in x
127  TH1F* fVertexY; ///< vertex location of generated events in y
128  TH1F* fVertexZ; ///< vertex location of generated events in z
129 
130  TH2F* fVertexXY; ///< vertex location in xy
131  TH2F* fVertexXZ; ///< vertex location in xz
132  TH2F* fVertexYZ; ///< vertex location in yz
133 
134  TH1F* fDCosX; ///< direction cosine in x
135  TH1F* fDCosY; ///< direction cosine in y
136  TH1F* fDCosZ; ///< direction cosine in z
137 
138  TH1F* fMuMomentum; ///< momentum of outgoing muons
139  TH1F* fMuDCosX; ///< direction cosine of outgoing mu in x
140  TH1F* fMuDCosY; ///< direction cosine of outgoing mu in y
141  TH1F* fMuDCosZ; ///< direction cosine of outgoing mu in z
142 
143  TH1F* fEMomentum; ///< momentum of outgoing electrons
144  TH1F* fEDCosX; ///< direction cosine of outgoing e in x
145  TH1F* fEDCosY; ///< direction cosine of outgoing e in y
146  TH1F* fEDCosZ; ///< direction cosine of outgoing e in z
147 
148  TH1F* fCCMode; ///< CC interaction mode
149  TH1F* fNCMode; ///< CC interaction mode
150 
151  TH1F* fDeltaE; ///< difference in neutrino energy from MCTruth::Enu() vs TParticle
152  TH1F* fECons; ///< histogram to determine if energy is conserved in the event
153 
154  };
155  }
156 
157  namespace evgen{
158 
159  //____________________________________________________________________________
161  : EDProducer{pset},
162  fGENIEHelp(0),
163  fPassEmptySpills (pset.get< bool >("PassEmptySpills")),
164  fGlobalTimeOffset(pset.get< double >("GlobalTimeOffset",0)),
165  fRandomTimeOffset(pset.get< double >("RandomTimeOffset",1600.)), // BNB default value
167  {
168  fStopwatch.Start();
169 
170  produces< std::vector<simb::MCTruth> >();
171  produces< std::vector<simb::MCFlux> >();
172  produces< std::vector<simb::GTruth> >();
173  produces< std::vector<sdp::GenieParticle> >();
174  produces< sumdata::RunData, ::art::InRun >();
175  produces< sumdata::POTSummary, ::art::InRun >();
176  produces< ::art::Assns<simb::MCTruth, simb::MCFlux> >();
177  produces< ::art::Assns<simb::MCTruth, simb::GTruth> >();
178 
179  std::string beam_type_name = pset.get<std::string>("BeamName");
180 
181  if (beam_type_name == "numi" ) fBeamType = gar::sdp::kNuMI;
182  else if(beam_type_name == "booster") fBeamType = gar::sdp::kBNB;
184 
185  auto geo = gar::providerFrom<geo::GeometryGAr>();
186 
187  fhicl::ParameterSet GENIEconfig(pset);
188  if (!GENIEconfig.has_key("RandomSeed")) {
189  // no RandomSeed specified; check for the GArSoft-style "Seed" instead:
190  // obtain the random seed from a service,
191  // unless overridden in configuration with key "Seed"
192 
193  unsigned int seed;
194  if (!GENIEconfig.has_key("Seed"))
195  seed = ::art::ServiceHandle<rndm::NuRandomService>()->getSeed();
196 
197  // The seed is not passed to RandomNumberGenerator,
198  // since GENIE uses a TRandom generator that is owned by the GENIEHelper.
199  // Instead, we explicitly configure the random seed for GENIEHelper:
200  GENIEconfig.put("RandomSeed", seed);
201  } // if no RandomSeed present
202 
203  fGENIEHelp = new evgb::GENIEHelper(GENIEconfig,
204  geo->ROOTGeoManager(),
205  geo->ROOTFile(),
206  geo->TotalMass(pset.get< std::string>("TopVolume").c_str()));
207 
208  }
209 
210  //____________________________________________________________________________
212  {
213  // if(fGENIEHelp) delete fGENIEHelp;
214  fStopwatch.Stop();
215  mf::LogInfo("GENIEProductionTime") << "real time to produce file: " << fStopwatch.RealTime();
216  }
217 
218  //____________________________________________________________________________
220  fGENIEHelp->Initialize();
221 
222  // Get access to the TFile service.
224 
225  fGenerated[0] = tfs->make<TH1F>("fGenerated_necc", "", 100, 0.0, 20.0);
226  fGenerated[1] = tfs->make<TH1F>("fGenerated_nebcc", "", 100, 0.0, 20.0);
227  fGenerated[2] = tfs->make<TH1F>("fGenerated_nmcc", "", 100, 0.0, 20.0);
228  fGenerated[3] = tfs->make<TH1F>("fGenerated_nmbcc", "", 100, 0.0, 20.0);
229  fGenerated[4] = tfs->make<TH1F>("fGenerated_nnc", "", 100, 0.0, 20.0);
230  fGenerated[5] = tfs->make<TH1F>("fGenerated_nbnc", "", 100, 0.0, 20.0);
231 
232  fDCosX = tfs->make<TH1F>("fDCosX", ";dx/ds", 200, -1., 1.);
233  fDCosY = tfs->make<TH1F>("fDCosY", ";dy/ds", 200, -1., 1.);
234  fDCosZ = tfs->make<TH1F>("fDCosZ", ";dz/ds", 200, -1., 1.);
235 
236  fMuMomentum = tfs->make<TH1F>("fMuMomentum", ";p_{#mu} (GeV/c)", 500, 0., 50.);
237  fMuDCosX = tfs->make<TH1F>("fMuDCosX", ";dx/ds;", 200, -1., 1.);
238  fMuDCosY = tfs->make<TH1F>("fMuDCosY", ";dy/ds;", 200, -1., 1.);
239  fMuDCosZ = tfs->make<TH1F>("fMuDCosZ", ";dz/ds;", 200, -1., 1.);
240 
241  fEMomentum = tfs->make<TH1F>("fEMomentum", ";p_{e} (GeV/c)", 500, 0., 50.);
242  fEDCosX = tfs->make<TH1F>("fEDCosX", ";dx/ds;", 200, -1., 1.);
243  fEDCosY = tfs->make<TH1F>("fEDCosY", ";dy/ds;", 200, -1., 1.);
244  fEDCosZ = tfs->make<TH1F>("fEDCosZ", ";dz/ds;", 200, -1., 1.);
245 
246  fCCMode = tfs->make<TH1F>("fCCMode", ";CC Interaction Mode;", 4, 0., 4.);
247  fCCMode->GetXaxis()->SetBinLabel(1, "QE");
248  fCCMode->GetXaxis()->SetBinLabel(2, "Res");
249  fCCMode->GetXaxis()->SetBinLabel(3, "DIS");
250  fCCMode->GetXaxis()->SetBinLabel(4, "Coh");
251  fCCMode->GetXaxis()->CenterLabels();
252 
253  fNCMode = tfs->make<TH1F>("fNCMode", ";NC Interaction Mode;", 4, 0., 4.);
254  fNCMode->GetXaxis()->SetBinLabel(1, "QE");
255  fNCMode->GetXaxis()->SetBinLabel(2, "Res");
256  fNCMode->GetXaxis()->SetBinLabel(3, "DIS");
257  fNCMode->GetXaxis()->SetBinLabel(4, "Coh");
258  fNCMode->GetXaxis()->CenterLabels();
259 
260  fDeltaE = tfs->make<TH1F>("fDeltaE", ";#Delta E_{#nu} (GeV);", 200, -1., 1.);
261  fECons = tfs->make<TH1F>("fECons", ";#Delta E(#nu,lepton);", 500, -5., 5.);
262 
263  auto geo = gar::providerFrom<geo::GeometryGAr>();
264  double x = 2.1 * geo->TPCRadius();
265  double y = 2.1 * geo->TPCRadius();
266  double z = 2. * geo->TPCLength();
267  int xdiv = TMath::Nint(2 * x / 5.);
268  int ydiv = TMath::Nint(2 * y / 5.);
269  int zdiv = TMath::Nint(2 * z / 5.);
270 
271  fVertexX = tfs->make<TH1F>("fVertexX", ";x (cm)", xdiv, -x, x);
272  fVertexY = tfs->make<TH1F>("fVertexY", ";y (cm)", ydiv, -y, y);
273  fVertexZ = tfs->make<TH1F>("fVertexZ", ";z (cm)", zdiv, -z, z);
274 
275  fVertexXY = tfs->make<TH2F>("fVertexXY", ";x (cm);y (cm)", xdiv, -x, x, ydiv, -y, y);
276  fVertexXZ = tfs->make<TH2F>("fVertexXZ", ";z (cm);x (cm)", zdiv, -z, z, xdiv, -x, x);
277  fVertexYZ = tfs->make<TH2F>("fVertexYZ", ";z (cm);y (cm)", zdiv, -z, z, ydiv, -y, y);
278 
279  }
280 
281  //____________________________________________________________________________
283  {
284  // grab the geometry object to see what geometry we are using
285  auto geo = gar::providerFrom<geo::GeometryGAr>();
286  std::unique_ptr<sumdata::RunData> runcol(new sumdata::RunData(geo->DetectorName()));
287  run.put(std::move(runcol));
288  return;
289  }
290 
291  //____________________________________________________________________________
293  {
294  std::unique_ptr<sumdata::POTSummary> p(new sumdata::POTSummary());
295  p->totpot = fGENIEHelp->TotalExposure();
296  p->totgoodpot = fGENIEHelp->TotalExposure();
297  run.put(std::move(p));
298  return;
299  }
300 
301  //____________________________________________________________________________
303  {
304  std::unique_ptr< std::vector<simb::MCTruth> > truthcol (new std::vector<simb::MCTruth>);
305  std::unique_ptr< std::vector<simb::MCFlux> > fluxcol (new std::vector<simb::MCFlux >);
306  std::unique_ptr< std::vector<simb::GTruth> > gtruthcol(new std::vector<simb::GTruth >);
307  std::unique_ptr< ::art::Assns<simb::MCTruth, simb::MCFlux> > tfassn (new ::art::Assns<simb::MCTruth, simb::MCFlux>);
308  std::unique_ptr< ::art::Assns<simb::MCTruth, simb::GTruth> > tgtassn (new ::art::Assns<simb::MCTruth, simb::GTruth>);
309  std::unique_ptr< std::vector<gar::sdp::GenieParticle> > geniepartcol( new std::vector<gar::sdp::GenieParticle> );
310 
311  while(truthcol->size() < 1)
312  {
313  unsigned int_idx = 0;
314  while(!fGENIEHelp->Stop())
315  {
316  simb::MCTruth truth;
317  simb::MCFlux flux;
318  simb::GTruth gTruth;
319 
320  // GENIEHelper returns a false in the sample method if
321  // either no neutrino was generated, or the interaction
322  // occurred beyond the detector's z extent - ie something we
323  // would never see anyway.
324  if(fGENIEHelp->Sample(truth, flux, gTruth)) {
325 
326  //Store the list of GENIE particles
327  genie::EventRecord *event = fGENIEHelp->GetGenieEventRecord();
328  genie::GHepParticle* p = nullptr;
329  TObjArrayIter piter(event);
330  unsigned int idx = 0;
331 
332  while( (p = (genie::GHepParticle*) piter.Next()) ) {
333  geniepartcol->emplace_back(int_idx, idx, p->Pdg(), p->Status(), p->Name(), p->FirstMother(), p->LastMother(), p->FirstDaughter(), p->LastDaughter(), p->Px(), p->Py(), p->Pz(), p->E(), p->Mass(), p->RescatterCode());
334  idx++;
335  }
336 
337  truthcol ->push_back(truth);
338  fluxcol ->push_back(flux);
339  gtruthcol->push_back(gTruth);
340  util::CreateAssn(*this, evt, *truthcol, *fluxcol, *tfassn, fluxcol->size() - 1, fluxcol->size() );
341  util::CreateAssn(*this, evt, *truthcol, *gtruthcol, *tgtassn, gtruthcol->size() - 1, gtruthcol->size());
342 
343  this->FillHistograms(truth);
344  }// end if genie was able to make an event
345  int_idx++;
346  }// end event generation loop
347 
348  // check to see if we are to pass empty spills
349  if(truthcol->size() < 1 && fPassEmptySpills) {
350  MF_LOG_DEBUG("GENIEGen") << "no events made for this spill but "
351  << "passing it on and ending the event anyway";
352  break;
353  }
354 
355  }// end loop while no interactions are made
356 
357  // put the collections in the event
358  evt.put(std::move(truthcol));
359  evt.put(std::move(fluxcol));
360  evt.put(std::move(gtruthcol));
361  evt.put(std::move(tfassn));
362  evt.put(std::move(tgtassn));
363  evt.put(std::move(geniepartcol));
364 
365  return;
366  }
367 
368  //......................................................................
370  {
371  int code = StatusCode;
373 
374  switch(code)
375  {
376  case -1:
377  ParticleStatusName = "kIStUndefined";
378  break;
379  case 0:
380  ParticleStatusName = "kIStInitialState";
381  break;
382  case 1:
383  ParticleStatusName = "kIStStableFinalState";
384  break;
385  case 2:
386  ParticleStatusName = "kIStIntermediateState";
387  break;
388  case 3:
389  ParticleStatusName = "kIStDecayedState";
390  break;
391  case 11:
392  ParticleStatusName = "kIStNucleonTarget";
393  break;
394  case 12:
395  ParticleStatusName = "kIStDISPreFragmHadronicState";
396  break;
397  case 13:
398  ParticleStatusName = "kIStPreDecayResonantState";
399  break;
400  case 14:
401  ParticleStatusName = "kIStHadronInTheNucleus";
402  break;
403  case 15:
404  ParticleStatusName = "kIStFinalStateNuclearRemnant";
405  break;
406  case 16:
407  ParticleStatusName = "kIStNucleonClusterTarget";
408  break;
409  default:
410  ParticleStatusName = "Status Unknown";
411  }
412  return ParticleStatusName;
413  }
414 
415  //......................................................................
417  {
418  std::string ReactionChannelName=" ";
419 
420  if(ccnc==0)
421  ReactionChannelName = "kCC";
422  else if(ccnc==1)
423  ReactionChannelName = "kNC";
424  else std::cout<<"Current mode unknown!! "<<std::endl;
425 
426  if(mode==0)
427  ReactionChannelName += "_kQE";
428  else if(mode==1)
429  ReactionChannelName += "_kRes";
430  else if(mode==2)
431  ReactionChannelName += "_kDIS";
432  else if(mode==3)
433  ReactionChannelName += "_kCoh";
434  else std::cout<<"interaction mode unknown!! "<<std::endl;
435 
436  return ReactionChannelName;
437  }
438 
439  //......................................................................
441  {
442  // Decide which histograms to put the spectrum in
443  int id = -1;
444  if (mc.GetNeutrino().CCNC()==simb::kCC) {
445  fCCMode->Fill(mc.GetNeutrino().Mode());
446  if (mc.GetNeutrino().Nu().PdgCode() == 12) id = 0;
447  else if (mc.GetNeutrino().Nu().PdgCode() == -12) id = 1;
448  else if (mc.GetNeutrino().Nu().PdgCode() == 14) id = 2;
449  else if (mc.GetNeutrino().Nu().PdgCode() == -14) id = 3;
450  else return;
451  }
452  else {
453  fNCMode->Fill(mc.GetNeutrino().Mode());
454  if (mc.GetNeutrino().Nu().PdgCode() > 0) id = 4;
455  else id = 5;
456  }
457  if (id==-1) abort();
458 
459  // Fill the specta histograms
460  fGenerated[id]->Fill(mc.GetNeutrino().Nu().E() );
461 
462  ///< fill the vertex histograms from the neutrino - that is always
463  ///< particle 0 in the list
464  simb::MCNeutrino mcnu = mc.GetNeutrino();
465  const simb::MCParticle nu = mcnu.Nu();
466 
467  fVertexX->Fill(nu.Vx());
468  fVertexY->Fill(nu.Vy());
469  fVertexZ->Fill(nu.Vz());
470 
471  fVertexXY->Fill(nu.Vx(), nu.Vy());
472  fVertexXZ->Fill(nu.Vz(), nu.Vx());
473  fVertexYZ->Fill(nu.Vz(), nu.Vy());
474 
475  double mom = nu.P();
476  if(std::abs(mom) > 0.){
477  fDCosX->Fill(nu.Px()/mom);
478  fDCosY->Fill(nu.Py()/mom);
479  fDCosZ->Fill(nu.Pz()/mom);
480  }
481 
482 
483  MF_LOG_DEBUG("GENIEInteractionInformation")
484  << std::endl
485  << "REACTION: " << ReactionChannel(mc.GetNeutrino().CCNC(),mc.GetNeutrino().Mode())
486  << std::endl
487  << "-----------> Particles in the Stack = " << mc.NParticles() << std::endl
488  << std::setiosflags(std::ios::left)
489  << std::setw(20) << "PARTICLE"
490  << std::setiosflags(std::ios::left)
491  << std::setw(32) << "STATUS"
492  << std::setw(18) << "E (GeV)"
493  << std::setw(18) << "m (GeV/c2)"
494  << std::setw(18) << "Ek (GeV)"
495  << std::endl << std::endl;
496 
497  const TDatabasePDG* databasePDG = TDatabasePDG::Instance();
498 
499  // Loop over the particle stack for this event
500  for(int i = 0; i < mc.NParticles(); ++i){
501  simb::MCParticle part(mc.GetParticle(i));
502  std::string name = databasePDG->GetParticle(part.PdgCode())->GetName();
503  int code = part.StatusCode();
505  double mass = part.Mass();
506  double energy = part.E();
507  double Ek = (energy-mass); // Kinetic Energy (GeV)
508  if(status == "kIStStableFinalState" ||
509  status == "kIStHadronInTheNucleus")
510  MF_LOG_DEBUG("GENIEFinalState")
511  << std::setiosflags(std::ios::left) << std::setw(20) << name
512  << std::setiosflags(std::ios::left) << std::setw(32) <<status
513  << std::setw(18)<< energy
514  << std::setw(18)<< mass
515  << std::setw(18)<< Ek <<std::endl;
516  else
517  MF_LOG_DEBUG("GENIEFinalState")
518  << std::setiosflags(std::ios::left) << std::setw(20) << name
519  << std::setiosflags(std::ios::left) << std::setw(32) << status
520  << std::setw(18) << energy
521  << std::setw(18) << mass <<std::endl;
522  }
523 
524 
525  if(mc.GetNeutrino().CCNC() == simb::kCC){
526 
527  ///look for the outgoing lepton in the particle stack
528  ///just interested in the first one
529  for(int i = 0; i < mc.NParticles(); ++i){
530  simb::MCParticle part(mc.GetParticle(i));
531  if(std::abs(part.PdgCode()) == 11){
532  fEMomentum->Fill(part.P());
533  fEDCosX->Fill(part.Px()/part.P());
534  fEDCosY->Fill(part.Py()/part.P());
535  fEDCosZ->Fill(part.Pz()/part.P());
536  fECons->Fill(nu.E() - part.E());
537  break;
538  }
539  else if(std::abs(part.PdgCode()) == 13){
540  fMuMomentum->Fill(part.P());
541  fMuDCosX->Fill(part.Px()/part.P());
542  fMuDCosY->Fill(part.Py()/part.P());
543  fMuDCosZ->Fill(part.Pz()/part.P());
544  fECons->Fill(nu.E() - part.E());
545  break;
546  }
547  }// end loop over particles
548  }//end if CC interaction
549 
550  return;
551  }
552 
553  }
554 
555  namespace evgen{
556 
558 
559  }
560 } // end gar
561 #endif
static QCString name
Definition: declinfo.cpp:673
double E(const int i=0) const
Definition: MCParticle.h:233
TH1F * fEDCosY
direction cosine of outgoing e in y
int RescatterCode(void) const
Definition: GHepParticle.h:65
int PdgCode() const
Definition: MCParticle.h:212
int CCNC() const
Definition: MCNeutrino.h:148
const simb::MCNeutrino & GetNeutrino() const
Definition: MCTruth.h:77
GENIEGen(fhicl::ParameterSet const &pset)
TH2F * fVertexXY
vertex location in xy
double Py(const int i=0) const
Definition: MCParticle.h:231
double E(void) const
Get energy.
Definition: GHepParticle.h:91
TH1F * fMuDCosY
direction cosine of outgoing mu in y
TH1F * fMuDCosZ
direction cosine of outgoing mu in z
TH1F * fCCMode
CC interaction mode.
std::string string
Definition: nybbler.cc:12
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
int FirstDaughter(void) const
Definition: GHepParticle.h:68
TH1F * fVertexZ
vertex location of generated events in z
const simb::MCParticle & Nu() const
Definition: MCNeutrino.h:146
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
void produce(::art::Event &evt)
double Px(const int i=0) const
Definition: MCParticle.h:230
void endRun(::art::Run &run)
double Mass(void) const
Mass that corresponds to the PDG code.
int NParticles() const
Definition: MCTruth.h:75
TH1F * fMuMomentum
momentum of outgoing muons
double Pz(void) const
Get Pz.
Definition: GHepParticle.h:90
GHepStatus_t Status(void) const
Definition: GHepParticle.h:64
TH1F * fVertexY
vertex location of generated events in y
object containing MC flux information
BeamType_t
Defines category of beams to be stored in sdp::BeamGateInfo.
Definition: BeamTypes.h:10
Definition: Run.h:17
TH1F * fECons
histogram to determine if energy is conserved in the event
double Px(void) const
Get Px.
Definition: GHepParticle.h:88
TH2F * fVertexXZ
vertex location in xz
TH2F * fVertexYZ
vertex location in yz
int LastMother(void) const
Definition: GHepParticle.h:67
int Pdg(void) const
Definition: GHepParticle.h:63
int FirstMother(void) const
Definition: GHepParticle.h:66
string Name(void) const
Name that corresponds to the PDG code.
TH1F * fEMomentum
momentum of outgoing electrons
std::string ParticleStatus(int StatusCode)
T abs(T value)
gar::sdp::BeamType_t fBeamType
The width of a simulated "beam gate".
double fRandomTimeOffset
The start of a simulated "beam gate".
int LastDaughter(void) const
Definition: GHepParticle.h:69
TH1F * fDeltaE
difference in neutrino energy from MCTruth::Enu() vs TParticle
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:67
void beginRun(::art::Run &run)
TH1F * fMuDCosX
direction cosine of outgoing mu in x
def move(depos, offset)
Definition: depos.py:107
A module to check the results from the Monte Carlo generator.
double P(const int i=0) const
Definition: MCParticle.h:234
Unknown beam type.
Definition: BeamTypes.h:11
TH1F * fDCosX
direction cosine in x
TH1F * fGenerated[6]
The type of beam.
p
Definition: test.py:223
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: DataViewImpl.h:686
TH1F * fDCosZ
direction cosine in z
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.
CodeOutputInterface * code
double fGlobalTimeOffset
keep track of how long it takes to run the job
int fPassEmptySpills
whether or not to kill evnets with no interactions
std::string ReactionChannel(int ccnc, int mode)
Q_EXPORT QTSManip setw(int w)
Definition: qtextstream.h:331
void FillHistograms(simb::MCTruth mc)
const simb::MCParticle & GetParticle(int i) const
Definition: MCTruth.h:76
Generated Event Record. It is a GHepRecord object that can accept / be visited by EventRecordVisitorI...
Definition: EventRecord.h:37
General GArSoft Utilities.
double Vx(const int i=0) const
Definition: MCParticle.h:221
TH1F * fDCosY
direction cosine in y
TH1F * fEDCosX
direction cosine of outgoing e in x
#define MF_LOG_DEBUG(id)
double Pz(const int i=0) const
Definition: MCParticle.h:232
double Vz(const int i=0) const
Definition: MCParticle.h:223
list x
Definition: train.py:276
evgb::GENIEHelper * fGENIEHelp
GENIEHelper object.
TCEvent evt
Definition: DataStructs.cxx:7
Event generator information.
Definition: MCTruth.h:32
Event generator information.
Definition: MCNeutrino.h:18
LArSoft geometry interface.
Definition: ChannelGeo.h:16
art framework interface to geometry description
int Mode() const
Definition: MCNeutrino.h:149
Event Generation using GENIE, cosmics or single particles.
std::string ParticleStatusName(int code)
Describes the status of a particle (simb::MCParticle::StatusCode()).
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
TH1F * fVertexX
vertex location of generated events in x
TH1F * fNCMode
CC interaction mode.
double Vy(const int i=0) const
Definition: MCParticle.h:222
QTextStream & endl(QTextStream &s)
Event finding and building.
double Py(void) const
Get Py.
Definition: GHepParticle.h:89
TH1F * fEDCosZ
direction cosine of outgoing e in z