GEVGDriver.h
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*!
3 
4 \class genie::GEVGDriver
5 
6 \brief GENIE Event Generation Driver.
7  A minimalist user interface object for generating neutrino interactions.
8  Each such object is configured for a given initial state and it drives all
9  relevant GENIE neutrino interaction physics simulation code for that state.
10  To set-up MC jobs involving a multitude of possible initial states,
11  including arbitrarily complex neutrino flux and detector geometry
12  descriptions, see the GMCJDriver object.
13 
14 \author Costas Andreopoulos <costas.andreopoulos \at stfc.ac.uk>
15  University of Liverpool & STFC Rutherford Appleton Lab
16 
17 \created August 06, 2004
18 
19 \cpright Copyright (c) 2003-2019, The GENIE Collaboration
20  For the full text of the license visit http://copyright.genie-mc.org
21  or see $GENIE/LICENSE
22 */
23 //____________________________________________________________________________
24 
25 #ifndef _GEVG_DRIVER_H_
26 #define _GEVG_DRIVER_H_
27 
28 #include <ostream>
29 #include <string>
30 
31 #include <TLorentzVector.h>
32 #include <TBits.h>
33 
34 #include "Framework/Utils/Range1.h"
35 
36 using std::ostream;
37 using std::string;
38 
39 namespace genie {
40 
41 class GEVGDriver;
42 class EventRecord;
43 class EventGeneratorList;
44 class EventGeneratorI;
45 class InteractionSelectorI;
46 class InteractionGeneratorMap;
47 class InteractionList;
48 class Interaction;
49 class InitialState;
50 class Target;
51 class Spline;
52 
53 ostream & operator << (ostream & stream, const GEVGDriver & driver);
54 
55 class GEVGDriver {
56 
57 public :
58  GEVGDriver();
59  ~GEVGDriver();
60 
61  // Driver options:
62  // - Set before calling Configure()
63  void UseSplines (void);
64  void SetEventGeneratorList(string listname);
65  // - Set before GenerateEvent()
66  void SetUnphysEventMask(const TBits & mask);
67 
68  // Configure the driver
69  void Configure (int nu_pdgc, int Z, int A);
70  void Configure (const InitialState & init_state);
71 
72  // Generate single event
73  EventRecord * GenerateEvent (const TLorentzVector & nu4p);
74 
75  // Get the list of all interactions that can be simulated for the specified
76  // initial state (depends on which event generation threads were loaded into
77  // the event generation driver driver)
78  const InteractionList * Interactions(void) const;
79 
80  // Get event generator thread list
81  const EventGeneratorList * EventGenerators (void) const { return fEvGenList; }
82 
83  // Get the event generator that is responsible for generating the input event
84  const EventGeneratorI * FindGenerator(const Interaction * interaction) const;
85 
86  // Cross section splines for input interaction and for the sum of all
87  // simulated interactions for the specified initial state
88  const Spline * XSecSumSpline (void) const { return fXSecSumSpl; }
89  const Spline * XSecSpline (const Interaction * interaction) const;
90 
91  // Instruct the driver to create all the splines it needs
92  void CreateSplines (int nknots=-1, double emax=-1, bool inLogE=true);
93 
94  // Methods used for building the 'total' cross section spline
95  double XSecSum (const TLorentzVector & nup4);
96  void CreateXSecSumSpline (int nk, double Emin, double Emax, bool inlogE=true);
97 
98  // Get validity range (combined validity range of loaded evg threads)
99  Range1D_t ValidEnergyRange (void) const;
100 
101  // Reset, Print etc
102  void Reset (void);
103  void Print (ostream & stream) const;
104 
105  friend ostream & operator << (ostream & stream, const GEVGDriver & driver);
106 
107 private:
108 
109  // Private initialization, configuration & input validation methods
110  void Init (void);
111  void CleanUp (void);
112  void BuildInitialState (const InitialState & init_state);
113  void BuildGeneratorList (void);
114  void BuildInteractionGeneratorMap (void);
115  void BuildInteractionSelector (void);
116  void AssertIsValidInitState (void) const;
117 
118  // Private data members
119  InitialState * fInitState; ///< initial state information for driver instance
120  EventRecord * fCurrentRecord; ///< ptr to the event record being processed
121  EventGeneratorList * fEvGenList; ///< all Event Generators available at this job
122  InteractionSelectorI * fIntSelector; ///< interaction selector
123  InteractionGeneratorMap * fIntGenMap; ///< interaction -> generator assosiative container
124  TBits * fUnphysEventMask; ///< controls whether unphysical events are returned
125  bool fUseSplines; ///< controls whether xsecs are computed or interpolated
126  Spline * fXSecSumSpl; ///< sum{xsec(all interactions | this init state)}
127  unsigned int fNRecLevel; ///< recursive mode depth counter
128  string fEventGenList; ///< list of event generators loaded by this driver (what used to be the $GEVGL setting)
129 };
130 
131 } // genie namespace
132 
133 #endif // _GENIE_H_
EventRecord * fCurrentRecord
ptr to the event record being processed
Definition: GEVGDriver.h:120
void Print(ostream &stream) const
Definition: GEVGDriver.cxx:707
void CreateXSecSumSpline(int nk, double Emin, double Emax, bool inlogE=true)
Definition: GEVGDriver.cxx:441
THE MAIN GENIE PROJECT NAMESPACE
Definition: GeneratorBase.h:8
void Reset(void)
Definition: GEVGDriver.cxx:132
A simple [min,max] interval for doubles.
Definition: Range1.h:43
const EventGeneratorI * FindGenerator(const Interaction *interaction) const
Definition: GEVGDriver.cxx:358
A numeric analysis tool class for interpolating 1-D functions.
Definition: Spline.h:47
void Init(void)
Definition: GEVGDriver.cxx:68
string fEventGenList
list of event generators loaded by this driver (what used to be the $GEVGL setting) ...
Definition: GEVGDriver.h:128
Defines the EventGeneratorI interface.
friend ostream & operator<<(ostream &stream, const GEVGDriver &driver)
Definition: GEVGDriver.cxx:51
unsigned int fNRecLevel
recursive mode depth counter
Definition: GEVGDriver.h:127
void BuildInteractionGeneratorMap(void)
Definition: GEVGDriver.cxx:190
const Spline * XSecSumSpline(void) const
Definition: GEVGDriver.h:88
InteractionSelectorI * fIntSelector
interaction selector
Definition: GEVGDriver.h:122
const EventGeneratorList * EventGenerators(void) const
Definition: GEVGDriver.h:81
Float_t Z
Definition: plot.C:38
Range1D_t ValidEnergyRange(void) const
Definition: GEVGDriver.cxx:669
Summary information for an interaction.
Definition: Interaction.h:56
An Interaction -> EventGeneratorI associative container. The container is being built for the loaded ...
void SetEventGeneratorList(string listname)
Definition: GEVGDriver.cxx:349
const Int_t nknots
Definition: testXsec.C:24
TBits * fUnphysEventMask
controls whether unphysical events are returned
Definition: GEVGDriver.h:124
const InteractionList * Interactions(void) const
Definition: GEVGDriver.cxx:335
const double emax
double XSecSum(const TLorentzVector &nup4)
Definition: GEVGDriver.cxx:374
GENIE Event Generation Driver. A minimalist user interface object for generating neutrino interaction...
Definition: GEVGDriver.h:55
InitialState * fInitState
initial state information for driver instance
Definition: GEVGDriver.h:119
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
Defines the InteractionSelectorI interface to be implemented by algorithms selecting interactions to ...
void BuildInteractionSelector(void)
Definition: GEVGDriver.cxx:209
static const double A
Definition: Units.h:82
const Spline * XSecSpline(const Interaction *interaction) const
Definition: GEVGDriver.cxx:489
ostream & operator<<(ostream &stream, const AlgConfigPool &config_pool)
Spline * fXSecSumSpl
sum{xsec(all interactions | this init state)}
Definition: GEVGDriver.h:126
InteractionGeneratorMap * fIntGenMap
interaction -> generator assosiative container
Definition: GEVGDriver.h:123
void Configure(int nu_pdgc, int Z, int A)
Definition: GEVGDriver.cxx:138
A vector of Interaction objects.
double Emax
A vector of EventGeneratorI objects.
void CreateSplines(int nknots=-1, double emax=-1, bool inLogE=true)
Definition: GEVGDriver.cxx:578
void UseSplines(void)
Definition: GEVGDriver.cxx:509
void SetUnphysEventMask(const TBits &mask)
Definition: GEVGDriver.cxx:220
void CleanUp(void)
Definition: GEVGDriver.cxx:122
EventGeneratorList * fEvGenList
all Event Generators available at this job
Definition: GEVGDriver.h:121
void AssertIsValidInitState(void) const
Definition: GEVGDriver.cxx:699
bool fUseSplines
controls whether xsecs are computed or interpolated
Definition: GEVGDriver.h:125
Initial State information.
Definition: InitialState.h:49
EventRecord * GenerateEvent(const TLorentzVector &nu4p)
Definition: GEVGDriver.cxx:229
void BuildInitialState(const InitialState &init_state)
Definition: GEVGDriver.cxx:167
enum BeamMode string