All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 <string>
15 
16 namespace CLHEP { class HepRandomEngine; }
17 
18 // Framework includes
19 namespace fhicl { class ParameterSet; }
20 
21 // nusimdata includes
22 namespace simb { class MCTruth; }
23 
24 namespace evgen {
25 
27 
28  public:
29 
30  // Constructor
31  NueAr40CCGenerator(fhicl::ParameterSet const& parameterSet);
32 
33  // Simulate interactions, produce plots
34  std::vector<simb::MCTruth> Generate(CLHEP::HepRandomEngine& engine);
35 
36  private:
37 
38  // Generate a direction vector isotropically
39  std::vector< double > GetIsotropicDirection
40  (CLHEP::HepRandomEngine& engine) const;
41 
42  // Generate a position distributed uniformly inside the active volume
43  std::vector< double > GetUniformPosition
44  (CLHEP::HepRandomEngine& engine) const;
45 
46  // Decide how many neutrinos to generate
47  int GetNumberOfNeutrinos(CLHEP::HepRandomEngine& engine) const;
48 
49  // Generate a neutrino time distributed uniformly
50  // from fNeutrinoTimeBegin to fNeutrinoTimeEnd
51  double GetNeutrinoTime(CLHEP::HepRandomEngine& engine) const;
52 
53  // Use fEnergyProbabilityMap to sample one energy value
54  // or return a constant value
55  double GetNeutrinoEnergy(CLHEP::HepRandomEngine& engine) const;
56 
57  // Read a ROOT file with a TGraph and fill fEnergyProbabilityMap
58  // Assume that the first point in TGraph is { 0, 0 }
59  void ReadNeutrinoSpectrum();
60 
61  // Initialize vectors with branching ratios, probabilities,
62  // and other quantities required to calculate
63  // number and energy of gammas produced
64  void InitializeVectors();
65 
66  // Simulate particles
67  void CreateKinematicsVector(simb::MCTruth& truth,
68  CLHEP::HepRandomEngine& engine) const;
69 
71  (simb::MCTruth& truth, double neutrinoEnergy,
72  double neutrinoTime, CLHEP::HepRandomEngine& engine) const;
73  std::vector< double > CalculateCrossSections
74  (double neutrinoEnergy, int& highestLevel) const;
75 
76  // Assume that the first entry is { 0, 0 }
77  std::map< double, double > fEnergyProbabilityMap;
78 
81 
82  // Vectors containing information about levels
83  std::vector< std::vector< double > > fBranchingRatios;
84  std::vector< std::vector< int > > fDecayTo;
85  std::vector< double > fStartEnergyLevels;
86  std::vector< double > fB;
87  std::vector< double > fEnergyLevels;
88 
89  // Generate monoenergetic neutrinos if this variable is set to true
91  // Energy of monoenergetic neutrinos
93 
94  // Otherwise sample the spectrum
96 
97  // Number of neutrinos is distributed according
98  // to Poisson distribution if this is true
100 
101  // Allow zero neutrinos to be created if that is what the randonmly
102  // generated number-of-nu ends up being.
104 
105  // Average or exact number of neutrinos generated
107 
108  // Generate neutrinos uniformly in a time interval
111 
112  // Two opposite vertices { { x0, y0, z0 }, { x1, y1, z1 } }
113  // of the active volume box, such that x0 < x1, y0 < y1, z0 < z1
114  std::vector< std::vector < double > > fActiveVolume;
115 
116  };
117 
118 }
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)
std::vector< std::vector< double > > fActiveVolume
std::vector< std::vector< int > > fDecayTo