Auxiliary program to determine PDF of L1 hit.
35{
38
40
41 string inputFile;
43 double E;
44 double R;
45 double R_Hz;
47 double T_ns;
50
51 try {
52
53 JParser<> zap(
"Auxiliary program to determine PDF of L1 hit.");
54
57 zap[
'E'] =
make_field(E,
"muon energy [GeV]") = 1.0;
58 zap[
'R'] =
make_field(R,
"distance of approach [m]");
59 zap[
'D'] =
make_field(dir,
"(theta, phi) of PMT [rad]");
60 zap[
'T'] =
make_field(T_ns,
"time window [ns]") = 10.0;
61 zap[
'B'] =
make_field(R_Hz,
"background rate [Hz]") = 0.0;
64
65 zap(argc, argv);
66 }
67 catch(const exception &error) {
68 FATAL(error.what() << endl);
69 }
70
76
77 JFunction1D_t::JSupervisor supervisor(new JFunction1D_t::JDefaultResult(zero));
78
80 DIRECT_LIGHT_FROM_MUON,
81 SCATTERED_LIGHT_FROM_MUON,
82 DIRECT_LIGHT_FROM_DELTARAYS,
83 SCATTERED_LIGHT_FROM_DELTARAYS,
84 DIRECT_LIGHT_FROM_EMSHOWERS,
85 SCATTERED_LIGHT_FROM_EMSHOWERS
86 };
87
88 const int N = sizeof(pdf_t) / sizeof(pdf_t[0]);
89
90 JPDF_t pdf[N];
91
92 for (int i = 0; i != N; ++i) {
93
94 try {
95
96 const string file_name = getFilename(inputFile, pdf_t[i]);
97
98 NOTICE(
"loading input from file " << file_name <<
"... " << flush);
99
100 pdf[i].load(file_name.c_str());
101
103 }
106 }
107
108 pdf[i].setExceptionHandler(supervisor);
109 }
110
112
114
116 }
117
118
119 JModule module = getModule<JKM3NeT_t>(1);
120
121 module.rotate(JRotation3D(dir));
122
123
125
127
129
131
132 const double t2 = t1 + T_ns;
133
134 JFunction1D_t::result_type y1;
135 JFunction1D_t::result_type y2;
136
137 for (int i = 0; i != N; ++i) {
138
139 JFunction1D_t::result_type
p1;
140 JFunction1D_t::result_type p2;
141
142
143
144 for (const auto& pmt : module) {
145 p1 += pdf[i](R, pmt.getTheta(), pmt.getPhi(), t1);
146 p2 += pdf[i](R, pmt.getTheta(), pmt.getPhi(), t2);
147 }
148
150 p1 *= JDeltaRays::getEnergyLossFromMuon(E);
151 p2 *= JDeltaRays::getEnergyLossFromMuon(E);
154 p2 *= E;
155 }
156
158 y2 += p2;
159 }
160
161
162
163 y1.f += R_Hz * 1e-9;
166
167 zsp[t1] = y1.f * (1.0 - exp(y1.v - y2.v));
168 }
169
170 zsp.compile();
171
172 for (int ix = 1; ix <= h0.GetNbinsX(); ++ix) {
173
174 const double t1 = h0.GetBinCenter(ix);
175
176 try {
177
178 const JFunction1D_t::result_type
result = zsp(t1);
179
181
182 h0.SetBinContent(ix, W);
183 }
184 catch(const exception&) {}
185 }
186
187 out.Write();
188 out.Close();
189}
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Data structure for a composite optical module.
Data structure for angles in three dimensions.
virtual const char * what() const override
Get error message.
Utility class to parse command line options.
Multi-dimensional PDF table for arrival time of Cherenkov light.
bool is_deltarays(const int pdf)
Test if given PDF type corresponds to Cherenkov light from delta-rays.
bool is_bremsstrahlung(const int pdf)
Test if given PDF type corresponds to Cherenkov light from Bremsstrahlung.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).