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