Jpp  19.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions | Variables
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 "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"
#include "JPhysics/JGeane.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, bofearraigh

Definition in file JDrawPDF.cc.

Function Documentation

double getAbsorptionLength ( const double  lambda)
inline

Definition at line 31 of file JDrawPDF.cc.

32 {
34 }
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 37 of file JDrawPDF.cc.

38 {
40 }
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 49 of file JDrawPDF.cc.

50 {
51  using namespace std;
52  using namespace JPP;
53 
54  typedef JAbstractHistogram<double> JHistogram_t;
55 
56  string outputFile;
57  int numberOfPoints;
58  double epsilon;
59  double E;
60  double R;
61  double z;
62  JAngle3D dir;
63  vector<int> function;
65  int debug;
66 
67  try {
68 
69  JProperties properties;
70 
71  properties.insert(gmake_property(JPHYSICS::MODULE_RADIUS_M));
72 
73  JParser<> zap("Auxiliary program to draw PDF of Cherenkov light from muon.");
74 
75  zap['@'] = make_field(properties) = JPARSER::initialised();
76  zap['o'] = make_field(outputFile) = "";
77  zap['n'] = make_field(numberOfPoints, "points for integration") = 25;
78  zap['e'] = make_field(epsilon, "precision for integration") = 1.0e-10;
79  zap['A'] = make_field(absorptionLengthFactor, "scaling factor") = 1.0;
80  zap['S'] = make_field(scatteringLengthFactor, "scaling factor") = 1.0;
81  zap['E'] = make_field(E, "muon energy at vertex [GeV]")= 1.0;
82  zap['R'] = make_field(R, "distance of approach [m]");
83  zap['z'] = make_field(z, "PMT z-position [m]");
84  zap['D'] = make_field(dir, "(theta, phi) of PMT [rad]");
85  zap['F'] = make_field(function, "PDF type");
86  zap['H'] = make_field(histogram, "histogram binning") = JHistogram_t();
87  zap['d'] = make_field(debug) = 0;
88 
89  zap(argc, argv);
90  }
91  catch(const exception &error) {
92  FATAL(error.what() << endl);
93  }
94 
95 
96  const JPDF_C
107  epsilon);
108 
109  const double z_emission = z - R/getTanThetaC(); // emission point z-position
110  const double E_emission = gWater.getE(E, z_emission ); // Get energy of muon at emission point
111 
112  if (outputFile == "") {
113 
114  for (double dt; cin >> dt; ) {
115 
116  for (vector<int>::const_iterator F = function.begin(); F != function.end(); ++F) {
117 
118  cout << setw(2) << *F << ' '
119  << SCIENTIFIC(7,1) << E << ' '
120  << FIXED(5,1) << R << ' '
121  << FIXED(5,1) << z << ' '
122  << FIXED(5,2) << dir.getTheta() << ' '
123  << FIXED(5,2) << dir.getPhi() << ' '
124  << FIXED(5,1) << dt << ' '
125  << SCIENTIFIC(9,3) << pdf.getLightFromMuon(*F, E_emission, R, dir.getTheta(), dir.getPhi(), dt) * E_emission << endl;
126  }
127  }
128 
129  return 0;
130  }
131 
132 
133  TFile out(outputFile.c_str(), "recreate");
134 
135  const double t0 = 0.0; // time [ns]
136 
137  if (!histogram.is_valid()) {
138 
139  if (function.size() == 1 && function[0] == DIRECT_LIGHT_FROM_MUON) {
140 
141  histogram = JHistogram_t(t0 - 20.0, t0 + 50.0);
142 
143  histogram.setBinWidth(0.1);
144 
145  } else {
146 
147  histogram = JHistogram_t(t0 - 20.0, t0 + 500.0);
148 
149  histogram.setBinWidth(0.5);
150  }
151  }
152 
153  TH1D h0("h0", NULL, histogram.getNumberOfBins(), histogram.getLowerLimit(), histogram.getUpperLimit());
154 
155  JSplineFunction1S_t f1;
156 
157  if ( E_emission > MASS_MUON* (1/COS_THETA_C_WATER) ) { // muon emission energy has to be above Cherenkov threshold
158 
159  if (z_emission >= 0 && z_emission <= gWater(E)) { // emission point is between start and end point of muon
160  for (int i = 1; i <= h0.GetNbinsX(); ++i) {
161 
162  const double dt = h0.GetBinCenter(i) - t0;
163 
164  double value = 0.0;
165 
166  for (vector<int>::const_iterator F = function.begin(); F != function.end(); ++F) {
167  value += pdf.getLightFromMuon(*F, E_emission, R, dir.getTheta(), dir.getPhi(), dt);
168  }
169 
170  h0.SetBinContent(i, value);
171 
172  f1[dt] = value;
173  }
174  }
175  }
176 
177  f1.setExceptionHandler(new JSplineFunction1S_t::JDefaultResult(JMATH::zero));
178  f1.compile();
179 
180  const double T = 5; // [ns]
181 
182  JQuantiles quantiles(f1);
183 
184  const double t1 = quantiles.getX();
185  const double y = f1(t1 + T).v - f1(t1 - T).v;
186 
187  DEBUG("E " << E << endl);
188  DEBUG("E_emission" << E_emission << endl);
189  DEBUG("R " << R << endl);
190  DEBUG("z " << z << endl);
191  DEBUG("theta " << dir.getTheta() << endl);
192  DEBUG("phi " << dir.getPhi() << endl);
193  DEBUG("int " << quantiles.getIntegral() << endl);
194  DEBUG("t1 " << t1 << endl);
195  DEBUG("max " << quantiles.getY() << endl);
196  DEBUG("FWHM " << quantiles.getFWHM() << endl);
197  DEBUG("int[] " << y << endl);
198 
199 
200  out.Write();
201  out.Close();
202 }
Utility class to parse command line options.
Definition: JParser.hh:1711
static const double COS_THETA_C_WATER
Average cosine corresponding to the group velocity.
then usage $script< input file >[option[primary[working directory]]] nWhere option can be E
Definition: JMuonPostfit.sh:40
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
Utility class to parse parameter values.
Definition: JProperties.hh:497
static const double MASS_MUON
muon mass [GeV]
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
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:84
static const JGeaneWater gWater
Function object for energy loss of muon in sea water.
Definition: JGeane.hh:381
static const JZero zero
Function object to assign zero value.
Definition: JZero.hh:105
double getMinimalWavelength()
Get minimal wavelength for PDF evaluations.
Definition: JPDFToolkit.hh:35
then warning Cannot perform comparison test for histogram
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:446
string outputFile
direct light from muon
Definition: JPDFTypes.hh:26
const JPolynome f1(1.0, 2.0, 3.0)
Function.
static double MODULE_RADIUS_M
Radius of optical module [m].
Definition: JPDF.hh:40
double getMaximalWavelength()
Get maximal wavelength for PDF evaluations.
Definition: JPDFToolkit.hh:46
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2158
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...
do set_variable OUTPUT_DIRECTORY $WORKDIR T
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
then JCookie sh JDataQuality D $DETECTOR_ID R
Definition: JDataQuality.sh:41
virtual double getE(const double E, const double dx) const override
Get energy of muon after specified distance.
Definition: JGeane.hh:257
then usage $script[energy[distance[z of PMT]]] fi case set_variable z
Definition: JDrawPDF.sh:45
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
double getTanThetaC()
Get average tangent of Cherenkov angle of water corresponding to group velocity.
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:486
const double epsilon
Definition: JQuadrature.cc:21
int debug
debug level
JAbstractHistogram< double > JHistogram_t
Type definition for scan along axis.
Definition: JBillabong.cc:61
#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 28 of file JDrawPDF.cc.

double scatteringLengthFactor

Definition at line 29 of file JDrawPDF.cc.