77{
81
83 typedef JParallelFileScanner_t::multi_pointer_type multi_pointer_type;
84
85 JParallelFileScanner_t inputFile;
87 string detectorFile;
88 string pdfFile;
92
93 try {
94
96
97 JParser<> zap(
"Program to evaluate hit probabilities.");
98
106
107 zap(argc, argv);
108 }
109 catch(const exception& error) {
110 FATAL(error.what() << endl);
111 }
112
113
114
115
118 }
119
121
122 try {
124 }
127 }
128
130
132
134
136
139
141
142 while (inputFile.hasNext()) {
143
144 STATUS(
"event: " << setw(10) << inputFile.getCounter() <<
'\r');
DEBUG(endl);
145
146 multi_pointer_type ps = inputFile.next();
147
150
151 DEBUG(
"event: " << *tev << endl);
152
153 summary.update(*tev);
154
156
157 JDataL0_t dataL0;
158
159 buildL0(*tev, router, true, back_inserter(dataL0));
160
161 for (JEvt::const_iterator shower = in->begin(); shower != in->end(); ++shower) {
162
163 DEBUG(
"shower: " << *shower << endl);
164
167
169
170
171
173
174 for (JDataL0_t::const_iterator i = dataL0.begin(); i != dataL0.end(); ++i) {
175
177
179
180 const int type = wip.
getType();
181 const double QE = wip.
QE;
182 const double R_Hz = summary.getRate(i->getPMTIdentifier(), parameters.
R_Hz);
183
184 JHitW0 hit(*i, type, QE, R_Hz);
185
186 hit.rotate(R);
187
188 if (match(hit)) {
190 }
191 }
192
193
194
195 sort(
data.begin(),
data.end(), compare);
196
197 JDataW0_t::iterator __end = unique(
data.begin(),
data.end(), equal_to<JDAQPMTIdentifier>());
198
200 <<
FIXED(12,3) << vx.getX() <<
' '
201 <<
FIXED(12,3) << vx.getY() <<
' '
202 <<
FIXED(12,3) << vx.getZ() <<
' '
203 <<
FIXED(12,3) << vx.getT() <<
' '
204 <<
FIXED( 8,3) << shower->getQ() << endl);
205
206 double Q = 0.0;
207
208 for (JDataW0_t::const_iterator hit =
data.begin(); hit != __end; ++hit) {
209
211 D.sub(vx);
212
213 const double x = hit->getX() - vx.getX();
214 const double y = hit->getY() - vx.getY();
215 const double z = hit->getZ() - vx.getZ();
216 const double cd = z/D.getLength();
217
219
220 JDirection3D u(hit->getDX(), hit->getDY(), hit->getDZ());
221
223
224 const double theta = u.getTheta();
225 const double phi = fabs(u.getPhi());
226
227 const double E = shower->getE();
228 const double dt = T_ns.constrain(hit->getT() - t1);
229
230 double H1 = npe.calculate(E, D.getLength(), cd, theta, phi);
231 double H0 = hit->getR() * 1e-9 * T_ns.getLength();
232
233 double Vmax_npe = 20.0;
234 if (H1 >= Vmax_npe) {
235 H1 *= Vmax_npe / H1;
236 }
237
238 H1 += H0;
239
240 const double chi2 =
getChi2(H1,
true);
241
243 << setw(10) << hit->getModuleID() << ':' << setw( 2) << setfill('0') << hit->getPMTAddress() << setfill(' ') << ' '
244 <<
FIXED(12,1) << E <<
' '
245 <<
FIXED( 9,1) << R <<
' '
246 <<
FIXED( 6,4) << theta <<
' '
247 <<
FIXED( 6,4) << phi <<
' '
248 <<
FIXED( 8,3) << dt <<
' '
249 <<
FIXED(12,3) << chi2 << endl);
250
252 }
253
255 }
256 }
258}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Router for direct addressing of module data in detector data structure.
Auxiliary class for map of PMT parameters.
const JPMTParameters & getPMTParameters(const JPMTIdentifier &id) const
Get PMT parameters.
Data structure for PMT parameters.
double QE
relative quantum efficiency
int getType() const
Get type for for time-slewing correction.
Data structure for vertex fit.
Data structure for direction in three dimensions.
Data structure for position in three dimensions.
JPosition3D & rotate(const JRotation3D &R)
Rotate.
Utility class to parse command line options.
Auxiliary class for a hit with background rate value.
General purpose class for parallel reading of objects from a single file or multiple files.
File router for fast addressing of summary data.
JDirection3D getDirection(const Vec &dir)
Get direction.
JPosition3D getPosition(const Vec &pos)
Get position.
double getQuality(const double chi2, const int NDF)
Get quality of fit.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
double getChi2(const double P)
Get chi2 corresponding to given probability.
double getIndexOfRefraction()
Get average index of refraction of water corresponding to group velocity.
const double getInverseSpeedOfLight()
Get inverse speed of light.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
bool qualitySorter(const JFit &first, const JFit &second)
Comparison of fit results.
KM3NeT DAQ data structures and auxiliaries.
Auxiliary data structure for floating point format specification.
Model for fit to acoustics data.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Data structure for fit parameters.
double DMax_m
maximal distance to optical module [m]
double TMax_ns
maximum time for local coincidences [ns]
double R_Hz
default rate [Hz]
double TMin_ns
minimum time for local coincidences [ns]
size_t numberOfPrefits
number of prefits
Auxiliary class for defining the range of iterations of objects.
const JLimit & getLimit() const
Get limit.
static counter_type max()
Get maximum counter value.
Auxiliary data structure for shower PDF.