Jpp 21.0.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JReconstruction/JEvD.cc
Go to the documentation of this file.
1#include <string>
2#include <iostream>
3#include <iomanip>
4#include <vector>
5#include <algorithm>
6#include <memory>
7
8#include "TROOT.h"
9#include "TApplication.h"
10#include "TCanvas.h"
11#include "TRootCanvas.h"
12#include "TStyle.h"
13#include "TH2D.h"
14#include "TArrow.h"
15#include "TLatex.h"
16#include "TMarker.h"
17
22
23#include "JROOT/JStyle.hh"
24#include "JROOT/JCanvas.hh"
25#include "JROOT/JRootToolkit.hh"
26
27#include "JDAQ/JDAQEventIO.hh"
29
34
36
37#include "JTrigger/JHitL0.hh"
38#include "JTrigger/JBuildL0.hh"
39
40#include "JSupport/JSupport.hh"
45
46#include "JPhysics/JPDF_t.hh"
47
48#include "JFit/JLine1Z.hh"
49#include "JFit/JModel.hh"
56
57#include "JLang/JPredicate.hh"
58#include "JLang/JComparator.hh"
59
60#include "JMath/JMathToolkit.hh"
61#include "JSystem/JKeypress.hh"
62#include "JSystem/JProcess.hh"
63
65#include "Jeep/JProperties.hh"
66#include "Jeep/JPrint.hh"
67#include "Jeep/JParser.hh"
68#include "Jeep/JMessage.hh"
69
70
71namespace {
72
73 /**
74 * Wild card character for file name substition.
75 */
76 const char WILDCARD = '%';
77
78 /**
79 * Execute command in shell.
80 *
81 * \param command command
82 */
83 inline void execute(const std::string& command, int debug)
84 {
85 using namespace std;
86 using namespace JPP;
87
88 JProcess process(command);
89
90 istream in(process.getInputStreamBuffer());
91
92 for (string buffer; getline(in, buffer); ) {
93 DEBUG(buffer << endl);
94 }
95 }
96
97 const char* const histogram_t = "histogram"; //!< draw histogram
98 const char* const arrow_t = "arrow"; //!< draw arrow
99}
100
101
102/**
103 * \file
104 *
105 * Program to display hit probabilities.
106 *
107 * \author mdejong
108 */
109int main(int argc, char **argv)
110{
111 using namespace std;
112 using namespace JPP;
113 using namespace KM3NETDAQ;
114
116 typedef JParallelFileScanner_t::multi_pointer_type multi_pointer_type;
117 typedef JMultipleFileScanner<calibration_types> JCalibration_t;
118
119 JParallelFileScanner_t inputFile;
120 JLimit_t& numberOfEvents = inputFile.getLimit();
121 string detectorFile;
122 JCalibration_t calibrationFile;
123 double Tmax_s;
124 string pdfFile;
125 string outputFile;
126 JMuonGandalfParameters_t parameters;
127 int application;
128 JEventSelector event_selector;
129 JCanvas canvas;
130 bool batch;
131 struct : JStyle::JParameters {
132 double arrowSize = 0.003;
133 string arrowType = "|->";
134 double arrowScale = 250.0;
135 Width_t lineWidth = 2;
136 Style_t lineStyle = 1;
137 int nbinsX = 50;
138 int nbinsY = 250;
139 double T_ns = 0.0;
140 bool equalize = false;
141 } graphics;
142 vector<string> keys;
143 string option;
144 int debug;
145
146
147 try {
148
149 JProperties properties = graphics.getProperties();
150
151 properties.insert(gmake_property(graphics.arrowSize));
152 properties.insert(gmake_property(graphics.arrowType));
153 properties.insert(gmake_property(graphics.arrowScale));
154 properties.insert(gmake_property(graphics.lineWidth));
155 properties.insert(gmake_property(graphics.lineStyle));
156 properties.insert(gmake_property(graphics.T_ns));
157 properties.insert(gmake_property(graphics.equalize));
158
159 parameters.numberOfPrefits = 1;
160
161 JParser<> zap("Program to display hit probabilities.");
162
163 zap['w'] = make_field(canvas, "size of canvas <nx>x<ny> [pixels]") = JCanvas(1200, 600);
164 zap['f'] = make_field(inputFile, "input file (output of JXXXMuonReconstruction.sh)");
165 zap['a'] = make_field(detectorFile);
166 zap['+'] = make_field(calibrationFile) = JPARSER::initialised();
167 zap['T'] = make_field(Tmax_s) = 100.0;
168 zap['n'] = make_field(numberOfEvents) = JLimit::max();
169 zap['F'] = make_field(pdfFile);
170 zap['o'] = make_field(outputFile, "graphics output file name") = MAKE_STRING("display_" << WILDCARD << ".gif");
171 zap['@'] = make_field(parameters) = JPARSER::initialised();
172 zap['A'] = make_field(application) = JMUONGANDALF, JMUONENERGY, JMUONSTART;
173 zap['L'] = make_field(event_selector) = JPARSER::initialised();
174 zap['%'] = make_field(properties) = JPARSER::initialised();
175 zap['k'] = make_field(keys, "display optional weights: " << get_keys(getWeight)) = JPARSER::initialised();
176 zap['O'] = make_field(option, "draw option") = arrow_t, histogram_t;
177 zap['B'] = make_field(batch, "batch processing");
178 zap['d'] = make_field(debug) = 1;
179
180 zap(argc, argv);
181 }
182 catch(const exception& error) {
183 FATAL(error.what() << endl);
184 }
185
186 if (batch && outputFile == "") {
187 FATAL("Missing output file name " << outputFile << " in batch mode." << endl);
188 }
189
190 if (!batch && outputFile == "") {
191 outputFile = MAKE_STRING(WILDCARD << ".gif");
192 }
193
194 if (outputFile.find(WILDCARD) == string::npos) {
195 FATAL("Output file name " << outputFile << " has no wild card '" << WILDCARD << "'" << endl);
196 }
197
198
200
201 try {
202 load(detectorFile, detector);
203 }
204 catch(const JException& error) {
205 FATAL(error);
206 }
207 unique_ptr<JDynamics> dynamics;
208
209 try {
210
211 dynamics.reset(new JDynamics(detector, Tmax_s));
212
213 dynamics->load(calibrationFile);
214 }
215 catch(const exception& error) {
216 if (!calibrationFile.empty()) {
217 FATAL(error.what());
218 }
219 }
220
221 const double Zbed = 0.0;
222
223 JCylinder3D cylinder(detector.begin(), detector.end());
224
225 cylinder.addMargin(parameters.roadWidth_m);
226
227 if (cylinder.getZmin() < Zbed) {
228 cylinder.setZmin(Zbed);
229 }
230
231 const JModuleRouter router(dynamics ? dynamics->getDetector() : detector);
232
233 JSummaryFileRouter summary(inputFile);
234
235 const JMuonPDF_t pdf(pdfFile, parameters.TTS_ns);
236
237 const JTimeRange T_ns(parameters.TMin_ns, parameters.TMax_ns);
238
239 typedef vector<JHitL0> JDataL0_t;
240 typedef vector<JHitW0> JDataW0_t;
241
242 const JBuildL0<JHitL0> buildL0;
243
244
245 Vec offset(0.0, 0.0, 0.0);
246
247 try {
248 offset = getOffset(getHeader(inputFile));
249 } catch(const exception& error) {}
250
251 NOTICE("Offset applied to true tracks is: " << offset << endl);
252
253
254 // ROOT
255
256 gROOT->SetBatch(batch);
257
258 TApplication* tp = new TApplication("user", NULL, NULL);
259 TCanvas* cv = new TCanvas("display", "", canvas.x, canvas.y);
260
261 if (!batch) {
262 ((TRootCanvas *) cv->GetCanvasImp())->Connect("CloseWindow()", "TApplication", tp, "Terminate()");
263 }
264
265 unique_ptr<TStyle> gStyle(new JStyle("gplot", cv->GetWw(), cv->GetWh(), graphics));
266
267 gROOT->SetStyle("gplot");
268 gROOT->ForceStyle();
269
270 const size_t NUMBER_OF_PADS = 3;
271
272 cv->SetFillStyle(4000);
273 cv->SetFillColor(kWhite);
274
275 TPad* p1 = new TPad("p1", NULL, 0.0, 0.00, 1.0, 0.95);
276 TPad* p2 = new TPad("p2", NULL, 0.0, 0.95, 1.0, 1.00);
277
278 p1->Divide(NUMBER_OF_PADS, 1);
279
280 p1->Draw();
281 p2->Draw();
282
283 const double Dmax = getMaximalDistance(detector);
284 const double Rmin = 0.0;
285 const double Rmax = min(parameters.roadWidth_m, 0.4 * Dmax);
286 const double Tmin = min(parameters.TMin_ns, -10.0);
287 const double Tmax = max(parameters.TMax_ns, +100.0);
288 const double Amin = 0.002 * (Tmax - Tmin); // minimal arrow length [ns]
289 const double Amax = 0.8 * (Tmax - Tmin); // maximal arrow length [ns]
290 const double ymin = Tmin - (option == arrow_t ? 0.2 * Amax : 0.0);
291 const double ymax = Tmax + (option == arrow_t ? 0.5 * Amax : 0.0);
292
293 const string Xlabel[NUMBER_OF_PADS] = { "R [m]", "#phi [rad]", "z [m]" };
294 const double Xmin [NUMBER_OF_PADS] = { Rmin, -PI, -0.4 * Dmax };
295 const double Xmax [NUMBER_OF_PADS] = { Rmax, +PI, +0.4 * Dmax };
296
297 double Xs[NUMBER_OF_PADS];
298
299 for (size_t i = 0; i != NUMBER_OF_PADS; ++i) {
300 Xs[i] = 0.003 * (Xmax[i] - Xmin[i]) * (0.5 * NUMBER_OF_PMTS); // x-offset arrow as function of PMT number
301 }
302
303 TH2D H2[NUMBER_OF_PADS];
304 TGraph G2[NUMBER_OF_PADS];
305
306 for (size_t i = 0; i != NUMBER_OF_PADS; ++i) {
307
308 H2[i] = TH2D(MAKE_CSTRING("h" << i), NULL, graphics.nbinsX, Xmin[i] - Xs[i], Xmax[i] + Xs[i], graphics.nbinsY, ymin, ymax);
309
310 H2[i].GetXaxis()->SetTitle(Xlabel[i].c_str());
311 H2[i].GetYaxis()->SetTitle("#Deltat [ns]");
312
313 H2[i].GetXaxis()->CenterTitle(true);
314 H2[i].GetYaxis()->CenterTitle(true);
315
316 H2[i].SetStats(kFALSE);
317
318 G2[i].Set(2);
319
320 G2[i].SetPoint(0, H2[i].GetXaxis()->GetXmin(), 0.0);
321 G2[i].SetPoint(1, H2[i].GetXaxis()->GetXmax(), 0.0);
322
323 p1->cd(i+1);
324
325 H2[i].Draw("AXIS");
326 G2[i].Draw("SAME");
327 }
328
329
330 for (JTreeScanner<Evt> mc(inputFile); inputFile.hasNext(); ) {
331
332 cout << "event: " << setw(8) << inputFile.getCounter() << '\r';
333
334 multi_pointer_type ps = inputFile.next();
335
336 JDAQEvent* tev = ps;
337 JFIT::JEvt* in = ps;
338 Evt* event = NULL;
339
340 if (dynamics) {
341 dynamics->update(*tev);
342 }
343
344 if (mc.getEntries() != 0) {
345 event = mc.getEntry(tev->getCounter()); // Monte Carlo true information
346 }
347
348 in->select(JHistory::is_application(application));
349
350 if (!in->empty()) {
351
352 sort(in->begin(), in->end(), qualitySorter);
353
354 if (!event_selector(*tev, *in, event)) {
355 continue;
356 }
357
358
359 JDataL0_t dataL0;
360
361 buildL0(*tev, router, true, back_inserter(dataL0));
362
363 summary.update(*tev);
364
365 JFIT::JFit muon; // Monte Carlo true muon
366
367 if (event != NULL) {
368
369 const time_converter converter = time_converter(*event, *tev);
370
371 for (const auto& t1 : event->mc_trks) {
372 if (is_muon(t1)) {
373 if (t1.E > muon.getE()) {
374
375 JTrack3E ta = getTrack(t1);
376
377 ta.add(getPosition(offset));
378 ta.add(converter.putTime());
379
380 muon = getFit(0, ta, 0.0, 0, t1.E, 1);
381
382 muon.setW(JSTART_LENGTH_METRES, fabs(t1.len));
383 }
384 }
385 }
386 }
387
388 bool monte_carlo = false; // show Monte Carlo true muon
389 size_t index = 0; // index of fit
390
391 for (bool next = false; !next; ) {
392
393 for (size_t i = 0; i != NUMBER_OF_PADS; ++i) {
394 H2[i].Reset();
395 }
396
397 JFIT::JFit fit;
398
399 if (!monte_carlo)
400 fit = (*in)[index];
401 else
402 fit = muon;
403
404 JRotation3D R (getDirection(fit));
405 JLine1Z tz(getPosition (fit).rotate(R), fit.getT());
406 JZRange Z_m;
407 /*
408 if (fit.getW(fit,JSTART_LENGTH_METRES, 0.0) > 0.0) {
409 Z_m = JZRange(fit.getW(JSTART_ZMIN_M) + parameters.ZMin_m,
410 fit.getW(JSTART_ZMAX_M) + parameters.ZMax_m);
411 }
412 */
413 const JFIT::JModel<JLine1Z> match(tz, parameters.roadWidth_m, T_ns, Z_m);
414
415 // hit selection based on fit result
416
417 JDataW0_t data;
418
419 for (JDataL0_t::const_iterator i = dataL0.begin(); i != dataL0.end(); ++i) {
420
421 const int type = 0;
422 const double QE = 1.0;
423 const double R_Hz = summary.getRate(i->getPMTIdentifier(), parameters.R_Hz);
424
425 JHitW0 hit(*i, type, QE, R_Hz);
426
427 hit.rotate(R);
428
429 if (match(hit)) {
430 data.push_back(hit);
431 }
432 }
433
434 // select first hit in PMT
435
436 sort(data.begin(), data.end(), JHitW0::compare);
437
438 JDataW0_t::iterator __end = unique(data.begin(), data.end(), equal_to<JDAQPMTIdentifier>());
439
440 double E_GeV = parameters.E_GeV;
441 /*
442 if (fit.getE() > 0.1) {
443 E_GeV = fit.getE();
444 }
445 */
446
447 // move fit to geometrical center of hits
448
450
451 for (JDataW0_t::iterator hit = data.begin(); hit != __end; ++hit) {
452
453 const double x = hit->getX() - tz.getX();
454 const double y = hit->getY() - tz.getY();
455 const double z = hit->getZ();
456 const double R = sqrt(x*x + y*y);
457
458 zs.include(z - R/getTanThetaC());
459 }
460
461 const double z0 = tz.getZ();
462 const double z1 = 0.5 * (zs.getLowerLimit() + zs.getUpperLimit());
463
464 tz.setZ(z1, getSpeedOfLight());
465
466 // graphics
467
468 ostringstream os;
469 vector<TArrow> arrow [NUMBER_OF_PADS];
470 vector<TMarker> marker[NUMBER_OF_PADS];
471
472 if (fit.hasW(JSTART_LENGTH_METRES) && fit.getW(JSTART_LENGTH_METRES) > 0.0) {
473
474 marker[2].push_back(TMarker(z0 - tz.getZ(), 0.0, kFullCircle));
475 marker[2].push_back(TMarker(z0 - tz.getZ() + fit.getW(JSTART_LENGTH_METRES), 0.0, kFullCircle));
476
477 static_cast<TAttMarker&>(marker[2][0]) = TAttMarker(kRed, kFullCircle, 0.7);
478 static_cast<TAttMarker&>(marker[2][1]) = TAttMarker(kRed, kFullCircle, 0.7);
479 }
480
481 DEBUG("trk: "
482 << FIXED(7,2) << tz.getX() << ' '
483 << FIXED(7,2) << tz.getY() << ' '
484 << FIXED(7,2) << tz.getZ() << ' '
485 << FIXED(12,2) << tz.getT() << endl);
486
487 double chi2 = 0;
488
489 for (JDataW0_t::const_iterator hit = data.begin(); hit != __end; ++hit) {
490
491 const double x = hit->getX() - tz.getX();
492 const double y = hit->getY() - tz.getY();
493 const double z = hit->getZ() - tz.getZ();
494 const double R = sqrt(x*x + y*y);
495
496 const double t1 = tz.getT() + (z + R * getTanThetaC()) * getInverseSpeedOfLight();
497
498 JDirection3D dir(hit->getDX(), hit->getDY(), hit->getDZ()); // PMT orientation
499
500 dir.rotate(JRotation3Z(-atan2(y,x))); // rotate PMT axis to x-z plane
501
502 const double theta = dir.getTheta();
503 const double phi = fabs(dir.getPhi()); // rotational symmetry of Cherenkov cone
504
505 //const double E = gWater.getE(E_GeV, z); // correct for energy loss
506 const double E = E_GeV;
507 const double dt = T_ns.constrain(hit->getT() - t1);
508
509 JMuonPDF_t::result_type H1 = pdf.calculate(E, R, theta, phi, dt);
510 JMuonPDF_t::result_type H0(hit->getR() * 1e-9, 0.0, T_ns);
511
512 if (H1.V >= parameters.VMax_npe) {
513 H1 *= parameters.VMax_npe / H1.V;
514 }
515
516 H1 += H0; // signal + background
517
518 chi2 += H1.getChi2() - H0.getChi2();
519
520 DEBUG("hit: "
521 << setw(8) << hit->getModuleID() << '.' << FILL(2,'0') << (int) hit->getPMTAddress() << FILL() << ' '
522 << SCIENTIFIC(8,2) << E << ' '
523 << FIXED(7,2) << R << ' '
524 << FIXED(7,4) << theta << ' '
525 << FIXED(7,4) << phi << ' '
526 << FIXED(7,3) << dt << ' '
527 << FIXED(7,3) << H1.getChi2() << ' '
528 << FIXED(7,3) << H0.getChi2() << endl);
529
530 const double derivative = H1.getDerivativeOfChi2() - H0.getDerivativeOfChi2();
531
532 double size = derivative * graphics.arrowScale; // size of arrow
533
534 if (fabs(size) < Amin) {
535 size = (size > 0.0 ? +Amin : -Amin);
536 } else if (fabs(size) > Amax) {
537 size = (size > 0.0 ? +Amax : -Amax);
538 }
539
540 const double X[NUMBER_OF_PADS] = { R, atan2(y,x), z - R/getTanThetaC() };
541
542 const double xs = (double) (NUMBER_OF_PMTS - 2 * hit->getPMTAddress()) / (double) NUMBER_OF_PMTS;
543
544 for (size_t i = 0; i != NUMBER_OF_PADS; ++i) {
545
546 TArrow a1(X[i] + xs*Xs[i], dt + graphics.T_ns, X[i] + xs*Xs[i], dt + graphics.T_ns + size, graphics.arrowSize, graphics.arrowType.c_str());
547
548 a1.SetLineWidth(graphics.lineWidth);
549 a1.SetLineStyle(graphics.lineStyle);
550
551 arrow[i].push_back(a1);
552
553 H2[i].Fill(X[i], dt + graphics.T_ns);
554 }
555 }
556
557 if (graphics.equalize) {
558
559 double zmax = 0.0;
560
561 for (size_t i = 0; i != NUMBER_OF_PADS; ++i) {
562 if (H2[i].GetMaximum() > zmax) {
563 zmax = H2[i].GetMaximum();
564 }
565 }
566
567 zmax *= 1.2;
568
569 for (size_t i = 0; i != NUMBER_OF_PADS; ++i) {
570 H2[i].SetMaximum(zmax);
571 }
572 }
573
574 os << FILL(6,'0') << tev->getRunNumber() << ":" << tev->getFrameIndex() << "/" << tev->getCounter() << FILL();
575 os << " Q = " << FIXED(4,0) << fit.getQ()
576 << '/' << FIXED(4,0) << -chi2;
577 os << " E = " << SCIENTIFIC(7,1) << fit.getE() << " [GeV]";
578 os << " cos(#theta) = " << FIXED(6,3) << fit.getDZ();
579 os << " L = " << FIXED(6,2) << fit.getW(JSTART_LENGTH_METRES, 0.0) << " [m]";
580
581 for (const auto& key : keys) {
582 os << ' ' << SCIENTIFIC(12,3) << getWeight(fit, key, 0.0);
583 }
584
585 if (monte_carlo)
586 os << " Monte Carlo";
587 else if (muon.getStatus() >= 0)
588 os << " #Delta#alpha = " << FIXED(6,2) << getAngle(getDirection(muon), getDirection(fit)) << " [deg]";
589
590
591 // draw
592
593 TLatex title(0.05, 0.5, os.str().c_str());
594
595 title.SetTextAlign(12);
596 title.SetTextFont(42);
597 title.SetTextSize(0.6);
598
599 p2->cd();
600
601 title.Draw();
602
603 for (int i = 0; i != NUMBER_OF_PADS; ++i) {
604
605 p1->cd(i+1);
606
607 if (option == arrow_t) {
608
609 for (auto& a1 : arrow[i]) {
610 a1.Draw();
611 }
612
613 for (auto& m1 : marker[i]) {
614 m1.Draw();
615 }
616 }
617
618 if (option == histogram_t) {
619 H2[i].Draw("SAME");
620 }
621 }
622
623 cv->Update();
624
625
626 // action
627
628 if (batch) {
629
630 cv->SaveAs(replace(outputFile, WILDCARD, MAKE_STRING(inputFile.getCounter())).c_str());
631
632 next = true;
633
634 } else {
635
636 static int count = 0;
637
638 if (count++ == 0) {
639 cout << endl << "Type '?' for possible options." << endl;
640 }
641
642 for (bool user = true; user; ) {
643
644 JAxis3D ts(getAxis(fit));
645
646 const JCylinder3D::intersection_type intersection = cylinder.getIntersection(ts);
647
648 ts.move(intersection.first);
649
650 cout << "\n> " << flush;
651
652 switch (JKeypress(true).get()) {
653
654 case '?':
655 cout << endl;
656 cout << "possible options: " << endl;
657 cout << 'p' << " -> " << "print information" << endl;
658 cout << 'q' << " -> " << "exit application" << endl;
659 cout << 'u' << " -> " << "update canvas" << endl;
660 cout << 's' << " -> " << "save graphics to file" << endl;
661 cout << '+' << " -> " << "next fit" << endl;
662 cout << '-' << " -> " << "previous fit" << endl;
663 cout << 'M' << " -> " << "Monte Carlo true muon information" << endl;
664 cout << 'F' << " -> " << "fit information" << endl;
665 if (event_selector.is_valid()) {
666 cout << 'L' << " -> " << "reload event selector" << endl;
667 }
668 cout << 'r' << " -> " << "rewind input file" << endl;
669 cout << 'R' << " -> " << "switch to ROOT mode (quit ROOT to continue)" << endl;
670 cout << ' ' << " -> " << "next event (as well as any other key)" << endl;
671 break;
672
673 case 'p':
674
675 cout << endl;
676 cout << "intersection: " << FIXED(6,1) << intersection.first << ' '<< FIXED(6,1) << intersection.second << endl;
677 cout << "entry point: "
678 << FIXED(6,1) << ts.getX() - cylinder.getX() << ' '
679 << FIXED(6,1) << ts.getY() - cylinder.getY() << ' '
680 << FIXED(6,1) << ts.getZ() << endl;
681 for (const auto& i : getWeight) {
682 cout << LEFT(32) << i.first << RIGHT(1) << ' ' << FIXED(12,5) << getWeight(fit, i.first, 0.0) << endl;
683 }
684 break;
685
686 case 'q':
687 cout << endl;
688 return 0;
689
690 case 'u':
691 cv->Update();
692 break;
693
694 case 's':
695 cv->SaveAs(replace(outputFile, WILDCARD, MAKE_STRING(inputFile.getCounter())).c_str());
696 break;
697
698 case '+':
699 monte_carlo = false;
700 index = (index != in->size() - 1 ? index + 1 : 0);
701 user = false;
702 break;
703
704 case '-':
705 monte_carlo = false;
706 index = (index != 0 ? index - 1 : in->size() - 1);
707 user = false;
708 break;
709
710 case 'M':
711 if (muon.getStatus() >= 0)
712 monte_carlo = true;
713 else
714 ERROR(endl << "No Monte Carlo muon available." << endl);
715 user = false;
716 break;
717
718 case 'F':
719 monte_carlo = false;
720 user = false;
721 break;
722
723 case 'L':
724 if (event_selector.is_valid()) {
725 execute(MAKE_STRING("make -f " << getPath(argv[0]) << "/JMakeEventSelector libs"), 3);
726 event_selector.reload();
727 }
728 break;
729
730 case 'R':
731 tp->Run(kTRUE);
732 break;
733
734 case 'r':
735 inputFile.rewind();
736
737 default:
738 next = true;
739 user = false;
740 break;
741 }
742 }
743 }
744 }
745 }
746 }
747 cout << endl;
748}
Definition of hit and track types and auxiliary methods for handling Monte Carlo data.
string outputFile
KM3NeT DAQ constants, bit handling, etc.
Data structure for detector geometry and calibration.
TPaveText * p1
Dynamic detector calibration.
Basic data structure for L0 hit.
Keyboard settings for unbuffered input.
Binary methods for member methods.
General purpose messaging.
#define DEBUG(A)
Message macros.
Definition JMessage.hh:62
#define NOTICE(A)
Definition JMessage.hh:64
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:74
Direct access to module in detector data structure.
Auxiliary data structure for muon PDF.
Parallel scanning of objects from a single file or multiple files according a format that follows fro...
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2140
I/O formatting auxiliaries.
#define MAKE_CSTRING(A)
Make C-string.
Definition JPrint.hh:57
#define MAKE_STRING(A)
Make string.
Definition JPrint.hh:48
Utility class to parse parameter values.
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
int main(int argc, char **argv)
ROOT TTree parameter settings of various packages.
Detector data structure.
Definition JDetector.hh:96
Router for direct addressing of module data in detector data structure.
Utility class to parse parameter values.
Data structure for set of track fit results.
void select(const JSelector_t &selector)
Select fits.
Data structure for track fit results with history and optional associated values.
void setW(const std::vector< double > &W)
Set associated values.
double getDZ() const
Get Z-slope.
double getE() const
Get energy.
int getStatus() const
Get status of the fit; negative values should refer to a bad fit.
double getQ() const
Get quality.
const std::vector< double > & getW() const
Get associated values.
double getT() const
Get time.
bool hasW(const int i) const
Check availability of value.
Data structure for fit of straight line paralel to z-axis.
Definition JLine1Z.hh:29
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
Definition JLine1Z.hh:114
double getZ(const JPosition3D &pos) const
Get point of emission of Cherenkov light along muon path.
Definition JLine1Z.hh:134
void setZ(const double z, const double velocity)
Set z-position of vertex.
Definition JLine1Z.hh:75
double getY() const
Get y position.
Definition JVector2D.hh:74
double getX() const
Get x position.
Definition JVector2D.hh:63
Axis object.
Definition JAxis3D.hh:41
JAxis3D & rotate(const JRotation3D &R)
Rotate axis.
Definition JAxis3D.hh:225
void move(const double step)
Move vertex along this axis.
Definition JAxis3D.hh:134
double getZmin() const
Get minimal z position.
intersection_type getIntersection(const JAxis3D &axis) const
Get intersection points of axis with cylinder.
void setZmin(const double zmin)
Set minimal z position.
void addMargin(const double D)
Add (safety) margin.
Data structure for direction in three dimensions.
JDirection3D & rotate(const JRotation3D &R)
Rotate.
Rotation around Z-axis.
JTime & add(const JTime &value)
Addition operator.
3D track with energy.
Definition JTrack3E.hh:34
double getY() const
Get y position.
Definition JVector3D.hh:104
double getZ() const
Get z position.
Definition JVector3D.hh:115
double getX() const
Get x position.
Definition JVector3D.hh:94
double getTheta() const
Get theta angle.
Definition JVersor3D.hh:128
double getPhi() const
Get phi angle.
Definition JVersor3D.hh:144
General exception.
Definition JException.hh:25
Utility class to parse command line options.
Definition JParser.hh:1697
Auxiliary class for a hit with background rate value.
Definition JHitW0.hh:25
Data structure for size of TCanvas.
Definition JCanvas.hh:26
int y
number of pixels in Y
Definition JCanvas.hh:99
int x
number of pixels in X
Definition JCanvas.hh:98
Wrapper class around ROOT TStyle.
Definition JStyle.hh:24
General purpose class for object reading from a list of file names.
General purpose class for parallel reading of objects from a single file or multiple files.
Object reading from a list of files.
File router for fast addressing of summary data.
void update(const JDAQHeader &header)
Update router.
double getRate(const JDAQPMTIdentifier &id) const
Get rate.
Template definition for direct access of elements in ROOT TChain.
Enable unbuffered terminal input.
Definition JKeypress.hh:32
Streaming of input and output from Linux command.
Definition JProcess.hh:30
T constrain(argument_type x) const
Constrain value to range.
Definition JRange.hh:350
static JRange< T, JComparator_t > DEFAULT_RANGE()
Default range.
Definition JRange.hh:555
range_type & include(argument_type x)
Include given value to range.
Definition JRange.hh:397
T getLowerLimit() const
Get lower limit.
Definition JRange.hh:202
T getUpperLimit() const
Get upper limit.
Definition JRange.hh:213
Template L0 hit builder.
Definition JBuildL0.hh:38
int getRunNumber() const
Get run number.
int getFrameIndex() const
Get frame index.
JTriggerCounter_t getCounter() const
Get trigger counter.
Auxiliary class to convert DAQ hit time to/from Monte Carlo hit time.
double putTime() const
Get Monte Carlo time minus DAQ/trigger time.
static const int JSTART_LENGTH_METRES
distance between projected positions on the track of optical modules for which the response does not ...
JAxis3D getAxis(const Trk &track)
Get axis.
JDirection3D getDirection(const Vec &dir)
Get direction.
JTrack3E getTrack(const Trk &track)
Get track.
JPosition3D getPosition(const Vec &pos)
Get position.
bool is_muon(const Trk &track)
Test whether given track is a (anti-)muon.
Vec getOffset(const JHead &header)
Get offset.
JFit getFit(const int id, const JMODEL::JString &string)
Get fit parameters of string.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
double getMaximalDistance(const JDetector &detector, const bool option=false)
Get maximal distance between modules in detector.
std::string getPath(const std::string &file_name)
Get path, i.e. part before last JEEP::PATHNAME_SEPARATOR if any.
double getAngle(const JQuaternion3D &first, const JQuaternion3D &second)
Get space angle between quanternions.
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
Definition JString.hh:478
array_type< JKey_t > get_keys(const std::map< JKey_t, JValue_t, JComparator_t, JAllocator_t > &data)
Method to create array of keys of map.
std::string replace(const std::string &input, const std::string &target, const std::string &replacement)
Replace tokens in string.
@ LEFT
Definition JTwosome.hh:18
@ RIGHT
Definition JTwosome.hh:18
static const double PI
Mathematical constants.
static const JX X
Definition JMathlib.hh:1551
const double getInverseSpeedOfLight()
Get inverse speed of light.
double getTanThetaC()
Get average tangent of Cherenkov angle of water corresponding to group velocity.
const double getSpeedOfLight()
Get 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.
JRECONSTRUCTION::JWeight getWeight
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
KM3NeT DAQ data structures and auxiliaries.
Definition DataQueue.cc:39
static const char WILDCARD
Definition JDAQTags.hh:56
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition Evt.hh:21
Auxiliary data structure for sequence of same character.
Definition JManip.hh:330
Auxiliary data structure for floating point format specification.
Definition JManip.hh:448
Detector file.
Definition JHead.hh:227
Dynamic detector calibration.
Definition JDynamics.hh:81
bool is_valid() const
Check validity of function.
void reload()
Reload function from shared library.
Auxiliary class to test history.
Definition JHistory.hh:188
Auxiliary class to match data points with given model.
Auxiliary data structure for muon PDF.
Definition JPDF_t.hh:135
JFunction1D_t::result_type result_type
Definition JPDF_t.hh:145
result_type calculate(const double E, const double R, const double theta, const double phi, const double t1) const
Get PDF.
Definition JPDF_t.hh:235
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition JParser.hh:67
double TMin_ns
minimal time w.r.t. Cherenkov hypothesis [ns]
double TMax_ns
maximal time w.r.t. Cherenkov hypothesis [ns]
double VMax_npe
maximum number of of photo-electrons
Auxiliary class for defining the range of iterations of objects.
Definition JLimit.hh:45
const JLimit & getLimit() const
Get limit.
Definition JLimit.hh:84
static counter_type max()
Get maximum counter value.
Definition JLimit.hh:128
Auxiliary data structure for floating point format specification.
Definition JManip.hh:488
The Vec class is a straightforward 3-d vector, which also works in pyroot.
Definition Vec.hh:13
Auxiliary include file for time conversion between DAQ/trigger hit and Monte Carlo hit.