Public Member Functions | Protected Attributes | List of all members
genie::supernova::GFluxGenerator Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-11-28/GenieSNova/src/GFluxGenerator.h"

Inheritance diagram for genie::supernova::GFluxGenerator:
genie::supernova::GeneratorBase

Public Member Functions

 GFluxGenerator (int pdg, TH2 *hist)
 
void GenerateNext ()
 
void FillParticle (GenParticle &particle)
 
void Reload ()
 
void SetProbScale (double scale)
 
void SetEmin (double Emin)
 
bool End ()
 
int PDG () const
 
double T () const
 
double E () const
 
const OrderedSamplerGetSamplerT () const
 
const RandomSamplerGetSamplerE (size_t i) const
 
const double GetIntegral () const
 
const Limits< double > & LimsE () const
 
const Limits< double > & LimsT () const
 

Protected Attributes

OrderedSampler fTSampler
 
std::vector< RandomSamplerfESamplers
 
int fPdg
 
double fT
 PDG code. More...
 
double fE
 Time. More...
 
double fEmin =10
 Energy. More...
 
double fIntegral
 
Limits< double > fLimsE
 Total flux integral. More...
 
Limits< double > fLimsT
 Energy range. More...
 

Detailed Description

Definition at line 17 of file GFluxGenerator.h.

Constructor & Destructor Documentation

GFluxGenerator::GFluxGenerator ( int  pdg,
TH2 *  hist 
)

Definition at line 15 of file GFluxGenerator.cxx.

References fESamplers, genie::supernova::GeneratorBase::fIntegral, genie::supernova::GeneratorBase::fLimsE, genie::supernova::GeneratorBase::fLimsT, fTSampler, make_syst_table_plots::h, genie::supernova::OrderedSampler::Init(), and genie::supernova::Limits< T >::Set().

15  : fPdg(pdg), fT(0), fE(0)
16 {
17  // Set the limits
18  fLimsT.Set(hist->GetXaxis()->GetXmin(),hist->GetXaxis()->GetXmax());
19  fLimsE.Set(hist->GetYaxis()->GetXmin(),hist->GetYaxis()->GetXmax());
20 
21  // Set generator integral
22  fIntegral = hist->Integral("width");
23 
24  // Init the time sampler
25  TH1D* histT = hist->ProjectionX(Form("HistT_%d", pdg));
26  fTSampler.Init(histT);
27  int NBins = hist->GetNbinsX();
28 
29  // Init the energy sampler (per each time bin)
30  fESamplers.resize(NBins);
31  for (int nbin = 0; nbin < NBins; ++nbin) {
32  TH1D* h = hist->ProjectionY(Form("HistE_%d_%d", pdg, nbin), nbin, nbin);
33  fESamplers[nbin].Init(h);
34  }
35 }
void Set(double val1, double val2)
Definition: Limits.h:19
Limits< double > fLimsE
Total flux integral.
Definition: GeneratorBase.h:22
Limits< double > fLimsT
Energy range.
Definition: GeneratorBase.h:23
std::vector< RandomSampler > fESamplers
void Init(TH1 *hist, bool integral=false)
Definition: Sampler.cxx:52

Member Function Documentation

double GFluxGenerator::E ( ) const

Definition at line 121 of file GFluxGenerator.cxx.

References fE.

122 {
123  return fE;
124 }
bool GFluxGenerator::End ( )

Definition at line 100 of file GFluxGenerator.cxx.

References genie::supernova::OrderedSampler::End(), and fTSampler.

Referenced by GenerateNext().

101 {
102  return fTSampler.End();
103 }
void GFluxGenerator::FillParticle ( GenParticle particle)
void GFluxGenerator::GenerateNext ( )

Definition at line 39 of file GFluxGenerator.cxx.

References bin, End(), fE, fEmin, fESamplers, fPdg, fT, fTSampler, genie::supernova::OrderedSampler::GenerateNext(), genie::supernova::OrderedSampler::GetBin(), LOG, genie::units::MeV, and pDEBUG.

40 {
41  fE = 0;
42  do {
43  // Generate next event time
45  if (this->End()) return;
46 
47  // Get current time bin
48  int bin = fTSampler.GetBin();
49  LOG("GFluxGenerator", pDEBUG) << "[" << fPdg
50  << "] T=" << fT
51  << " (bin=" << bin <<")";
52 
53  // Generate event energy using current bin distribution
54  fE = fESamplers[bin].GenerateNext();
55  LOG("GFluxGenerator", pDEBUG) << "[" << fPdg
56  << "] E=" << fE
57  << " vs Emin=" << fEmin;
58 
59  } while (fE <= fEmin);
60 
62 
63  LOG("GFluxGenerator", pDEBUG) << "[" << fPdg
64  << "]: generated T=" << fT
65  << "; E=" << fE;
66 }
static const double MeV
Definition: Units.h:130
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
float bin[41]
Definition: plottest35.C:14
std::vector< RandomSampler > fESamplers
#define pDEBUG
Definition: Messenger.h:64
const double GeneratorBase::GetIntegral ( ) const
inherited
const RandomSampler & GFluxGenerator::GetSamplerE ( size_t  i) const

Definition at line 135 of file GFluxGenerator.cxx.

References fESamplers, and MECModelEnuComparisons::i.

136 {
137  return fESamplers[i];
138 }
std::vector< RandomSampler > fESamplers
const OrderedSampler & GFluxGenerator::GetSamplerT ( ) const

Definition at line 128 of file GFluxGenerator.cxx.

References fTSampler.

129 {
130  return fTSampler;
131 }
const Limits< double > & GeneratorBase::LimsE ( ) const
inherited

Definition at line 22 of file GeneratorBase.cxx.

References genie::supernova::GeneratorBase::fLimsE.

Referenced by genie::supernova::GSNovaModel::AddGenerator(), and genie::supernova::GFluxSNova::MaxEnergy().

23 {
24  return fLimsE;
25 }
Limits< double > fLimsE
Total flux integral.
Definition: GeneratorBase.h:22
const Limits< double > & GeneratorBase::LimsT ( ) const
inherited

Definition at line 29 of file GeneratorBase.cxx.

References genie::supernova::GeneratorBase::fLimsT.

Referenced by genie::supernova::GSNovaModel::AddGenerator().

30 {
31  return fLimsT;
32 }
Limits< double > fLimsT
Energy range.
Definition: GeneratorBase.h:23
int GFluxGenerator::PDG ( ) const

Definition at line 107 of file GFluxGenerator.cxx.

References fPdg.

Referenced by genie::supernova::GSNovaModel::AddGenerator().

108 {
109  return fPdg;
110 }
void GFluxGenerator::Reload ( )
void GFluxGenerator::SetEmin ( double  Emin)

Definition at line 93 of file GFluxGenerator.cxx.

References fEmin.

94 {
95  fEmin = Emin;
96 }
void GFluxGenerator::SetProbScale ( double  scale)

Definition at line 86 of file GFluxGenerator.cxx.

References fTSampler, and genie::supernova::OrderedSampler::SetProbScale().

87 {
89 }
void SetProbScale(double scale)
Definition: Sampler.cxx:121
Double_t scale
Definition: plot.C:25
double GFluxGenerator::T ( ) const

Definition at line 114 of file GFluxGenerator.cxx.

References fT.

Referenced by compare().

115 {
116  return fT;
117 }

Member Data Documentation

double genie::supernova::GFluxGenerator::fE
protected

Time.

Definition at line 43 of file GFluxGenerator.h.

Referenced by E(), FillParticle(), and GenerateNext().

double genie::supernova::GFluxGenerator::fEmin =10
protected

Energy.

Definition at line 44 of file GFluxGenerator.h.

Referenced by GenerateNext(), and SetEmin().

std::vector<RandomSampler> genie::supernova::GFluxGenerator::fESamplers
protected

Definition at line 39 of file GFluxGenerator.h.

Referenced by GenerateNext(), GetSamplerE(), and GFluxGenerator().

double genie::supernova::GeneratorBase::fIntegral
protectedinherited
Limits<double> genie::supernova::GeneratorBase::fLimsE
protectedinherited
Limits<double> genie::supernova::GeneratorBase::fLimsT
protectedinherited
int genie::supernova::GFluxGenerator::fPdg
protected

Definition at line 41 of file GFluxGenerator.h.

Referenced by FillParticle(), GenerateNext(), and PDG().

double genie::supernova::GFluxGenerator::fT
protected

PDG code.

Definition at line 42 of file GFluxGenerator.h.

Referenced by FillParticle(), GenerateNext(), and T().

OrderedSampler genie::supernova::GFluxGenerator::fTSampler
protected

Definition at line 38 of file GFluxGenerator.h.

Referenced by End(), GenerateNext(), GetSamplerT(), GFluxGenerator(), Reload(), and SetProbScale().


The documentation for this class was generated from the following files: