34int main(
int argc,
char **argv)
39 string fileDescriptor;
54 zap[
'O'] =
make_field(option) =
"KM3NeT",
"Antares";
55 zap[
'E'] =
make_field(E,
"muon/shower energy [GeV]");
56 zap[
'c'] =
make_field(cd,
"cosine emission angle");
57 zap[
'D'] =
make_field(dir,
"(theta, phi) of PMT [rad]");
58 zap[
'T'] =
make_field(TMax_ns,
"L1 coincidence time window [ns]") = 20.0;
65 catch(
const exception &error) {
66 FATAL(error.what() << endl);
70 const double epsilon = 1.0e-6;
78 if (option ==
"KM3NeT") {
112 }
else if (option ==
"Antares") {
120 FATAL(
"Fatal error at detector option " << option << endl);
136 TH1D h0m(
"L0m", NULL, 300, 1.0, 151.0);
137 TH1D h1m(
"L1m", NULL, 300, 1.0, 151.0);
139 TH1D h0s(
"L0s", NULL, 300, 1.0, 151.0);
140 TH1D h1s(
"L1s", NULL, 300, 1.0, 151.0);
154 DIRECT_LIGHT_FROM_MUON,
155 SCATTERED_LIGHT_FROM_MUON,
156 DIRECT_LIGHT_FROM_EMSHOWERS,
157 SCATTERED_LIGHT_FROM_EMSHOWERS,
158 DIRECT_LIGHT_FROM_DELTARAYS,
159 SCATTERED_LIGHT_FROM_DELTARAYS
162 const double TTS = 2.0;
164 const double epsilon = 1.0e-10;
166 const int NUMBER_OF_PDFS =
sizeof(type)/
sizeof(type[0]);
168 JPDF_t pdf[NUMBER_OF_PDFS];
170 const JPDF_t::JSupervisor supervisor(
new JPDF_t::JDefaultResult(
JMATH::zero));
172 for (
int i = 0; i != NUMBER_OF_PDFS; ++i) {
176 const string file_name = getFilename(fileDescriptor, type[i]);
178 NOTICE(
"loading PDF from file " << file_name <<
"... " << flush);
180 pdf[i].load(file_name.c_str());
184 pdf[i].setExceptionHandler(supervisor);
192 const double Tmin = -15.0;
193 const double Tmax = +250.0;
194 const double dt = 1.0;
196 for (
int ix = 1; ix <= h0m.GetNbinsX(); ++ix) {
198 const double R = h0m.GetBinCenter(ix);
202 for (vector<JAngle3D>::const_iterator pmt =
PMT.begin(); pmt !=
PMT.end(); ++pmt) {
204 const double theta = pi.
constrain(pmt->getTheta());
205 const double phi = pi.
constrain(fabs(pmt->getPhi()));
207 for (
int i = 0; i != NUMBER_OF_PDFS; ++i) {
209 double yi = pdf[i](R, theta, phi, Tmax).V;
211 if (is_bremsstrahlung(type[i])) {
213 }
else if (is_deltarays(type[i])) {
214 yi *= JDeltaRays::getEnergyLossFromMuon(E);
220 h0m.SetBinContent(ix, 1.0 - TMath::PoissonI(0,V));
224 const int NUMBER_OF_PMTS =
PMT.size();
226 double Vi[NUMBER_OF_PMTS];
228 for (
int ix = 1; ix <= h1m.GetNbinsX(); ++ix) {
230 const double R = h1m.GetBinCenter(ix);
234 for (
double x = Tmin; x <= Tmax; x += dt) {
238 for (
int pmt = 0; pmt != NUMBER_OF_PMTS; ++pmt) {
243 const double phi = pi.
constrain(fabs(
PMT[pmt].getPhi()));
245 for (
int i = 0; i != NUMBER_OF_PDFS; ++i) {
248 pdf[i](R, theta, phi, x).v,
249 pdf[i](R, theta, phi, x + TMax_ns).v
252 if (is_bremsstrahlung(type[i])) {
255 }
else if (is_deltarays(type[i])) {
256 yi[0] *= JDeltaRays::getEnergyLossFromMuon(E);
257 yi[1] *= JDeltaRays::getEnergyLossFromMuon(E);
260 Vi[pmt] += yi[1] - yi[0];
266 for (
int pmt = 0; pmt != NUMBER_OF_PMTS; ++pmt) {
269 const double phi = pi.
constrain(fabs(
PMT[pmt].getPhi()));
273 for (
int i = 0; i != NUMBER_OF_PDFS; ++i) {
275 double yi = pdf[i](R, theta, phi, x).f;
277 if (is_bremsstrahlung(type[i])) {
279 }
else if (is_deltarays(type[i])) {
280 yi *= JDeltaRays::getEnergyLossFromMuon(E);
287 Y += y * (1.0 - TMath::PoissonI(0, V - Vi[pmt])) * dt;
292 h1m.SetBinContent(ix, 1.0 - TMath::PoissonI(0,Y));
309 DIRECT_LIGHT_FROM_EMSHOWER,
310 SCATTERED_LIGHT_FROM_EMSHOWER
313 const double TTS = 2.0;
315 const double epsilon = 1.0e-10;
317 const int NUMBER_OF_PDFS =
sizeof(type)/
sizeof(type[0]);
319 JPDF_t pdf[NUMBER_OF_PDFS];
321 const JPDF_t::JSupervisor supervisor(
new JPDF_t::JDefaultResult(
JMATH::zero));
323 for (
int i = 0; i != NUMBER_OF_PDFS; ++i) {
327 const string file_name = getFilename(fileDescriptor, type[i]);
329 NOTICE(
"loading PDF from file " << file_name <<
"... " << flush);
331 pdf[i].load(file_name.c_str());
335 pdf[i].setExceptionHandler(supervisor);
343 const double Tmin = -15.0;
344 const double Tmax = +250.0;
345 const double dt = 1.0;
347 for (
int ix = 1; ix <= h0s.GetNbinsX(); ++ix) {
349 const double D = h0s.GetBinCenter(ix);
353 for (vector<JAngle3D>::const_iterator pmt =
PMT.begin(); pmt !=
PMT.end(); ++pmt) {
355 const double theta = pi.
constrain(pmt->getTheta());
356 const double phi = pi.
constrain(fabs(pmt->getPhi()));
358 for (
int i = 0; i != NUMBER_OF_PDFS; ++i) {
360 double yi = pdf[i](D, cd, theta, phi, Tmax).V;
368 h0s.SetBinContent(ix, 1.0 - TMath::PoissonI(0,V));
372 const int NUMBER_OF_PMTS =
PMT.size();
374 double Vi[NUMBER_OF_PMTS];
376 for (
int ix = 1; ix <= h1s.GetNbinsX(); ++ix) {
378 const double D = h1s.GetBinCenter(ix);
382 for (
double x = Tmin; x <= Tmax; x += dt) {
386 for (
int pmt = 0; pmt != NUMBER_OF_PMTS; ++pmt) {
391 const double phi = pi.
constrain(fabs(
PMT[pmt].getPhi()));
393 for (
int i = 0; i != NUMBER_OF_PDFS; ++i) {
396 pdf[i](D, cd, theta, phi, x).v,
397 pdf[i](D, cd, theta, phi, x + TMax_ns).v
403 Vi[pmt] += yi[1] - yi[0];
409 for (
int pmt = 0; pmt != NUMBER_OF_PMTS; ++pmt) {
412 const double phi = pi.
constrain(fabs(
PMT[pmt].getPhi()));
416 for (
int i = 0; i != NUMBER_OF_PDFS; ++i) {
418 double yi = pdf[i](D, cd, theta, phi, x).f;
426 Y += y * (1.0 - TMath::PoissonI(0, V - Vi[pmt])) * dt;
431 h1s.SetBinContent(ix, 1.0 - TMath::PoissonI(0,Y));