Public Member Functions | Private Member Functions | Private Attributes | List of all members
gar::evgen::GENIEGen Class Reference

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

Inheritance diagram for gar::evgen::GENIEGen:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Member Functions

 GENIEGen (fhicl::ParameterSet const &pset)
 
virtual ~GENIEGen ()
 
void produce (::art::Event &evt)
 
void beginJob ()
 
void beginRun (::art::Run &run)
 
void endRun (::art::Run &run)
 
- Public Member Functions inherited from art::EDProducer
 EDProducer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDProducer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Producer
virtual ~Producer () noexcept
 
 Producer (fhicl::ParameterSet const &)
 
 Producer (Producer const &)=delete
 
 Producer (Producer &&)=delete
 
Produceroperator= (Producer const &)=delete
 
Produceroperator= (Producer &&)=delete
 
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)
 
- Public Member Functions inherited from art::Modifier
 ~Modifier () noexcept
 
 Modifier ()
 
 Modifier (Modifier const &)=delete
 
 Modifier (Modifier &&)=delete
 
Modifieroperator= (Modifier const &)=delete
 
Modifieroperator= (Modifier &&)=delete
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
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)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Member Functions

std::string ParticleStatus (int StatusCode)
 
std::string ReactionChannel (int ccnc, int mode)
 
void FillHistograms (simb::MCTruth mc)
 

Private Attributes

evgb::GENIEHelper * fGENIEHelp
 GENIEHelper object. More...
 
int fPassEmptySpills
 whether or not to kill evnets with no interactions More...
 
TStopwatch fStopwatch
 
double fGlobalTimeOffset
 keep track of how long it takes to run the job More...
 
double fRandomTimeOffset
 The start of a simulated "beam gate". More...
 
gar::sdp::BeamType_t fBeamType
 The width of a simulated "beam gate". More...
 
TH1F * fGenerated [6]
 The type of beam. More...
 
TH1F * fVertexX
 vertex location of generated events in x More...
 
TH1F * fVertexY
 vertex location of generated events in y More...
 
TH1F * fVertexZ
 vertex location of generated events in z More...
 
TH2F * fVertexXY
 vertex location in xy More...
 
TH2F * fVertexXZ
 vertex location in xz More...
 
TH2F * fVertexYZ
 vertex location in yz More...
 
TH1F * fDCosX
 direction cosine in x More...
 
TH1F * fDCosY
 direction cosine in y More...
 
TH1F * fDCosZ
 direction cosine in z More...
 
TH1F * fMuMomentum
 momentum of outgoing muons More...
 
TH1F * fMuDCosX
 direction cosine of outgoing mu in x More...
 
TH1F * fMuDCosY
 direction cosine of outgoing mu in y More...
 
TH1F * fMuDCosZ
 direction cosine of outgoing mu in z More...
 
TH1F * fEMomentum
 momentum of outgoing electrons More...
 
TH1F * fEDCosX
 direction cosine of outgoing e in x More...
 
TH1F * fEDCosY
 direction cosine of outgoing e in y More...
 
TH1F * fEDCosZ
 direction cosine of outgoing e in z More...
 
TH1F * fCCMode
 CC interaction mode. More...
 
TH1F * fNCMode
 CC interaction mode. More...
 
TH1F * fDeltaE
 difference in neutrino energy from MCTruth::Enu() vs TParticle More...
 
TH1F * fECons
 histogram to determine if energy is conserved in the event More...
 

Additional Inherited Members

- Public Types inherited from art::EDProducer
using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
- Public Types inherited from art::detail::Producer
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 
- Public Types inherited from art::Modifier
template<typename UserConfig , typename UserKeysToIgnore = void>
using Table = ProducerTable< UserConfig, detail::ModuleConfig, UserKeysToIgnore >
 
- Static Public Member Functions inherited from art::EDProducer
static void commitEvent (EventPrincipal &ep, Event &e)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
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 ()
 

Detailed Description

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

Note on random number generator

GENIE uses a TRandom generator for its purposes. Since art's RandomNumberGenerator service only provides CLHEP::HepRandomEngine, the standard GArSoft/art mechanism for handling the random stream can't be used. GENIEHelper, interface to GENIE provided by nutools, creates a TRandom that GENIE can use. It initializes it with a random seed read from RandomSeed configuration parameter. This and all the other parameters are inherited from the art module (that is, GENIEGen) configuration. GArSoft meddles with this mechanism to provide support for the standard "Seed" parameter and NuRandomService service.

Configuration parameters

As custom, if the random seed is not provided by the configuration, one is fetched from NuRandomService (if available), with the behaviour in gar::rndm::FetchRandomSeed().

Definition at line 99 of file GENIEGen_module.cc.

Constructor & Destructor Documentation

gar::evgen::GENIEGen::GENIEGen ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 160 of file GENIEGen_module.cc.

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  }
std::string string
Definition: nybbler.cc:12
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
gar::sdp::BeamType_t fBeamType
The width of a simulated "beam gate".
double fRandomTimeOffset
The start of a simulated "beam gate".
Unknown beam type.
Definition: BeamTypes.h:11
double fGlobalTimeOffset
keep track of how long it takes to run the job
int fPassEmptySpills
whether or not to kill evnets with no interactions
evgb::GENIEHelper * fGENIEHelp
GENIEHelper object.
LArSoft geometry interface.
Definition: ChannelGeo.h:16
gar::evgen::GENIEGen::~GENIEGen ( )
virtual

Definition at line 211 of file GENIEGen_module.cc.

212  {
213  // if(fGENIEHelp) delete fGENIEHelp;
214  fStopwatch.Stop();
215  mf::LogInfo("GENIEProductionTime") << "real time to produce file: " << fStopwatch.RealTime();
216  }
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo

Member Function Documentation

void gar::evgen::GENIEGen::beginJob ( )
virtual

Reimplemented from art::EDProducer.

Definition at line 219 of file GENIEGen_module.cc.

219  {
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  }
TH1F * fEDCosY
direction cosine of outgoing e in y
TH2F * fVertexXY
vertex location in xy
TH1F * fMuDCosY
direction cosine of outgoing mu in y
TH1F * fMuDCosZ
direction cosine of outgoing mu in z
TH1F * fCCMode
CC interaction mode.
TH1F * fVertexZ
vertex location of generated events in z
TH1F * fMuMomentum
momentum of outgoing muons
TH1F * fVertexY
vertex location of generated events in y
TH1F * fECons
histogram to determine if energy is conserved in the event
TH2F * fVertexXZ
vertex location in xz
TH2F * fVertexYZ
vertex location in yz
TH1F * fEMomentum
momentum of outgoing electrons
TH1F * fDeltaE
difference in neutrino energy from MCTruth::Enu() vs TParticle
TH1F * fMuDCosX
direction cosine of outgoing mu in x
TH1F * fDCosX
direction cosine in x
TH1F * fGenerated[6]
The type of beam.
TH1F * fDCosZ
direction cosine in z
TH1F * fDCosY
direction cosine in y
TH1F * fEDCosX
direction cosine of outgoing e in x
list x
Definition: train.py:276
evgb::GENIEHelper * fGENIEHelp
GENIEHelper object.
LArSoft geometry interface.
Definition: ChannelGeo.h:16
TH1F * fVertexX
vertex location of generated events in x
TH1F * fNCMode
CC interaction mode.
TH1F * fEDCosZ
direction cosine of outgoing e in z
void gar::evgen::GENIEGen::beginRun ( ::art::Run run)

Definition at line 282 of file GENIEGen_module.cc.

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  }
def move(depos, offset)
Definition: depos.py:107
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: DataViewImpl.h:686
LArSoft geometry interface.
Definition: ChannelGeo.h:16
void gar::evgen::GENIEGen::endRun ( ::art::Run run)

Definition at line 292 of file GENIEGen_module.cc.

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  }
def move(depos, offset)
Definition: depos.py:107
p
Definition: test.py:223
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: DataViewImpl.h:686
evgb::GENIEHelper * fGENIEHelp
GENIEHelper object.
void gar::evgen::GENIEGen::FillHistograms ( simb::MCTruth  mc)
private

< fill the vertex histograms from the neutrino - that is always particle 0 in the list

look for the outgoing lepton in the particle stack just interested in the first one

Definition at line 440 of file GENIEGen_module.cc.

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  }
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 PdgCode() const
Definition: MCParticle.h:212
int CCNC() const
Definition: MCNeutrino.h:148
const simb::MCNeutrino & GetNeutrino() const
Definition: MCTruth.h:77
TH2F * fVertexXY
vertex location in xy
double Py(const int i=0) const
Definition: MCParticle.h:231
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
TH1F * fVertexZ
vertex location of generated events in z
const simb::MCParticle & Nu() const
Definition: MCNeutrino.h:146
double Px(const int i=0) const
Definition: MCParticle.h:230
int NParticles() const
Definition: MCTruth.h:75
TH1F * fMuMomentum
momentum of outgoing muons
TH1F * fVertexY
vertex location of generated events in y
TH1F * fECons
histogram to determine if energy is conserved in the event
TH2F * fVertexXZ
vertex location in xz
TH2F * fVertexYZ
vertex location in yz
TH1F * fEMomentum
momentum of outgoing electrons
std::string ParticleStatus(int StatusCode)
T abs(T value)
TH1F * fMuDCosX
direction cosine of outgoing mu in x
double P(const int i=0) const
Definition: MCParticle.h:234
TH1F * fDCosX
direction cosine in x
TH1F * fGenerated[6]
The type of beam.
TH1F * fDCosZ
direction cosine in z
CodeOutputInterface * code
std::string ReactionChannel(int ccnc, int mode)
Q_EXPORT QTSManip setw(int w)
Definition: qtextstream.h:331
const simb::MCParticle & GetParticle(int i) const
Definition: MCTruth.h:76
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
Event generator information.
Definition: MCNeutrino.h:18
int Mode() const
Definition: MCNeutrino.h:149
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)
TH1F * fEDCosZ
direction cosine of outgoing e in z
std::string gar::evgen::GENIEGen::ParticleStatus ( int  StatusCode)
private

Definition at line 369 of file GENIEGen_module.cc.

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  }
std::string string
Definition: nybbler.cc:12
CodeOutputInterface * code
std::string ParticleStatusName(int code)
Describes the status of a particle (simb::MCParticle::StatusCode()).
void gar::evgen::GENIEGen::produce ( ::art::Event evt)

Definition at line 302 of file GENIEGen_module.cc.

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  }
int RescatterCode(void) const
Definition: GHepParticle.h:65
double E(void) const
Get energy.
Definition: GHepParticle.h:91
int FirstDaughter(void) const
Definition: GHepParticle.h:68
double Mass(void) const
Mass that corresponds to the PDG code.
double Pz(void) const
Get Pz.
Definition: GHepParticle.h:90
GHepStatus_t Status(void) const
Definition: GHepParticle.h:64
double Px(void) const
Get Px.
Definition: GHepParticle.h:88
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.
int LastDaughter(void) const
Definition: GHepParticle.h:69
def move(depos, offset)
Definition: depos.py:107
p
Definition: test.py:223
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: DataViewImpl.h:686
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.
int fPassEmptySpills
whether or not to kill evnets with no interactions
void FillHistograms(simb::MCTruth mc)
Generated Event Record. It is a GHepRecord object that can accept / be visited by EventRecordVisitorI...
Definition: EventRecord.h:37
#define MF_LOG_DEBUG(id)
evgb::GENIEHelper * fGENIEHelp
GENIEHelper object.
Event generator information.
Definition: MCTruth.h:32
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
Event finding and building.
double Py(void) const
Get Py.
Definition: GHepParticle.h:89
std::string gar::evgen::GENIEGen::ReactionChannel ( int  ccnc,
int  mode 
)
private

Definition at line 416 of file GENIEGen_module.cc.

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  }
std::string string
Definition: nybbler.cc:12
QTextStream & endl(QTextStream &s)

Member Data Documentation

gar::sdp::BeamType_t gar::evgen::GENIEGen::fBeamType
private

The width of a simulated "beam gate".

Definition at line 122 of file GENIEGen_module.cc.

TH1F* gar::evgen::GENIEGen::fCCMode
private

CC interaction mode.

Definition at line 148 of file GENIEGen_module.cc.

TH1F* gar::evgen::GENIEGen::fDCosX
private

direction cosine in x

Definition at line 134 of file GENIEGen_module.cc.

TH1F* gar::evgen::GENIEGen::fDCosY
private

direction cosine in y

Definition at line 135 of file GENIEGen_module.cc.

TH1F* gar::evgen::GENIEGen::fDCosZ
private

direction cosine in z

Definition at line 136 of file GENIEGen_module.cc.

TH1F* gar::evgen::GENIEGen::fDeltaE
private

difference in neutrino energy from MCTruth::Enu() vs TParticle

Definition at line 151 of file GENIEGen_module.cc.

TH1F* gar::evgen::GENIEGen::fECons
private

histogram to determine if energy is conserved in the event

Definition at line 152 of file GENIEGen_module.cc.

TH1F* gar::evgen::GENIEGen::fEDCosX
private

direction cosine of outgoing e in x

Definition at line 144 of file GENIEGen_module.cc.

TH1F* gar::evgen::GENIEGen::fEDCosY
private

direction cosine of outgoing e in y

Definition at line 145 of file GENIEGen_module.cc.

TH1F* gar::evgen::GENIEGen::fEDCosZ
private

direction cosine of outgoing e in z

Definition at line 146 of file GENIEGen_module.cc.

TH1F* gar::evgen::GENIEGen::fEMomentum
private

momentum of outgoing electrons

Definition at line 143 of file GENIEGen_module.cc.

TH1F* gar::evgen::GENIEGen::fGenerated[6]
private

The type of beam.

Spectra as generated

Definition at line 124 of file GENIEGen_module.cc.

evgb::GENIEHelper* gar::evgen::GENIEGen::fGENIEHelp
private

GENIEHelper object.

Definition at line 116 of file GENIEGen_module.cc.

double gar::evgen::GENIEGen::fGlobalTimeOffset
private

keep track of how long it takes to run the job

Definition at line 120 of file GENIEGen_module.cc.

TH1F* gar::evgen::GENIEGen::fMuDCosX
private

direction cosine of outgoing mu in x

Definition at line 139 of file GENIEGen_module.cc.

TH1F* gar::evgen::GENIEGen::fMuDCosY
private

direction cosine of outgoing mu in y

Definition at line 140 of file GENIEGen_module.cc.

TH1F* gar::evgen::GENIEGen::fMuDCosZ
private

direction cosine of outgoing mu in z

Definition at line 141 of file GENIEGen_module.cc.

TH1F* gar::evgen::GENIEGen::fMuMomentum
private

momentum of outgoing muons

Definition at line 138 of file GENIEGen_module.cc.

TH1F* gar::evgen::GENIEGen::fNCMode
private

CC interaction mode.

Definition at line 149 of file GENIEGen_module.cc.

int gar::evgen::GENIEGen::fPassEmptySpills
private

whether or not to kill evnets with no interactions

Definition at line 117 of file GENIEGen_module.cc.

double gar::evgen::GENIEGen::fRandomTimeOffset
private

The start of a simulated "beam gate".

Definition at line 121 of file GENIEGen_module.cc.

TStopwatch gar::evgen::GENIEGen::fStopwatch
private

Definition at line 118 of file GENIEGen_module.cc.

TH1F* gar::evgen::GENIEGen::fVertexX
private

vertex location of generated events in x

Definition at line 126 of file GENIEGen_module.cc.

TH2F* gar::evgen::GENIEGen::fVertexXY
private

vertex location in xy

Definition at line 130 of file GENIEGen_module.cc.

TH2F* gar::evgen::GENIEGen::fVertexXZ
private

vertex location in xz

Definition at line 131 of file GENIEGen_module.cc.

TH1F* gar::evgen::GENIEGen::fVertexY
private

vertex location of generated events in y

Definition at line 127 of file GENIEGen_module.cc.

TH2F* gar::evgen::GENIEGen::fVertexYZ
private

vertex location in yz

Definition at line 132 of file GENIEGen_module.cc.

TH1F* gar::evgen::GENIEGen::fVertexZ
private

vertex location of generated events in z

Definition at line 128 of file GENIEGen_module.cc.


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