31 int main(
int argc,
char **argv)
36 typedef JAbstractHistogram<double> JHistogram_t;
45 JHistogram_t histogram;
50 JParser<> zap(
"Program to verify generation of arrival times of Cherenkov photons from a shower using tabulated CDF.");
54 zap[
'E'] =
make_field(
E,
"muon energy [GeV]") = 1.0;
56 zap[
'c'] =
make_field(cd,
"cosine emission angle");
57 zap[
'D'] =
make_field(dir,
"(theta, phi) of PMT [rad]");
59 zap[
'H'] =
make_field(histogram,
"histogram binning") = JHistogram_t();
64 catch(
const exception& error) {
65 FATAL(error.what() << endl);
70 typedef JPolint2Function1D_t JFunction1D_t;
71 typedef JMAPLIST<JPolint1FunctionalMap,
72 JPolint1FunctionalMap,
73 JPolint1FunctionalGridMap,
74 JPolint1FunctionalGridMap>::maplist JMapList_t;
75 typedef JCDFTable<JFunction1D_t, JMapList_t> JCDF_t;
82 NOTICE(
"loading input from file " << inputFile <<
"... " << flush);
84 cdf.load(inputFile.c_str());
88 catch(
const JException& error) {
89 FATAL(error.what() << endl);
97 cout <<
"t0 " << t0 << endl;
103 cout <<
"> " << flush;
108 const double npe =
cdf.getNPE (
D, cd, dir.getTheta(), dir.getPhi()) *
E;
109 const double t =
cdf.getTime(
D, cd, dir.getTheta(), dir.getPhi(), x);
111 cout <<
" --> " << t <<
' ' << t0 + t <<
' ' << npe;
113 catch(
const exception& error) {
114 ERROR(error.what() << endl);
133 if (!histogram.is_valid()) {
137 histogram = JHistogram_t(t0 - 20.0, t0 + 50.0);
139 histogram.setBinWidth(0.1);
143 histogram = JHistogram_t(t0 - 20.0, t0 + 500.0);
145 histogram.setBinWidth(0.5);
149 TH1D h0(
"h0", NULL, histogram.getNumberOfBins(), histogram.getLowerLimit(), histogram.getUpperLimit());
150 TH1D
h1(
"h1", NULL, 5000, 0.0, +1.0);
152 for (
int j = 1;
j <= h1.GetNbinsX(); ++
j) {
156 const double x = h1.GetBinCenter(
j);
157 const double t =
cdf.getTime(
D, cd, dir.getTheta(), dir.getPhi(), x);
159 h1.SetBinContent(
j, t);
161 catch(
const exception& error) {
162 ERROR(error.what() << endl);
166 if (numberOfEvents > 0) {
173 for (
int i = 0; i != numberOfEvents; ++i) {
175 if (i%1000== 0) {
NOTICE(i <<
'\r'); }
181 const double npe =
cdf.getNPE(
D, cd, dir.getTheta(), dir.getPhi()) *
E;
183 for (
int j = gRandom->Poisson(npe);
j != 0; --
j) {
185 const double x = gRandom->Rndm();
186 const double t =
cdf.getTime(
D, cd, dir.getTheta(), dir.getPhi(), x);
191 catch(
const exception& error) {
192 ERROR(error.what() << endl);
199 const double w = 1.0 / (double) numberOfEvents;
202 timer.print(cout, w);
207 for (
int j = 1;
j <= h0.GetNbinsX(); ++
j) {
209 const double y = h0.GetBinContent(
j);
210 const double dx = h0.GetBinWidth (
j);
212 h0.SetBinContent(
j, y / (dx*numberOfEvents*
E));
Utility class to parse command line options.
do echo Generating $dir eval D
int main(int argc, char *argv[])
double getIndexOfRefraction()
Get average index of refraction of water corresponding to group velocity.
std::string getLabel(const JLocation &location)
Get module label for monitoring and other applications.
then for HISTOGRAM in h0 h1
Various implementations of functional maps.
Numbering scheme for PDF types.
static const double C
Physics constants.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
direct light from EM shower
General purpose messaging.
then for FUNCTION in pdf npe cdf
Utility class to parse command line options.
then usage $script[input file[working directory[option]]] nWhere option can be E