GFluxSNova.cxx
Go to the documentation of this file.
1 // ROOT includes
2 #include "TLorentzVector.h"
3 #include "TVector3.h"
4 
5 // GENIE includes
6 #include "GENIE/Framework/Conventions/Units.h"
7 #include "GENIE/Framework/Messenger/Messenger.h"
8 
9 // NOvASoft includes
11 
12 using namespace genie::supernova;
13 
14 
15 //.......................................................................
17 {
18  return fModel.PdgList();
19 }
20 
21 
22 //.......................................................................
24 {
25  return fModel.LimsE().Max() * genie::units::MeV;
26 }
27 
28 
29 //.......................................................................
31  // Throw std::runtime_error("End of flux reached");
32  if (this->End()) return false;
33 
34  // Increase the generated particle counter
35  ++fIndex;
36  fPart.fW = 1;
37 
38  // Generate particle from model
40 
41  // Generate position
43  LOG("GFluxSNova", pDEBUG) << "Generated neutrino #" << this->Index()
44  <<" pdg=" << this->PdgCode()
45  <<" E=" << this->Momentum().E()
46  <<" pos=[" << this->Position().X()
47  << "," << this->Position().Y()
48  << "," << this->Position().Z() << "]"
49  <<" time=" << this->Position().T();
50 
51  return true;
52 }
53 
54 
55 
56 //.......................................................................
58 {
59  return fPart.PDG();
60 }
61 
62 
63 //.......................................................................
64 double GFluxSNova::Weight (void)
65 {
66  return fPart.W();
67 }
68 
69 
70 //.......................................................................
71 const TLorentzVector & GFluxSNova::Momentum (void)
72 {
73  return fPart.Mom();
74 }
75 
76 
77 //.......................................................................
78 const TLorentzVector & GFluxSNova::Position (void)
79 {
80  return fPart.Pos();
81 }
82 
83 
84 //.......................................................................
85 bool GFluxSNova::End (void)
86 {
87  return fModel.End();
88 }
89 
90 
91 //.......................................................................
92 long int GFluxSNova::Index (void)
93 {
94  return fIndex;
95 }
96 
97 
98 //.......................................................................
99 void GFluxSNova::Clear (Option_t * opt)
100 {
101  return;
102 }
103 
104 
105 //.......................................................................
106 void GFluxSNova::GenerateWeighted (bool gen_weighted)
107 {
108  fGenWeighted = gen_weighted;
109 }
110 
111 
112 //.......................................................................
113 void GFluxSNova::Charge(double distanceKpc, double probScale)
114 {
115  fModel.SetProbScale(probScale * fWindow.Area() / (distanceKpc * distanceKpc));
116 
117  double Nv_avg = probScale * fModel.GetIntegral() * fWindow.Area() / (distanceKpc * distanceKpc);
118 
119  LOG("GFluxSNova", pNOTICE) << "For distance " << distanceKpc
120  << " kpc Nv_avg=" << Nv_avg
121  << " per " << fWindow.Area()
122  << "cm2 (" << Nv_avg / fWindow.Area() << "nu/cm2)";
123 
124  for (auto& gen: fModel.ActiveGenerators())
125  std::cout << "gen [" << gen.PDG()
126  << "] = " << gen.GetIntegral()
127  << std::endl;
128 }
bool End()
Check if there are no active generators left.
void GenerateNext(GenParticle &)
Definition: GFluxWindow.cxx:26
static const double MeV
Definition: Units.h:130
virtual void Clear(Option_t *opt)
reset state variables based on opt
Definition: GFluxSNova.cxx:99
virtual const genie::PDGCodeList & FluxParticles(void)
declare list of flux neutrinos that can be generated (for init. purposes)
Definition: GFluxSNova.cxx:16
const Limits< double > & LimsE() const
A list of PDG codes.
Definition: PDGCodeList.h:33
const std::list< GFluxGenerator > ActiveGenerators()
Access to generators.
const double GetIntegral() const
GSNovaModel fModel
structre with generated neutrino info
Definition: GFluxSNova.h:41
virtual bool GenerateNext(void)
generate the next flux neutrino (return false in err)
Definition: GFluxSNova.cxx:30
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
const genie::PDGCodeList & PdgList()
Get model features.
Definition: GSNovaModel.cxx:79
virtual long int Index(void)
returns corresponding index for current flux neutrino (e.g. for a flux ntuple returns the current ent...
Definition: GFluxSNova.cxx:92
virtual double Weight(void)
returns the flux neutrino weight (if any)
Definition: GFluxSNova.cxx:64
void GenerateNext(GenParticle &)
Generate next particle.
const TLorentzVector & Mom() const
Definition: GenParticle.cxx:67
OStream cout
Definition: OStream.cxx:6
const TLorentzVector & Pos() const
Definition: GenParticle.cxx:74
virtual void GenerateWeighted(bool gen_weighted)
set whether to generate weighted or unweighted neutrinos
Definition: GFluxSNova.cxx:106
void Charge(double distanceKpc, double probScale)
Charge the supernova: generate number on neutrinos.
Definition: GFluxSNova.cxx:113
virtual int PdgCode(void)
returns the flux neutrino pdg code
Definition: GFluxSNova.cxx:57
const T & Max() const
Definition: Limits.h:15
virtual const TLorentzVector & Momentum(void)
returns the flux neutrino 4-momentum
Definition: GFluxSNova.cxx:71
GFluxWindow fWindow
container for SuperNova model
Definition: GFluxSNova.h:42
void SetProbScale(double Scale)
#define pNOTICE
Definition: Messenger.h:62
virtual const TLorentzVector & Position(void)
returns the flux neutrino 4-position (note: expect SI rather than physical units) ...
Definition: GFluxSNova.cxx:78
virtual double MaxEnergy(void)
declare the max flux neutrino energy that can be generated (for init. purposes)
Definition: GFluxSNova.cxx:23
long int fIndex
flux windowm where neutrinos will appear
Definition: GFluxSNova.h:44
virtual bool End(void)
true if no more flux nu&#39;s can be thrown (eg reaching end of beam sim ntuples)
Definition: GFluxSNova.cxx:85
#define pDEBUG
Definition: Messenger.h:64