Jpp  18.3.0-209-g56ce19a
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 #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/JPrint.hh"
53 #include "Jeep/JParser.hh"
54 #include "Jeep/JMessage.hh"
55 
56 
57 namespace JAANET {
58 
60 
61  /**
62  * Event selector.
63  *
64  * The default constructor will accept all events.\n
65  * A different method can dynamically be loaded from a shared library using class JEEP::JFunctionAdaptor.
66  */
67  struct JEventSelector :
68  public JFunctionAdaptor<bool, const Trk&, const Evt&>
69  {
70  /**
71  * Default event selection.
72  *
73  * \param trk track
74  * \param evt event
75  * \return true
76  */
77  static inline bool select(const Trk& trk, const Evt& evt)
78  {
79  return true;
80  }
81 
82 
83  /**
84  * Default constructor.
85  */
87  {
88  this->function = select;
89  this->symbol = "select";
90  }
91  };
92 
93 
94  /**
95  * Check availability of value.
96  *
97  * \param trk track
98  * \param i index
99  * \return true if available; else false
100  */
101  inline bool hasW(const Trk& trk, const int i)
102  {
103  return (i >= 0 && i < (int) trk.fitinf.size());
104  }
105 
106 
107  /**
108  * Get associated value.
109  *
110  * \param trk track
111  * \param i index
112  * \return value
113  */
114  inline double getW(const Trk& trk, const int i)
115  {
116  return trk.fitinf.at(i);
117  }
118 
119 
120  /**
121  * Get associated value.
122  *
123  * \param trk track
124  * \param i index
125  * \param value default value
126  * \return value
127  */
128  inline double getW(const Trk& trk, const int i, const double value)
129  {
130  if (hasW(trk,i))
131  return trk.fitinf.at(i);
132  else
133  return value;
134  }
135 
136 
137  /**
138  * Set associated value.
139  *
140  * \param trk track
141  * \param i index
142  * \param value value
143  */
144  void setW(Trk& trk, const int i, const double value)
145  {
146  if (i >= (int) trk.fitinf.size()) {
147  trk.fitinf.resize(i + 1, 0.0);
148  }
149 
150  trk.fitinf[i] = value;
151  }
152 }
153 
154 namespace {
155 
156  /**
157  * Wild card character for file name substition.
158  */
159  const char WILDCARD = '%';
160 
161 
162  /**
163  * Execute command in shell.
164  *
165  * \param command command
166  */
167  inline void execute(const std::string& command, int debug)
168  {
169  using namespace std;
170  using namespace JPP;
171 
172  JProcess process(command);
173 
174  istream in(process.getInputStreamBuffer());
175 
176  for (string buffer; getline(in, buffer); ) {
177  DEBUG(buffer << endl);
178  }
179  }
180 }
181 
182 
183 /**
184  * \file
185  *
186  * Program to display hit probabilities.
187  *
188  * \author mdejong
189  */
190 int main(int argc, char **argv)
191 {
192  using namespace std;
193  using namespace JPP;
194  using namespace KM3NETDAQ;
195 
196  JSingleFileScanner<Evt> inputFile;
197  JLimit_t& numberOfEvents = inputFile.getLimit();
198  string pdfFile;
199  string outputFile;
201  int application;
202  JEventSelector event_selector;
203  JCanvas canvas;
204  bool batch;
205  double arrowSize;
206  string arrowType;
207  double arrowScale;
208  int debug;
209 
210 
211  try {
212 
213  parameters.numberOfPrefits = 1;
214 
215  JParser<> zap("Program to display hit probabilities.");
216 
217  zap['w'] = make_field(canvas, "size of canvas <nx>x<ny> [pixels]") = JCanvas(1200, 600);
218  zap['f'] = make_field(inputFile, "input file (output of JXXXMuonReconstruction.sh)");
219  zap['n'] = make_field(numberOfEvents) = JLimit::max();
220  zap['P'] = make_field(pdfFile);
221  zap['o'] = make_field(outputFile, "graphics output file name") = MAKE_STRING("display_" << WILDCARD << ".gif");
224  zap['L'] = make_field(event_selector) = JPARSER::initialised();
225  zap['S'] = make_field(arrowSize) = 0.003;
226  zap['T'] = make_field(arrowType) = "|->";
227  zap['F'] = make_field(arrowScale) = 250.0;
228  zap['B'] = make_field(batch, "batch processing");
229  zap['d'] = make_field(debug) = 1;
230 
231  zap(argc, argv);
232  }
233  catch(const exception& error) {
234  FATAL(error.what() << endl);
235  }
236 
237  if (batch && outputFile == "") {
238  FATAL("Missing output file name " << outputFile << " in batch mode." << endl);
239  }
240 
241  if (!batch && outputFile == "") {
242  outputFile = MAKE_STRING(WILDCARD << ".gif");
243  }
244 
245  if (outputFile.find(WILDCARD) == string::npos) {
246  FATAL("Output file name " << outputFile << " has no wild card '" << WILDCARD << "'" << endl);
247  }
248 
249  JHit::setSlewing(false);
250 
251  JSummaryFileRouter summary(inputFile, parameters.R_Hz);
252 
253  const JMuonPDF_t pdf(pdfFile, parameters.TTS_ns);
254 
255  const JTimeRange T_ns(parameters.TMin_ns, parameters.TMax_ns);
256 
257  typedef vector<JHitL0> JDataL0_t;
258  typedef vector<JHitW0> JDataW0_t;
259 
260 
261  // ROOT
262 
263  gROOT->SetBatch(batch);
264 
265  TApplication* tp = new TApplication("user", NULL, NULL);
266  TCanvas* cv = new TCanvas("display", "", canvas.x, canvas.y);
267 
268  unique_ptr<TStyle> gStyle(new JStyle("gplot", cv->GetWw(), cv->GetWh()));
269 
270  gROOT->SetStyle("gplot");
271  gROOT->ForceStyle();
272 
273  const size_t NUMBER_OF_PADS = 3;
274 
275  cv->SetFillStyle(4000);
276  cv->SetFillColor(kWhite);
277 
278  TPad* p1 = new TPad("p1", NULL, 0.0, 0.00, 1.0, 0.95);
279  TPad* p2 = new TPad("p2", NULL, 0.0, 0.95, 1.0, 1.00);
280 
281  p1->Divide(NUMBER_OF_PADS, 1);
282 
283  p1->Draw();
284  p2->Draw();
285 
286  const double Dmax = 1000.0;
287  const double Rmin = 0.0;
288  const double Rmax = min(parameters.roadWidth_m, 0.4 * Dmax);
289  const double Tmin = min(parameters.TMin_ns, -10.0);
290  const double Tmax = max(parameters.TMax_ns, +100.0);
291  const double Amin = 0.002 * (Tmax - Tmin); // minimal arrow length [ns]
292  const double Amax = 0.8 * (Tmax - Tmin); // maximal arrow length [ns]
293  const double ymin = min(-Amax, Tmin - 0.3 * Amax);
294  const double ymax = max(+Amax, Tmax + 0.5 * Amax);
295 
296  const string Xlabel[NUMBER_OF_PADS] = { "R [m]", "#phi [rad]", "z [m]" };
297  const double Xmin [NUMBER_OF_PADS] = { Rmin, -PI, -0.5 * Dmax };
298  const double Xmax [NUMBER_OF_PADS] = { Rmax, +PI, +0.5 * Dmax };
299 
300  double Xs[NUMBER_OF_PADS];
301 
302  for (size_t i = 0; i != NUMBER_OF_PADS; ++i) {
303  Xs[i] = 0.003 * (Xmax[i] - Xmin[i]) * (0.5 * NUMBER_OF_PMTS); // x-offset arrow as function of PMT number
304  }
305 
306  TH2D H2[NUMBER_OF_PADS];
307  TGraph G2[NUMBER_OF_PADS];
308 
309  for (size_t i = 0; i != NUMBER_OF_PADS; ++i) {
310 
311  H2[i] = TH2D(MAKE_CSTRING("h" << i), NULL, 100, Xmin[i] - Xs[i], Xmax[i] + Xs[i], 100, ymin, ymax);
312 
313  H2[i].GetXaxis()->SetTitle(Xlabel[i].c_str());
314  H2[i].GetYaxis()->SetTitle("#Deltat [ns]");
315 
316  H2[i].GetXaxis()->CenterTitle(true);
317  H2[i].GetYaxis()->CenterTitle(true);
318 
319  H2[i].SetStats(kFALSE);
320 
321  G2[i].Set(2);
322 
323  G2[i].SetPoint(0, H2[i].GetXaxis()->GetXmin(), 0.0);
324  G2[i].SetPoint(1, H2[i].GetXaxis()->GetXmax(), 0.0);
325 
326  p1->cd(i+1);
327 
328  H2[i].Draw("AXIS");
329  G2[i].Draw("SAME");
330  }
331 
332 
333  while (inputFile.hasNext()) {
334 
335  cout << "event: " << setw(8) << inputFile.getCounter() << endl;
336 
337  Evt* evt = inputFile.next();
338 
339  if (has_reconstructed_track<JPP_RECONSTRUCTION_TYPE>(*evt, rec_stages_range(application))) {
340 
341  Trk fit = get_best_reconstructed_track<JPP_RECONSTRUCTION_TYPE>(*evt, rec_stages_range(application));
342 
343  if (!event_selector(fit, *evt)) {
344  continue;
345  }
346 
347 
348  JDataL0_t dataL0;
349 
350  for (const Hit& hit : evt->hits) {
351  dataL0.push_back(JHitL0(JDAQPMTIdentifier(hit.dom_id, hit.channel_id),
352  JAxis3D(getPosition(hit.pos), getDirection(hit.dir)),
353  JHit(hit.t, hit.tot)));
354  }
355 
356  summary.update(JDAQChronometer(evt->det_id,
357  evt->run_id,
358  evt->frame_index,
359  JDAQUTCExtended(evt->t.GetSec(), evt->t.GetNanoSec() / 16)));
360 
361  const time_converter converter = time_converter(*evt);
362 
363  Trk muon; // Monte Carlo true muon
364 
365  if (has_muon(*evt)) {
366 
367  for (const auto& trk : evt->mc_trks) {
368  if (is_muon(trk)) {
369  if (trk.E > muon.E) {
370 
371  muon = trk;
372  muon.t += converter.putTime();
373 
374  setW(muon, JSTART_LENGTH_METRES, fabs(muon.len));
375  }
376  }
377  }
378  }
379 
380 
381  bool monte_carlo = false; // show Monte Carlo true muon
382 
383  for (bool next = false; !next; ) {
384 
385  Trk trk;
386 
387  if (!monte_carlo)
388  trk = fit;
389  else
390  trk = muon;
391 
392  JRotation3D R (getDirection(trk));
393  JLine1Z tz(getPosition (trk).rotate(R), trk.t);
394  JRange<double> Z_m;
395  /*
396  if (hasW(trk, JSTART_LENGTH_METRES)) {
397  Z_m = JRange<double>(0.0, getW(fit,JSTART_LENGTH_METRES)) + JRange<double>(parameters.ZMin_m, parameters.ZMax_m);
398  }
399  */
400  const JModel<JLine1Z> match(tz, parameters.roadWidth_m, T_ns, Z_m);
401 
402  // hit selection based on fit result
403 
404  JDataW0_t data;
405 
406  for (JDataL0_t::const_iterator i = dataL0.begin(); i != dataL0.end(); ++i) {
407 
408  JHitW0 hit(*i, summary.getRate(i->getPMTIdentifier()));
409 
410  hit.rotate(R);
411 
412  if (match(hit)) {
413  data.push_back(hit);
414  }
415  }
416 
417  // select first hit in PMT
418 
419  sort(data.begin(), data.end(), JHitW0::compare);
420 
421  JDataW0_t::iterator __end = unique(data.begin(), data.end(), equal_to<JDAQPMTIdentifier>());
422 
423  double E_GeV = parameters.E_GeV;
424  /*
425  if (trk.E > 0.1) {
426  E_GeV = trk.E;
427  }
428  */
429 
430  // move fit to geometrical center of hits
431 
432  JRange<double> zs(make_array(data.begin(), __end, &JHitW0::getZ));
433 
434  const double z0 = tz.getZ();
435  const double z1 = 0.5 * (zs.getLowerLimit() + zs.getUpperLimit());
436 
437  tz.setZ(z1, getSpeedOfLight());
438 
439 
440  // graphics
441 
442  ostringstream os;
443  vector<TArrow> arrow [NUMBER_OF_PADS];
444  vector<TMarker> marker[NUMBER_OF_PADS];
445 
446  if (hasW(trk, JSTART_LENGTH_METRES) && getW(trk, JSTART_LENGTH_METRES) > 0.0) {
447 
448  marker[2].push_back(TMarker(z0 - tz.getZ(), 0.0, kFullCircle));
449  marker[2].push_back(TMarker(z0 - tz.getZ() + getW(trk, JSTART_LENGTH_METRES), 0.0, kFullCircle));
450 
451  static_cast<TAttMarker&>(marker[2][0]) = TAttMarker(kRed, kFullCircle, 0.7);
452  static_cast<TAttMarker&>(marker[2][1]) = TAttMarker(kRed, kFullCircle, 0.7);
453  }
454 
455  DEBUG("trk: "
456  << FIXED(7,2) << tz.getX() << ' '
457  << FIXED(7,2) << tz.getY() << ' '
458  << FIXED(7,2) << tz.getZ() << ' '
459  << FIXED(12,2) << tz.getT() << endl);
460 
461  double chi2 = 0;
462 
463  for (JDataW0_t::const_iterator hit = data.begin(); hit != __end; ++hit) {
464 
465  const double x = hit->getX() - tz.getX();
466  const double y = hit->getY() - tz.getY();
467  const double z = hit->getZ() - tz.getZ();
468  const double R = sqrt(x*x + y*y);
469 
470  const double t1 = tz.getT() + (z + R * getTanThetaC()) * getInverseSpeedOfLight();
471 
472  JDirection3D dir(hit->getDX(), hit->getDY(), hit->getDZ()); // PMT orientation
473 
474  dir.rotate(JRotation3Z(-atan2(y,x))); // rotate PMT axis to x-z plane
475 
476  const double theta = dir.getTheta();
477  const double phi = fabs(dir.getPhi()); // rotational symmetry of Cherenkov cone
478 
479  //const double E = gWater.getE(E_GeV, z); // correct for energy loss
480  const double E = E_GeV;
481  const double dt = T_ns.constrain(hit->getT() - t1);
482 
483  JMuonPDF_t::result_type H1 = pdf.calculate(E, R, theta, phi, dt);
484  JMuonPDF_t::result_type H0(hit->getR() * 1e-9, 0.0, T_ns);
485 
486  if (H1.V >= parameters.VMax_npe) {
487  H1 *= parameters.VMax_npe / H1.V;
488  }
489 
490  H1 += H0; // signal + background
491 
492  chi2 += H1.getChi2() - H0.getChi2();
493 
494  DEBUG("hit: "
495  << setw(8) << hit->getModuleID() << '.' << FILL(2,'0') << (int) hit->getPMTAddress() << FILL() << ' '
496  << SCIENTIFIC(8,2) << E << ' '
497  << FIXED(7,2) << R << ' '
498  << FIXED(7,4) << theta << ' '
499  << FIXED(7,4) << phi << ' '
500  << FIXED(7,3) << dt << ' '
501  << FIXED(7,3) << H1.getChi2() << ' '
502  << FIXED(7,3) << H0.getChi2() << endl);
503 
504  const double derivative = H1.getDerivativeOfChi2() - H0.getDerivativeOfChi2();
505 
506  double size = derivative * arrowScale; // size of arrow
507 
508  if (fabs(size) < Amin) {
509  size = (size > 0.0 ? +Amin : -Amin);
510  } else if (fabs(size) > Amax) {
511  size = (size > 0.0 ? +Amax : -Amax);
512  }
513 
514  const double X[NUMBER_OF_PADS] = { R, atan2(y,x), z - R/getTanThetaC() };
515 
516  const double xs = (double) (NUMBER_OF_PMTS - 2 * hit->getPMTAddress()) / (double) NUMBER_OF_PMTS;
517 
518  for (size_t i = 0; i != NUMBER_OF_PADS; ++i) {
519  arrow[i].push_back(TArrow(X[i] + xs*Xs[i], dt, X[i] + xs*Xs[i], dt + size, arrowSize, arrowType.c_str()));
520  }
521  }
522 
523  os << FILL(6,'0') << evt->run_id << ":" << evt->frame_index << "/" << evt->trigger_counter << FILL();
524  os << " Q = " << FIXED(4,0) << -chi2;
525  os << " E = " << SCIENTIFIC(7,1) << trk.E << " [GeV]";
526  os << " cos(#theta) = " << FIXED(6,3) << trk.dir.z;
527 
528  if (monte_carlo)
529  os << " Monte Carlo";
530  else if (is_muon(muon))
531  os << " #Delta#alpha = " << FIXED(6,2) << getAngle(getDirection(muon), getDirection(trk)) << " [deg]";
532 
533 
534  // draw
535 
536  TLatex title(0.05, 0.5, os.str().c_str());
537 
538  title.SetTextAlign(12);
539  title.SetTextFont(42);
540  title.SetTextSize(0.6);
541 
542  p2->cd();
543 
544  title.Draw();
545 
546  for (int i = 0; i != NUMBER_OF_PADS; ++i) {
547 
548  p1->cd(i+1);
549 
550  for (auto& a1 : arrow[i]) {
551  a1.Draw();
552  }
553 
554  for (auto& m1 : marker[i]) {
555  m1.Draw();
556  }
557  }
558 
559  cv->Update();
560 
561 
562  // action
563 
564  if (batch) {
565 
566  cv->SaveAs(replace(outputFile, WILDCARD, MAKE_STRING(inputFile.getCounter())).c_str());
567 
568  next = true;
569 
570  } else {
571 
572  static int count = 0;
573 
574  if (count++ == 0) {
575  cout << endl << "Type '?' for possible options." << endl;
576  }
577 
578  for (bool user = true; user; ) {
579 
580  cout << "\n> " << flush;
581 
582  switch (JKeypress(true).get()) {
583 
584  case '?':
585  cout << endl;
586  cout << "possible options: " << endl;
587  cout << 'q' << " -> " << "exit application" << endl;
588  cout << 'u' << " -> " << "update canvas" << endl;
589  cout << 's' << " -> " << "save graphics to file" << endl;
590  cout << 'M' << " -> " << "Monte Carlo true muon information" << endl;
591  cout << 'F' << " -> " << "fit information" << endl;
592  if (event_selector.is_valid()) {
593  cout << 'L' << " -> " << "reload event selector" << endl;
594  }
595  cout << 'r' << " -> " << "rewind input file" << endl;
596  cout << 'R' << " -> " << "switch to ROOT mode (quit ROOT to continue)" << endl;
597  cout << 'p' << " -> " << "print event information" << endl;
598  cout << ' ' << " -> " << "next event (as well as any other key)" << endl;
599  break;
600 
601  case 'q':
602  cout << endl;
603  return 0;
604 
605  case 'u':
606  cv->Update();
607  break;
608 
609  case 's':
610  cv->SaveAs(replace(outputFile, WILDCARD, MAKE_STRING(inputFile.getCounter())).c_str());
611  break;
612 
613  case 'M':
614  if (is_muon(muon))
615  monte_carlo = true;
616  else
617  ERROR(endl << "No Monte Carlo muon available." << endl);
618  user = false;
619  break;
620 
621  case 'F':
622  monte_carlo = false;
623  user = false;
624  break;
625 
626  case 'L':
627  if (event_selector.is_valid()) {
628  execute(MAKE_STRING("make -f " << getPath(argv[0]) << "/JMakeEventSelector libs"), 3);
629  event_selector.reload();
630  }
631  break;
632 
633  case 'R':
634  tp->Run(kTRUE);
635  break;
636 
637  case 'p':
638  cout << endl;
639  evt->print(cout);
640  if (debug >= debug_t) {
641  for (const auto& trk : evt->mc_trks) {
642  cout << "MC "; trk.print(cout); cout << endl;
643  }
644  for (const auto& trk : evt->trks) {
645  cout << "fit "; trk.print(cout); cout << endl;
646  }
647  for (const auto& hit : evt->hits) {
648  cout << "hit "; hit.print(cout); cout << endl;
649  }
650  }
651  break;
652 
653  case 'r':
654  inputFile.rewind();
655 
656  default:
657  next = true;
658  user = false;
659  break;
660  }
661  }
662  }
663  }
664  }
665  }
666  cout << endl;
667 }
static const int JMUONSTART
Utility class to parse command line options.
Definition: JParser.hh:1711
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.
TPaveText * p1
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 $script< input file >[option[primary[working directory]]] nWhere option can be E
Definition: JMuonPostfit.sh:40
double t
track time [ns] (when the particle is at pos )
Definition: Trk.hh:19
double z
Definition: Vec.hh:14
JEventSelector()
Default constructor.
Definition: JAAnet/JEvD.cc:86
then wget no check certificate user
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.
void setW(Trk &trk, const int i, const double value)
Set associated value.
Definition: JAAnet/JEvD.cc:144
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:84
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.
Acoustics hit.
#define MAKE_STRING(A)
Make string.
Definition: JPrint.hh:127
Event selector.
Definition: JAAnet/JEvD.cc:67
void print(std::ostream &out=std::cout) const
Print hit.
Definition: Hit.hh:60
static const char WILDCARD
Definition: JDAQTags.hh:50
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
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
char get()
Get single character.
Definition: JKeypress.hh:74
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:2158
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
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
then awk string
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
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
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
p2
Definition: module-Z:fit.sh:74
then JCookie sh JDataQuality D $DETECTOR_ID R
Definition: JDataQuality.sh:41
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
then fatal The output file must have the wildcard in the e g root fi 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:48
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
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:84
void print(std::ostream &out=std::cout) const
Print track.
Definition: Trk.hh:182
KM3NeT DAQ constants, bit handling, etc.
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
Definition: JDAQ.hh:26
Function adaptor.
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:486
Wrapper class around ROOT TStyle.
Definition: JStyle.hh:20
static bool select(const Trk &trk, const Evt &evt)
Default event selection.
Definition: JAAnet/JEvD.cc:77
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
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
bool hasW(const Trk &trk, const int i)
Check availability of value.
Definition: JAAnet/JEvD.cc:101