34 typedef JAbstractHistogram<double> JHistogram_t;
43 JHistogram_t histogram;
48 JParser<> zap(
"Program to plot PDF of Cherenkov light from EM-shower using interpolation tables.");
52 zap[
'E'] =
make_field(
E,
"shower energy [GeV]") = 1.0;
54 zap[
'c'] =
make_field(cd,
"cosine emission angle");
55 zap[
'D'] =
make_field(dir,
"(theta, phi) of PMT [rad]");
56 zap[
'T'] =
make_field(TTS_ns,
"PMT time smearing [ns]") = 0.0;
57 zap[
'H'] =
make_field(histogram,
"histogram binning") = JHistogram_t();
62 catch(
const exception &error) {
63 FATAL(error.what() << endl);
67 typedef JSplineFunction1S_t JFunction1D_t;
68 typedef JMAPLIST<JPolint1FunctionalMap,
69 JPolint1FunctionalMap,
70 JPolint1FunctionalGridMap,
71 JPolint1FunctionalGridMap>::maplist JMapList_t;
72 typedef JPDFTable<JFunction1D_t, JMapList_t> JPDF_t;
74 const int N = inputFile.size();
81 for (
int i = 0; i !=
N; ++i) {
83 NOTICE(
"loading input from file " << inputFile[i] <<
"... " << flush);
87 pdf [i].load(inputFile[i].c_str());
89 pdf [i].setExceptionHandler(
new JFunction1D_t::JDefaultResult(
JMATH::zero));
98 catch(
const JException& error) {
99 FATAL(error.what() << endl);
105 for (
double dt; cin >> dt; ) {
107 for (
int i = 0; i !=
N; ++i) {
109 JFunction1D_t::result_type y = pdf[i](
D, cd, dir.getTheta(), dir.getPhi(), dt);
111 cout << setw(2) << type[i] <<
' '
113 <<
FIXED(5,1) << D <<
' '
114 <<
FIXED(5,2) << cd <<
' '
115 <<
FIXED(5,2) << dir.getTheta() <<
' '
116 <<
FIXED(5,2) << dir.getPhi() <<
' '
117 <<
FIXED(5,1) << dt <<
' '
133 if (inputFile.size() == 1 &&
139 const double t0 = 0.0;
141 if (!histogram.is_valid()) {
145 histogram = JHistogram_t(t0 - 20.0, t0 + 50.0);
147 histogram.setBinWidth(0.1);
151 histogram = JHistogram_t(t0 - 20.0, t0 + 500.0);
153 histogram.setBinWidth(0.5);
157 TH1D h0(
"h0", NULL, histogram.getNumberOfBins(), histogram.getLowerLimit(), histogram.getUpperLimit());
159 for (
int i = 1; i <= h0.GetNbinsX(); ++i) {
161 const double dt = h0.GetBinCenter(i) - t0;
165 for (
int j = 0;
j !=
N; ++
j) {
166 Y += pdf[
j](
D, cd, dir.getTheta(), dir.getPhi(), dt) *
E;
Utility class to parse command line options.
do echo Generating $dir eval D
std::string getLabel(const JLocation &location)
Get module label for monitoring and other applications.
scattered light from EM shower
static const JZero zero
Function object to assign zero value.
then fatal Wrong number of arguments fi set_variable STRING $argv[1] set_variable DETECTORXY_TXT $WORKDIR $DETECTORXY_TXT tail read X Y CHI2 RMS printf optimum n $X $Y $CHI2 $RMS awk v Y
Auxiliary data structure for floating point format specification.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
int getPDFType(const std::string &file_name)
Get PDF type.
Auxiliary data structure for floating point format specification.
then usage $script[input file[working directory[option]]] nWhere option can be N
then usage $script[input file[working directory[option]]] nWhere option can be E