Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
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 "JPhysics/JPDF.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

◆ main()

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

Definition at line 22 of file JRateK40.cc.

23{
24 using namespace std;
25 using namespace JPP;
26
27 double bequerel;
28 JPMTParameters parameters;
29 int debug;
30
31 try {
32
33 JProperties properties = parameters.getProperties();
34
35 JParser<> zap("Example program to calculate singles rate.");
36
37 zap['b'] = make_field(bequerel) = 13.75e3; // [m^-3 s^-1]
38 zap['P'] = make_field(properties) = JPARSER::initialised();
39 zap['d'] = make_field(debug) = 3;
40
41 zap(argc, argv);
42 }
43 catch(const exception &error) {
44 FATAL(error.what() << endl);
45 }
46
47
48 using namespace NAMESPACE;
49
50 JPMTAnalogueSignalProcessor cpu(parameters);
51
52 //For Geant4 inputs see https://git.km3net.de/vkulikovskiy/g4ly
53 const double wmin = 280.0; // minimal wavelength [nm]
54 const double wmax = 700.0; // maximal wavelength [nm]
55 double ng = 47.11; // Geant4 simulations of K40 decays in (wmin,wmax) window
56 const int npe = 1; // number of photo-electrons for each decay
57 double cpow = 2.156; // 1/lambda^cpow shape of the Cherenkov photons distribution is a fit from Geant4
58
59 double R[] = { 0.0, 0.0 };
60 double W[] = { 0.0, 0.0 };
61
62 const char* option[] = { "1Dx1D", "2D" };
63
64 for (double x = -1.0, dx = 0.02; x <= +1.0; x += dx) {
65 W[0] += getPhotocathodeArea() * getAngularAcceptance(x) * dx;
66 }
67
68
69 const double dw = 1.5; // [nm]
70
71 double norm[] = { 0.0, 0.0 };
72
73 for (double w = wmin; w <= wmax; w += dw) {
74
75 W[1] = 0.0;
76
77 for (double x = -1.0, dx = 0.02; x <= +1.0; x += dx) {
78 W[1] += KM3NET2D::getPhotocathodeArea2D(x, w) * dx;
79 }
80
81 R[0] += W[0] * dw * getQE(w) * getAbsorptionLength(w) / pow(w,cpow);
82 R[1] += W[1] * dw * getAbsorptionLength(w) / pow(w,cpow);
83 norm[0] += W[0] * dw * getQE(w) / pow(w,cpow);
84 norm[1] += W[1] * dw / pow(w,cpow);
85 }
86
87 double avabs[] = { 0.0, 0.0 };
88
89 cout << "survival probability: " << cpu.getSurvivalProbability(npe) << endl;
90
91 for (int i = 0; i != sizeof(R)/sizeof(R[0]); ++i) {
92 avabs[i] = R[i]/norm[i];
93
94 R[i] *= cpow-1.0;
95 R[i] /= pow(wmin, 1.0-cpow) - pow(wmax,1.0-cpow);
96
97 R[i] *= bequerel * ng;
98
99 R[i] *= cpu.getSurvivalProbability(npe);
100 R[i] *= 0.5e-3;
101
102 cout << "Rate " << setw(6) << left << option[i] << " [kHz]: " << R[i] << endl;
103 double corr = R[i]*(1.0-exp(-MODULE_RADIUS_M/avabs[i])); //rate due to coincidences within the DOM
104 cout << "Rcor "<< setw(6) << left << option[i] << " [kHz]: " << R[i]-corr << " <abs> [m]: "<< avabs[i] << endl;
105 }
106}
double getAngularAcceptance(const double x)
Angular acceptence of PMT.
Definition JDrawLED.cc:68
double getAbsorptionLength(const double lambda)
Definition JDrawPD0.cc:27
#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
Data structure for PMT parameters.
JProperties getProperties(const JEquationParameters &equation=JPMTParameters::getEquationParameters())
Get properties of this class.
Utility class to parse parameter values.
Utility class to parse command line options.
Definition JParser.hh:1698
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.
T pow(const T &x, const double y)
Power .
Definition JMath.hh:97
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
static const JPhotocathodeArea2D getPhotocathodeArea2D
Function object for effective photo-cathode area of PMT.
Definition KM3NeT2D.hh:5235
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition JParser.hh:68