28 int main(
int argc,
char **argv)
33 typedef JAbstractHistogram<double> JHistogram_t;
41 JHistogram_t histogram;
46 JParser<> zap(
"Program to plot PDF of Cherenkov light from bright point using interpolation tables.");
50 zap[
'E'] =
make_field(
E,
"shower energy [GeV]") = 1.0;
53 zap[
'T'] =
make_field(TTS_ns,
"PMT time smearing [ns]") = 0.0;
54 zap[
'H'] =
make_field(histogram,
"histogram binning") = JHistogram_t();
59 catch(
const exception &error) {
60 FATAL(error.what() << endl);
63 JDistance<double>::precision = 1.0e-10;
65 typedef JSplineFunction1S_t JFunction1D_t;
66 typedef JMAPLIST<JPolint1FunctionalMap,
67 JPolint1FunctionalGridMap>::maplist JMapList_t;
68 typedef JPDFTable<JFunction1D_t, JMapList_t> JPDF_t;
70 const int N = inputFile.size();
77 for (
int i = 0; i !=
N; ++i) {
79 NOTICE(
"loading input from file " << inputFile[i] <<
"... " << flush);
83 pdf [i].load(inputFile[i].c_str());
85 pdf [i].setExceptionHandler(
new JFunction1D_t::JDefaultResult(
JMATH::zero));
94 catch(
const JException& error) {
95 FATAL(error.what() << endl);
101 for (
double dt; cin >> dt; ) {
103 for (
int i = 0; i !=
N; ++i) {
105 JFunction1D_t::result_type y = pdf[i](
D, ct, dt);
107 cout << setw(2) << type[i] <<
' '
109 <<
FIXED(5,1) << D <<
' '
110 <<
FIXED(5,2) << ct <<
' '
111 <<
FIXED(5,1) << dt <<
' '
127 if (inputFile.size() == 1 &&
133 const double t0 = 0.0;
135 if (!histogram.is_valid()) {
139 histogram = JHistogram_t(t0 - 20.0, t0 + 50.0);
141 histogram.setBinWidth(0.1);
145 histogram = JHistogram_t(t0 - 20.0, t0 + 500.0);
147 histogram.setBinWidth(0.5);
151 TH1D h0(
"h0", NULL, histogram.getNumberOfBins(), histogram.getLowerLimit(), histogram.getUpperLimit());
153 for (
int i = 1; i <= h0.GetNbinsX(); ++i) {
155 const double dt = h0.GetBinCenter(i) - t0;
159 for (
int j = 0;
j !=
N; ++
j) {
160 Y += pdf[
j](
D, ct, 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.
static const JZero zero
Function object to assign zero value.
Auxiliary data structure for floating point format specification.
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
General purpose messaging.
scattered light from bright point
int getPDFType(const std::string &file_name)
Get PDF type.
Utility class to parse command line options.
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
int main(int argc, char *argv[])