LArSoft  v06_85_00
Liquid Argon Software toolkit - http://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 <vector>
13 #include <map>
14 #include <iostream>
15 #include <string>
16 
17 // Framework includes
18 #include "fhiclcpp/ParameterSet.h"
19 
20 // nutools includes
22 
23 #include "CLHEP/Random/RandomEngine.h"
24 
25 namespace evgen {
26 
28 
29  public:
30 
31  // Constructor
32  NueAr40CCGenerator(fhicl::ParameterSet const& parameterSet);
33 
34  // Simulate interactions, produce plots
35  std::vector<simb::MCTruth> Generate(CLHEP::HepRandomEngine& engine);
36 
37  private:
38 
39  // Generate a direction vector isotropically
40  std::vector< double > GetIsotropicDirection
41  (CLHEP::HepRandomEngine& engine) const;
42 
43  // Generate a position distributed uniformly inside the active volume
44  std::vector< double > GetUniformPosition
45  (CLHEP::HepRandomEngine& engine) const;
46 
47  // Decide how many neutrinos to generate
48  int GetNumberOfNeutrinos(CLHEP::HepRandomEngine& engine) const;
49 
50  // Generate a neutrino time distributed uniformly
51  // from fNeutrinoTimeBegin to fNeutrinoTimeEnd
52  double GetNeutrinoTime(CLHEP::HepRandomEngine& engine) const;
53 
54  // Use fEnergyProbabilityMap to sample one energy value
55  // or return a constant value
56  double GetNeutrinoEnergy(CLHEP::HepRandomEngine& engine) const;
57 
58  // Read a ROOT file with a TGraph and fill fEnergyProbabilityMap
59  // Assume that the first point in TGraph is { 0, 0 }
60  void ReadNeutrinoSpectrum();
61 
62  // Initialize vectors with branching ratios, probabilities,
63  // and other quantities required to calculate
64  // number and energy of gammas produced
65  void InitializeVectors();
66 
67  // Simulate particles
69  CLHEP::HepRandomEngine& engine) const;
70 
72  (simb::MCTruth& truth, double neutrinoEnergy,
73  double neutrinoTime, CLHEP::HepRandomEngine& engine) const;
74  std::vector< double > CalculateCrossSections
75  (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 
119 }
std::vector< double > fStartEnergyLevels
bool ProcessOneNeutrino(simb::MCTruth &truth, double neutrinoEnergy, double neutrinoTime, CLHEP::HepRandomEngine &engine) const
std::vector< double > GetUniformPosition(CLHEP::HepRandomEngine &engine) const
std::vector< double > fEnergyLevels
void CreateKinematicsVector(simb::MCTruth &truth, CLHEP::HepRandomEngine &engine) const
std::vector< std::vector< double > > fBranchingRatios
std::vector< double > GetIsotropicDirection(CLHEP::HepRandomEngine &engine) const
double GetNeutrinoTime(CLHEP::HepRandomEngine &engine) const
std::vector< double > CalculateCrossSections(double neutrinoEnergy, int &highestLevel) const
int GetNumberOfNeutrinos(CLHEP::HepRandomEngine &engine) const
NueAr40CCGenerator(fhicl::ParameterSet const &parameterSet)
std::vector< double > fB
std::map< double, double > fEnergyProbabilityMap
double GetNeutrinoEnergy(CLHEP::HepRandomEngine &engine) const
std::vector< simb::MCTruth > Generate(CLHEP::HepRandomEngine &engine)
Event generator information.
Definition: MCTruth.h:30
std::vector< std::vector< double > > fActiveVolume
std::vector< std::vector< int > > fDecayTo
Event Generation using GENIE, cosmics or single particles.