Jpp  18.6.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JRateK40.cc File Reference

Example program to calculate singles rate. More...

#include <string>
#include <iostream>
#include "JPhysics/KM3NeT.hh"
#include "JPhysics/KM3NeT2D.hh"
#include "JPhysics/Antares.hh"
#include "JDetector/JPMTAnalogueSignalProcessor.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Detailed Description

Example program to calculate singles rate.

The calculation is based on the Antares internal note ANTARES-PHYS-2006-005 by Jurgen Brunner. According Antares internal note ANTARES-PHYS-2012-013, the absorption length is used (and not the attenuation length).

Author
mdejong

Definition in file JRateK40.cc.

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 21 of file JRateK40.cc.

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:1711
data_type w[N+1][M+1]
Definition: JPolint.hh:867
Utility class to parse parameter values.
Definition: JProperties.hh:497
*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:84
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2158
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
#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
int debug
debug level
double getAngularAcceptance(const double x)
Angular acceptence of PMT.
Definition: JDrawLED.cc:68