GEVGDriver.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*
3  Copyright (c) 2003-2020, The GENIE Collaboration
4  For the full text of the license visit http://copyright.genie-mc.org
5 
6  Costas Andreopoulos <constantinos.andreopoulos \at cern.ch>
7  University of Liverpool & STFC Rutherford Appleton Laboratory
8 */
9 //____________________________________________________________________________
10 
11 #include <cassert>
12 #include <cstdlib>
13 #include <sstream>
14 
15 #include <TSystem.h>
16 #include <TMath.h>
17 
42 
43 using std::ostringstream;
44 
45 using namespace genie;
46 using namespace genie::controls;
47 
48 //____________________________________________________________________________
49 namespace genie {
50  ostream & operator<< (ostream& stream, const GEVGDriver & driver)
51  {
52  driver.Print(stream);
53  return stream;
54  }
55 }
56 //___________________________________________________________________________
58 {
59  this->Init();
60 }
61 //___________________________________________________________________________
63 {
64  this->CleanUp();
65 }
66 //___________________________________________________________________________
67 void GEVGDriver::Init(void)
68 {
69  // initial state for which this driver is configured
70  fInitState = 0;
71 
72  // current event record (ownership is transfered at GenerateEvent())
73  fCurrentRecord = 0;
74 
75  // list of Event Generator objects loaded into the driver
76  fEvGenList = 0;
77 
78  // interaction selector
79  fIntSelector = 0;
80 
81  // flag instructing the driver whether, for each interaction, to compute
82  // cross section by running their corresponding XSecAlgorithm or by
83  // evaluating their corresponding xsec spline
84  fUseSplines = false;
85 
86  // set of event generators to be loaded by this driver
87  fEventGenList = "Default";
88 
89  // 'depth' counter when entering a recursive mode to re-generate a failed/
90  // unphysical event - the driver is not allowed to go into arbitrarily large
91  // depths
92  fNRecLevel = 0;
93 
94  // an "interaction" -> "generator" associative contained built for all
95  // simulated interactions (from the loaded Event Generators and for the
96  // input initial state)
97  fIntGenMap = 0;
98 
99  // A spline describing the sum of all interaction cross sections given an
100  // initial state (the init state with which this driver was configured).
101  // Create it using the CreateXSecSumSpline() method
102  // The sum of all interaction cross sections is used, for example, by
103  // GMCJDriver for selecting an initial state.
104  fXSecSumSpl = 0;
105 
106  // Default driver behaviour is to filter out unphysical events
107  // If needed, set the fUnphysEventMask bitfield to get pre-selected types of
108  // unphysical events (just set to 1 the bit you want ignored from the check).
109  // Be warned that the event record for unphysical events might be incomplete
110  // depending on the processing step that event generation was stopped.
111  fUnphysEventMask = new TBits(GHepFlags::NFlags());
112  //fUnphysEventMask->ResetAllBits(true);
113  for(unsigned int i = 0; i < GHepFlags::NFlags(); i++) {
114  fUnphysEventMask->SetBitNumber(i, true);
115  }
116  LOG("GEVGDriver", pNOTICE)
117  << "Initializing unphysical event mask (bits: " << GHepFlags::NFlags()-1
118  << " -> 0) : " << *fUnphysEventMask;
119 }
120 //___________________________________________________________________________
122 {
123  if (fUnphysEventMask) delete fUnphysEventMask;
124  if (fInitState) delete fInitState;
125  if (fEvGenList) delete fEvGenList;
126  if (fIntSelector) delete fIntSelector;
127  if (fIntGenMap) delete fIntGenMap;
128  if (fXSecSumSpl) delete fXSecSumSpl;
129 }
130 //___________________________________________________________________________
132 {
133  this->CleanUp();
134  this->Init();
135 }
136 //___________________________________________________________________________
137 void GEVGDriver::Configure(int nu_pdgc, int Z, int A)
138 {
139  Target target(Z, A);
140  InitialState init_state(target, nu_pdgc);
141 
142  this->Configure(init_state);
143 }
144 //___________________________________________________________________________
146 {
147  InitialState init_state(is.TgtPdg(), is.ProbePdg()); // filter any other init state info
148 
149  ostringstream mesg;
150  mesg << "Configuring event generation driver for initial state: `"
151  << init_state.AsString()
152  << "' using event generator list: `"
153  << fEventGenList << "'.";
154 
155  LOG("GEVGDriver", pNOTICE)
156  << utils::print::PrintFramedMesg(mesg.str(), 0, '*');
157 
158  this -> BuildInitialState (init_state);
159  this -> BuildGeneratorList ();
160  this -> BuildInteractionGeneratorMap ();
161  this -> BuildInteractionSelector ();
162 
163  LOG("GEVGDriver", pINFO) << "Done configuring. \n";
164 }
165 //___________________________________________________________________________
167 {
168  LOG("GEVGDriver", pINFO) << "Setting the initial state";
169 
170  if(fInitState) delete fInitState;
171  fInitState = new InitialState(init_state);
172 
173  this->AssertIsValidInitState();
174 }
175 //___________________________________________________________________________
177 {
178 //! Load event generators.
179 //! The list of event generators is named by fEventGenList.
180 
181  LOG("GEVGDriver", pINFO)
182  << "Building the event generator list (specified list name: "
183  << fEventGenList << ")";
184 
185  EventGeneratorListAssembler evglist_assembler(fEventGenList.c_str());
186  fEvGenList = evglist_assembler.AssembleGeneratorList();
187 }
188 //___________________________________________________________________________
190 {
191 //! Map each possible interaction, for the given initial state, to one
192 //! of the generators loaded up
193 
194  LOG("GEVGDriver", pINFO)
195  << "Building the interaction -> generator associations...";
196 
197  fIntGenMap = new InteractionGeneratorMap;
198  fIntGenMap->UseGeneratorList(fEvGenList);
199  fIntGenMap->BuildMap(*fInitState);
200 
201  string mesgh = "Interaction -> Generator assignments for Initial State: ";
202 
203  LOG("GEVGDriver", pDEBUG)
204  << utils::print::PrintFramedMesg(mesgh + fInitState->AsString(), 0, '-')
205  << *fIntGenMap;
206 }
207 //___________________________________________________________________________
209 {
210  LOG("GEVGDriver", pINFO) << "Building the interaction selector...";
211 
212  AlgFactory * algf = AlgFactory::Instance();
213 
214  if(fIntSelector) delete fIntSelector;
215  fIntSelector = dynamic_cast<InteractionSelectorI *> (
216  algf->AdoptAlgorithm("genie::PhysInteractionSelector","Default"));
217 }
218 //___________________________________________________________________________
220 {
221  *fUnphysEventMask = mask;
222 
223  LOG("GEVGDriver", pNOTICE)
224  << "Setting unphysical event mask (bits: " << GHepFlags::NFlags() - 1
225  << " -> 0) : " << *fUnphysEventMask;
226 }
227 //___________________________________________________________________________
228 EventRecord * GEVGDriver::GenerateEvent(const TLorentzVector & nu4p)
229 {
230  //-- Build initial state information from inputs
231  LOG("GEVGDriver", pINFO) << "Creating the initial state";
232  InitialState init_state(*fInitState);
233  init_state.SetProbeP4(nu4p);
234 
235  //-- Select the interaction to be generated (amongst the entries of the
236  // InteractionList assembled by the EventGenerators) and bootstrap the
237  // event record
238  LOG("GEVGDriver", pINFO)
239  << "Selecting an Interaction & Bootstraping the EventRecord";
240  fCurrentRecord = fIntSelector->SelectInteraction(fIntGenMap, nu4p);
241 
242  if(!fCurrentRecord) {
243  LOG("GEVGDriver", pWARN)
244  << "No interaction could be selected for: "
245  << init_state.AsString() << " at E = " << nu4p.E() << " GeV";
246  return 0;
247  }
248 
249  //-- Get a ptr to the interaction summary
250  LOG("GEVGDriver", pDEBUG) << "Getting the selected interaction";
251  Interaction * interaction = fCurrentRecord->Summary();
252 
253  //-- Find the appropriate concrete EventGeneratorI implementation
254  // for generating this event.
255  //
256  // The right EventGeneratorI will be selecting by iterating over the
257  // entries of the EventGeneratorList and compare the interaction
258  // against the ValidityContext declared by each EventGeneratorI
259  //
260  // (note: use of the 'Chain of Responsibility' Design Pattern)
261 
262  LOG("GEVGDriver", pINFO) << "Finding an appropriate EventGenerator";
263 
264  const EventGeneratorI * evgen = fIntGenMap->FindGenerator(interaction);
265  assert(evgen);
266 
268  rtinfo->UpdateRunningThread(evgen);
269 
270  //-- Generate the selected event
271  //
272  // The selected EventGeneratorI subclass will start processing the
273  // event record (by sequentially asking each entry in its list of
274  // EventRecordVisitorI subclasses to visit and process the record).
275  // Most of the actual event generation takes place in this step.
276  //
277  // (note: use of the 'Visitor' Design Pattern)
278 
279  string mesg = "Requesting from event generation thread: " +
280  evgen->Id().Key() + " to generate the selected interaction";
281 
282  LOG("GEVGDriver", pNOTICE)
283  << utils::print::PrintFramedMesg(mesg,1,'=');
284 
285  fCurrentRecord->SetUnphysEventMask(*fUnphysEventMask);
286  evgen->ProcessEventRecord(fCurrentRecord);
287 
288  //-- Check the generated event flags. The default behaviour is
289  // to reject an unphysical event and enter in recursive mode
290  // and try to regenerate it. If an unphysical event mask has
291  // been set, error conditions may be ignored so that the
292  // requested classes of unphysical events can be passed-through.
293 
294  bool unphys = fCurrentRecord->IsUnphysical();
295  if(!unphys) {
296  LOG("GEVGDriver", pINFO) << "Returning the current event!";
297  fNRecLevel = 0;
298  return fCurrentRecord; // The client 'adopts' the event record
299  } else {
300  LOG("GEVGDriver", pWARN) << "An unphysical event was generated...";
301  // Check whether the user wants to ignore the err
302  bool accept = fCurrentRecord->Accept();
303  if(accept) {
304  LOG("GEVGDriver", pWARN)
305  << "The generated unphysical event is accepted by the user";
306  fNRecLevel = 0;
307  return fCurrentRecord; // The client 'adopts' the event record
308 
309  } else {
310  LOG("GEVGDriver", pWARN)
311  << "The generated unphysical event is rejected";
312  delete fCurrentRecord;
313  fCurrentRecord = 0;
314  fNRecLevel++; // increase the nested level counter
315 
316  if(fNRecLevel<=kRecursiveModeMaxDepth) {
317  LOG("GEVGDriver", pWARN)
318  << "Attempting to regenerate the event...";
319  return this->GenerateEvent(nu4p);
320  } else {
321  LOG("GEVGDriver", pERROR)
322  << "Could not produce a physical event after "
323  << kRecursiveModeMaxDepth << " attempts!";
324  delete fCurrentRecord;
325  fCurrentRecord = 0;
326  fNRecLevel = 0;
327  return 0;
328 // exit(1);
329  }
330  }
331  }
332 }
333 //___________________________________________________________________________
335 {
336 // Returns the list of all interactions that can be generated by this driver
337 
338  if(!fIntGenMap) {
339  LOG("GEVGDriver", pWARN)
340  << "Interaction->Generator Map has not being built yet!";
341  return 0;
342  }
343 
344  const InteractionList & ilst = fIntGenMap->GetInteractionList();
345  return &ilst;
346 }
347 //___________________________________________________________________________
349 {
350  LOG("GEVGDriver", pNOTICE)
351  << "Setting event generator list: " << listname;
352 
353  fEventGenList = listname;
354 }
355 //___________________________________________________________________________
356 const EventGeneratorI *
358 {
359  if(!interaction) {
360  LOG("GEVGDriver", pWARN) << "Null interaction!!";
361  return 0;
362  }
363  if(!fIntGenMap) {
364  LOG("GEVGDriver", pWARN)
365  << "Interaction->Generator Map has not being built yet!";
366  return 0;
367  }
368 
369  const EventGeneratorI * evgen = fIntGenMap->FindGenerator(interaction);
370  return evgen;
371 }
372 //___________________________________________________________________________
373 double GEVGDriver::XSecSum(const TLorentzVector & nup4)
374 {
375 // Computes the sum of the cross sections for all the interactions that can
376 // be simulated for the given initial state and for the input neutrino energy
377 //
378  LOG("GEVGDriver", pDEBUG) << "Computing the cross section sum";
379 
380  double xsec_sum = 0;
381 
382  // Get the list of spline objects
383  // Should have been constructed at the job initialization
385 
386  // Get the list of all interactions that can be generated by this driver
387  const InteractionList & ilst = fIntGenMap->GetInteractionList();
388 
389  // Loop over all interactions & compute cross sections
391  for(intliter = ilst.begin(); intliter != ilst.end(); ++intliter) {
392 
393  // get current interaction
394  Interaction * interaction = new Interaction(**intliter);
395  interaction->InitStatePtr()->SetProbeP4(nup4);
396 
397  string code = interaction->AsString();
398  SLOG("GEVGDriver", pDEBUG)
399  << "Compute cross section for interaction: \n" << code;
400 
401  // get corresponding cross section algorithm
402  const XSecAlgorithmI * xsec_alg =
403  fIntGenMap->FindGenerator(interaction)->CrossSectionAlg();
404  assert(xsec_alg);
405 
406  // compute (or evaluate) the cross section
407  double xsec = 0;
408  bool spline_exists = xssl->SplineExists(xsec_alg, interaction);
409  if (spline_exists && fUseSplines) {
410  double E = nup4.Energy();
411  xsec = xssl->GetSpline(xsec_alg,interaction)->Evaluate(E);
412  } else
413  xsec = xsec_alg->Integral(interaction);
414 
415  xsec = TMath::Max(0., xsec);
416 
417  // sum-up and report
418  xsec_sum += xsec;
419  LOG("GEVGDriver", pDEBUG)
420  << "\nInteraction = " << code
421  << "\nCross Section "
422  << (fUseSplines ? "*interpolated*" : "*computed*")
423  << " = " << (xsec/units::cm2) << " cm2";
424 
425  delete interaction;
426  } // loop over event generators
427 
428  PDGLibrary * pdglib = PDGLibrary::Instance();
429  LOG("GEVGDriver", pINFO)
430  << "SumXSec("
431  << pdglib->Find(fInitState->ProbePdg())->GetName() << "+"
432  << pdglib->Find(fInitState->Tgt().Pdg())->GetName() << "->X, "
433  << "E = " << nup4.Energy() << " GeV)"
434  << (fUseSplines ? "*interpolated*" : "*computed*")
435  << " = " << (xsec_sum/units::cm2) << " cm2";
436 
437  return xsec_sum;
438 }
439 //___________________________________________________________________________
441  int nk, double Emin, double Emax, bool inlogE)
442 {
443 // This method creates a spline with the *total* cross section vs E (or logE)
444 // for the initial state that this driver was configured with.
445 // This spline is used, for example, by the GMCJDriver to select a target
446 // material out of all the materials in a detector geometry (summing the
447 // cross sections again and again proved to be expensive...)
448 
449  LOG("GEVGDriver", pINFO)
450  << "Creating spline (sum-xsec = f(" << ((inlogE) ? "logE" : "E")
451  << ") in E = [" << Emin << ", " << Emax << "] using " << nk << " knots";
452 
453  if(!fUseSplines) {
454  LOG("GEVGDriver", pFATAL) << "You haven't loaded any splines!! ";
455  }
456  assert(fUseSplines);
457  assert(Emin<Emax && Emin>0 && nk>2);
458 
459  double logEmin=0, logEmax=0, dE=0;
460 
461  double * E = new double[nk];
462  double * xsec = new double[nk];
463 
464  if(inlogE) {
465  logEmin = TMath::Log(Emin);
466  logEmax = TMath::Log(Emax);
467  dE = (logEmax-logEmin)/(nk-1);
468  } else {
469  dE = (Emax-Emin)/(nk-1);
470  }
471 
472  TLorentzVector p4(0,0,0,0);
473 
474  for(int i=0; i<nk; i++) {
475  double e = (inlogE) ? TMath::Exp(logEmin + i*dE) : Emin + i*dE;
476  p4.SetPxPyPzE(0.,0.,e,e);
477  double xs = this->XSecSum(p4);
478 
479  E[i] = e;
480  xsec[i] = xs;
481  }
482  if (fXSecSumSpl) delete fXSecSumSpl;
483  fXSecSumSpl = new Spline(nk, E, xsec);
484  delete [] E;
485  delete [] xsec;
486 }
487 //___________________________________________________________________________
489 {
490 // Returns the cross section spline for the input interaction as was
491 // computed from the cross section model associated with that interaction.
492 
493  if (!fUseSplines) return 0;
494 
495  // Get the list of spline objects
496  // Should have been constructed at the job initialization
498 
499  // get corresponding cross section algorithm for the input interaction
500  const XSecAlgorithmI * xsec_alg =
501  fIntGenMap->FindGenerator(interaction)->CrossSectionAlg();
502  assert(xsec_alg);
503 
504  const Spline * spl = xssl->GetSpline(xsec_alg,interaction);
505  return spl;
506 }
507 //___________________________________________________________________________
509 {
510 // Instructs the driver to use cross section splines rather than computing
511 // cross sections by integrating the differential cross section model which
512 // can be very time-consuming.
513 // **Note**
514 // -- If you called GEVGDriver::CreateSplines() already the driver would
515 // a) assume that you want to use them and b) would be assured that it
516 // has all the splines it needs, so you do not need to call this method.
517 // -- If you populated the XSecSplineList in another way without this driver
518 // knowing about it, eg from an external XML file, do call this method
519 // to let the driver know that you want to use the splines. However, note
520 // that the driver would **explicitly check** that you have loaded all the
521 // splines it needs. If not, then its fiery personality will take over and
522 // it will refuse your request, reverting back to not using splines.
523 
524  fUseSplines = true;
525 
526  // Get the list of spline objects
527  // Should have been constructed at the job initialization
529 
530  // If the user wants to use splines, make sure that all the splines needed
531  // have been computed or loaded
532  if(fUseSplines) {
533 
534  // Get the list of all interactions that can be generated by this driver
535  const InteractionList & ilst = fIntGenMap->GetInteractionList();
536 
537  // Loop over all interactions & check that all splines have been loaded
539  for(intliter = ilst.begin(); intliter != ilst.end(); ++intliter) {
540 
541  // current interaction
542  Interaction * interaction = *intliter;
543 
544  // corresponding cross section algorithm
545  const XSecAlgorithmI * xsec_alg =
546  fIntGenMap->FindGenerator(interaction)->CrossSectionAlg();
547  assert(xsec_alg);
548 
549  // spline exists in spline list?
550  bool spl_exists = xsl->SplineExists(xsec_alg, interaction);
551 
552  // update the 'use splines' flag
553  fUseSplines = fUseSplines && spl_exists;
554 
555  if(!spl_exists) {
556  if(!xsec_alg) {
557  LOG("GEVGDriver", pWARN)
558  << "Null cross-section algorithm! Can not load cross-section spline.";
559  return;
560  }
561  if(!interaction) {
562  LOG("GEVGDriver", pWARN)
563  << "Null interaction! Can not load cross-section spline.";
564  return;
565  }
566  LOG("GEVGDriver", pWARN)
567  << "*** At least a spline (algorithm: "
568  << xsec_alg->Id().Key() << ", interaction: "
569  << interaction->AsString() << " doesn't exist. "
570  << "Reverting back to not using splines";
571  return;
572  }
573  } // loop over interaction list
574  }//use-splines?
575 }
576 //___________________________________________________________________________
577 void GEVGDriver::CreateSplines(int nknots, double emax, bool useLogE)
578 {
579 // Creates all the cross section splines that are needed by this driver.
580 // It will check for pre-loaded splines and it will skip the creation of the
581 // splines it already finds loaded.
582 
583  LOG("GEVGDriver", pINFO)
584  << "Creating (missing) splines with [UseLogE: "
585  << ((useLogE) ? "ON]" : "OFF]");
586  // Get the list of spline objects
588  xsl->SetLogE(useLogE);
589 
590  EventGeneratorList::const_iterator evgliter; // event generator list iter
591  InteractionList::iterator intliter; // interaction list iter
592 
593  // loop over all EventGenerator objects used in the current job
594  for(evgliter = fEvGenList->begin();
595  evgliter != fEvGenList->end(); ++evgliter) {
596  // current event generator
597  const EventGeneratorI * evgen = *evgliter;
598  LOG("GEVGDriver", pINFO)
599  << "Querying [" << evgen->Id().Key()
600  << "] for its InteractionList";
601 
602  // ask the event generator to produce a list of all interaction it can
603  // generate for the input initial state
604  const InteractionListGeneratorI * ilstgen = evgen->IntListGenerator();
605  InteractionList * ilst = ilstgen->CreateInteractionList(*fInitState);
606  if(!ilst) continue;
607 
608  // total cross section algorithm used by the current EventGenerator
609  const XSecAlgorithmI * alg = evgen->CrossSectionAlg();
610 
611  // get the energy range of the spline from the EventGenerator
612  // validity context
613  double Emin = TMath::Max(0.001,evgen->ValidityContext().Emin());
614  double Emax = evgen->ValidityContext().Emax();
615 
616  // if the user set a maximum energy, create the spline up to this
617  // energy - otherwise use the upper limit of the validity range of
618  // the current generator
619  if ( emax > 0 ) {
620  if ( emax > Emax ) {
621  LOG("GEVGDriver", pWARN)
622  << "Refusing to exceed validity range: Emax = " << Emax;
623  }
624  emax = TMath::Min(emax,Emax); // don't exceed validity range
625  } else {
626  emax = Emax;
627  }
628 
629  assert( emax > Emin );
630 
631  // number of knots: use specified number. If not set, use 15 knots
632  // per decade. Don't use less than 30 knots.
633  if ( nknots < 0 ) {
634  nknots = (int) (15 * TMath::Log10(emax-Emin));
635  }
636  nknots = TMath::Max(nknots,30);
637 
638  // loop over all interactions that can be generated and ask the
639  // appropriate cross section algorithm to compute its cross section
640  for(intliter = ilst->begin(); intliter != ilst->end(); ++intliter) {
641 
642  // current interaction
643  Interaction * interaction = *intliter;
644  string code = interaction->AsString();
645 
646  SLOG("GEVGDriver", pINFO) << "Need xsec spline for " << code;
647 
648  // only create the spline if it does not already exists
649  bool spl_exists = xsl->SplineExists(alg, interaction);
650  if(!spl_exists) {
651  SLOG("GEVGDriver", pDEBUG)
652  << "The spline wasn't loaded at initialization. "
653  << "I can build it now but it might take a while...";
654  xsl->CreateSpline(alg, interaction, nknots, Emin, emax);
655  } else {
656  SLOG("GEVGDriver", pDEBUG) << "Spline was found";
657  }
658  } // loop over interaction that can be generated by this generator
659  delete ilst;
660  ilst = 0;
661  } // loop over event generators
662 
663  LOG("GEVGDriver", pINFO) << *xsl; // print list of splines
664 
665  fUseSplines = true;
666 }
667 //___________________________________________________________________________
669 {
670 // loops over all loaded event generation threads, queries for the energy
671 // range at their validity context and builds the valid energy range for
672 // this driver
673 
674  Range1D_t E;
675  E.min = 9999;
676  E.max = -9999;
677 
678  EventGeneratorList::const_iterator evgliter; // event generator list iter
679 
680  // loop over all EventGenerator objects used in the current job
681  for(evgliter = fEvGenList->begin();
682  evgliter != fEvGenList->end(); ++evgliter) {
683  // current event generator
684  const EventGeneratorI * evgen = *evgliter;
685 
686  // Emin, Emax as declared in current generator's validity context
687  double Emin = TMath::Max(0.001,evgen->ValidityContext().Emin());
688  double Emax = evgen->ValidityContext().Emax();
689 
690  // combined Emin, Emax
691  E.min = TMath::Min(E.min, Emin);
692  E.max = TMath::Max(E.max, Emax);
693  }
694  assert(E.min<E.max && E.min>=0);
695  return E;
696 }
697 //___________________________________________________________________________
699 {
700  assert(fInitState);
701  int ppdgc = fInitState->ProbePdg();
702  bool isv = pdg::IsLepton(ppdgc) || pdg::IsDarkMatter(ppdgc) || pdg::IsAntiDarkMatter(ppdgc);
703  assert(isv);
704 }
705 //___________________________________________________________________________
706 void GEVGDriver::Print(ostream & stream) const
707 {
708  stream
709  << "\n\n *********************** GEVGDriver ***************************";
710 
711  int ppdg = fInitState->ProbePdg();
712  int tgtpdg = fInitState->Tgt().Pdg();
713 
714  stream << "\n |---o Probe PDG-code ......: " << ppdg;
715  stream << "\n |---o Target PDG-code .....: " << tgtpdg;
716 
717  stream << "\n |---o Using cross section splines is turned "
718  << utils::print::BoolAsIOString(fUseSplines);
719  stream << "\n |---o Unphysical event filter mask ("
720  << GHepFlags::NFlags() << "->0) = " << *fUnphysEventMask;
721 
722  stream << "\n *********************************************************\n";
723 }
724 //___________________________________________________________________________
Cross Section Calculation Interface.
void Print(ostream &stream) const
Definition: GEVGDriver.cxx:706
intermediate_table::iterator iterator
void CreateXSecSumSpline(int nk, double Emin, double Emax, bool inlogE=true)
Definition: GEVGDriver.cxx:440
void SetProbeP4(const TLorentzVector &P4)
THE MAIN GENIE PROJECT NAMESPACE
Definition: AlgCmp.h:25
virtual void ProcessEventRecord(GHepRecord *event_rec) const =0
#define pERROR
Definition: Messenger.h:59
void CreateSpline(const XSecAlgorithmI *alg, const Interaction *i, int nknots=-1, double e_min=-1, double e_max=-1)
void Reset(void)
Definition: GEVGDriver.cxx:131
Defines the InteractionListGeneratorI interface. Concrete implementations of this interface generate ...
virtual const InteractionListGeneratorI * IntListGenerator(void) const =0
A simple [min,max] interval for doubles.
Definition: Range1.h:42
const EventGeneratorI * FindGenerator(const Interaction *interaction) const
Definition: GEVGDriver.cxx:357
bool SplineExists(const XSecAlgorithmI *alg, const Interaction *i) const
A numeric analysis tool class for interpolating 1-D functions.
Definition: Spline.h:46
#define pFATAL
Definition: Messenger.h:56
void Init(void)
Definition: GEVGDriver.cxx:67
Defines the EventGeneratorI interface.
bool IsDarkMatter(int pdgc)
Definition: PDGUtils.cxx:124
intermediate_table::const_iterator const_iterator
void BuildInteractionGeneratorMap(void)
Definition: GEVGDriver.cxx:189
static XSecSplineList * Instance()
double Evaluate(double x) const
Definition: Spline.cxx:361
string AsString(void) const
virtual const GVldContext & ValidityContext(void) const =0
Range1D_t ValidEnergyRange(void) const
Definition: GEVGDriver.cxx:668
string BoolAsIOString(bool b)
Definition: PrintUtils.cxx:102
void GenerateEvent(string mesg)
Definition: gEvServ.cxx:390
Summary information for an interaction.
Definition: Interaction.h:56
An Interaction -> EventGeneratorI associative container. The container is being built for the loaded ...
static unsigned int NFlags(void)
Definition: GHepFlags.h:76
const double e
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
void SetEventGeneratorList(string listname)
Definition: GEVGDriver.cxx:348
bool IsAntiDarkMatter(int pdgc)
Definition: PDGUtils.cxx:130
const InteractionList * Interactions(void) const
Definition: GEVGDriver.cxx:334
static constexpr double cm2
Definition: Units.h:69
double XSecSum(const TLorentzVector &nup4)
Definition: GEVGDriver.cxx:373
virtual double Integral(const Interaction *i) const =0
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
Definition: Target.h:40
int ProbePdg(void) const
Definition: InitialState.h:64
string AsString(void) const
CodeOutputInterface * code
GENIE Event Generation Driver. A minimalist user interface object for generating neutrino interaction...
Definition: GEVGDriver.h:54
#define pINFO
Definition: Messenger.h:62
Algorithm * AdoptAlgorithm(const AlgId &algid) const
Definition: AlgFactory.cxx:116
virtual InteractionList * CreateInteractionList(const InitialState &init) const =0
void Init(void)
Definition: gXSecComp.cxx:138
Misc GENIE control constants.
#define pWARN
Definition: Messenger.h:60
virtual const XSecAlgorithmI * CrossSectionAlg(void) const =0
void BuildGeneratorList(void)
Definition: GEVGDriver.cxx:176
Generated Event Record. It is a GHepRecord object that can accept / be visited by EventRecordVisitorI...
Definition: EventRecord.h:37
Defines the InteractionSelectorI interface to be implemented by algorithms selecting interactions to ...
static RunningThreadInfo * Instance(void)
void BuildInteractionSelector(void)
Definition: GEVGDriver.cxx:208
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition: Algorithm.h:97
double max
Definition: Range1.h:53
static PDGLibrary * Instance(void)
Definition: PDGLibrary.cxx:57
static AlgFactory * Instance()
Definition: AlgFactory.cxx:64
const Spline * XSecSpline(const Interaction *interaction) const
Definition: GEVGDriver.cxx:488
Singleton class to load & serve a TDatabasePDG.
Definition: PDGLibrary.h:32
ostream & operator<<(ostream &stream, const AlgConfigPool &config_pool)
void UpdateRunningThread(const EventGeneratorI *evg)
double Emax(void) const
Definition: GVldContext.h:46
E
Definition: 018_def.c:13
void Configure(string mesg)
Definition: gEvServ.cxx:196
int TgtPdg(void) const
void SetLogE(bool on)
set opt to build splines as f(E) or as f(logE)
void Configure(int nu_pdgc, int Z, int A)
Definition: GEVGDriver.cxx:137
#define A
Definition: memgrp.cpp:38
A vector of Interaction objects.
InitialState * InitStatePtr(void) const
Definition: Interaction.h:74
string PrintFramedMesg(string mesg, unsigned int nl=1, const char f='*')
Definition: PrintUtils.cxx:164
void CreateSplines(int nknots=-1, double emax=-1, bool inLogE=true)
Definition: GEVGDriver.cxx:577
double Emin(void) const
Definition: GVldContext.h:45
double min
Definition: Range1.h:52
void UseSplines(void)
Definition: GEVGDriver.cxx:508
TParticlePDG * Find(int pdgc, bool must_exist=true)
Definition: PDGLibrary.cxx:75
#define pNOTICE
Definition: Messenger.h:61
The GENIE Algorithm Factory.
Definition: AlgFactory.h:39
void UseGeneratorList(const EventGeneratorList *list)
void SetUnphysEventMask(const TBits &mask)
Definition: GEVGDriver.cxx:219
#define SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...
Definition: Messenger.h:84
const Spline * GetSpline(const XSecAlgorithmI *alg, const Interaction *i) const
List of cross section vs energy splines.
Event Generation using GENIE, cosmics or single particles.
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils...
void CleanUp(void)
Definition: GEVGDriver.cxx:121
Keep info on the event generation thread currently on charge. This is used so that event generation m...
string Key(void) const
Definition: AlgId.h:46
void AssertIsValidInitState(void) const
Definition: GEVGDriver.cxx:698
bool IsLepton(int pdgc)
Definition: PDGUtils.cxx:83
Assembles a list of all the EventGeneratorI subclasses that can be employed during a neutrino event g...
Initial State information.
Definition: InitialState.h:48
#define pDEBUG
Definition: Messenger.h:63
EventRecord * GenerateEvent(const TLorentzVector &nu4p)
Definition: GEVGDriver.cxx:228
void BuildInitialState(const InitialState &init_state)
Definition: GEVGDriver.cxx:166
static const unsigned int kRecursiveModeMaxDepth
Definition: Controls.h:29