Jpp  master_rocky-40-g5f0272dcd
the software that should make you happy
JAAnet/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 "TStyle.h"
12 #include "TH2D.h"
13 #include "TArrow.h"
14 #include "TLatex.h"
15 #include "TMarker.h"
16 
22 
23 #include "JROOT/JStyle.hh"
24 #include "JROOT/JCanvas.hh"
25 #include "JROOT/JRootToolkit.hh"
26 
28 
29 #include "JTrigger/JHitL0.hh"
30 
31 #include "JSupport/JSupport.hh"
35 #include "JAAnet/JAAnetToolkit.hh"
36 
37 #include "JPhysics/JPDF_t.hh"
38 
39 #include "JFit/JLine1Z.hh"
40 #include "JFit/JModel.hh"
43 
44 #include "JLang/JPredicate.hh"
45 #include "JLang/JComparator.hh"
46 
47 #include "JMath/JMathToolkit.hh"
48 #include "JSystem/JKeypress.hh"
49 #include "JSystem/JProcess.hh"
50 
51 #include "Jeep/JFunctionAdaptor.hh"
52 #include "Jeep/JProperties.hh"
53 #include "Jeep/JPrint.hh"
54 #include "Jeep/JParser.hh"
55 #include "Jeep/JMessage.hh"
56 
57 
58 namespace JAANET {
59 
61 
62  /**
63  * Event selector.
64  *
65  * The default constructor will accept all events.\n
66  * A different method can dynamically be loaded from a shared library using class JEEP::JFunctionAdaptor.
67  */
68  struct JEventSelector :
69  public JFunctionAdaptor<bool, const Trk&, const Evt&>
70  {
71  /**
72  * Default event selection.
73  *
74  * \param trk track
75  * \param evt event
76  * \return true
77  */
78  static inline bool select(const Trk& trk, const Evt& evt)
79  {
80  return true;
81  }
82 
83 
84  /**
85  * Default constructor.
86  */
88  {
89  this->function = select;
90  this->symbol = "select";
91  }
92  };
93 
94 
95  /**
96  * Check availability of value.
97  *
98  * \param trk track
99  * \param i index
100  * \return true if available; else false
101  */
102  inline bool hasW(const Trk& trk, const int i)
103  {
104  return (i >= 0 && i < (int) trk.fitinf.size());
105  }
106 
107 
108  /**
109  * Get associated value.
110  *
111  * \param trk track
112  * \param i index
113  * \return value
114  */
115  inline double getW(const Trk& trk, const int i)
116  {
117  return trk.fitinf.at(i);
118  }
119 
120 
121  /**
122  * Get associated value.
123  *
124  * \param trk track
125  * \param i index
126  * \param value default value
127  * \return value
128  */
129  inline double getW(const Trk& trk, const int i, const double value)
130  {
131  if (hasW(trk,i))
132  return trk.fitinf.at(i);
133  else
134  return value;
135  }
136 
137 
138  /**
139  * Set associated value.
140  *
141  * \param trk track
142  * \param i index
143  * \param value value
144  */
145  void setW(Trk& trk, const int i, const double value)
146  {
147  if (i >= (int) trk.fitinf.size()) {
148  trk.fitinf.resize(i + 1, 0.0);
149  }
150 
151  trk.fitinf[i] = value;
152  }
153 }
154 
155 namespace {
156 
157  /**
158  * Wild card character for file name substition.
159  */
160  const char WILDCARD = '%';
161 
162 
163  /**
164  * Execute command in shell.
165  *
166  * \param command command
167  */
168  inline void execute(const std::string& command, int debug)
169  {
170  using namespace std;
171  using namespace JPP;
172 
173  JProcess process(command);
174 
175  istream in(process.getInputStreamBuffer());
176 
177  for (string buffer; getline(in, buffer); ) {
178  DEBUG(buffer << endl);
179  }
180  }
181 
182  const char* const histogram_t = "histogram"; //!< draw histogram
183  const char* const arrow_t = "arrow"; //!< draw arrow
184 }
185 
186 
187 /**
188  * \file
189  *
190  * Program to display hit probabilities.
191  *
192  * \author mdejong
193  */
194 int main(int argc, char **argv)
195 {
196  using namespace std;
197  using namespace JPP;
198  using namespace KM3NETDAQ;
199 
200  JSingleFileScanner<Evt> inputFile;
201  JLimit_t& numberOfEvents = inputFile.getLimit();
202  string pdfFile;
203  string outputFile;
204  JMuonGandalfParameters_t parameters;
205  int application;
206  JEventSelector event_selector;
207  JCanvas canvas;
208  bool batch;
209  struct : JStyle::JParameters {
210  double arrowSize = 0.003;
211  string arrowType = "|->";
212  double arrowScale = 250.0;
213  Width_t lineWidth = 2;
214  Style_t lineStyle = 1;
215  int nbinsX = 50;
216  int nbinsY = 250;
217  double T_ns = 0.0;
218  } graphics;
219  string option;
220  int debug;
221 
222 
223  try {
224 
225  JProperties properties = graphics.getProperties();
226 
227  properties.insert(gmake_property(graphics.arrowSize));
228  properties.insert(gmake_property(graphics.arrowType));
229  properties.insert(gmake_property(graphics.arrowScale));
230  properties.insert(gmake_property(graphics.lineWidth));
231  properties.insert(gmake_property(graphics.lineStyle));
232  properties.insert(gmake_property(graphics.T_ns));
233 
234  parameters.numberOfPrefits = 1;
235 
236  JParser<> zap("Program to display hit probabilities.");
237 
238  zap['w'] = make_field(canvas, "size of canvas <nx>x<ny> [pixels]") = JCanvas(1200, 600);
239  zap['f'] = make_field(inputFile, "input file (output of JXXXMuonReconstruction.sh)");
240  zap['n'] = make_field(numberOfEvents) = JLimit::max();
241  zap['P'] = make_field(pdfFile);
242  zap['o'] = make_field(outputFile, "graphics output file name") = MAKE_STRING("display_" << WILDCARD << ".gif");
243  zap['@'] = make_field(parameters) = JPARSER::initialised();
245  zap['L'] = make_field(event_selector) = JPARSER::initialised();
246  zap['%'] = make_field(properties) = JPARSER::initialised();
247  zap['O'] = make_field(option, "draw option") = arrow_t, histogram_t;
248  zap['B'] = make_field(batch, "batch processing");
249  zap['d'] = make_field(debug) = 1;
250 
251  zap(argc, argv);
252  }
253  catch(const exception& error) {
254  FATAL(error.what() << endl);
255  }
256 
257  if (batch && outputFile == "") {
258  FATAL("Missing output file name " << outputFile << " in batch mode." << endl);
259  }
260 
261  if (!batch && outputFile == "") {
262  outputFile = MAKE_STRING(WILDCARD << ".gif");
263  }
264 
265  if (outputFile.find(WILDCARD) == string::npos) {
266  FATAL("Output file name " << outputFile << " has no wild card '" << WILDCARD << "'" << endl);
267  }
268 
269  JHit::setSlewing(false);
270 
271  JSummaryFileRouter summary(inputFile, parameters.R_Hz);
272 
273  const JMuonPDF_t pdf(pdfFile, parameters.TTS_ns);
274 
275  const JTimeRange T_ns(parameters.TMin_ns, parameters.TMax_ns);
276 
277  typedef vector<JHitL0> JDataL0_t;
278  typedef vector<JHitW0> JDataW0_t;
279 
280 
281  // ROOT
282 
283  gROOT->SetBatch(batch);
284 
285  TApplication* tp = new TApplication("user", NULL, NULL);
286  TCanvas* cv = new TCanvas("display", "", canvas.x, canvas.y);
287 
288  unique_ptr<TStyle> gStyle(new JStyle("gplot", cv->GetWw(), cv->GetWh(), graphics));
289 
290  gROOT->SetStyle("gplot");
291  gROOT->ForceStyle();
292 
293  const size_t NUMBER_OF_PADS = 3;
294 
295  cv->SetFillStyle(4000);
296  cv->SetFillColor(kWhite);
297 
298  TPad* p1 = new TPad("p1", NULL, 0.0, 0.00, 1.0, 0.95);
299  TPad* p2 = new TPad("p2", NULL, 0.0, 0.95, 1.0, 1.00);
300 
301  p1->Divide(NUMBER_OF_PADS, 1);
302 
303  p1->Draw();
304  p2->Draw();
305 
306  const double Dmax = 1000.0;
307  const double Rmin = 0.0;
308  const double Rmax = min(parameters.roadWidth_m, 0.4 * Dmax);
309  const double Tmin = min(parameters.TMin_ns, -10.0);
310  const double Tmax = max(parameters.TMax_ns, +100.0);
311  const double Amin = 0.002 * (Tmax - Tmin); // minimal arrow length [ns]
312  const double Amax = 0.8 * (Tmax - Tmin); // maximal arrow length [ns]
313  const double ymin = Tmin - (option == arrow_t ? 0.2 * Amax : 0.0);
314  const double ymax = Tmax + (option == arrow_t ? 0.5 * Amax : 0.0);
315 
316  const string Xlabel[NUMBER_OF_PADS] = { "R [m]", "#phi [rad]", "z [m]" };
317  const double Xmin [NUMBER_OF_PADS] = { Rmin, -PI, -0.3 * Dmax };
318  const double Xmax [NUMBER_OF_PADS] = { Rmax, +PI, +0.3 * Dmax };
319 
320  double Xs[NUMBER_OF_PADS];
321 
322  for (size_t i = 0; i != NUMBER_OF_PADS; ++i) {
323  Xs[i] = 0.003 * (Xmax[i] - Xmin[i]) * (0.5 * NUMBER_OF_PMTS); // x-offset arrow as function of PMT number
324  }
325 
326  TH2D H2[NUMBER_OF_PADS];
327  TGraph G2[NUMBER_OF_PADS];
328 
329  for (size_t i = 0; i != NUMBER_OF_PADS; ++i) {
330 
331  H2[i] = TH2D(MAKE_CSTRING("h" << i), NULL, graphics.nbinsX, Xmin[i] - Xs[i], Xmax[i] + Xs[i], graphics.nbinsY, ymin, ymax);
332 
333  H2[i].GetXaxis()->SetTitle(Xlabel[i].c_str());
334  H2[i].GetYaxis()->SetTitle("#Deltat [ns]");
335 
336  H2[i].GetXaxis()->CenterTitle(true);
337  H2[i].GetYaxis()->CenterTitle(true);
338 
339  H2[i].SetStats(kFALSE);
340 
341  G2[i].Set(2);
342 
343  G2[i].SetPoint(0, H2[i].GetXaxis()->GetXmin(), 0.0);
344  G2[i].SetPoint(1, H2[i].GetXaxis()->GetXmax(), 0.0);
345 
346  p1->cd(i+1);
347 
348  H2[i].Draw("AXIS");
349  G2[i].Draw("SAME");
350  }
351 
352 
353  while (inputFile.hasNext()) {
354 
355  cout << "event: " << setw(8) << inputFile.getCounter() << endl;
356 
357  const Evt* evt = inputFile.next();
358 
359  if (has_reconstructed_track<JPP_RECONSTRUCTION_TYPE>(*evt, rec_stages_range(application))) {
360 
361  Trk fit = get_best_reconstructed_track<JPP_RECONSTRUCTION_TYPE>(*evt, rec_stages_range(application));
362 
363  if (!event_selector(fit, *evt)) {
364  continue;
365  }
366 
367  JDataL0_t dataL0;
368 
369  for (const Hit& hit : evt->hits) {
370  dataL0.push_back(JHitL0(JDAQPMTIdentifier(hit.dom_id, hit.channel_id),
371  JAxis3D(getPosition(hit.pos), getDirection(hit.dir)),
372  JHit(hit.t, hit.tot)));
373  }
374 
375  summary.update(JDAQChronometer(evt->det_id,
376  evt->run_id,
377  evt->frame_index,
378  JDAQUTCExtended(evt->t.GetSec(), evt->t.GetNanoSec() / 16)));
379 
380  const time_converter converter = time_converter(*evt);
381 
382  Trk muon; // Monte Carlo true muon
383 
384  if (has_muon(*evt)) {
385 
386  for (const auto& trk : evt->mc_trks) {
387  if (is_muon(trk)) {
388  if (trk.E > muon.E) {
389 
390  muon = trk;
391  muon.t += converter.putTime();
392 
393  setW(muon, JSTART_LENGTH_METRES, fabs(muon.len));
394  }
395  }
396  }
397  }
398 
399 
400  bool monte_carlo = false; // show Monte Carlo true muon
401 
402  for (bool next = false; !next; ) {
403 
404  for (size_t i = 0; i != NUMBER_OF_PADS; ++i) {
405  H2[i].Reset();
406  }
407 
408  Trk trk;
409 
410  if (!monte_carlo)
411  trk = fit;
412  else
413  trk = muon;
414 
415  JRotation3D R (getDirection(trk));
416  JLine1Z tz(getPosition (trk).rotate(R), trk.t);
417  JRange<double> Z_m;
418  /*
419  if (hasW(trk, JSTART_LENGTH_METRES)) {
420  Z_m = JRange<double>(0.0, getW(fit,JSTART_LENGTH_METRES)) + JRange<double>(parameters.ZMin_m, parameters.ZMax_m);
421  }
422  */
423  const JModel<JLine1Z> match(tz, parameters.roadWidth_m, T_ns, Z_m);
424 
425  // hit selection based on fit result
426 
427  JDataW0_t data;
428 
429  for (JDataL0_t::const_iterator i = dataL0.begin(); i != dataL0.end(); ++i) {
430 
431  JHitW0 hit(*i, summary.getRate(i->getPMTIdentifier()));
432 
433  hit.rotate(R);
434 
435  if (match(hit)) {
436  data.push_back(hit);
437  }
438  }
439 
440  // select first hit in PMT
441 
442  sort(data.begin(), data.end(), JHitW0::compare);
443 
444  JDataW0_t::iterator __end = unique(data.begin(), data.end(), equal_to<JDAQPMTIdentifier>());
445 
446  double E_GeV = parameters.E_GeV;
447  /*
448  if (trk.E > 0.1) {
449  E_GeV = trk.E;
450  }
451  */
452 
453  // move fit to geometrical center of hits
454 
456 
457  for (JDataW0_t::iterator hit = data.begin(); hit != __end; ++hit) {
458 
459  const double x = hit->getX() - tz.getX();
460  const double y = hit->getY() - tz.getY();
461  const double z = hit->getZ();
462  const double R = sqrt(x*x + y*y);
463 
464  zs.include(z - R/getTanThetaC());
465  }
466 
467  const double z0 = tz.getZ();
468  const double z1 = 0.5 * (zs.getLowerLimit() + zs.getUpperLimit());
469 
470  tz.setZ(z1, getSpeedOfLight());
471 
472 
473  // graphics
474 
475  ostringstream os;
476  vector<TArrow> arrow [NUMBER_OF_PADS];
477  vector<TMarker> marker[NUMBER_OF_PADS];
478 
479  if (hasW(trk, JSTART_LENGTH_METRES) && getW(trk, JSTART_LENGTH_METRES) > 0.0) {
480 
481  marker[2].push_back(TMarker(z0 - tz.getZ(), 0.0, kFullCircle));
482  marker[2].push_back(TMarker(z0 - tz.getZ() + getW(trk, JSTART_LENGTH_METRES), 0.0, kFullCircle));
483 
484  static_cast<TAttMarker&>(marker[2][0]) = TAttMarker(kRed, kFullCircle, 0.7);
485  static_cast<TAttMarker&>(marker[2][1]) = TAttMarker(kRed, kFullCircle, 0.7);
486  }
487 
488  DEBUG("trk: "
489  << FIXED(7,2) << tz.getX() << ' '
490  << FIXED(7,2) << tz.getY() << ' '
491  << FIXED(7,2) << tz.getZ() << ' '
492  << FIXED(12,2) << tz.getT() << endl);
493 
494  double chi2 = 0;
495 
496  for (JDataW0_t::const_iterator hit = data.begin(); hit != __end; ++hit) {
497 
498  const double x = hit->getX() - tz.getX();
499  const double y = hit->getY() - tz.getY();
500  const double z = hit->getZ() - tz.getZ();
501  const double R = sqrt(x*x + y*y);
502 
503  const double t1 = tz.getT() + (z + R * getTanThetaC()) * getInverseSpeedOfLight();
504 
505  JDirection3D dir(hit->getDX(), hit->getDY(), hit->getDZ()); // PMT orientation
506 
507  dir.rotate(JRotation3Z(-atan2(y,x))); // rotate PMT axis to x-z plane
508 
509  const double theta = dir.getTheta();
510  const double phi = fabs(dir.getPhi()); // rotational symmetry of Cherenkov cone
511 
512  //const double E = gWater.getE(E_GeV, z); // correct for energy loss
513  const double E = E_GeV;
514  const double dt = T_ns.constrain(hit->getT() - t1);
515 
516  JMuonPDF_t::result_type H1 = pdf.calculate(E, R, theta, phi, dt);
517  JMuonPDF_t::result_type H0(hit->getR() * 1e-9, 0.0, T_ns);
518 
519  if (H1.V >= parameters.VMax_npe) {
520  H1 *= parameters.VMax_npe / H1.V;
521  }
522 
523  H1 += H0; // signal + background
524 
525  chi2 += H1.getChi2() - H0.getChi2();
526 
527  DEBUG("hit: "
528  << setw(8) << hit->getModuleID() << '.' << FILL(2,'0') << (int) hit->getPMTAddress() << FILL() << ' '
529  << SCIENTIFIC(8,2) << E << ' '
530  << FIXED(7,2) << R << ' '
531  << FIXED(7,4) << theta << ' '
532  << FIXED(7,4) << phi << ' '
533  << FIXED(7,3) << dt << ' '
534  << FIXED(7,3) << H1.getChi2() << ' '
535  << FIXED(7,3) << H0.getChi2() << endl);
536 
537  const double derivative = H1.getDerivativeOfChi2() - H0.getDerivativeOfChi2();
538 
539  double size = derivative * graphics.arrowScale; // size of arrow
540 
541  if (fabs(size) < Amin) {
542  size = (size > 0.0 ? +Amin : -Amin);
543  } else if (fabs(size) > Amax) {
544  size = (size > 0.0 ? +Amax : -Amax);
545  }
546 
547  const double X[NUMBER_OF_PADS] = { R, atan2(y,x), z - R/getTanThetaC() };
548 
549  const double xs = (double) (NUMBER_OF_PMTS - 2 * hit->getPMTAddress()) / (double) NUMBER_OF_PMTS;
550 
551  for (size_t i = 0; i != NUMBER_OF_PADS; ++i) {
552 
553  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());
554 
555  a1.SetLineWidth(graphics.lineWidth);
556  a1.SetLineStyle(graphics.lineStyle);
557 
558  arrow[i].push_back(a1);
559 
560  H2[i].Fill(X[i], dt + graphics.T_ns);
561  }
562  }
563 
564  os << FILL(6,'0') << evt->run_id << ":" << evt->frame_index << "/" << evt->trigger_counter << FILL();
565  os << " Q = " << FIXED(4,0) << trk.lik;
566  os << " E = " << SCIENTIFIC(7,1) << trk.E << " [GeV]";
567  os << " cos(#theta) = " << FIXED(6,3) << trk.dir.z;
568 
569  if (monte_carlo)
570  os << " Monte Carlo";
571  else if (is_muon(muon))
572  os << " #Delta#alpha = " << FIXED(6,2) << getAngle(getDirection(muon), getDirection(trk)) << " [deg]";
573 
574 
575  // draw
576 
577  TLatex title(0.05, 0.5, os.str().c_str());
578 
579  title.SetTextAlign(12);
580  title.SetTextFont(42);
581  title.SetTextSize(0.6);
582 
583  p2->cd();
584 
585  title.Draw();
586 
587  for (int i = 0; i != NUMBER_OF_PADS; ++i) {
588 
589  p1->cd(i+1);
590 
591  if (option == arrow_t) {
592 
593  for (auto& a1 : arrow[i]) {
594  a1.Draw();
595  }
596 
597  for (auto& m1 : marker[i]) {
598  m1.Draw();
599  }
600  }
601 
602  if (option == histogram_t) {
603  H2[i].Draw("SAME");
604  }
605  }
606 
607  cv->Update();
608 
609 
610  // action
611 
612  if (batch) {
613 
614  cv->SaveAs(replace(outputFile, WILDCARD, MAKE_STRING(inputFile.getCounter())).c_str());
615 
616  next = true;
617 
618  } else {
619 
620  static int count = 0;
621 
622  if (count++ == 0) {
623  cout << endl << "Type '?' for possible options." << endl;
624  }
625 
626  for (bool user = true; user; ) {
627 
628  cout << "\n> " << flush;
629 
630  switch (JKeypress(true).get()) {
631 
632  case '?':
633  cout << endl;
634  cout << "possible options: " << endl;
635  cout << 'q' << " -> " << "exit application" << endl;
636  cout << 'u' << " -> " << "update canvas" << endl;
637  cout << 's' << " -> " << "save graphics to file" << endl;
638  cout << 'M' << " -> " << "Monte Carlo true muon information" << endl;
639  cout << 'F' << " -> " << "fit information" << endl;
640  if (event_selector.is_valid()) {
641  cout << 'L' << " -> " << "reload event selector" << endl;
642  }
643  cout << 'r' << " -> " << "rewind input file" << endl;
644  cout << 'R' << " -> " << "switch to ROOT mode (quit ROOT to continue)" << endl;
645  cout << 'p' << " -> " << "print event information" << endl;
646  cout << ' ' << " -> " << "next event (as well as any other key)" << endl;
647  break;
648 
649  case 'q':
650  cout << endl;
651  return 0;
652 
653  case 'u':
654  cv->Update();
655  break;
656 
657  case 's':
658  cv->SaveAs(replace(outputFile, WILDCARD, MAKE_STRING(inputFile.getCounter())).c_str());
659  break;
660 
661  case 'M':
662  if (is_muon(muon))
663  monte_carlo = true;
664  else
665  ERROR(endl << "No Monte Carlo muon available." << endl);
666  user = false;
667  break;
668 
669  case 'F':
670  monte_carlo = false;
671  user = false;
672  break;
673 
674  case 'L':
675  if (event_selector.is_valid()) {
676  execute(MAKE_STRING("make -f " << getPath(argv[0]) << "/JMakeEventSelector libs"), 3);
677  event_selector.reload();
678  }
679  break;
680 
681  case 'R':
682  tp->Run(kTRUE);
683  break;
684 
685  case 'p':
686  cout << endl;
687  evt->print(cout);
688  if (debug >= debug_t) {
689  for (const auto& trk : evt->mc_trks) {
690  cout << "MC "; trk.print(cout); cout << endl;
691  }
692  for (const auto& trk : evt->trks) {
693  cout << "fit "; trk.print(cout); cout << endl;
694  }
695  for (const auto& hit : evt->hits) {
696  cout << "hit "; hit.print(cout); cout << endl;
697  }
698  }
699  break;
700 
701  case 'r':
702  inputFile.rewind();
703 
704  default:
705  next = true;
706  user = false;
707  break;
708  }
709  }
710  }
711  }
712  }
713  }
714  cout << endl;
715 }
Definition of hit and track types and auxiliary methods for handling Monte Carlo data.
int main(int argc, char **argv)
Definition: JAAnet/JEvD.cc:194
string outputFile
KM3NeT DAQ constants, bit handling, etc.
TPaveText * p1
Basic data structure for L0 hit.
Keyboard settings for unbuffered input.
Auxiliary methods for geometrical methods.
General purpose messaging.
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
#define ERROR(A)
Definition: JMessage.hh:66
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level
Definition: JSirene.cc:69
Auxiliary data structure for muon PDF.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2142
TString replace(const TString &target, const TRegexp &regexp, const T &replacement)
Replace regular expression in input by given replacement.
Definition: JPrintResult.cc:63
I/O formatting auxiliaries.
#define MAKE_CSTRING(A)
Make C-string.
Definition: JPrint.hh:72
#define MAKE_STRING(A)
Make string.
Definition: JPrint.hh:63
Utility class to parse parameter values.
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
Scanning of objects from a single file according a format that follows from the extension of each fil...
ROOT TTree parameter settings of various packages.
Utility class to parse parameter values.
Definition: JProperties.hh:501
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
Axis object.
Definition: JAxis3D.hh:41
JAxis3D & rotate(const JRotation3D &R)
Rotate axis.
Definition: JAxis3D.hh:225
Data structure for direction in three dimensions.
Definition: JDirection3D.hh:35
JDirection3D & rotate(const JRotation3D &R)
Rotate.
Rotation matrix.
Definition: JRotation3D.hh:114
Rotation around Z-axis.
Definition: JRotation3D.hh:87
double getY() const
Get y position.
Definition: JVector3D.hh:104
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
Utility class to parse command line options.
Definition: JParser.hh:1698
Auxiliary class for a hit with background rate value.
Definition: JHitW0.hh:23
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
Object reading from a list of files.
virtual const pointer_type & next() override
Get next element.
virtual void rewind() override
Rewind.
virtual bool hasNext() override
Check availability of next element.
counter_type getCounter() const
Get counter.
File router for fast addressing of summary data.
void update(const JDAQHeader &header)
Update router.
double getRate() const
Get default rate.
Enable unbuffered terminal input.
Definition: JKeypress.hh:32
Streaming of input and output from Linux command.
Definition: JProcess.hh:30
range_type & include(argument_type x)
Include given value to range.
Definition: JRange.hh:397
T constrain(argument_type x) const
Constrain value to range.
Definition: JRange.hh:350
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
Data structure for L0 hit.
Definition: JHitL0.hh:31
Data structure for UTC time.
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 JMUONGANDALF
static const int JMUONPREFIT
static const int JMUONENERGY
static const int JMUONSIMPLEX
static const int JMUONSTART
static const int JSTART_LENGTH_METRES
distance between first and last hits in metres from JStart.cc
Extensions to Evt data format.
JDirection3D getDirection(const Vec &dir)
Get direction.
bool hasW(const Trk &trk, const int i)
Check availability of value.
Definition: JAAnet/JEvD.cc:102
double getW(const Trk &trk, const int i, const double value)
Get associated value.
Definition: JAAnet/JEvD.cc:129
bool has_muon(const Evt &evt)
Test whether given event has a muon.
void setW(Trk &trk, const int i, const double value)
Set associated value.
Definition: JAAnet/JEvD.cc:145
double getW(const Trk &track, const size_t index, const double value)
Get track information.
JPosition3D getPosition(const Vec &pos)
Get position.
bool is_muon(const Trk &track)
Test whether given track is a (anti-)muon.
@ debug_t
debug
Definition: JMessage.hh:29
std::string getPath(const std::string &file_name)
Get path, i.e. part before last JEEP::PATHNAME_SEPARATOR if any.
Definition: JeepToolkit.hh:148
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
static const double PI
Mathematical constants.
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).
KM3NeT DAQ data structures and auxiliaries.
Definition: DataQueue.cc:39
static const char WILDCARD
Definition: JDAQTags.hh:56
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
Definition: JDAQ.hh:26
Definition: JSTDTypes.hh:14
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition: Evt.hh:21
int frame_index
from the raw data
Definition: Evt.hh:29
int run_id
DAQ run identifier.
Definition: Evt.hh:26
std::vector< Hit > hits
list of hits
Definition: Evt.hh:38
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
Definition: Evt.hh:49
int det_id
detector identifier from DAQ
Definition: Evt.hh:23
ULong64_t trigger_counter
trigger counter
Definition: Evt.hh:31
void print(std::ostream &out=std::cout) const
Print event.
Definition: Evt.hh:74
std::vector< Trk > trks
list of reconstructed tracks (can be several because of prefits,showers, etc).
Definition: Evt.hh:39
TTimeStamp t
UTC time of the timeslice, or the event_time for MC. (default: 01 Jan 1970 00:00:00)
Definition: Evt.hh:33
Auxiliary data structure for sequence of same character.
Definition: JManip.hh:330
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:448
Definition: Hit.hh:10
int dom_id
module identifier from the data (unique in the detector).
Definition: Hit.hh:14
Vec pos
hit position
Definition: Hit.hh:25
void print(std::ostream &out=std::cout) const
Print hit.
Definition: Hit.hh:60
Vec dir
hit direction; i.e. direction of the PMT
Definition: Hit.hh:26
unsigned int channel_id
PMT channel id {0,1, .., 30} local to moduke.
Definition: Hit.hh:15
unsigned int tot
tot value as stored in raw data (int for pyroot)
Definition: Hit.hh:17
double t
hit time (from tdc+calibration or MC truth)
Definition: Hit.hh:23
Event selector.
Definition: JAAnet/JEvD.cc:70
JEventSelector()
Default constructor.
Definition: JAAnet/JEvD.cc:87
static bool select(const Trk &trk, const Evt &evt)
Default event selection.
Definition: JAAnet/JEvD.cc:78
Acoustics hit.
bool is_valid() const
Check validity of function.
void reload()
Reload function from shared library.
Template specialisation of class JModel to match hit with muon trajectory along z-axis.
Definition: JFit/JModel.hh:36
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:233
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:68
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
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:488
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
Definition: Trk.hh:15
void print(std::ostream &out=std::cout) const
Print track.
Definition: Trk.hh:182
std::vector< double > fitinf
place to store additional fit info, see km3net-dataformat/definitions/fitparameters....
Definition: Trk.hh:32
Vec dir
track direction
Definition: Trk.hh:18
double E
Energy [GeV] (either MC truth or reconstructed)
Definition: Trk.hh:20
double t
track time [ns] (when the particle is at pos )
Definition: Trk.hh:19
double len
length, if applicable [m]
Definition: Trk.hh:22
double lik
likelihood or lambda value (for aafit, lambda)
Definition: Trk.hh:23
double z
Definition: Vec.hh:14
Range of reconstruction stages.
Auxiliary include file for time conversion between DAQ/trigger hit and Monte Carlo hit.