LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
NueAr40CCGenerator.h
Go to the documentation of this file.
1 //=============================================================================
2 // NueAr40CCGenerator.h
3 //
4 // Gleb Sinev, Duke, 2015
5 // Supernova neutrino generator that simulates nu_e-Ar40 CC interactions
6 // and produces a text file with kinematics information,
7 // which can be used as input for LArSoft
8 // Based on a generator written by AJ Roeth
9 //=============================================================================
10 
11 // C++ includes
12 #include <map>
13 #include <string>
14 #include <vector>
15 
16 namespace CLHEP {
17  class HepRandomEngine;
18 }
19 
20 // Framework includes
21 namespace fhicl {
22  class ParameterSet;
23 }
24 
25 // nusimdata includes
26 namespace simb {
27  class MCTruth;
28 }
29 
30 namespace evgen {
31 
33 
34  public:
35  // Constructor
36  NueAr40CCGenerator(fhicl::ParameterSet const& parameterSet);
37 
38  // Simulate interactions, produce plots
39  std::vector<simb::MCTruth> Generate(CLHEP::HepRandomEngine& engine);
40 
41  private:
42  // Generate a direction vector isotropically
43  std::vector<double> GetIsotropicDirection(CLHEP::HepRandomEngine& engine) const;
44 
45  // Generate a position distributed uniformly inside the active volume
46  std::vector<double> GetUniformPosition(CLHEP::HepRandomEngine& engine) const;
47 
48  // Decide how many neutrinos to generate
49  int GetNumberOfNeutrinos(CLHEP::HepRandomEngine& engine) const;
50 
51  // Generate a neutrino time distributed uniformly
52  // from fNeutrinoTimeBegin to fNeutrinoTimeEnd
53  double GetNeutrinoTime(CLHEP::HepRandomEngine& engine) const;
54 
55  // Use fEnergyProbabilityMap to sample one energy value
56  // or return a constant value
57  double GetNeutrinoEnergy(CLHEP::HepRandomEngine& engine) const;
58 
59  // Read a ROOT file with a TGraph and fill fEnergyProbabilityMap
60  // Assume that the first point in TGraph is { 0, 0 }
61  void ReadNeutrinoSpectrum();
62 
63  // Initialize vectors with branching ratios, probabilities,
64  // and other quantities required to calculate
65  // number and energy of gammas produced
66  void InitializeVectors();
67 
68  // Simulate particles
69  void CreateKinematicsVector(simb::MCTruth& truth, CLHEP::HepRandomEngine& engine) const;
70 
71  bool ProcessOneNeutrino(simb::MCTruth& truth,
72  double neutrinoEnergy,
73  double neutrinoTime,
74  CLHEP::HepRandomEngine& engine) const;
75  std::vector<double> CalculateCrossSections(double neutrinoEnergy, int& highestLevel) const;
76 
77  // Assume that the first entry is { 0, 0 }
78  std::map<double, double> fEnergyProbabilityMap;
79 
82 
83  // Vectors containing information about levels
84  std::vector<std::vector<double>> fBranchingRatios;
85  std::vector<std::vector<int>> fDecayTo;
86  std::vector<double> fStartEnergyLevels;
87  std::vector<double> fB;
88  std::vector<double> fEnergyLevels;
89 
90  // Generate monoenergetic neutrinos if this variable is set to true
92  // Energy of monoenergetic neutrinos
94 
95  // Otherwise sample the spectrum
97 
98  // Number of neutrinos is distributed according
99  // to Poisson distribution if this is true
101 
102  // Allow zero neutrinos to be created if that is what the randonmly
103  // generated number-of-nu ends up being.
105 
106  // Average or exact number of neutrinos generated
108 
109  // Generate neutrinos uniformly in a time interval
112 
113  // Two opposite vertices { { x0, y0, z0 }, { x1, y1, z1 } }
114  // of the active volume box, such that x0 < x1, y0 < y1, z0 < z1
115  std::vector<std::vector<double>> fActiveVolume;
116  };
117 
118 }
std::vector< double > fB
std::vector< std::vector< double > > fBranchingRatios
parameter set interface
std::vector< std::vector< int > > fDecayTo
std::vector< double > fStartEnergyLevels
ART objects.
std::vector< std::vector< double > > fActiveVolume
std::map< double, double > fEnergyProbabilityMap
Event generator information.
Definition: MCTruth.h:32
Event Generation using GENIE, cosmics or single particles.
std::vector< double > fEnergyLevels