44int main(
int argc,
char**argv)
57 size_t numberOfEvents;
83 zap[
'M'] =
make_field(morphology,
"morphology: \"<type> (parameters)+\"");
84 zap[
'r'] =
make_field(resolution,
"resolution: \"<type> (parameters)+\"");
85 zap[
'B'] =
make_field(background,
"number of events / s / sr") = 0.0;
86 zap[
'O'] =
make_field(omega,
"effective bin width [sr]") = 1.0e-4;
90 if (zap.
read(argc, argv) != 0)
93 catch(
const exception &error) {
94 FATAL(error.what() << endl);
97 gRandom->SetSeed(seed);
102 const time_t Tmin_s = UTC.getLowerLimit().getTime();
103 const time_t Tmax_s = UTC.getUpperLimit().getTime();
112 const double V = (ymax - ymin) * (xmax - xmin);
114 x0 = 1.0 - V / (sqrt(2.0)*2.0*PI);
116 const double dx = omega / (2.0*PI);
117 const int nx = (int) ((1.0 - x0) / dx);
119 TH1D ha(
"ha", NULL, 70, -3.0, +2.3);
120 TH1D h1(
"h1", NULL, nx, 1.0 - nx*dx, +1.0);
128 TH2D hs(
"hs", NULL, 100, 0.0, NUMBER_OF_SECONDS_PER_SEDERIAL_DAY / NUMBER_OF_SECONDS_PER_HOUR, 100, -1.0, +1.0);
130 for (
size_t counter = 0; counter != numberOfEvents; ++counter) {
132 STATUS(
"counter: "<< setw(8) << counter <<
'\r');
DEBUG(endl);
137 const double t1 = getTimeMJD(Tmin_s + gRandom->Rndm() * (Tmax_s - Tmin_s));
161 hs.Fill(fmod(t1, NUMBER_OF_SECONDS_PER_SEDERIAL_DAY) / NUMBER_OF_SECONDS_PER_HOUR, u3.
getDZ());
163 if (!parameters.ct(u3.
getDZ())) {
177 const JRotation3D Rs(morphology->getSourceLocation());
185 const double x = getDegrees(asin(vs.
getDX() - us.
getDX()));
186 const double y = getDegrees(asin(vs.
getDY() - us.
getDY()));
191 const double dot = getDot(us, vs);
193 ha.Fill(log10(getDegrees(acos(dot))));
199 if (background > 0.0) {
201 NOTICE(
"Background: " <<
FIXED(9,5) << background * (Tmax_s - Tmin_s) * omega <<
" events / bin" << endl);
203 for (Int_t ix = 1; ix <= h2.GetXaxis()->GetNbins(); ++ix) {
204 for (Int_t iy = 1; iy <= h2.GetYaxis()->GetNbins(); ++iy) {
206 const double xmin = getRadians(h2.GetXaxis()->GetBinLowEdge(ix));
207 const double xmax = getRadians(h2.GetXaxis()->GetBinUpEdge (ix));
208 const double ymin = sin(getRadians(h2.GetYaxis()->GetBinLowEdge(iy)));
209 const double ymax = sin(getRadians(h2.GetYaxis()->GetBinUpEdge (iy)));
211 const double omega = (ymax - ymin) * (xmax - xmin);
213 const double mu = background * omega * (Tmax_s - Tmin_s);
215 const double x = h2.GetXaxis()->GetBinCenter(ix);
216 const double y = h2.GetYaxis()->GetBinCenter(iy);
217 const double z = gRandom->Poisson(mu);
228 const double omega = (ymax - ymin) * (xmax - xmin);
230 const double mu = background * omega * (Tmax_s - Tmin_s);
232 const size_t N = gRandom->Poisson(mu);
234 for (
size_t i = 0; i != N; ++i) {
236 const double x = gRandom->Uniform(xmin, xmax);
237 const double y = gRandom->Uniform(ymin, ymax);
239 g1.put(getDegrees(x), getDegrees(asin(y)));
241 const double dot = sqrt(1.0 - y*y - sin(x)*sin(x));
250 out << ha << h1 << h2 << hs;