GENIEGenerator
Loading...
Searching...
No Matches
GFluxBlender.h
Go to the documentation of this file.
1//____________________________________________________________________________
2/*!
3
4\class genie::flux::GFluxBlender
5
6\brief GENIE GFluxI adapter to allow flavor modification
7
8 This adapter intervenes between the GENIE GMCJDriver class
9 (MC job driver) and a concrete GFluxI flux generator, to
10 allow user modification of the neutrino flavor. This
11 modification could be a fixed "swap" or an energy and/or
12 distance dependent (standard oscillations) one.
13
14 Because the GMCJDriver only queries the flavor of a
15 generated neutrino once, prior to propagation through
16 the geometry, this approach is _not_ appropriate with
17 use of an oscillatory model in situations where the flavor
18 might change significantly over the scale of the geometry.
19 In such cases one would have to generate with a fixed flavor
20 (energy/distance independent) swap and reweight after the fact.
21
22 Do not use this as a means of selecting only certain flavor
23 from flux generators that support other means (e.g. GNuMIFlux,
24 GSimpleNtpFlux which have SetFluxParticles(PDGCodeList)) as
25 those will be more efficient.
26
27\author Robert Hatcher <rhatcher \at fnal.gov>
28 Fermi National Accelerator Laboratory
29
30\created 2010/12/22
31
32\cpright Copyright (c) 2003-2025, The GENIE Collaboration
33 for the full text of the license visit http://copyright.genie-mc.org
34*/
35//____________________________________________________________________________
36
37#ifndef GENIE_FLUX_GFLUXBLENDER_H
38#define GENIE_FLUX_GFLUXBLENDER_H
39
40#include <vector>
43
44namespace genie {
45namespace flux {
46
47 // forward declarations within namespace
48 class GFlavorMixerI;
49 class GNuMIFlux;
50 class GSimpleNtpFlux;
51
52 class GFluxBlender : public GFluxI {
53
54 public:
55
58
59 //
60 // implement the GFluxI interface:
61 // overriding real GFluxI methods:
62 // FluxParticles() [final list of flavor might be more than source]
63 // GenerateNext() [choose flavor during generation, avoid sterile]
64 //
65 const PDGCodeList & FluxParticles (void); ///< declare list of flux neutrinos that can be generated (for init. purposes)
66 double MaxEnergy (void) { return fRealGFluxI->MaxEnergy(); } ///< declare the max flux neutrino energy that can be generated (for init. purposes)
67 bool GenerateNext (void); ///< generate the next flux neutrino (return false in err)
68 int PdgCode (void) { return fPdgCMixed; } ///< returns the flux neutrino pdg code
69 double Weight (void) { return fRealGFluxI->Weight(); } ///< returns the flux neutrino weight (if any)
70 const TLorentzVector & Momentum (void) { return fRealGFluxI->Momentum(); } ///< returns the flux neutrino 4-momentum
71 const TLorentzVector & Position (void) { return fRealGFluxI->Position(); } ///< returns the flux neutrino 4-position (note: expect SI rather than physical units)
72 bool End (void) { return fRealGFluxI->End(); } ///< true if no more flux nu's can be thrown (eg reaching end of beam sim ntuples)
73 long int Index (void);
74 void Clear (Option_t * opt);
75 void GenerateWeighted (bool gen_weighted);
76
77 //
78 // Additions to the GFluxI interface:
79 //
80 int PdgCodeGenerated (void) { return fPdgCGenerated; } ///< returns the flux neutrino original pdg code
81 double Energy (void) { return fEnergy; } //< returns the current neutrino's energy
82 double TravelDist (void) { return fDistance; } ///< returns the distance used in the flavor mixing
83 //
84 // For flux methods that report a distance from the point of origin
85 // to the chosen starting point for the ray use that distance
86 // (supported in GNuMIFlux and GSimpleNtpFlux).
87 // For other cases use a fixed travel distance (meters) set via:
88 //
89 void SetBaselineDist (double dist) { fBaselineDist = dist; }
90 double GetBaselineDist (void) { return fBaselineDist; }
91
92 //
93 // Configuration:
94 //
95 GFluxI* AdoptFluxGenerator(GFluxI* generator); ///< return previous
96 GFlavorMixerI* AdoptFlavorMixer(GFlavorMixerI* mixer); ///< return previous
97 GFluxI* GetFluxGenerator() { return fRealGFluxI; } ///< access, not ownership
98 GFlavorMixerI* GetFlavorMixer() { return fFlavorMixer; } ///< access, not ownership
99
100 void PrintConfig(void);
101 void PrintState(bool verbose=true);
102
103 private:
104 int ChooseFlavor(int pdg_init, double energy, double dist);
105
106 GFluxI* fRealGFluxI; ///< actual flux generator
107 GNuMIFlux* fGNuMIFlux; ///< ref to avoid repeat dynamic_cast
108 GSimpleNtpFlux* fGSimpleFlux; ///< ref to avoid repeat dynamic_cast
109
110 GFlavorMixerI* fFlavorMixer; ///< flavor modification schema
111
112 PDGCodeList fPDGListGenerator; ///< possible flavors from generator
113 PDGCodeList fPDGListMixed; ///< possible flavors after mixing
114 size_t fNPDGOut; ///< # of possible output flavors
115
116 double fBaselineDist; ///< travel dist for mixing (if flux doesn't support GetDecayDist())
117
118 double fEnergy; ///< current neutrino's energy
119 double fDistance; ///< current neutrino's travel distance
120 int fPdgCGenerated; ///< current neutrino's original flavor
121 int fPdgCMixed; ///< current neutrino's new flavor
122
123 std::vector<double> fProb; ///< individual transition probs
124 std::vector<double> fSumProb; ///< cummulative probability
125 double fRndm; ///< random # used to make choice
126
127 };
128
129} // namespace flux
130} // namespace genie
131#endif //GENIE_FLUX_GFLUXBLENDER_H
GENIE Interface for user-defined flux classes.
Definition GFluxI.h:29
A list of PDG codes.
Definition PDGCodeList.h:32
GENIE interface for flavor modification.
GFlavorMixerI * GetFlavorMixer()
access, not ownership
bool GenerateNext(void)
generate the next flux neutrino (return false in err)
std::vector< double > fSumProb
cummulative probability
double fDistance
current neutrino's travel distance
int ChooseFlavor(int pdg_init, double energy, double dist)
bool End(void)
true if no more flux nu's can be thrown (eg reaching end of beam sim ntuples)
double fRndm
random # used to make choice
double fBaselineDist
travel dist for mixing (if flux doesn't support GetDecayDist())
GSimpleNtpFlux * fGSimpleFlux
ref to avoid repeat dynamic_cast
std::vector< double > fProb
individual transition probs
double TravelDist(void)
returns the distance used in the flavor mixing
const PDGCodeList & FluxParticles(void)
declare list of flux neutrinos that can be generated (for init. purposes)
GFluxI * GetFluxGenerator()
access, not ownership
double MaxEnergy(void)
declare the max flux neutrino energy that can be generated (for init. purposes)
int fPdgCMixed
current neutrino's new flavor
void GenerateWeighted(bool gen_weighted)
set whether to generate weighted or unweighted neutrinos
const TLorentzVector & Momentum(void)
returns the flux neutrino 4-momentum
void PrintState(bool verbose=true)
int PdgCode(void)
returns the flux neutrino pdg code
GFluxI * fRealGFluxI
actual flux generator
PDGCodeList fPDGListMixed
possible flavors after mixing
void Clear(Option_t *opt)
reset state variables based on opt
long int Index(void)
returns corresponding index for current flux neutrino (e.g. for a flux ntuple returns the current ent...
double fEnergy
current neutrino's energy
double Weight(void)
returns the flux neutrino weight (if any)
GFluxI * AdoptFluxGenerator(GFluxI *generator)
return previous
GNuMIFlux * fGNuMIFlux
ref to avoid repeat dynamic_cast
GFlavorMixerI * AdoptFlavorMixer(GFlavorMixerI *mixer)
return previous
PDGCodeList fPDGListGenerator
possible flavors from generator
int PdgCodeGenerated(void)
returns the flux neutrino original pdg code
const TLorentzVector & Position(void)
returns the flux neutrino 4-position (note: expect SI rather than physical units)
int fPdgCGenerated
current neutrino's original flavor
void SetBaselineDist(double dist)
GFlavorMixerI * fFlavorMixer
flavor modification schema
A GENIE flux driver encapsulating the NuMI neutrino flux. It reads-in the official GNUMI neutrino flu...
Definition GNuMIFlux.h:221
A GENIE flux driver using a simple ntuple format.
GENIE flux drivers.
THE MAIN GENIE PROJECT NAMESPACE
Definition AlgCmp.h:25
TRandom3 generator(0)