54{
58
60 JLimit_t& numberOfEvents = inputFile.getLimit();
62 double ct;
63 double numberOfBlocks;
66
67 try {
68
69 JParser<> zap(
"Example program to plot event rates using JASTRONOMY::JStarTrek.");
70
78
79 zap(argc, argv);
80 }
81 catch(const exception &error) {
82 FATAL(error.what() << endl);
83 }
85
86
87 const double radius = 1.0;
88 const double omega = 2*PI * (1.0 - cos(radius*PI/180));
89
91
92
94
95 try {
97 }
100 }
101
102
103 double Wall = numberOfBlocks;
104
105 {
107
108 if (!buffer.is_valid(&
JHead::genvol) || buffer.genvol.numberOfEvents == 0) {
109 FATAL(
"No generated events." << endl);
110 }
111
112 Wall /= buffer.genvol.numberOfEvents;
113
114 STATUS(
"Generation: " << buffer.genvol.numberOfEvents << endl);
115
117 STATUS(
"Solid angle: " << 2 * buffer.cut_nu.cosT.getLength() <<
"pi" << endl);
118 }
119 }
120
121 if (join) {
122 Wall *= 0.5;
123 }
124
125
126
127
129
130 TH1D hc("ct [live time]", NULL, 1000, -1.0, +1.0);
131
132 for (int i = 1; i != hc.GetNbinsX(); ++i) {
133
134 const double x = hc.GetBinCenter(i);
135 const double y = startrek(x);
136
137 hc.SetBinContent(i, y);
138 }
139
140 TH1D h0("h0 [background]", NULL, 20, +1.0, +6.0);
141 TH1D h1("h1 [signal]", NULL, 20, +1.0, +6.0);
142
143 TH1D*
H[] = { &h0, &h1 };
144 double W[] = { 0.0, 0.0 };
145
146 for (
int i = 0; i !=
sizeof(
H)/
sizeof(
H[0]); ++i) {
148 }
149
150
152
154
156
157
158 const Evt*
event = ps;
159
161
163
164 const double E = neutrino.
E;
165 const double dz = neutrino.
dir.
z;
166 const double P = 1.0;
167 const double W2 = event->w[1];
168 const double W3 = event->w[2];
169
170
171
172 const double x = log10(E);
173 const double y[] = { P * W3 * omega * startrek(dz),
174 P * W2 * rxj1713(E) * startrek(dz) };
175
176 if (dz >= ct) {
177 for (
int i = 0; i !=
sizeof(
H)/
sizeof(
H[0]); ++i) {
178 H[i]->Fill(x, y[i] * Wall);
180 }
181 }
182 }
183 }
185
186 for (int i = 0; i != sizeof(W)/sizeof(W[0]); ++i) {
187 NOTICE(
"W[" << i <<
"] = " <<
FIXED(9,2) << W[i] << endl);
188 }
189
190 out.Write();
191 out.Close();
192}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Utility class to parse command line options.
counter_type getCounter() const
Get counter.
bool has_neutrino(const Evt &evt)
Test whether given event has an incoming neutrino.
const Trk & get_neutrino(const Evt &evt)
Get incoming neutrino.
static const JGeographicalLocation Sicily(36, 16, 16, 06)
static const JSourceLocation RXJ1713(getRadians(-39, -46, 0.0), getHourAngle(17, 13, 7))
static const double H
Planck constant [eV s].
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
KM3NeT DAQ data structures and auxiliaries.
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Auxiliary data structure for floating point format specification.
The Head class reflects the header of Monte-Carlo event files, which consists of keys (also referred ...
Auxiliary class for source tracking.
General purpose class for multiple pointers.
Auxiliary class for defining the range of iterations of objects.
static counter_type max()
Get maximum counter value.
Auxiliary class to synchronously read DAQ events and Monte Carlo events (and optionally other events)...
virtual bool hasNext() override
Check availability of next element.
virtual const multi_pointer_type & next() override
Get next element.
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
double E
Energy [GeV] (either MC truth or reconstructed)