Jpp
Functions | Variables
JDrawPDF.cc File Reference
#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/JElement.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

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 muon.

Author
mdejong

Definition in file JDrawPDF.cc.

Function Documentation

◆ getAbsorptionLength()

double getAbsorptionLength ( const double  lambda)
inline

Definition at line 30 of file JDrawPDF.cc.

31 {
33 }

◆ getScatteringLength()

double getScatteringLength ( const double  lambda)
inline

Definition at line 36 of file JDrawPDF.cc.

37 {
39 }

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 48 of file JDrawPDF.cc.

49 {
50  using namespace std;
51  using namespace JPP;
52 
53  typedef JAbstractHistogram<double> JHistogram_t;
54 
55  string outputFile;
56  int numberOfPoints;
57  double epsilon;
58  double E;
59  double R;
60  JAngle3D dir;
61  vector<int> function;
62  JHistogram_t histogram;
63  int debug;
64 
65  try {
66 
67  JProperties properties;
68 
69  properties.insert(gmake_property(JPHYSICS::MODULE_RADIUS_M));
70 
71  JParser<> zap("Auxiliary program to draw PDF of Cherenkov light from muon.");
72 
73  zap['@'] = make_field(properties) = JPARSER::initialised();
74  zap['o'] = make_field(outputFile) = "";
75  zap['n'] = make_field(numberOfPoints, "points for integration") = 25;
76  zap['e'] = make_field(epsilon, "precision for integration") = 1.0e-10;
77  zap['A'] = make_field(absorptionLengthFactor, "scaling factor") = 1.0;
78  zap['S'] = make_field(scatteringLengthFactor, "scaling factor") = 1.0;
79  zap['E'] = make_field(E, "muon energy [GeV]") = 1.0;
80  zap['R'] = make_field(R, "distance of approach [m]");
81  zap['D'] = make_field(dir, "(theta, phi) of PMT [rad]");
82  zap['F'] = make_field(function, "PDF type");
83  zap['H'] = make_field(histogram, "histogram binning") = JHistogram_t();
84  zap['d'] = make_field(debug) = 0;
85 
86  zap(argc, argv);
87  }
88  catch(const exception &error) {
89  FATAL(error.what() << endl);
90  }
91 
92 
93  const JPDF_C
104  epsilon);
105 
106 
107  if (outputFile == "") {
108 
109  for (double dt; cin >> dt; ) {
110 
111  for (vector<int>::const_iterator F = function.begin(); F != function.end(); ++F) {
112 
113  cout << setw(2) << *F << ' '
114  << SCIENTIFIC(7,1) << E << ' '
115  << FIXED(5,1) << R << ' '
116  << FIXED(5,2) << dir.getTheta() << ' '
117  << FIXED(5,2) << dir.getPhi() << ' '
118  << FIXED(5,1) << dt << ' '
119  << SCIENTIFIC(9,3) << pdf.getLightFromMuon(*F, E, R, dir.getTheta(), dir.getPhi(), dt) * E << endl;
120  }
121  }
122 
123  return 0;
124  }
125 
126 
127  TFile out(outputFile.c_str(), "recreate");
128 
129  //const double z0 = -100.0; // [m]
130  //const double t0 = (-z0 + R * getTanThetaC()) / C; // time [ns]
131  const double t0 = 0.0; // time [ns]
132 
133  if (!histogram.is_valid()) {
134 
135  if (function.size() == 1 && function[0] == DIRECT_LIGHT_FROM_MUON) {
136 
137  histogram = JHistogram_t(t0 - 20.0, t0 + 50.0);
138 
139  histogram.setBinWidth(0.1);
140 
141  } else {
142 
143  histogram = JHistogram_t(t0 - 20.0, t0 + 500.0);
144 
145  histogram.setBinWidth(0.5);
146  }
147  }
148 
149  TH1D h0("h0", NULL, histogram.getNumberOfBins(), histogram.getLowerLimit(), histogram.getUpperLimit());
150 
151  JSplineFunction1S_t f1;
152 
153  for (int i = 1; i <= h0.GetNbinsX(); ++i) {
154 
155  const double dt = h0.GetBinCenter(i) - t0;
156 
157  double value = 0.0;
158 
159  for (vector<int>::const_iterator F = function.begin(); F != function.end(); ++F) {
160  value += pdf.getLightFromMuon(*F, E, R, dir.getTheta(), dir.getPhi(), dt);
161  }
162 
163  h0.SetBinContent(i, value);
164 
165  f1[dt] = value;
166  }
167 
168  f1.setExceptionHandler(new JSplineFunction1S_t::JDefaultResult(JMATH::zero));
169  f1.compile();
170 
171  const double T = 5; // [ns]
172 
173  JQuantiles quantiles(f1);
174 
175  const double t1 = quantiles.getX();
176  const double y = f1(t1 + T).v - f1(t1 - T).v;
177 
178  DEBUG("E " << E << endl);
179  DEBUG("R " << R << endl);
180  DEBUG("theta " << dir.getTheta() << endl);
181  DEBUG("phi " << dir.getPhi() << endl);
182  DEBUG("int " << quantiles.getIntegral() << endl);
183  DEBUG("t1 " << t1 << endl);
184  DEBUG("max " << quantiles.getY() << endl);
185  DEBUG("FWHM " << quantiles.getFWHM() << endl);
186  DEBUG("int[] " << y << endl);
187 
188 
189  out.Write();
190  out.Close();
191 }

Variable Documentation

◆ absorptionLengthFactor

double absorptionLengthFactor

Scaling of absorption and scattering length.

Definition at line 27 of file JDrawPDF.cc.

◆ scatteringLengthFactor

double scatteringLengthFactor

Definition at line 28 of file JDrawPDF.cc.

JPHYSICS::MODULE_RADIUS_M
static double MODULE_RADIUS_M
Radius of optical module [m].
Definition: JPDF.hh:39
getScatteringLength
double getScatteringLength(const double lambda)
Definition: JDrawPDF.cc:36
absorptionLengthFactor
double absorptionLengthFactor
Scaling of absorption and scattering length.
Definition: JDrawPDF.cc:27
FIXED
Auxiliary data structure for floating point format specification.
Definition: JPrint.hh:481
numberOfPoints
int numberOfPoints
Definition: JResultPDF.cc:22
JPARSER::initialised
Empty structure for specification of parser element that is initialised (i.e.
Definition: JParser.hh:63
ANTARES::getScatteringProbability
double getScatteringProbability(const double x)
Function to describe light scattering in water.
Definition: Antares.hh:292
std::vector< int >
JPARSER::JParser
Utility class to parse command line options.
Definition: JParser.hh:1493
JDETECTOR::getQE
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.
Definition: JPMTParametersToolkit.hh:89
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
debug
int debug
debug level
Definition: JSirene.cc:59
ANTARES::getAmbientPressure
double getAmbientPressure()
Get ambient pressure.
Definition: Antares.hh:30
JPHYSICS::getMinimalWavelength
double getMinimalWavelength()
Get minimal wavelength for PDF evaluations.
Definition: JPDFToolkit.hh:38
SCIENTIFIC
Auxiliary data structure for floating point format specification.
Definition: JPrint.hh:518
scatteringLengthFactor
double scatteringLengthFactor
Definition: JDrawPDF.cc:28
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
gmake_property
#define gmake_property(A)
macro to convert (template) parameter to JPropertiesElement object
Definition: JProperties.hh:1319
JEEP::JProperties
Utility class to parse parameter values.
Definition: JProperties.hh:496
DEBUG
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
std
Definition: jaanetDictionary.h:36
getAbsorptionLength
double getAbsorptionLength(const double lambda)
Definition: JDrawPDF.cc:30
JPHYSICS::DIRECT_LIGHT_FROM_MUON
direct light from muon
Definition: JPDFTypes.hh:29
JMATH::zero
static const JZero zero
Function object to assign zero value.
Definition: JZero.hh:94
getAngularAcceptance
double getAngularAcceptance(const double x)
Angular acceptence of PMT.
Definition: JDrawLED.cc:84
FATAL
#define FATAL(A)
Definition: JMessage.hh:67
outputFile
string outputFile
Definition: JDAQTimesliceSelector.cc:37
JPHYSICS::getMaximalWavelength
double getMaximalWavelength()
Get maximal wavelength for PDF evaluations.
Definition: JPDFToolkit.hh:49
ANTARES::getPhotocathodeArea
const double getPhotocathodeArea()
Photo-cathode area 10 inch PMT.
Definition: Antares.hh:41