1 #ifndef _icemc_source_hh 2 #define _icemc_source_hh 46 const char * whichSubtype;
47 const char * whichSources;
48 double whichStartTime;
51 static double fromString(
const char * time);
52 Restriction(
double max_dec = 30,
const char * sources =
"All",
const char * subtype =
"All",
53 double startTime = 0,
double endTime= 2147483647)
54 : whichSubtype(subtype), whichSources(sources), whichStartTime(startTime), whichEndTime(endTime), maxDec(max_dec) {; }
60 void setUpWeights(
double t0,
double t1,
double minE = 1e9,
double maxE=1e12,
int N = 1e6);
67 double getTimeWeight(
double t,
bool use_average_nonzero_flux =
true)
const;
68 double getPerSourceTimeWeight(
double t,
int i,
bool use_average_nonzero_flux =
true)
const;
70 const char * getName()
const {
return name; }
75 TH1 * estimateFlux (
double tmin,
double tmax,
double Emin,
double Emax,
int nbins = 100,
int Ntrials = 1e6);
76 const Source * getSource(
int i )
const {
return sources[i]; }
77 unsigned getNSources()
const {
return sources.size(); }
83 std::vector<Source*> sources;
87 double average_nonzero_flux;
88 std::vector<double> per_source_average_flux;
89 std::vector<double> per_source_average_nonzero_flux;
98 virtual double getFlux(
double E,
double t)
const = 0;
99 virtual double getFluxBetween(
double Emin,
double Emax,
double t)
const = 0;
100 virtual double pickEnergy(
double Emin,
double Emax,
double t, TRandom * rng = gRandom)
const = 0;
101 virtual void getFluxTimeChanges(std::vector<double> * changes)
const { (void) changes ; }
118 const char * getName()
const {
return name.c_str(); }
119 double getRA()
const {
return RA; }
120 double getDec()
const {
return dec; }
122 const SourceFlux * getFlux()
const {
return flux; }
123 virtual ~
Source() {
delete flux; }
138 virtual double getFlux(
double E,
double t)
const 139 { (void) t;
return A * TMath::Power(E,-gamma) ; }
140 virtual double getFluxBetween(
double Emin,
double Emax,
double t)
const 141 { (void) t;
return A * ( TMath::Power(Emin,-gamma+1) / (gamma-1) - TMath::Power(Emax,-gamma+1) / (gamma-1)); }
142 virtual double pickEnergy(
double Emin,
double Emax,
double t, TRandom * rng = gRandom)
const;
163 virtual double getFlux(
double E,
double t)
const 165 if (t < t0 || t > t1){
return 0; }
166 if (cutoff && E > cutoff)
return 0;
167 else return A * TMath::Power(E,-gamma) ;
169 virtual double getFluxBetween(
double Emin,
double Emax,
double t)
const 171 if (t < t0 || t > t1){
return 0; }
172 if (cutoff && Emin > cutoff)
return 0;
173 if (cutoff && Emax > cutoff) Emax = cutoff;
174 return A * ( TMath::Power(Emin,-gamma+1) / (gamma-1) - TMath::Power(Emax,-gamma+1) / (gamma-1));
176 virtual double pickEnergy(
double Emin,
double Emax,
double t, TRandom * rng = gRandom)
const;
179 virtual void getFluxTimeChanges(std::vector<double> * changes)
const { changes->push_back(t0); changes->push_back(t1); }
void computeFluxTimeChanges(std::vector< double > *changes) const
int getDirectionAndEnergy(Vector *nudir, double t, double &nuE, double minE=1e9, double maxE=1e12)
int getDirection(Vector &nudir, double t, double nuE=1e10)
static SourceModel * getSourceModel(const char *key, Restriction r=Restriction())
void addSource(Source *source)
This class represents a three-vector. Operators are overloaded to provide for the familiar operations...
void setUpWeights(double t0, double t1, double minE=1e9, double maxE=1e12, int N=1e6)