Jpp  master_rocky-43-ge265d140c
the software that should make you happy
Functions
JMakeHDE.cc File Reference

Program to convert 5-dimensional histograms of shower light to multi-dimensional PDFs. More...

#include <string>
#include <iostream>
#include <fstream>
#include <iomanip>
#include "JPhysics/JPDFTable.hh"
#include "JPhysics/JPDFTypes.hh"
#include "JIO/JFileStreamIO.hh"
#include "JTools/JHistogram1D_t.hh"
#include "JTools/JHistogramMap_t.hh"
#include "JTools/JTransformableMultiHistogram.hh"
#include "JTools/JFunction1D_t.hh"
#include "JTools/JFunctionalMap_t.hh"
#include "JGeometry3D/JAngle3D.hh"
#include "JGeometry3D/JDirection3D.hh"
#include "JPhysics/JConstants.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
#include "JPhysics/JPDFTransformer.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Program to convert 5-dimensional histograms of shower light to multi-dimensional PDFs.

Author
jseneca

Definition in file JMakeHDE.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 33 of file JMakeHDE.cc.

34 {
35  using namespace std;
36  using namespace JPP;
37 
38  string inputFile;
39  string outputFile;
40  int debug;
41  try {
42 
43  JParser<> zap("Program to convert multi-dimensional histograms of shower light to multi-dimensional PDFs.");
44 
45  zap['f'] = make_field(inputFile);
46  zap['o'] = make_field(outputFile);
47  zap['d'] = make_field(debug) = 1;
48 
49  zap(argc, argv);
50  }
51  catch(const exception &error) {
52  FATAL(error.what() << endl);
53  }
54 
55 
56  typedef JHistogram1D_t::abscissa_type abscissa_type;
57 
63  JHistogramGridMap_t>::maplist> JMultiHistogram_t;
64 
65  typedef JPDFTransformer<5, abscissa_type> JFunction5DTransformer_t;
66 
67  JMultiHistogram_t h0; // occurrence rate of PMT (used for normalisation)
68  JMultiHistogram_t h1; // light from cascade
69 
70  h1.transformer.reset(new JFunction5DTransformer_t());
71 
72  // input
73 
74  NOTICE("Loading in input, " << flush);
75 
76  JFileStreamReader in(inputFile.c_str());
77 
78  for (JMultiHistogram_t* p : { &h0, &h1 }) {
79  in.load(*p);
80  }
81 
82  in.close();
83 
84  NOTICE("done." << endl);
85 
86  // rebin histograms according angle of incidence on PMT and normalise contents to PMT occurrence rate
87 
88  for (JMultiHistogram_t::super_iterator
89  i0 = h0.super_begin(),
90  i1 = h1.super_begin(); i1 != h1.super_end(); ++i0, ++i1) {
91 
92  const double W = i0.getValue().getIntegral();
93 
94  if (W != 0.0) {
95 
96  const JDirection3D u(JAngle3D(i0->second->second->first, i0->second->second->second->first));
97  const JDirection3D v(getSinThetaC(), 0.0, getCosThetaC());
98 
99  int number_of_bins = (int) (2 + u.getDot(v));
100 
101  i1.getValue().rebin(JHistogram1D_t::JRebin(number_of_bins));
102  i1.getValue().div(W);
103  }
104  }
105 
106  // output
107 
108  struct tuple {
109  const JPDFType_t type;
110  const JMultiHistogram_t& value;
111  };
112 
118  JPolint1FunctionalGridMap>::maplist> JPDF_t;
119 
120  try {
121  NOTICE("Storing output to file " << outputFile << "... " << flush);
122 
123  const JPDF_t pdf(h1);
124 
125  pdf.store(outputFile.c_str());
126 
127  NOTICE("OK" << endl);
128  }
129  catch(const JException& error) {
130  FATAL(error.what() << endl);
131  }
132  NOTICE("JMakeHDE done." << endl);
133 }
string outputFile
#define NOTICE(A)
Definition: JMessage.hh:64
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level
Definition: JSirene.cc:69
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2142
Data structure for angles in three dimensions.
Definition: JAngle3D.hh:35
Data structure for direction in three dimensions.
Definition: JDirection3D.hh:35
Binary buffered file input.
General exception.
Definition: JException.hh:24
virtual const char * what() const override
Get error message.
Definition: JException.hh:64
Utility class to parse command line options.
Definition: JParser.hh:1698
Multi-dimensional PDF table for arrival time of Cherenkov light.
Definition: JPDFTable.hh:44
Template definition of transformer of the probability density function (PDF) of the time response of ...
collection_type::abscissa_type abscissa_type
Transformable multidimensional histogram.
double getCosThetaC()
Get average cosine of Cherenkov angle of water corresponding to group velocity.
double getSinThetaC()
Get average sine of Cherenkov angle of water corresponding to group velocity.
JPDFType_t
PDF types.
Definition: JPDFTypes.hh:24
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
JHistogram1D< JElement2D< double, double >, JCollection > JHistogram1D_t
Type definition of a 1 dimensional histogram based on a JCollection.
double u[N+1]
Definition: JPolint.hh:865
data_type v[N+1][M+1]
Definition: JPolint.hh:866
Definition: JSTDTypes.hh:14
Type definition of a JHistogramMap based on JGridMap implementation.
Type definition of a JHistogramMap based on JMap implementation.
Auxiliary class for recursive map list generation.
Definition: JMapList.hh:109
Type definition of a 1st degree polynomial interpolation with result type double.
Type definition of a 1st degree polynomial interpolation based on a JGridMap implementation.
Type definition of a 1st degree polynomial interpolation based on a JMap implementation.
Auxiliary class for merging of fixed number of consecutive bins.
Definition: JHistogram1D.hh:30