Jpp  18.0.0-rc.3
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions | Variables
JDrawPD0.cc File Reference

Auxiliary program to draw PDF of Cherenkov light from bright point. 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 "JTools/JSpline.hh"
#include "JTools/JQuantiles.hh"
#include "JTools/JAbstractHistogram.hh"
#include "Jeep/JPrint.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

double getAbsorptionLength (const double lambda)
 
double getScatteringLength (const double lambda)
 
int main (int argc, char **argv)
 

Variables

double absorptionLengthFactor
 Scaling of absorption and scattering length. More...
 
double scatteringLengthFactor
 

Detailed Description

Auxiliary program to draw PDF of Cherenkov light from bright point.

Author
mdejong

Definition in file JDrawPD0.cc.

Function Documentation

double getAbsorptionLength ( const double  lambda)
inline

Definition at line 27 of file JDrawPD0.cc.

28 {
30 }
double absorptionLengthFactor
Scaling of absorption and scattering length.
Definition: JDrawPD0.cc:24
double getAbsorptionLength(const double lambda)
Get absorption length.
Definition: Antares.hh:63
double getScatteringLength ( const double  lambda)
inline

Definition at line 33 of file JDrawPD0.cc.

34 {
36 }
double getScatteringLength(const double lambda)
Get scattering length.
Definition: Antares.hh:148
double scatteringLengthFactor
Definition: JDrawPD0.cc:25
int main ( int  argc,
char **  argv 
)

Definition at line 45 of file JDrawPD0.cc.

46 {
47  using namespace std;
48  using namespace JPP;
49 
50  typedef JAbstractHistogram<double> JHistogram_t;
51 
52  string outputFile;
53  int numberOfPoints;
54  double epsilon;
55  double E;
56  double D;
57  double ct;
58  vector<int> function;
59  JHistogram_t histogram;
60  int debug;
61 
62  try {
63 
64  JParser<> zap("Auxiliary program to draw PDF of Cherenkov light from bright point.");
65 
66  zap['o'] = make_field(outputFile) = "pd0.root";
67  zap['n'] = make_field(numberOfPoints, "points for integration") = 25;
68  zap['e'] = make_field(epsilon, "precision for integration") = 1.0e-10;
69  zap['A'] = make_field(absorptionLengthFactor, "scaling factor") = 1.0;
70  zap['S'] = make_field(scatteringLengthFactor, "scaling factor") = 1.0;
71  zap['E'] = make_field(E, "shower energy [GeV]");
72  zap['R'] = make_field(D, "distance [m]");
73  zap['c'] = make_field(ct, "cosine PMT angle");
74  zap['F'] = make_field(function, "PDF type");
75  zap['H'] = make_field(histogram, "histogram binning") = JHistogram_t();
76  zap['d'] = make_field(debug) = 0;
77 
78  zap(argc, argv);
79  }
80  catch(const exception &error) {
81  FATAL(error.what() << endl);
82  }
83 
84 
85  const JPDF_C
96  epsilon);
97 
98 
99  if (outputFile == "") {
100 
101  for (double dt; cin >> dt; ) {
102 
103  for (vector<int>::const_iterator F = function.begin(); F != function.end(); ++F) {
104 
105  cout << setw(2) << *F << ' '
106  << SCIENTIFIC(7,1) << E << ' '
107  << FIXED(5,1) << D << ' '
108  << FIXED(5,2) << ct << ' '
109  << FIXED(5,1) << dt << ' '
110  << SCIENTIFIC(9,3) << pdf.getLightFromBrightPoint(*F, D, ct, dt) * E << endl;
111  }
112  }
113 
114  return 0;
115  }
116 
117 
118  TFile out(outputFile.c_str(), "recreate");
119 
120  //const double t0 = D * getIndexOfRefraction() / C; // time [ns]
121  const double t0 = 0.0; // time [ns]
122 
123  if (!histogram.is_valid()) {
124 
125  if (function.size() == 1 && function[0] == DIRECT_LIGHT_FROM_BRIGHT_POINT) {
126 
127  histogram = JHistogram_t(t0 - 20.0, t0 + 50.0);
128 
129  histogram.setBinWidth(0.1);
130 
131  } else {
132 
133  histogram = JHistogram_t(t0 - 20.0, t0 + 500.0);
134 
135  histogram.setBinWidth(0.5);
136  }
137  }
138 
139  TH1D h0("h0", NULL, histogram.getNumberOfBins(), histogram.getLowerLimit(), histogram.getUpperLimit());
140 
141  JSplineFunction1D_t f1;
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.getLightFromBrightPoint(*F, D, ct, dt) * E;
151  }
152 
153  h0.SetBinContent(i, value);
154 
155  f1[dt] = value;
156  }
157 
158  f1.compile();
159 
160  JQuantiles quantiles(f1);
161 
162  DEBUG("int " << quantiles.getIntegral() << endl);
163  DEBUG("x " << quantiles.getX() << endl);
164  DEBUG("y " << quantiles.getY() << endl);
165  DEBUG("FWHM " << quantiles.getFWHM() << endl);
166 
167 
168  out.Write();
169  out.Close();
170 }
Utility class to parse command line options.
Definition: JParser.hh:1514
then usage $script< input file >[option[primary[working directory]]] nWhere option can be E
Definition: JMuonPostfit.sh:36
double absorptionLengthFactor
Scaling of absorption and scattering length.
Definition: JDrawPD0.cc:24
double getScatteringProbability(const double x)
Function to describe light scattering in water.
Definition: Antares.hh:210
double getMinimalWavelength()
Get minimal wavelength for PDF evaluations.
Definition: JPDFToolkit.hh:26
direct light from bright point
Definition: JPDFTypes.hh:42
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:446
string outputFile
const JPolynome f1(1.0, 2.0, 3.0)
Function.
double getMaximalWavelength()
Get maximal wavelength for PDF evaluations.
Definition: JPDFToolkit.hh:37
#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 getAmbientPressure()
Get ambient pressure.
Definition: Antares.hh:40
double getPhotocathodeArea()
Get photo-cathode area of PMT.
Definition: Antares.hh:51
then awk F
#define FATAL(A)
Definition: JMessage.hh:67
double getAbsorptionLength(const double lambda)
Get absorption length.
Definition: Antares.hh:63
double getScatteringLength(const double lambda)
Get scattering length.
Definition: Antares.hh:148
int numberOfPoints
Definition: JResultPDF.cc:22
double scatteringLengthFactor
Definition: JDrawPD0.cc:25
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:484
do echo Generating $dir eval D
Definition: JDrawLED.sh:53
const double epsilon
Definition: JQuadrature.cc:21
int debug
debug level
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
double getAngularAcceptance(const double x)
Angular acceptence of PMT.
Definition: JDrawLED.cc:68

Variable Documentation

double absorptionLengthFactor

Scaling of absorption and scattering length.

Definition at line 24 of file JDrawPD0.cc.

double scatteringLengthFactor

Definition at line 25 of file JDrawPD0.cc.