Jpp  18.5.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JRateK40.cc
Go to the documentation of this file.
1 #include <string>
2 #include <iostream>
3 
4 #include "JPhysics/KM3NeT.hh"
5 #include "JPhysics/KM3NeT2D.hh"
6 #include "JPhysics/Antares.hh"
8 
9 #include "Jeep/JParser.hh"
10 #include "Jeep/JMessage.hh"
11 
12 
13 /**
14  * \file
15  *
16  * Example program to calculate singles rate.
17  * The calculation is based on the Antares internal note ANTARES-PHYS-2006-005 by Jurgen Brunner.
18  * According Antares internal note ANTARES-PHYS-2012-013, the absorption length is used (and not the attenuation length).
19  * \author mdejong
20  */
21 int main(int argc, char* argv[])
22 {
23  using namespace std;
24  using namespace JPP;
25 
26  double bequerel;
27  JPMTParameters parameters;
28  int debug;
29 
30  try {
31 
32  JProperties properties = parameters.getProperties();
33 
34  JParser<> zap("Example program to calculate singles rate.");
35 
36  zap['b'] = make_field(bequerel) = 13.75e3; // [m^-3 s^-1]
37  zap['P'] = make_field(properties) = JPARSER::initialised();
38  zap['d'] = make_field(debug) = 3;
39 
40  zap(argc, argv);
41  }
42  catch(const exception &error) {
43  FATAL(error.what() << endl);
44  }
45 
46 
47  using namespace NAMESPACE;
48 
49  JPMTAnalogueSignalProcessor cpu(parameters);
50 
51  const double wmin = 280.0; // minimal wavelength [nm]
52  const double wmax = 700.0; // maximal wavelength [nm]
53  double ng = 41.0; // average number of photons per decay in given wavelength range
54  const int npe = 1; // number of photo-electrons for each decay
55 
56  ng *= (wmax-wmin) / (wmin*wmax) * (300.0*600.0)/(600.0-300.0);
57 
58  double R[] = { 0.0, 0.0 };
59  double W[] = { 0.0, 0.0 };
60 
61  const char* option[] = { "1Dx1D", "2D" };
62 
63  for (double x = -1.0, dx = 0.02; x <= +1.0; x += dx) {
64  W[0] += getPhotocathodeArea() * getAngularAcceptance(x) * dx;
65  }
66 
67 
68  const double dw = 1.5; // [nm]
69 
70  for (double w = wmin; w <= wmax; w += dw) {
71 
72  W[1] = 0.0;
73 
74  for (double x = -1.0, dx = 0.02; x <= +1.0; x += dx) {
75  W[1] += KM3NET2D::getPhotocathodeArea2D(x, w) * dx;
76  }
77 
78  R[0] += W[0] * dw * getQE(w) * getAbsorptionLength(w) / (w*w);
79  R[1] += W[1] * dw * getAbsorptionLength(w) / (w*w);
80  }
81 
82  for (int i = 0; i != sizeof(R)/sizeof(R[0]); ++i) {
83 
84  R[i] *= wmax*wmin / (wmax - wmin);
85  R[i] *= bequerel * ng;
86 
87  R[i] *= cpu.getSurvivalProbability(npe);
88  R[i] *= 0.5e-3;
89 
90  cout << "Rate " << setw(6) << left << option[i] << " [kHz]: " << R[i] << endl;
91  }
92 }
Utility class to parse command line options.
Definition: JParser.hh:1514
data_type w[N+1][M+1]
Definition: JPolint.hh:867
int main(int argc, char *argv[])
Definition: Main.cc:15
Utility class to parse parameter values.
Definition: JProperties.hh:497
Properties of Antares PMT and deep-sea water.
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Definition: diff-Tuna.sh:38
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:83
Properties of KM3NeT PMT and deep-sea water.
Properties of KM3NeT PMT and deep-sea water.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1989
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...
double getPhotocathodeArea()
Get photo-cathode area of PMT.
Definition: Antares.hh:51
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
then JCookie sh JDataQuality D $DETECTOR_ID R
Definition: JDataQuality.sh:41
static const JPhotocathodeArea2D getPhotocathodeArea2D
Function object for effective photo-cathode area of PMT.
Definition: KM3NeT2D.hh:5235
double getAbsorptionLength(const double lambda)
Get absorption length.
Definition: Antares.hh:63
Utility class to parse command line options.
PMT analogue signal processor.
int debug
debug level
double getAngularAcceptance(const double x)
Angular acceptence of PMT.
Definition: JDrawLED.cc:68