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