34 int main(
int argc,
char **argv)
39 typedef JAbstractHistogram<double> JHistogram_t;
48 JHistogram_t histogram;
53 JParser<> zap(
"Program to verify generation of arrival times of Cherenkov photons from a shower using tabulated CDF.");
57 zap[
'E'] =
make_field(
E,
"muon energy [GeV]") = 1.0;
59 zap[
'c'] =
make_field(cd,
"cosine emission angle");
60 zap[
'D'] =
make_field(dir,
"(theta, phi) of PMT [rad]");
62 zap[
'H'] =
make_field(histogram,
"histogram binning") = JHistogram_t();
67 catch(
const exception& error) {
68 FATAL(error.what() << endl);
72 typedef JHermiteSplineFunction1D_t JFunction1D_t;
75 typedef JMAPLIST<JPolint1FunctionalMap,
76 JPolint1FunctionalMap,
77 JPolint1FunctionalGridMap,
78 JPolint1FunctionalGridMap>::maplist JMapList_t;
79 typedef JCDFTable<JFunction1D_t, JMapList_t> JCDF_t;
81 const int N = inputFile.size();
87 for (
int i = 0; i !=
N; ++i) {
89 NOTICE(
"loading input from file " << inputFile[i] <<
"... " << flush);
91 cdf [i].load(inputFile[i].c_str());
96 catch(
const JException& error) {
97 FATAL(error.what() << endl);
107 cout <<
"> " << flush;
112 for (
int i = 0; i !=
N; ++i) {
116 const double npe =
cdf[i].getNPE (
D, cd, dir.getTheta(), dir.getPhi()) *
E;
117 const double t =
cdf[i].getTime(
D, cd, dir.getTheta(), dir.getPhi(),
x);
119 cout <<
' ' <<
FIXED(6,2) << t <<
' ' <<
FIXED(5,2) << npe;
121 catch(
const exception& error) {
122 ERROR(error.what() << endl);
140 const double t0 = 0.0;
142 if (!histogram.is_valid()) {
146 histogram = JHistogram_t(t0 - 20.0, t0 + 50.0);
148 histogram.setBinWidth(0.5);
152 histogram = JHistogram_t(t0 - 20.0, t0 + 500.0);
154 histogram.setBinWidth(2.0);
158 TH1D h0(
"h0", NULL, histogram.getNumberOfBins(), histogram.getLowerLimit(), histogram.getUpperLimit());
162 JManager<int, TH1D> H1(
new TH1D(
"h1[%]", NULL, 100000, 0.0, +1.0));
164 for (
int i = 0; i !=
N; ++i) {
166 for (
int j = 1;
j <= H1->GetNbinsX(); ++
j) {
170 const double x = H1->GetBinCenter(
j);
171 const double t =
cdf[i].getTime(
D, cd, dir.getTheta(), dir.getPhi(),
x);
173 H1[i]->SetBinContent(
j, t);
175 catch(
const exception& error) {
176 ERROR(error.what() << endl);
181 if (numberOfEvents > 0) {
187 for (
int counter = 0; counter != numberOfEvents; ++counter) {
189 if (counter%1000== 0) {
195 for (
int i = 0; i !=
N; ++i) {
199 const double npe =
cdf[i].getNPE(
D, cd, dir.getTheta(), dir.getPhi()) *
E;
201 for (
int j = gRandom->Poisson(npe);
j != 0; --
j) {
203 const double x = gRandom->Rndm();
204 const double t =
cdf[i].getTime(
D, cd, dir.getTheta(), dir.getPhi(),
x);
209 catch(
const exception& error) {
210 NOTICE(error.what() << endl);
218 const double w = 1.0 / (double) numberOfEvents;
221 timer.print(cout, w);
226 for (
int j = 1;
j <= h0.GetNbinsX(); ++
j) {
228 const double y = h0.GetBinContent(
j);
229 const double z = h0.GetBinError (
j);
230 const double dx = h0.GetBinWidth (
j);
232 h0.SetBinContent(
j, y / (dx*numberOfEvents));
233 h0.SetBinError (
j, z / (dx*numberOfEvents));
Utility class to parse command line options.
int main(int argc, char *argv[])
then JShowerPostfit f $INPUT_FILE o $OUTPUT_FILE N
Dynamic ROOT object management.
Auxiliary data structure for floating point format specification.
Various implementations of functional maps.
Numbering scheme for PDF types.
#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
int getPDFType(const std::string &file_name)
Get PDF type.
Utility class to parse command line options.
do echo Generating $dir eval D
#define DEBUG(A)
Message macros.