Toy simulation to study morphology of source and detector resolution.
44{
47
51
52 struct {
54 } parameters;
55
56 size_t numberOfEvents;
63 double background;
64 double omega;
67
68 try {
69
71
73
75
83 zap[
'r'] =
make_field(resolution,
"resolution: \"<type> (parameters)+\"\n\twhere <type> can be:" <<
get_keys(resolution_helper));
84 zap[
'B'] =
make_field(background,
"number of events / s / sr") = 0.0;
85 zap[
'O'] =
make_field(omega,
"effective bin width [sr]") = 1.0e-4;
88
90 }
91 catch(const exception &error) {
93 }
94
96
97
99
101 const time_t Tmax_s =
UTC.getUpperLimit().getTime();
102
103 double x0 = -1.0;
104 {
105 const double xmin =
getRadians(X.getLowerLimit());
106 const double xmax =
getRadians(X.getUpperLimit());
109
110 const double V = (
ymax -
ymin) * (xmax - xmin);
111
112 x0 = 1.0 - V / (sqrt(2.0)*2.0*PI);
113 }
114 const double dx = omega / (2.0*PI);
115 const int nx = (
int) ((1.0 - x0) /
dx);
116
120 X.getNumberOfBins(), X.getLowerLimit(), X.getUpperLimit(),
121 Y.getNumberOfBins(), Y.getLowerLimit(), Y.getUpperLimit());
122
124 JGraph_t g2;
125
126 TH2D hs(
"hs",
NULL, 100, 0.0, NUMBER_OF_SECONDS_PER_SEDERIAL_DAY / NUMBER_OF_SECONDS_PER_HOUR, 100, -1.0, +1.0);
127
128 for (size_t counter = 0; counter != numberOfEvents; ++counter) {
129
131
132
133
134
137
138
139
140
142
143
144
145
147
148
149
150 {
152
154 }
155
156
157
158
159 hs.Fill(
fmod(t1, NUMBER_OF_SECONDS_PER_SEDERIAL_DAY) / NUMBER_OF_SECONDS_PER_HOUR,
u3.getDZ());
160
161 if (!parameters.ct(
u3.getDZ())) {
162 continue;
163 }
164
165
166
167
169
171
172
173
174
176
179
182
185
186 h2.Fill(x, y);
187 g2.put (x, y);
188
190
192 h1.Fill(dot);
193 }
195
196
197 if (background > 0.0) {
198
199 NOTICE(
"Background: " <<
FIXED(9,5) << background * (Tmax_s -
Tmin_s) * omega <<
" events / bin" <<
endl);
200
203
204 const double xmin =
getRadians(h2.GetXaxis()->GetBinLowEdge(
ix));
205 const double xmax =
getRadians(h2.GetXaxis()->GetBinUpEdge (
ix));
208
209 const double omega = (
ymax -
ymin) * (xmax - xmin);
210
211 const double mu = background * omega * (Tmax_s -
Tmin_s);
212
213 const double x = h2.GetXaxis()->GetBinCenter(
ix);
214 const double y = h2.GetYaxis()->GetBinCenter(
iy);
215 const double z =
gRandom->Poisson(mu);
216
217 h2.Fill(x, y, z);
218 }
219 }
220
221 const double xmin =
getRadians(X.getLowerLimit());
222 const double xmax =
getRadians(X.getUpperLimit());
225
226 const double omega = (
ymax -
ymin) * (xmax - xmin);
227
228 const double mu = background * omega * (Tmax_s -
Tmin_s);
229
230 const size_t N =
gRandom->Poisson(mu);
231
232 for (size_t i = 0; i != N; ++i) {
233
234 const double x =
gRandom->Uniform(xmin, xmax);
236
238
239 const double dot = sqrt(1.0 - y*y -
sin(x)*
sin(x));
240
241 h1.Fill(dot);
242 }
243 }
244
245
247
248 out <<
ha << h1 << h2 <<
hs;
251
252 out.Write();
253 out.Close();
254}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
Double_t g1(const Double_t x)
Function.
Auxiliary class to make coordinate transformations for a specific geographical location of the detect...
Utility class to parse parameter values.
Data structure for direction in three dimensions.
Template definition of a multi-dimensional oscillation probability interpolation table.
Utility class to parse command line options.
std::shared_ptr< JMorphology > morphology_type
Type definition of generic morphology.
double getTimeMJD(time_t t1_s)
Get MJD time given UTC time.
std::shared_ptr< JResolution > resolution_type
Type definition of generic resolution.
double getDegrees(const double angle)
Convert angle to degrees.
double getRadians(const double angle)
Convert angle to radians.
const array_type< JKey_t > & get_keys(const std::map< JKey_t, JValue_t, JComparator_t, JAllocator_t > &data)
Method to create array of keys of map.
double getDot(const JFirst_t &first, const JSecond_t &second)
Get dot product of objects.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.
Direction of incident neutrino.
Location of astrophysical source.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary data structure to build TGraph.