Jpp 20.0.0-195-g190c9e876
the software that should make you happy
Loading...
Searching...
No Matches
JEMShower.cc File Reference

Auxiliary program to draw npe as a function of EM-energy. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "TROOT.h"
#include "TFile.h"
#include "TH1D.h"
#include "JPhysics/JPDF.hh"
#include "JPhysics/KM3NeT.hh"
#include "JPhysics/JConstants.hh"
#include "Jeep/JPrint.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
#include <cmath>
#include "JTools/JFunction1D_t.hh"
#include "JPhysics/JDispersion.hh"
#include "JPhysics/JPDFToolkit.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Auxiliary program to draw npe as a function of EM-energy.

Author
mdejong

Definition in file JEMShower.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 147 of file JEMShower.cc.

148{
149 using namespace std;
150
151 string outputFile;
152 int numberOfPoints;
153 double epsilon;
154 int debug;
155
156 try {
157
158 JParser<> zap("Auxiliary program to draw npe as a function of EM-energy.");
159
160 zap['o'] = make_field(outputFile) = "geanc.root";
161 zap['n'] = make_field(numberOfPoints) = 25;
162 zap['e'] = make_field(epsilon) = 1.0e-10;
163 zap['d'] = make_field(debug) = 2;
164
165 zap(argc, argv);
166 }
167 catch(const exception &error) {
168 FATAL(error.what() << endl);
169 }
170
171
172 using namespace JPP;
173
174 const JPDF_C
175 pdf(NAMESPACE::getPhotocathodeArea(),
176 NAMESPACE::getQE,
177 NAMESPACE::getAngularAcceptance,
181 NAMESPACE::getAmbientPressure(),
185 epsilon);
186
187
188 double xmin = -4.0;
189 double xmax = 0.0;
190
191 const double precision = 1.0e-10;
192
193 while (fabs(xmax - xmin) > precision) {
194
195 const double x = 0.5 * (xmin + xmax);
196 const double E = pow(10.0, x);
197
198 const double y = getEMShowerCorrection(E);
199
200 if (y < 0.5)
201 xmin = x;
202 else
203 xmax = x;
204 }
205
206 const double EMIN = pow(10.0, 0.5*(xmax + xmin));
207
208 NOTICE("Threshold kinetic energy [GeV] " << sqrt((EMIN + MASS_ELECTRON) * (EMIN - MASS_ELECTRON)) << endl);
209
210
211 TFile out(outputFile.c_str(), "recreate");
212
213 TH1D h0("h0", NULL, 10000, -4.0, +4.0);
214 TH1D h1("h1", NULL, 10000, -4.0, +4.0);
215
216 for (int i = 1; i <= h0.GetNbinsX(); ++i) {
217
218 const Double_t x = h0.GetBinCenter(i);
219 const Double_t E = pow(10.0, x);
220
221 h0.SetBinContent(i, E * geanc() * pdf.getNumberOfPhotons());
222 h1.SetBinContent(i, getEMShowerCorrection(E));
223 }
224
225 out.Write();
226 out.Close();
227}
string outputFile
#define NOTICE(A)
Definition JMessage.hh:64
#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:2142
int numberOfPoints
Definition JResultPDF.cc:22
Utility class to parse command line options.
Definition JParser.hh:1698
Probability Density Functions of the time response of a PMT with an implementation of the JAbstractPM...
Definition JPDF.hh:2186
T pow(const T &x, const double y)
Power .
Definition JMath.hh:97
double getMinimalWavelength()
Get minimal wavelength for PDF evaluations.
double geanc()
Equivalent muon track length per unit shower energy.
Definition JGeane.hh:28
double getMaximalWavelength()
Get maximal wavelength for PDF evaluations.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
double getAbsorptionLength(const double lambda)
double getScatteringLength(const double lambda)
double getScatteringProbability(const double x)