35int main(
int argc,
char **argv)
54 JParser<> zap(
"Program to verify generation of arrival times of Cherenkov photons from a shower using tabulated CDF.");
58 zap[
'E'] =
make_field(E,
"muon energy [GeV]") = 1.0;
60 zap[
'c'] =
make_field(cd,
"cosine emission angle");
61 zap[
'D'] =
make_field(dir,
"(theta, phi) of PMT [rad]");
68 catch(
const exception& error) {
69 FATAL(error.what() << endl);
82 const int N = inputFile.size();
88 for (
int i = 0; i != N; ++i) {
90 NOTICE(
"loading input from file " << inputFile[i] <<
"... " << flush);
92 cdf [i].load(inputFile[i].c_str());
98 FATAL(error.what() << endl);
108 cout <<
"> " << flush;
113 for (
int i = 0; i != N; ++i) {
117 const double npe = cdf[i].getNPE (D, cd, dir.
getTheta(), dir.
getPhi()) * E;
118 const double t = cdf[i].getTime(D, cd, dir.
getTheta(), dir.
getPhi(), x);
120 cout <<
' ' <<
FIXED(6,2) << t <<
' ' <<
FIXED(5,2) << npe;
122 catch(
const exception& error) {
123 ERROR(error.what() << endl);
136 if (inputFile.size() == 1 && getPDFType(inputFile[0]) == DIRECT_LIGHT_FROM_EMSHOWER) {
143 const double t0 = 0.0;
152 for ( ; x < -10.0; x += 5.0) { X.push_back(t0 + x); }
153 for ( ; x < +20.0; x += 1.0) { X.push_back(t0 + x); }
154 for ( ; x < +50.0; x += 2.0) { X.push_back(t0 + x); }
157 for ( ; x < +100.0; x += 5.0) { X.push_back(t0 + x); }
158 for ( ; x < +250.0; x += 10.0) { X.push_back(t0 + x); }
159 for ( ; x < +500.0; x += 25.0) { X.push_back(t0 + x); }
160 for ( ; x < +900.0; x += 50.0) { X.push_back(t0 + x); }
163 h0 =
new TH1D(
"h0", NULL, X.size() - 1, X.data());
172 JManager<int, TH1D> H1(
new TH1D(
"h1[%]", NULL, 100000, 0.0, +1.0));
174 for (
int i = 0; i != N; ++i) {
176 for (
int j = 1; j <= H1->GetNbinsX(); ++j) {
180 const double x = H1->GetBinCenter(j);
181 const double t = cdf[i].getTime(D, cd, dir.
getTheta(), dir.
getPhi(), x);
183 H1[i]->SetBinContent(j, t);
185 catch(
const exception& error) {
186 ERROR(error.what() << endl);
191 if (numberOfEvents > 0) {
197 for (
int counter = 0; counter != numberOfEvents; ++counter) {
199 if (counter%1000== 0) {
205 for (
int i = 0; i != N; ++i) {
209 const double npe = cdf[i].getNPE(D, cd, dir.
getTheta(), dir.
getPhi()) * E;
211 for (
int j = gRandom->Poisson(npe); j != 0; --j) {
213 const double x = gRandom->Rndm();
214 const double t = cdf[i].getTime(D, cd, dir.
getTheta(), dir.
getPhi(), x);
219 catch(
const exception& error) {
220 NOTICE(error.what() << endl);
228 const double W = 1.0 / (double) numberOfEvents;
231 timer.
print(cout, W);
234 convertToPDF(*h0,
"WE", W);