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 <constantinos.andreopoulos \at cern.ch>
15  University of Liverpool & STFC Rutherford Appleton Laboratory
16 
17 \created August 06, 2004
18 
19 \cpright Copyright (c) 2003-2020, The GENIE Collaboration
20  For the full text of the license visit http://copyright.genie-mc.org
21 */
22 //____________________________________________________________________________
23 
24 #ifndef _GEVG_DRIVER_H_
25 #define _GEVG_DRIVER_H_
26 
27 #include <ostream>
28 #include <string>
29 
30 #include <TLorentzVector.h>
31 #include <TBits.h>
32 
33 #include "Framework/Utils/Range1.h"
34 
35 using std::ostream;
36 using std::string;
37 
38 namespace genie {
39 
40 class GEVGDriver;
41 class EventRecord;
42 class EventGeneratorList;
43 class EventGeneratorI;
44 class InteractionSelectorI;
45 class InteractionGeneratorMap;
46 class InteractionList;
47 class Interaction;
48 class InitialState;
49 class Target;
50 class Spline;
51 
52 ostream & operator << (ostream & stream, const GEVGDriver & driver);
53 
54 class GEVGDriver {
55 
56 public :
57  GEVGDriver();
58  ~GEVGDriver();
59 
60  // Driver options:
61  // - Set before calling Configure()
62  void UseSplines (void);
63  void SetEventGeneratorList(string listname);
64  // - Set before GenerateEvent()
65  void SetUnphysEventMask(const TBits & mask);
66 
67  // Configure the driver
68  void Configure (int nu_pdgc, int Z, int A);
69  void Configure (const InitialState & init_state);
70 
71  // Generate single event
72  EventRecord * GenerateEvent (const TLorentzVector & nu4p);
73 
74  // Get the list of all interactions that can be simulated for the specified
75  // initial state (depends on which event generation threads were loaded into
76  // the event generation driver driver)
77  const InteractionList * Interactions(void) const;
78 
79  // Get event generator thread list
80  const EventGeneratorList * EventGenerators (void) const { return fEvGenList; }
81 
82  // Get the event generator that is responsible for generating the input event
84 
85  // Cross section splines for input interaction and for the sum of all
86  // simulated interactions for the specified initial state
87  const Spline * XSecSumSpline (void) const { return fXSecSumSpl; }
88  const Spline * XSecSpline (const Interaction * interaction) const;
89 
90  // Instruct the driver to create all the splines it needs
91  void CreateSplines (int nknots=-1, double emax=-1, bool inLogE=true);
92 
93  // Methods used for building the 'total' cross section spline
94  double XSecSum (const TLorentzVector & nup4);
95  void CreateXSecSumSpline (int nk, double Emin, double Emax, bool inlogE=true);
96 
97  // Get validity range (combined validity range of loaded evg threads)
98  Range1D_t ValidEnergyRange (void) const;
99 
100  // Reset, Print etc
101  void Reset (void);
102  void Print (ostream & stream) const;
103 
104  friend ostream & operator << (ostream & stream, const GEVGDriver & driver);
105 
106 private:
107 
108  // Private initialization, configuration & input validation methods
109  void Init (void);
110  void CleanUp (void);
111  void BuildInitialState (const InitialState & init_state);
112  void BuildGeneratorList (void);
113  void BuildInteractionGeneratorMap (void);
114  void BuildInteractionSelector (void);
115  void AssertIsValidInitState (void) const;
116 
117  // Private data members
118  InitialState * fInitState; ///< initial state information for driver instance
119  EventRecord * fCurrentRecord; ///< ptr to the event record being processed
120  EventGeneratorList * fEvGenList; ///< all Event Generators available at this job
121  InteractionSelectorI * fIntSelector; ///< interaction selector
122  InteractionGeneratorMap * fIntGenMap; ///< interaction -> generator assosiative container
123  TBits * fUnphysEventMask; ///< controls whether unphysical events are returned
124  bool fUseSplines; ///< controls whether xsecs are computed or interpolated
125  Spline * fXSecSumSpl; ///< sum{xsec(all interactions | this init state)}
126  unsigned int fNRecLevel; ///< recursive mode depth counter
127  string fEventGenList; ///< list of event generators loaded by this driver (what used to be the $GEVGL setting)
128 };
129 
130 } // genie namespace
131 
132 #endif // _GENIE_H_
EventRecord * fCurrentRecord
ptr to the event record being processed
Definition: GEVGDriver.h:119
void Print(ostream &stream) const
Definition: GEVGDriver.cxx:706
void CreateXSecSumSpline(int nk, double Emin, double Emax, bool inlogE=true)
Definition: GEVGDriver.cxx:440
THE MAIN GENIE PROJECT NAMESPACE
Definition: AlgCmp.h:25
void Reset(void)
Definition: GEVGDriver.cxx:131
std::string string
Definition: nybbler.cc:12
A simple [min,max] interval for doubles.
Definition: Range1.h:42
const EventGeneratorI * FindGenerator(const Interaction *interaction) const
Definition: GEVGDriver.cxx:357
A numeric analysis tool class for interpolating 1-D functions.
Definition: Spline.h:46
void Init(void)
Definition: GEVGDriver.cxx:67
string fEventGenList
list of event generators loaded by this driver (what used to be the $GEVGL setting) ...
Definition: GEVGDriver.h:127
Defines the EventGeneratorI interface.
friend ostream & operator<<(ostream &stream, const GEVGDriver &driver)
Definition: GEVGDriver.cxx:50
unsigned int fNRecLevel
recursive mode depth counter
Definition: GEVGDriver.h:126
void BuildInteractionGeneratorMap(void)
Definition: GEVGDriver.cxx:189
const Spline * XSecSumSpline(void) const
Definition: GEVGDriver.h:87
InteractionSelectorI * fIntSelector
interaction selector
Definition: GEVGDriver.h:121
const EventGeneratorList * EventGenerators(void) const
Definition: GEVGDriver.h:80
Range1D_t ValidEnergyRange(void) const
Definition: GEVGDriver.cxx:668
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:348
TBits * fUnphysEventMask
controls whether unphysical events are returned
Definition: GEVGDriver.h:123
const InteractionList * Interactions(void) const
Definition: GEVGDriver.cxx:334
double XSecSum(const TLorentzVector &nup4)
Definition: GEVGDriver.cxx:373
GENIE Event Generation Driver. A minimalist user interface object for generating neutrino interaction...
Definition: GEVGDriver.h:54
InitialState * fInitState
initial state information for driver instance
Definition: GEVGDriver.h:118
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 ...
void BuildInteractionSelector(void)
Definition: GEVGDriver.cxx:208
const Spline * XSecSpline(const Interaction *interaction) const
Definition: GEVGDriver.cxx:488
ostream & operator<<(ostream &stream, const AlgConfigPool &config_pool)
Spline * fXSecSumSpl
sum{xsec(all interactions | this init state)}
Definition: GEVGDriver.h:125
InteractionGeneratorMap * fIntGenMap
interaction -> generator assosiative container
Definition: GEVGDriver.h:122
void Configure(int nu_pdgc, int Z, int A)
Definition: GEVGDriver.cxx:137
A vector of Interaction objects.
A vector of EventGeneratorI objects.
void CreateSplines(int nknots=-1, double emax=-1, bool inLogE=true)
Definition: GEVGDriver.cxx:577
void UseSplines(void)
Definition: GEVGDriver.cxx:508
void SetUnphysEventMask(const TBits &mask)
Definition: GEVGDriver.cxx:219
void CleanUp(void)
Definition: GEVGDriver.cxx:121
EventGeneratorList * fEvGenList
all Event Generators available at this job
Definition: GEVGDriver.h:120
void AssertIsValidInitState(void) const
Definition: GEVGDriver.cxx:698
bool fUseSplines
controls whether xsecs are computed or interpolated
Definition: GEVGDriver.h:124
Initial State information.
Definition: InitialState.h:48
EventRecord * GenerateEvent(const TLorentzVector &nu4p)
Definition: GEVGDriver.cxx:228
void BuildInitialState(const InitialState &init_state)
Definition: GEVGDriver.cxx:166