83 using namespace KM3NETDAQ;
86 typedef JParallelFileScanner_t::multi_pointer_type multi_pointer_type;
88 JParallelFileScanner_t inputFile;
99 JParser<> zap(
"Program to perform detector calibration using reconstructed shower direction.");
103 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
110 catch(
const exception& error) {
111 FATAL(error.what() << endl);
119 WARNING(
"Number of prefits " <<
parameters.numberOfPrefits <<
" != " << 1 << endl);
144 while (inputFile.hasNext()) {
146 STATUS(
"event: " << setw(10) << inputFile.getCounter() <<
'\r');
DEBUG(endl);
148 multi_pointer_type ps = inputFile.next();
153 DEBUG(
"event: " << *tev << endl);
155 summary.update(*tev);
161 buildL0(*tev, router,
true, back_inserter(dataL0));
163 for (JEvt::const_iterator shower = in->begin(); shower != in->end(); ++shower) {
165 DEBUG(
"shower: " << *shower << endl);
176 for (JDataL0_t::const_iterator i = dataL0.begin(); i != dataL0.end(); ++i) {
178 double rate_Hz = summary.getRate(*i);
180 if (rate_Hz <= 0.0) {
181 rate_Hz = summary.getRate();
195 sort(data.begin(), data.end(), compare);
197 JDataW0_t::iterator __end = unique(data.begin(), data.end(), equal_to<JDAQPMTIdentifier>());
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);
208 for (JDataW0_t::const_iterator hit = data.begin(); hit != __end; ++hit) {
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();
224 const double theta =
u.getTheta();
225 const double phi = fabs(
u.getPhi());
227 const double E = shower->getE();
228 const double dt = T_ns.constrain(hit->getT() - t1);
230 double H1 = npe.calculate(E,
D.getLength(), cd, theta, phi);
231 double H0 = hit->getR() * 1e-9 * T_ns.getLength();
233 double Vmax_npe = 20.0;
234 if (H1 >= Vmax_npe) {
240 const double chi2 =
getChi2(H1,
true);
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);
254 DEBUG(
"quality: " <<
FIXED(8,3) << Q <<
' ' <<
distance(data.begin(), __end) << endl);
Utility class to parse command line options.
do echo Generating $dir eval D
Data structure for direction in three dimensions.
double getQuality(const double chi2, const int NDF)
Get quality of fit.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Template specialisation of L0 builder for JHitL0 data type.
double getIndexOfRefraction()
Get average index of refraction of water corresponding to group velocity.
Data structure for vertex fit.
Router for direct addressing of module data in detector data structure.
Auxiliary data structure for shower PDF.
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
General purpose class for parallel reading of objects from a single file or multiple files...
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary data structure for floating point format specification.
Auxiliary class for defining the range of iterations of objects.
JDirection3D getDirection(const Vec &dir)
Get direction.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
JPosition3D getPosition(const Vec &pos)
Get position.
File router for fast addressing of summary data.
then usage $script[distance] fi case set_variable R
Auxiliary class for a hit with background rate value.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Data structure for fit parameters.
const double getInverseSpeedOfLight()
Get inverse speed of light.
Data structure for position in three dimensions.
const JLimit & getLimit() const
Get limit.
do set_variable DETECTOR_TXT $WORKDIR detector
Template specialisation of class JModel to match hit with bright point.
double getChi2(const double P)
Get chi2 corresponding to given probability.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
JPosition3D & rotate(const JRotation3D &R)
Rotate.
bool qualitySorter(const JRECONSTRUCTION::JFit &first, const JRECONSTRUCTION::JFit &second)
Comparison of fit results.
then usage $script[input file[working directory[option]]] nWhere option can be E
#define DEBUG(A)
Message macros.