40 typedef JAbstractHistogram<double> JHistogram_t;
48 JHistogram_t histogram;
53 JParser<> zap(
"Program to verify generation of arrival times of Cherenkov photons from a muon using tabulated CDF.");
57 zap[
'E'] =
make_field(
E,
"muon energy [GeV]") = 1.0;
58 zap[
'R'] =
make_field(
R,
"distance of approach [m]");
59 zap[
'D'] =
make_field(dir,
"(theta, phi) of PMT [rad]");
61 zap[
'H'] =
make_field(histogram,
"histogram binning") = JHistogram_t();
66 catch(
const exception& error) {
67 FATAL(error.what() << endl);
71 typedef JHermiteSplineFunction1D_t JFunction1D_t;
74 typedef JMAPLIST<JPolint1FunctionalMap,
75 JPolint1FunctionalGridMap,
76 JPolint1FunctionalGridMap>::maplist JMapList_t;
77 typedef JCDFTable<JFunction1D_t, JMapList_t> JCDF_t;
79 const int N = inputFile.size();
86 for (
int i = 0; i !=
N; ++i) {
88 NOTICE(
"loading input from file " << inputFile[i] <<
"... " << flush);
92 cdf [i].load(inputFile[i].c_str());
97 catch(
const JException& error) {
98 FATAL(error.what() << endl);
108 cout <<
"> " << flush;
113 for (
int i = 0; i !=
N; ++i) {
117 double npe =
cdf[i].getNPE (
R, dir.getTheta(), dir.getPhi());
118 double t =
cdf[i].getTime(
R, dir.getTheta(), dir.getPhi(),
x);
126 cout <<
' ' <<
FIXED(6,2) << t <<
' ' <<
FIXED(5,2) << npe;
128 catch(
const exception& error) {
129 ERROR(error.what() << endl);
148 const double t0 = 0.0;
150 if (!histogram.is_valid()) {
154 histogram = JHistogram_t(t0 - 20.0, t0 + 50.0);
156 histogram.setBinWidth(0.5);
160 histogram = JHistogram_t(t0 - 20.0, t0 + 500.0);
162 histogram.setBinWidth(2.0);
166 TH1D h0(
"h0", NULL, histogram.getNumberOfBins(), histogram.getLowerLimit(), histogram.getUpperLimit());
170 JManager<int, TH1D> H1(
new TH1D(
"h1[%]", NULL, 100000, 0.0, +1.0));
172 for (
int i = 0; i !=
N; ++i) {
174 for (
int j = 1;
j <= H1->GetNbinsX(); ++
j) {
178 const double x = H1->GetBinCenter(
j);
179 const double t =
cdf[i].getTime(
R, dir.getTheta(), dir.getPhi(),
x);
181 H1[i]->SetBinContent(
j, t);
183 catch(
const exception& error) {
184 ERROR(error.what() << endl);
189 if (numberOfEvents > 0) {
195 for (
int counter = 0; counter != numberOfEvents; ++counter) {
197 if (counter%1000== 0) {
203 for (
int i = 0; i !=
N; ++i) {
207 double npe =
cdf[i].getNPE(
R, dir.getTheta(), dir.getPhi());
215 for (
int j = gRandom->Poisson(npe);
j != 0; --
j) {
217 const double x = gRandom->Rndm();
218 const double t =
cdf[i].getTime(
R, dir.getTheta(), dir.getPhi(),
x);
223 catch(
const exception& error) {
224 NOTICE(error.what() << endl);
232 const double w = 1.0 / (double) numberOfEvents;
235 timer.print(cout, w);
240 for (
int j = 1;
j <= h0.GetNbinsX(); ++
j) {
242 const double y = h0.GetBinContent(
j);
243 const double z = h0.GetBinError (
j);
244 const double dx = h0.GetBinWidth (
j);
246 h0.SetBinContent(
j, y / (dx*numberOfEvents));
247 h0.SetBinError (
j, z / (dx*numberOfEvents));
Utility class to parse command line options.
then JShowerPostfit f $INPUT_FILE o $OUTPUT_FILE N
Auxiliary data structure for floating point format specification.
bool is_bremsstrahlung(const int pdf)
Test if given PDF type corresponds to Cherenkov light from Bremsstrahlung.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
then usage $script[distance] fi case set_variable R
then for FUNCTION in pdf npe cdf
int getPDFType(const std::string &file_name)
Get PDF type.
bool is_deltarays(const int pdf)
Test if given PDF type corresponds to Cherenkov light from delta-rays.
double getDeltaRaysFromMuon(const double E)
Equivalent EM-shower energy due to delta-rays per unit muon track length.
#define DEBUG(A)
Message macros.