31 int main(
int argc,
char **argv)
45 JParser<> zap(
"Demonstration program to plot RMS of arrival time of first hit as a function of the minimal distance of approach of a muon to the PMT.");
49 zap[
'E'] =
make_field(E_GeV,
"muon energy [GeV]");
50 zap[
'R'] =
make_field(R_Hz,
"background rate [Hz]");
51 zap[
'D'] =
make_field(dir,
"(theta, phi) of PMT [rad]");
56 catch(
const exception &error) {
57 FATAL(error.what() << endl);
61 typedef JSplineFunction1S_t JFunction1D_t;
62 typedef JMAPLIST<JPolint1FunctionalMap,
63 JPolint1FunctionalGridMap,
64 JPolint1FunctionalGridMap>::maplist JMapList_t;
65 typedef JPDFTable<JFunction1D_t, JMapList_t> JPDF_t;
67 JFunction1D_t::JSupervisor supervisor(
new JFunction1D_t::JDefaultResult(
zero));
74 const int N =
sizeof(pdf_t) /
sizeof(pdf_t[0]);
78 for (
int i = 0; i != N; ++i) {
82 const string file_name =
getFilename(inputFile, pdf_t[i]);
84 NOTICE(
"loading input from file " << file_name <<
"... " << flush);
86 pdf[i].load(file_name.c_str());
90 catch(
const JException& error) {
91 FATAL(error.what() << endl);
94 pdf[i].setExceptionHandler(supervisor);
122 os <<
"t[" << *i <<
"]";
124 buffer.push_back(
new TH1D(os.str().c_str(), NULL, 5000, -250.0, +250.0));
133 x.push_back(*i - 0.5*(*j-*i));
135 for (; j != X.end(); ++i, ++j)
136 x.push_back(0.5*(*i+*j));
141 x.push_back(*j + 0.5*(*j-*i));
144 TH1D rms(
"rms", NULL, X.size(), &x[0]);
147 JFunction1D_t::result_type p[4];
153 const double Tmin = -250.0;
154 const double Tmax = +250.0;
158 for (
size_t i = 0; i != X.size(); ++i) {
161 const double R = X[i];
163 JSplineFunction1S_t zsp;
165 for (
int j = 1; j <= h->GetNbinsX(); ++j) {
167 const double t1 = h->GetBinCenter(j);
173 for (
int k = 0; k != 4; ++k) {
174 p[k] = pdf[k](R, dir.getTheta(), dir.getPhi(), t1);
183 R_Hz * 1e-9 * (t1 - Tmin);
191 R_Hz * 1e-9 * (Tmax - Tmin);
201 const double W = exp(-v) * y / (1.0 - exp(-V));
207 h->SetBinContent(j,W);
212 JQuantiles result(zsp);
214 const double sig = result.getFWHM() * 0.5 / sqrt(2.0*log(2.0));
218 NOTICE(
"integral " << R <<
' ' << result.getIntegral() << endl);
221 const float w = 1.0 / (float) n;
224 timer.print(cout, w);
Utility class to parse command line options.
direct light from EM showers
static const JZero zero
Function object to assign zero value.
Various implementations of functional maps.
Numbering scheme for PDF types.
scattered light from muon
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
scattered light from EM showers
General purpose messaging.
Utility class to parse command line options.
std::string getFilename(const std::string &file_name)
Get file name part, i.e.
int main(int argc, char *argv[])