36 int main(
int argc,
char **argv)
54 JParser<> zap(
"Program to verify generation of arrival times of Cherenkov photons from a muon using tabulated CDF.");
58 zap[
'E'] =
make_field(
E,
"muon energy [GeV]") = 1.0;
59 zap[
'R'] =
make_field(
R,
"distance of approach [m]");
60 zap[
'D'] =
make_field(dir,
"(theta, phi) of PMT [rad]");
67 catch(
const exception& error) {
68 FATAL(error.what() << endl);
72 typedef JHermiteSplineFunction1D_t JFunction1D_t;
75 typedef JMAPLIST<JPolint1FunctionalMap,
76 JPolint1FunctionalGridMap,
77 JPolint1FunctionalGridMap>::maplist JMapList_t;
78 typedef JCDFTable<JFunction1D_t, JMapList_t> JCDF_t;
80 const int N = inputFile.size();
87 for (
int i = 0;
i !=
N; ++
i) {
89 NOTICE(
"loading input from file " << inputFile[
i] <<
"... " << flush);
93 cdf [
i].load(inputFile[i].c_str());
98 catch(
const JException& error) {
99 FATAL(error.what() << endl);
109 cout <<
"> " << flush;
114 for (
int i = 0;
i !=
N; ++
i) {
118 double npe =
cdf[
i].getNPE (
R, dir.getTheta(), dir.getPhi());
119 double t =
cdf[
i].getTime(
R, dir.getTheta(), dir.getPhi(),
x);
127 cout <<
' ' <<
FIXED(6,2) << t <<
' ' <<
FIXED(5,2) << npe;
129 catch(
const exception& error) {
130 ERROR(error.what() << endl);
151 const double t0 = 0.0;
160 for ( ; x < -10.0; x += 5.0) { X.push_back(t0 + x); }
161 for ( ; x < +20.0; x += 1.0) { X.push_back(t0 + x); }
162 for ( ; x < +50.0; x += 2.0) { X.push_back(t0 + x); }
165 for ( ; x < +100.0; x += 5.0) { X.push_back(t0 + x); }
166 for ( ; x < +250.0; x += 10.0) { X.push_back(t0 + x); }
167 for ( ; x < +500.0; x += 25.0) { X.push_back(t0 + x); }
168 for ( ; x < +900.0; x += 50.0) { X.push_back(t0 + x); }
171 h0 =
new TH1D(
"h0", NULL, X.size() - 1, X.data());
180 JManager<int, TH1D> H1(
new TH1D(
"h1[%]", NULL, 100000, 0.0, +1.0));
182 for (
int i = 0;
i !=
N; ++
i) {
184 for (
int j = 1;
j <= H1->GetNbinsX(); ++
j) {
188 const double x = H1->GetBinCenter(
j);
189 const double t =
cdf[
i].getTime(
R, dir.getTheta(), dir.getPhi(),
x);
191 H1[
i]->SetBinContent(
j, t);
193 catch(
const exception& error) {
194 ERROR(error.what() << endl);
199 if (numberOfEvents > 0) {
205 for (
int counter = 0; counter != numberOfEvents; ++counter) {
207 if (counter%1000== 0) {
213 for (
int i = 0;
i !=
N; ++
i) {
217 double npe =
cdf[
i].getNPE(
R, dir.getTheta(), dir.getPhi());
225 for (
int j = gRandom->Poisson(npe);
j != 0; --
j) {
227 const double x = gRandom->Rndm();
228 const double t =
cdf[
i].getTime(
R, dir.getTheta(), dir.getPhi(),
x);
233 catch(
const exception& error) {
234 NOTICE(error.what() << endl);
242 const double W = 1.0 / (double) numberOfEvents;
245 timer.print(cout, W);
Utility class to parse command line options.
int main(int argc, char *argv[])
then usage $script< input file >[option[primary[working directory]]] nWhere option can be E
then warning Cannot perform comparison test for histogram
Dynamic ROOT object management.
Auxiliary data structure for floating point format specification.
Various implementations of functional maps.
double getDeltaRaysFromMuon(const double E, const JRange< double > T_GeV=JRange< double >(DELTARAY_TMIN, DELTARAY_TMAX))
Equivalent EM-shower energy due to delta-rays per unit muon track length.
Numbering scheme for PDF types.
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
void convertToPDF(TH1 &h1, const std::string &option="NW", const double factor=1.0)
Convert 1D histogram to PDF.
General purpose messaging.
then for FUNCTION in pdf npe cdf
int getPDFType(const std::string &file_name)
Get PDF type.
then JCookie sh JDataQuality D $DETECTOR_ID R
then usage $script< input file >[option[primary[working directory]]] nWhere option can be N
Utility class to parse command line options.
bool is_deltarays(const int pdf)
Test if given PDF type corresponds to Cherenkov light from delta-rays.
no fit printf nominal n $STRING awk v X
then set_variable DETECTOR set_variable OUTPUT_FILE set_variable DAQ_FILE set_variable PMT_FILE else fatal Wrong number of arguments fi JPrintTree f $DAQ_FILE type
JAbstractHistogram< double > JHistogram_t
Type definition for scan along axis.
#define DEBUG(A)
Message macros.