• No results found

Components for building customized event generation applications

cations

GENIE provides off-the-shelf components for generating neutrino interactions under the most realistic assumptions integrating the state-of-the-art GENIE neutrino interaction modeling with detailed flux and detector geometry descriptions. GENIE provides an event generation driver class,GMCJDriver, that can be used to setup complicated Monte Carlo jobs involving arbitrarily complex, realistic beam flux simula- tions and detector geometry descriptions. These flux descriptions are typically derived from experiment- specific beam-line simulations while the detector geometry descriptions are typically derived from CAD engineering drawings mapped into the Geant4, ROOT or GDML geometry description languages. Obvi- ously, flux and detector geometry descriptions can take many forms, driven by experiment-specific choices. GENIE standardizes the geometry navigation and flux driver interfaces. These interfaces define a) the

76 CHAPTER 6. USING A REALISTIC FLUX AND DETECTOR GEOMETRY

operations that GENIE needs to perform on the geometry and flux descriptions and b) the information GENIE needs to extract from these in order to generate events.

Concrete implementations of these interfaces are loaded into the GENIE event generation drivers, extending GENIE event generation capabilities and allow it to seamlessly integrate new geometry de- scriptions and beam fluxes.

6.2.1

The flux driver interface

In GENIE every concrete flux driver implements theGFluxIinterface. The interface defines what neutrino flux information is needed by the event generation drivers and how that information is to be obtained. Each concrete flux driver implements the following methods.

const PDGCodeList & GFluxI::FluxParticles (void)

Declare the list of flux neutrinos that can be generated. This information is used for initialization purposes, in order to construct a list of all possible initial states in a given event generation run.

double GFluxI::MaxEnergy (void)

Declare the maximum energy. Again this information is used for initialization purposes, in order to calculate the maximum possible interaction probability in a given event generation run. Since neutrino interaction probabilities are tiny and in order to boost the MC performance, GENIE scales all interaction probabilities in a particular event generation run so that the maximum possible inter- action probability is 1. That maximum interaction probability corresponds to the total interaction probability (summed over nuclear targets and process types) for a maximum energy neutrino fol- lowing a trajectory that maximizes the density-weighted path-lengths for each nuclear target in the geometry. GENIE adjusts the MC run normalization accordingly to account for that internal weighting.

bool GFluxI::GenerateNext (void)

Generate a flux neutrino and specify its pdg code, its weight (if any), its 4-momentum and 4- position. The 4-position is given in the detector coordinate system (as specified by the input geometry). Each such flux neutrino is propagated towards the detector geometry but is not required to cross any detector volume. GENIE will take that neutrino through the geometry, calculate density-weighted path-lengths for all nuclear targets in the geometry, calculate the corresponding interactions probability off each nuclear target and decide whether that flux neutrino should interact. If it interacts, an appropriateGEVGDriver will be invoked to generate the event kinematics.

int GFluxI::PdgCode (void)

Returns the PDG code of the flux neutrino generated by the most recent GFluxI::GenerateNext (void)call.

double GFluxI::Weight (void)

Returns the weight of the flux neutrino generated by the most recentGFluxI::GenerateNext (void)

call.

const TLorentzVector & GFluxI::Momentum (void)

Returns the 4-momentum of the flux neutrino generated by the most recentGFluxI::GenerateNext (void)call.

const TLorentzVector & GFluxI::Position (void)

Returns the position 4-vector of the flux neutrino generated by the most recentGFluxI::GenerateNext (void)call.

6.2. COMPONENTS FOR BUILDING CUSTOMIZED EVENT GENERATION APPLICATIONS 77

bool GFluxI::End(void)

Notify that no more flux neutrinos can be thrown. This flag is typically raised by flux drivers that simply read-in beam-line simulation outputs (as opposed to run the beam simulation code on the fly) so as to notify GENIE that the end of the neutrino flux file has been reached (after, probably, having been recycled N times). The flag allows GENIE to properly terminate the event generation run at the end-of-flux-file irrespective of the accumulated number of events, protons on target, or other metric of exposure.

The above correspond the the common set of operations /information that GENIE expects to be able to perform / extract from all concrete flux drivers. Specialized drivers may define additional information that can be utilized in the experiment-specific event generation drivers. One typical example of this is the flux-specific pass-through information, that is information about the flux neutrino parents such as the parent meson PDG code, its 4-momentum its 4-position at the production and decay points that GENIE simply attaches to each generated event and passes-through so as to be used in later analysis stages.

6.2.2

The geometry navigation driver interface

In GENIE every concrete geometry driver implements theGeomAnalyzerI interface. The interface spec- ifies what information about the input geometry is relevant to the event generation and how that infor- mation is to be obtained. Each concrete geometry driver implements methods to

const PDGCodeList & GeomAnalyzerI::ListOfTargetNuclei (void)

Declare the list of target nuclei that can be found in the geometry. This information is used for initialization purposes, in order to construct a list of all possible initial states in a given event generation run.

const PathLengthList & GeomAnalyzerI::ComputeMaxPathLengths (void)

Compute the maximum density-weighted path-lengths for each nuclear target in the geometry. Again, this is information used for initialization purposes. The computed ‘worst-case’ trajectory is used to calculate the maximum possible interaction probability in a particular event generation run which is being used internally to normalize all computed interaction probabilities.

const PathLengthList & GeomAnalyzerI::ComputePathLengths (const TLorentzVector & x, const TLorentzVector & p)

Compute density-weighted path-lengths for all nuclear targets, for a ‘ray’ of a given 4-momentum and starting 4-position. This allows GENIE to calculate probabilities for each flux neutrino to be scattered off every nuclear target along its path through the detector geometry.

const TVector3 & GeomAnalyzerI::GenerateVertex (const TLorentzVector & x, const TLorentzVec- tor & p, int tgtpdg)

Generate a vertex along a ‘ray’ of a given 4-momentum and starting 4-position on a volume con- taining a given nuclear target. This allows GENIE to place a neutrino interaction vertex within the detector geometry once an interaction of a flux neutrino off a selected nuclear target has been generated.

6.2.3

Setting-up GENIE MC jobs using fluxes and geometries

{ ...

78 CHAPTER 6. USING A REALISTIC FLUX AND DETECTOR GEOMETRY

GFluxI * flux_driver = new ... ; // get geometry driver

GeomAnalyzerI * geom_driver = new ... ; // create the GENIE monte carlo job driver GMCJDriver* mcjob_driver = new GMCJDriver; mcjob_driver->UseFluxDriver(flux_driver); mcjob_driver->UseGeomAnalyzer(geom_driver); mcjob_driver->Configure();

... }