35 int 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);
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());
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);
Various implementations of functional maps.
Dynamic ROOT object management.
General purpose messaging.
#define DEBUG(A)
Message macros.
Numbering scheme for PDF types.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
int main(int argc, char **argv)
Auxiliary class for CPU timing and usage.
void print(std::ostream &out, const JScale_t scale=milli_t) const
Print timer data.
Data structure for angles in three dimensions.
double getTheta() const
Get theta angle.
double getPhi() const
Get phi angle.
Utility class to parse command line options.
Multi-dimensional CDF table for arrival time of Cherenkov light.
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys.
void Write(TDirectory &out, const bool wm=false)
Write objects to file.
JAbstractHistogram< double > JHistogram_t
Type definition for scan along axis.
void convertToPDF(TH1 &h1, const std::string &option="NW", const double factor=1.0)
Convert 1D histogram to PDF.
@ DIRECT_LIGHT_FROM_EMSHOWER
direct light from EM shower
int getPDFType(const std::string &file_name)
Get PDF type.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.