32 int main(
int argc,
char **argv)
37 typedef JAbstractHistogram<double> JHistogram_t;
50 JParser<> zap(
"Program to plot PDF of Cherenkov light from EM-shower using interpolation tables.");
54 zap[
'D'] =
make_field(dir,
"(theta, phi) of PMT [rad]");
55 zap[
'x'] =
make_field(x,
"histogram x-binning") = JHistogram_t();
56 zap[
'y'] =
make_field(y,
"histogram y-binning") = JHistogram_t();
63 catch(
const exception &error) {
64 FATAL(error.what() << endl);
77 typedef JPolint0Function1D_t JFunction1D_t;
79 JMapList<JPolint2FunctionalMap,
80 JMapList<JPolint2FunctionalMap,
81 JMapList<JPolint1FunctionalGridMap,
82 JMapList<JPolint1FunctionalGridMap> > > > JMapList_t;
83 typedef JPDFTable<JFunction1D_t, JMapList_t> JPDF_t;
84 typedef JNPETable<double, double, JMapList_t> JNPE_t;
86 JDistance<double>::precision = 1.0e-10;
88 const int N = inputFile.size();
95 for (
int i = 0; i !=
N; ++i) {
97 NOTICE(
"loading input from file " << inputFile[i] <<
"... " << flush);
99 pdf[i].load(inputFile[i].c_str());
101 pdf[i].setExceptionHandler(
new JFunction1D_t::JDefaultResult(
JMATH::zero));
103 npe[i] = JNPE_t(pdf[i]);
108 catch(
const JException& error) {
109 FATAL(error.what() << endl);
115 if (!x.is_valid()) { x = JHistogram_t(150, 0.0, 150.0); }
116 if (!y.is_valid()) { y = JHistogram_t(200, -1.0, +1.0); }
118 TH2D h0(
"h0",
"PDF Projection; D [m]; cos #theta_{0}",
119 x.getNumberOfBins(), x.getLowerLimit(), x.getUpperLimit(),
120 y.getNumberOfBins(), y.getLowerLimit(), y.getUpperLimit());
122 for (
int ix = 1; ix <= h0.GetNbinsX(); ++ix) {
123 for (
int iy = 1; iy <= h0.GetNbinsY(); ++iy) {
125 const double cd = h0.GetYaxis()->GetBinCenter(iy);
126 const double D = h0.GetXaxis()->GetBinCenter(ix);
132 const double W = 1.0 / (double) Z.size();
136 const double __D = sqrt(D*D - 2.0*(D*cd)*(*z) + (*z)*(*z));
137 const double __cd = (D * cd - (*z)) / __D;
139 for (
int i = 0; i !=
N; ++i) {
141 Y += W * npe[i](__D, __cd, dir.getTheta(), dir.getPhi());
143 catch(
const exception& error) {}
149 for (
int i = 0; i !=
N; ++i) {
150 Y += npe[i](
D, cd, dir.getTheta(), dir.getPhi());
154 h0.SetBinContent(ix, iy, Y);
Utility class to parse command line options.
do echo Generating $dir eval D
int main(int argc, char *argv[])
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
Various implementations of functional maps.
Numbering scheme for PDF types.
I/O formatting auxiliaries.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
static const JGeanz geanz(1.85, 0.62, 0.54)
Function object for longitudinal EM-shower profile.
General purpose messaging.
Utility class to parse command line options.
Longitudinal emission profile EM-shower.
double getLength(const double E, const double P, const double eps=1.0e-3) const
Get shower length for a given integrated probability.
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