Jpp 21.0.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
JDrawPDF.cc File Reference

Auxiliary program to draw PDF of Cherenkov light from muon. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "TROOT.h"
#include "TFile.h"
#include "TH1D.h"
#include "JPhysics/JPDF.hh"
#include "JPhysics/Antares.hh"
#include "JPhysics/KM3NeT.hh"
#include "JPhysics/JPDFSupportkit.hh"
#include "JPhysics/JGeane.hh"
#include "JTools/JFunction1D_t.hh"
#include "JTools/JQuantiles.hh"
#include "JTools/JAbstractHistogram.hh"
#include "JGeometry3D/JAngle3D.hh"
#include "Jeep/JProperties.hh"
#include "Jeep/JPrint.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

Auxiliary program to draw PDF of Cherenkov light from muon.

Author
mdejong, bofearraigh

Definition in file JDrawPDF.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 31 of file JDrawPDF.cc.

32{
33 using namespace std;
34 using namespace JPP;
35
37
38 string outputFile;
40 double epsilon;
41 PDF::configuration_type configuration;
42 double E;
43 double R;
44 double z;
45 JAngle3D dir;
46 vector<int> function;
47 JHistogram_t histogram;
48 int debug;
49
50 try {
51
52 JProperties properties = configuration.getProperties();
53
54 JParser<> zap("Auxiliary program to draw PDF of Cherenkov light from muon.");
55
56 zap['@'] = make_field(properties, PDF::help() << configuration) = JPARSER::initialised();
57 zap['o'] = make_field(outputFile) = "";
58 zap['n'] = make_field(numberOfPoints, "points for integration") = 25;
59 zap['e'] = make_field(epsilon, "precision for integration") = 1.0e-10;
60 zap['E'] = make_field(E, "muon energy at vertex [GeV]") = 1.0;
61 zap['R'] = make_field(R, "distance of approach [m]");
62 zap['z'] = make_field(z, "PMT z-position [m]");
63 zap['D'] = make_field(dir, "(theta, phi) of PMT [rad]");
64 zap['F'] = make_field(function, "PDF type");
65 zap['H'] = make_field(histogram, "histogram binning") = JHistogram_t();
66 zap['d'] = make_field(debug) = 0;
67
68 zap(argc, argv);
69 }
70 catch(const exception &error) {
71 FATAL(error.what() << endl);
72 }
73
74
75 const JPDF_C
76 pdf(NAMESPACE::getPhotocathodeArea(),
77 PDF::getQE,
78 PDF::getAngularAcceptance,
79 PDF::getAbsorptionLength,
80 PDF::getScatteringLength,
81 PDF::getScatteringProbability,
82 NAMESPACE::getAmbientPressure(),
86 epsilon);
87
88 const double z_0 = z - R/getTanThetaC(); // emission point z-position
89 const double E_0 = gWater.getE(E, z_0); // energy of muon at emission point
90
91
92 if (outputFile == "") {
93
94 cout << "enter time (^C to exit) > " << flush;
95
96 for (double dt; cin >> dt; ) {
97
98 for (vector<int>::const_iterator F = function.begin(); F != function.end(); ++F) {
99
100 cout << setw(2) << *F << ' '
101 << SCIENTIFIC(7,1) << E << ' '
102 << FIXED(5,1) << R << ' '
103 << FIXED(5,1) << z << ' '
104 << FIXED(5,2) << dir.getTheta() << ' '
105 << FIXED(5,2) << dir.getPhi() << ' '
106 << FIXED(5,1) << dt << ' '
107 << SCIENTIFIC(9,3) << pdf.getLightFromMuon(*F, E_0, R, dir.getTheta(), dir.getPhi(), dt) << endl;
108 }
109 }
110
111 return 0;
112 }
113
114
115 TFile out(outputFile.c_str(), "recreate");
116
117 const double t0 = 0.0; // time [ns]
118
119 if (!histogram.is_valid()) {
120
121 if (function.size() == 1 && function[0] == DIRECT_LIGHT_FROM_MUON) {
122
123 histogram = JHistogram_t(t0 - 20.0, t0 + 50.0);
124
125 histogram.setBinWidth(0.1);
126
127 } else {
128
129 histogram = JHistogram_t(t0 - 20.0, t0 + 500.0);
130
131 histogram.setBinWidth(0.5);
132 }
133 }
134
135 TH1D h0("h0", NULL, histogram.getNumberOfBins(), histogram.getLowerLimit(), histogram.getUpperLimit());
136
138
139 if (E_0 >= MASS_MUON* (1.0/SIN_THETA_C_WATER)) { // muon emission energy has to be above Cherenkov threshold
140
141 if (z_0 >= 0 && z_0 <= gWater(E)) { // emission point is between start and end point of muon
142
143 for (int i = 1; i <= h0.GetNbinsX(); ++i) {
144
145 const double dt = h0.GetBinCenter(i) - t0;
146
147 double value = 0.0;
148
149 for (vector<int>::const_iterator F = function.begin(); F != function.end(); ++F) {
150 value += pdf.getLightFromMuon(*F, E_0, R, dir.getTheta(), dir.getPhi(), dt);
151 }
152
153 h0.SetBinContent(i, value);
154
155 f1[dt] = value;
156 }
157 }
158 }
159
160 f1.setExceptionHandler(new JSplineFunction1S_t::JDefaultResult(JMATH::zero));
161 f1.compile();
162
163 try {
164
165 const double T_ns = 5; // [ns]
166
167 JQuantiles quantiles(f1);
168
169 const double t1 = quantiles.getX();
170 const double y = f1(t1 + T_ns).v - f1(t1 - T_ns).v;
171
172 DEBUG("E " << E << endl);
173 DEBUG("E_0 " << E_0 << endl);
174 DEBUG("R " << R << endl);
175 DEBUG("z " << z << endl);
176 DEBUG("theta " << dir.getTheta() << endl);
177 DEBUG("phi " << dir.getPhi() << endl);
178 DEBUG("int " << quantiles.getIntegral() << endl);
179 DEBUG("t1 " << t1 << endl);
180 DEBUG("max " << quantiles.getY() << endl);
181 DEBUG("FWHM " << quantiles.getFWHM() << endl);
182 DEBUG("int[] " << y << endl);
183 }
184 catch(const exception&) {}
185
186 out.Write();
187 out.Close();
188}
string outputFile
#define DEBUG(A)
Message macros.
Definition JMessage.hh:62
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:74
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2107
int numberOfPoints
Definition JResultPDF.cc:22
Utility class to parse parameter values.
Data structure for angles in three dimensions.
Definition JAngle3D.hh:35
double getTheta() const
Get theta angle.
Definition JAngle3D.hh:86
double getPhi() const
Get phi angle.
Definition JAngle3D.hh:97
Utility class to parse command line options.
Definition JParser.hh:1664
Probability Density Functions of the time response of a PMT with an implementation of the JAbstractPM...
Definition JPDF.hh:2188
Quantile calculator for a given interpolating function.
Definition JQuantiles.hh:34
T getLowerLimit() const
Get lower limit.
Definition JRange.hh:202
T getUpperLimit() const
Get upper limit.
Definition JRange.hh:213
Template class for spline interpolation in 1D.
Definition JSpline.hh:734
static const JZero zero
Function object to assign zero value.
Definition JZero.hh:105
double getMinimalWavelength()
Get minimal wavelength for PDF evaluations.
double getMaximalWavelength()
Get maximal wavelength for PDF evaluations.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
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:66
Auxiliary data structure for complete configuration.
JProperties getProperties()
Get properties.
Manipulator for help output.
Simple data structure for histogram binning.
void setBinWidth(const abscissa_type dx, int option=0)
Set bin width.
bool is_valid() const
Check validity of histogram binning.
int getNumberOfBins() const
Get number of bins.
void setExceptionHandler(const JSupervisor &supervisor)
Set the supervisor for handling of exceptions.
Auxiliary data structure for floating point format specification.
Definition JManip.hh:488