76{
80
82 typedef JParallelFileScanner_t::multi_pointer_type multi_pointer_type;
83
84 JParallelFileScanner_t inputFile;
86 string detectorFile;
87 string pdfFile;
90
91 try {
92
94
95 JParser<> zap(
"Program to evaluate hit probabilities.");
96
103
104 zap(argc, argv);
105 }
106 catch(const exception& error) {
107 FATAL(error.what() << endl);
108 }
109
110
111
112
115 }
116
118
119 try {
121 }
124 }
125
127
129
131
133
136
138
139 while (inputFile.hasNext()) {
140
141 STATUS(
"event: " << setw(10) << inputFile.getCounter() <<
'\r');
DEBUG(endl);
142
143 multi_pointer_type ps = inputFile.next();
144
147
148 DEBUG(
"event: " << *tev << endl);
149
150 summary.update(*tev);
151
153
154 JDataL0_t dataL0;
155
156 buildL0(*tev, router, true, back_inserter(dataL0));
157
158 for (JEvt::const_iterator shower = in->begin(); shower != in->end(); ++shower) {
159
160 DEBUG(
"shower: " << *shower << endl);
161
164
166
167
168
170
171 for (JDataL0_t::const_iterator i = dataL0.begin(); i != dataL0.end(); ++i) {
172
173 JHitW0 hit(*i, summary.getRate(*i, parameters.
R_Hz));
174
175 hit.rotate(R);
176
177 if (match(hit)) {
179 }
180 }
181
182
183
184 sort(
data.begin(),
data.end(), compare);
185
186 JDataW0_t::iterator __end = unique(
data.begin(),
data.end(), equal_to<JDAQPMTIdentifier>());
187
189 <<
FIXED(12,3) << vx.getX() <<
' '
190 <<
FIXED(12,3) << vx.getY() <<
' '
191 <<
FIXED(12,3) << vx.getZ() <<
' '
192 <<
FIXED(12,3) << vx.getT() <<
' '
193 <<
FIXED( 8,3) << shower->getQ() << endl);
194
195 double Q = 0.0;
196
197 for (JDataW0_t::const_iterator hit =
data.begin(); hit != __end; ++hit) {
198
200 D.sub(vx);
201
202 const double x = hit->getX() - vx.getX();
203 const double y = hit->getY() - vx.getY();
204 const double z = hit->getZ() - vx.getZ();
205 const double cd = z/D.getLength();
206
208
209 JDirection3D u(hit->getDX(), hit->getDY(), hit->getDZ());
210
212
213 const double theta = u.getTheta();
214 const double phi = fabs(u.getPhi());
215
216 const double E = shower->getE();
217 const double dt = T_ns.constrain(hit->getT() - t1);
218
219 double H1 = npe.calculate(E, D.getLength(), cd, theta, phi);
220 double H0 = hit->getR() * 1e-9 * T_ns.getLength();
221
222 double Vmax_npe = 20.0;
223 if (H1 >= Vmax_npe) {
224 H1 *= Vmax_npe / H1;
225 }
226
227 H1 += H0;
228
229 const double chi2 =
getChi2(H1,
true);
230
232 << setw(10) << hit->getModuleID() << ':' << setw( 2) << setfill('0') << hit->getPMTAddress() << setfill(' ') << ' '
233 <<
FIXED(12,1) << E <<
' '
234 <<
FIXED( 9,1) << R <<
' '
235 <<
FIXED( 6,4) << theta <<
' '
236 <<
FIXED( 6,4) << phi <<
' '
237 <<
FIXED( 8,3) << dt <<
' '
238 <<
FIXED(12,3) << chi2 << endl);
239
241 }
242
244 }
245 }
247}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Router for direct addressing of module data in detector data structure.
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 JEvent &evt)
Get average quality.
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.