8 if(configfile!=
"") m_variables.Initialise(configfile);
15 bool use_stopwatch =
false;
16 m_variables.Get(
"use_stopwatch", use_stopwatch);
27 if(! m_variables.Get(
"nevents",
fNEvents) ) {
28 Log(
"WARN: nevents configuration not found. Producing 1 event",
WARN,
m_verbose);
32 Log(
"WARN: Given negative or 0 nevents. Producing 1 event",
WARN,
m_verbose);
43 if(!m_variables.Get(
"x_mean_pos",
fXMean)) {
47 if(!m_variables.Get(
"x_width",
fXWidth)) {
51 if(!m_variables.Get(
"y_mean_pos",
fYMean)) {
55 if(!m_variables.Get(
"y_width",
fYWidth)) {
59 if(!m_variables.Get(
"z_mean_pos",
fZMean)) {
63 if(!m_variables.Get(
"z_width",
fZWidth)) {
68 if(!m_variables.Get(
"max_z_pos",
fMaxZPos)) {
72 if(!m_variables.Get(
"max_r_pos",
fMaxRPos)) {
77 if(!m_variables.Get(
"flat_r",
fFlatR)) {
87 if(!m_variables.Get(
"t_min",
fTMin)) {
91 if(!m_variables.Get(
"t_max",
fTMax)) {
97 if(!m_variables.Get(
"seed", seed)) {
98 Log(
"WARN: No seed specified. Using default 0. Your results are not reproducable!",
WARN,
m_verbose);
100 fRand =
new TRandom3(seed);
116 const double likelihood = 9E7;
117 const int nhits = 1E4;
119 for(
int iv = 0; iv < N; iv++) {
123 ss <<
"DEBUG: Created event at x,y,z";
124 for(
int i = 0; i < 3; i++)
126 ss <<
" time " << time;
143 m_data->vars.Set(
"StopLoop",1);
177 double x, y, r, z, xdir, ydir;
178 const int maxcount = 100;
185 fRand->Circle(xdir, ydir, 1);
198 r = TMath::Sqrt(TMath::Power(x, 2) + TMath::Power(y, 2));
213 return fRand->Uniform(-max, +max);
218 while(abs(x) > max) {
219 fRand->Gaus(mean, width);
220 if(count > maxcount)
break;
224 ss <<
"WARN: Could not produce random number within limit. Returning appropriately signed " << max;
239 ss <<
"WARN: Unknown Distribution_t value " << dist <<
" Returning 0";
250 if(abs(width) < 1E-6) {
259 ss <<
"INFO: Will generate " << axis <<
" axis as " <<
EnumAsString(dist);
std::string Result(std::string method_name, std::string output_file="")
enum EDistribution Distribution_t
std::string m_stopwatch_file
Image filename to save the histogram to, if required.
void Start()
Start the stopwatch.
StopwatchTimes Stop()
Stop the stopwatch, returning the CPU time.
Distribution_t fYDistribution
Distribution_t fXDistribution
void StreamToLog(int level)
static std::string EnumAsString(Distribution_t dist)
Distribution_t GetDistributionType(double width, const char *axis)
void CreateVertex(double *pos)
void Log(const std::string &message, const int message_level)
Format messages in the same way as for tools.
util::Stopwatch * m_stopwatch
The stopwatch, if we're using one.
Distribution_t fZDistribution
bool Initialise(std::string configfile, DataModel &data)
double GetRandomNumber(Distribution_t dist, double max, double mean, double width, const int maxcount)