Jpp 20.0.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JKM3Sim.cc File Reference
#include <string>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <vector>
#include <map>
#include "JLang/JException.hh"
#include "JMath/JConstants.hh"
#include "JPhysics/JConstants.hh"
#include "JPhysics/KM3NeT.hh"
#include "JPhysics/JDispersion.hh"
#include "Jeep/JStreamToolkit.hh"
#include "Jeep/JParser.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 270 of file JKM3Sim.cc.

271{
272 using namespace std;
273 using namespace JPP;
274
275 string inputFile;
276 map_type precision (0.0);
277 map_type correction(1.0);
278 int debug;
279
280 precision[JKM3Sim::RINDEX_WATER_t] = 1.0e-4;
281 precision[JKM3Sim::ABSORPTION_WATER_t] = 1.0e-4;
282 precision[JKM3Sim::MIE_WATER_t] = 0.2;
283 precision[JKM3Sim::ANG_ACCEPT_t] = 0.5;
284 precision[JKM3Sim::Q_EFF_t] = 0.01;
285
286 try {
287
288 JParser<> zap;
289
290 zap['f'] = make_field(inputFile);
291 zap['p'] = make_field(precision) = JPARSER::initialised();
292 zap['c'] = make_field(correction) = JPARSER::initialised();
293 zap['d'] = make_field(debug) = 1;
294
295 zap(argc, argv);
296 }
297 catch(const exception &error) {
298 FATAL(error.what() << endl);
299 }
300
301
302 JKM3Sim km3sim;
303
304 ifstream in(inputFile.c_str());
305
306 in >> km3sim;
307
308 in.close();
309
310 DEBUG(km3sim);
311
312 using namespace KM3NET;
313
314
315 {
316 /*
317 const double g = 9.80665; // [m/s^2]
318 const double P = detectorDepth * DENSITY_SEA_WATER * 1.0e-3 * g * 1.0e1; // [Atm]
319 */
320 const double P = 315.0; // [Atm]
321
322 DEBUG("Pressure " << P << " [Atm]" << endl);
323
324 const JDispersion dispersion(P);
325
326 for (size_t i = 0; i != km3sim.ppckov.size(); ++i) {
327
328 const double x = km3sim.ppckov[i];
329
330 ASSERT(fabs(km3sim.rindex_water[i] - dispersion.getIndexOfRefractionPhase(x) * correction.get(JKM3Sim::RINDEX_WATER_t)) <= precision.get(JKM3Sim::RINDEX_WATER_t),
331 "Test of index of refraction at " << FIXED(6,1) << x << ' ' << FIXED(7,4) << km3sim.rindex_water[i] << ' ' << FIXED(7,4) << dispersion.getIndexOfRefractionPhase(x) * correction.get(JKM3Sim::RINDEX_WATER_t));
332 }
333 }
334 {
335 for (const auto& i : km3sim.absorption_water) {
336 ASSERT(fabs(i.second - getAbsorptionLength(i.first) * correction.get(JKM3Sim::ABSORPTION_WATER_t)) <= precision.get(JKM3Sim::ABSORPTION_WATER_t),
337 "Test of absorption length at " << FIXED(6,1) << i.first << ' ' << FIXED(7,3) << i.second << ' ' << FIXED(7,3) << getAbsorptionLength(i.first) * correction.get(JKM3Sim::ABSORPTION_WATER_t));
338 }
339 }
340 {
341 for (size_t i = 0; i != km3sim.ppckov.size(); ++i) {
342
343 const double x = km3sim.ppckov[i];
344
345 ASSERT(fabs(km3sim.mie_water[i] - getScatteringLength(x) * correction.get(JKM3Sim::MIE_WATER_t)) <= precision.get(JKM3Sim::MIE_WATER_t),
346 "Test of scattering length at " << FIXED(6,1) << x << ' ' << FIXED(7,3) << km3sim.mie_water[i] << ' ' << FIXED(7,3) << getScatteringLength(x) * correction.get(JKM3Sim::MIE_WATER_t));
347 }
348 }
349 {
350 for (size_t i = 0; i != km3sim.ppckov.size(); ++i) {
351
352 const double x = km3sim.ppckov[i];
353
354 ASSERT(fabs(km3sim.q_eff[i] - getQE(x) * correction.get(JKM3Sim::Q_EFF_t)) <= precision.get(JKM3Sim::Q_EFF_t),
355 "Test of QE at " << FIXED(6,1) << x << ' ' << FIXED(7,4) << km3sim.q_eff[i] << ' ' << FIXED(7,4) << getQE(x) * correction.get(JKM3Sim::Q_EFF_t));
356 }
357 }
358 {
359 const double U = 1.0e4; // m^2 -> cm^2
360
361 for (size_t i = 0; i != km3sim.cos_angles.size(); ++i) {
362
363 const double x = km3sim.cos_angles[i];
364
365 ASSERT(fabs(km3sim.ang_accept[i]*km3sim.A - getPhotocathodeArea() * getAngularAcceptance(x) * U * correction.get(km3sim.ANG_ACCEPT_t)) <= precision.get(km3sim.ANG_ACCEPT_t),
366 "Test of PMT acceptance at " << FIXED(6,2) << x << ' ' << FIXED(9,5) << km3sim.ang_accept[i]*km3sim.A << ' ' << FIXED(9,5) << getPhotocathodeArea() * getAngularAcceptance(x) * U * correction.get(km3sim.ANG_ACCEPT_t));
367 }
368 }
369}
double getAngularAcceptance(const double x)
Angular acceptence of PMT.
Definition JDrawLED.cc:68
double getAbsorptionLength(const double lambda)
Definition JDrawPD0.cc:27
double getScatteringLength(const double lambda)
Definition JDrawPD0.cc:33
#define DEBUG(A)
Message macros.
Definition JMessage.hh:62
#define ASSERT(A,...)
Assert macro.
Definition JMessage.hh:90
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Utility class to parse command line options.
Definition JParser.hh:1698
Implementation of dispersion for water in deep sea.
double getPhotocathodeArea()
Get photo-cathode area of PMT.
Definition Antares.hh:51
double getQE(const double R, const double mu)
Get QE for given ratio of hit probabilities and expectation value of the number of photo-electrons.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Name space for KM3NeT.
Definition Jpp.hh:16
Auxiliary data structure for floating point format specification.
Definition JManip.hh:448
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition JParser.hh:68