24 static constexpr const char*
const detectorDepth_t =
"detectorDepth";
25 static constexpr const char*
const PPCKOV_t =
"PPCKOV";
26 static constexpr const char*
const RINDEX_WATER_t =
"RINDEX_WATER";
27 static constexpr const char*
const ABSORPTION_WATER_t =
"ABSORPTION_WATER";
28 static constexpr const char*
const RINDEX_GLASS_t =
"RINDEX_GLASS";
29 static constexpr const char*
const ABSORPTION_GLASS_t =
"ABSORPTION_GLASS";
30 static constexpr const char*
const RINDEX_GELL_t =
"RINDEX_GELL";
31 static constexpr const char*
const RINDEX_AIR_t =
"RINDEX_AIR";
32 static constexpr const char*
const ABSORPTION_AIR_t =
"ABSORPTION_AIR";
33 static constexpr const char*
const RINDEX_CATH_t =
"RINDEX_CATH";
34 static constexpr const char*
const ABSORPTION_CATH_t =
"ABSORPTION_CATH";
35 static constexpr const char*
const Q_EFF_t =
"Q_EFF";
36 static constexpr const char*
const MIE_WATER_t =
"MIE_WATER";
37 static constexpr const char*
const MIE_PARAM_t =
"MIE_PARAM";
38 static constexpr const char*
const COS_ANGLES_t =
"COS_ANGLES";
39 static constexpr const char*
const ANG_ACCEPT_t =
"ANG_ACCEPT";
41 static constexpr const char*
const END_t =
"END";
42 static constexpr char SEPARATOR =
'*';
75 const string::size_type pos = buffer.find(SEPARATOR);
77 if (pos != string::npos) {
81 istringstream(buffer.substr(0,pos)) >> value;
83 return make_pair(value, buffer.substr(pos+1));
99 friend inline std::istream&
operator>>(std::istream& in, JKM3Sim&
object)
103 for (
string key; in >>
key; ) {
109 if (key == detectorDepth_t) {
111 if (in >> buffer[0]) {
112 object.detectorDepth =
parse(buffer[0]).first;
115 }
else if (key == PPCKOV_t) {
118 for (
size_t i = 0; i != N; ++i) {
119 if (in >> buffer[0]) {
120 object.ppckov.push_back(
parse(buffer[0]).first);
125 }
else if (key == RINDEX_WATER_t) {
127 for (
size_t i = 0; i !=
object.ppckov.size(); ++i) {
129 object.rindex_water.push_back(value);
133 }
else if (key == ABSORPTION_WATER_t) {
135 for (in >> buffer[0]; in >> buffer[0] >> buffer[1] && buffer[0] != END_t; ) {
136 object.absorption_water[
parse(buffer[0]).first] =
parse(buffer[1]).first;
139 }
else if (key == MIE_WATER_t) {
141 for (
size_t i = 0; i !=
object.ppckov.size(); ++i) {
142 if (in >> buffer[0]) {
143 object.mie_water.push_back(
parse(buffer[0]).first);
147 }
else if (key == Q_EFF_t) {
153 for (
size_t i = 0; i !=
object.ppckov.size(); ++i) {
155 object.q_eff.push_back(value*QE);
159 }
else if (key == MIE_PARAM_t) {
161 in >>
object.mie_param;
163 }
else if (key == COS_ANGLES_t) {
166 for (
size_t i = 0; i != N; ++i) {
168 object.cos_angles.push_back(value);
173 }
else if (key == ANG_ACCEPT_t) {
175 for (
size_t i = 0; i !=
object.cos_angles.size(); ++i) {
177 object.ang_accept.push_back(value);
194 friend inline std::ostream&
operator<<(std::ostream& out,
const JKM3Sim&
object)
199 out << detectorDepth_t <<
' ' <<
object.detectorDepth << endl;
200 out << PPCKOV_t <<
' ' <<
JEEPZ() <<
object.ppckov << endl;
201 out << RINDEX_WATER_t <<
' ' <<
JEEPZ() <<
object.rindex_water << endl;
202 out << ABSORPTION_WATER_t <<
' ' <<
JEEPZ() <<
object.absorption_water << endl;
203 out << MIE_WATER_t <<
' ' <<
JEEPZ() <<
object.mie_water << endl;
204 out << Q_EFF_t <<
' ' <<
JEEPZ() <<
object.q_eff << endl;
205 out << MIE_PARAM_t <<
' ' <<
object.mie_param << endl;
206 out << COS_ANGLES_t <<
' ' <<
JEEPZ() <<
object.cos_angles << endl;
207 out << ANG_ACCEPT_t <<
' ' <<
JEEPZ() <<
object.ang_accept << endl;
216 double detectorDepth;
232 public std::map<std::string, double>
250 double get(
const std::string key)
const
252 const_iterator p = this->find(key);
254 if (p != this->end())
276 map_type precision (0.0);
277 map_type correction(1.0);
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;
297 catch(
const exception &error) {
298 FATAL(error.what() << endl);
304 ifstream in(inputFile.c_str());
320 const double P = 315.0;
322 DEBUG(
"Pressure " << P <<
" [Atm]" << endl);
326 for (
size_t i = 0; i != km3sim.ppckov.size(); ++i) {
328 const double x = km3sim.ppckov[i];
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));
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));
341 for (
size_t i = 0; i != km3sim.ppckov.size(); ++i) {
343 const double x = km3sim.ppckov[i];
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));
350 for (
size_t i = 0; i != km3sim.ppckov.size(); ++i) {
352 const double x = km3sim.ppckov[i];
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));
359 const double U = 1.0e4;
361 for (
size_t i = 0; i != km3sim.cos_angles.size(); ++i) {
363 const double x = km3sim.cos_angles[i];
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));
double getAngularAcceptance(const double x)
Angular acceptence of PMT.
double getAbsorptionLength(const double lambda)
double getScatteringLength(const double lambda)
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
std::istream & operator>>(std::istream &in, JAANET::JHead &header)
Read header from input.
int main(int argc, char **argv)
#define DEBUG(A)
Message macros.
#define ASSERT(A,...)
Assert macro.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Properties of KM3NeT PMT and deep-sea water.
Exception for parsing value.
Utility class to parse command line options.
Implementation of dispersion for water in deep sea.
virtual double getIndexOfRefractionPhase(const double lambda) const
Index of refraction (phase velocity).
std::ostream & writeObject(std::ostream &out, const T &object)
Stream output of object.
std::istream & readObject(std::istream &in, T &object)
Stream input of object.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
JWriter & operator<<(JWriter &out, const JDAQChronometer &chronometer)
Write DAQ chronometer to output.
std::map< int, range_type > map_type
JReader & operator>>(JReader &in, JDAQChronometer &chronometer)
Read DAQ chronometer from input.
boost::property_tree::ptree parse(std::string str)
Auxiliary data structure for floating point format specification.
Auxiliary data structure for streaming of STL containers.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...