Jpp  18.6.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 "TStyle.h"
12 #include "TH2D.h"
13 #include "TArrow.h"
14 #include "TLatex.h"
15 #include "TMarker.h"
16 
21 
22 #include "JROOT/JStyle.hh"
23 #include "JROOT/JCanvas.hh"
24 #include "JROOT/JRootToolkit.hh"
25 
26 #include "JDAQ/JDAQEventIO.hh"
28 
29 #include "JDetector/JDetector.hh"
32 
33 #include "JTrigger/JHitL0.hh"
34 #include "JTrigger/JBuildL0.hh"
35 
36 #include "JSupport/JSupport.hh"
40 #include "JAAnet/JAAnetToolkit.hh"
41 
42 #include "JPhysics/JPDF_t.hh"
43 
44 #include "JFit/JLine1Z.hh"
45 #include "JFit/JModel.hh"
47 #include "JReconstruction/JEvt.hh"
51 
52 #include "JLang/JPredicate.hh"
53 #include "JLang/JComparator.hh"
54 
55 #include "JMath/JMathToolkit.hh"
56 #include "JSystem/JKeypress.hh"
57 #include "JSystem/JProcess.hh"
58 
59 #include "Jeep/JFunctionAdaptor.hh"
60 #include "Jeep/JPrint.hh"
61 #include "Jeep/JParser.hh"
62 #include "Jeep/JMessage.hh"
63 
64 
65 namespace {
66 
67  /**
68  * Wild card character for file name substition.
69  */
70  const char WILDCARD = '%';
71 
72  /**
73  * Execute command in shell.
74  *
75  * \param command command
76  */
77  inline void execute(const std::string& command, int debug)
78  {
79  using namespace std;
80  using namespace JPP;
81 
82  JProcess process(command);
83 
84  istream in(process.getInputStreamBuffer());
85 
86  for (string buffer; getline(in, buffer); ) {
87  DEBUG(buffer << endl);
88  }
89  }
90 }
91 
92 
93 /**
94  * \file
95  *
96  * Program to display hit probabilities.
97  *
98  * \author mdejong
99  */
100 int main(int argc, char **argv)
101 {
102  using namespace std;
103  using namespace JPP;
104  using namespace KM3NETDAQ;
105 
106  typedef JParallelFileScanner< JTypeList<JDAQEvent, JEvt> > JParallelFileScanner_t;
107  typedef JParallelFileScanner_t::multi_pointer_type multi_pointer_type;
108 
109  JParallelFileScanner_t inputFile;
110  JLimit_t& numberOfEvents = inputFile.getLimit();
111  string detectorFile;
112  string pdfFile;
113  string outputFile;
115  int application;
116  JEventSelector event_selector;
117  JCanvas canvas;
118  bool batch;
119  double arrowSize;
120  string arrowType;
121  double arrowScale;
122  int debug;
123 
124 
125  try {
126 
127  parameters.numberOfPrefits = 1;
128 
129  JParser<> zap("Program to display hit probabilities.");
130 
131  zap['w'] = make_field(canvas, "size of canvas <nx>x<ny> [pixels]") = JCanvas(1200, 600);
132  zap['f'] = make_field(inputFile, "input file (output of JXXXMuonReconstruction.sh)");
133  zap['a'] = make_field(detectorFile);
134  zap['n'] = make_field(numberOfEvents) = JLimit::max();
135  zap['P'] = make_field(pdfFile);
136  zap['o'] = make_field(outputFile, "graphics output file name") = MAKE_STRING("display_" << WILDCARD << ".gif");
138  zap['A'] = make_field(application) = JMUONGANDALF, JMUONENERGY, JMUONSTART;
139  zap['L'] = make_field(event_selector) = JPARSER::initialised();
140  zap['S'] = make_field(arrowSize) = 0.003;
141  zap['T'] = make_field(arrowType) = "|->";
142  zap['F'] = make_field(arrowScale) = 250.0;
143  zap['B'] = make_field(batch, "batch processing");
144  zap['d'] = make_field(debug) = 1;
145 
146  zap(argc, argv);
147  }
148  catch(const exception& error) {
149  FATAL(error.what() << endl);
150  }
151 
152  if (batch && outputFile == "") {
153  FATAL("Missing output file name " << outputFile << " in batch mode." << endl);
154  }
155 
156  if (!batch && outputFile == "") {
157  outputFile = MAKE_STRING(WILDCARD << ".gif");
158  }
159 
160  if (outputFile.find(WILDCARD) == string::npos) {
161  FATAL("Output file name " << outputFile << " has no wild card '" << WILDCARD << "'" << endl);
162  }
163 
164 
166 
167  try {
168  load(detectorFile, detector);
169  }
170  catch(const JException& error) {
171  FATAL(error);
172  }
173 
174  const JModuleRouter router(detector);
175 
176  JSummaryFileRouter summary(inputFile, parameters.R_Hz);
177 
178  const JMuonPDF_t pdf(pdfFile, parameters.TTS_ns);
179 
180  const JTimeRange T_ns(parameters.TMin_ns, parameters.TMax_ns);
181 
182  typedef vector<JHitL0> JDataL0_t;
183  typedef vector<JHitW0> JDataW0_t;
184 
185  const JBuildL0<JHitL0> buildL0;
186 
187 
188  Vec offset(0.0, 0.0, 0.0);
189 
190  try {
191  offset = getOffset(getHeader(inputFile));
192  } catch(const exception& error) {}
193 
194 
195  // ROOT
196 
197  gROOT->SetBatch(batch);
198 
199  TApplication* tp = new TApplication("user", NULL, NULL);
200  TCanvas* cv = new TCanvas("display", "", canvas.x, canvas.y);
201 
202  unique_ptr<TStyle> gStyle(new JStyle("gplot", cv->GetWw(), cv->GetWh()));
203 
204  gROOT->SetStyle("gplot");
205  gROOT->ForceStyle();
206 
207  const size_t NUMBER_OF_PADS = 3;
208 
209  cv->SetFillStyle(4000);
210  cv->SetFillColor(kWhite);
211 
212  TPad* p1 = new TPad("p1", NULL, 0.0, 0.00, 1.0, 0.95);
213  TPad* p2 = new TPad("p2", NULL, 0.0, 0.95, 1.0, 1.00);
214 
215  p1->Divide(NUMBER_OF_PADS, 1);
216 
217  p1->Draw();
218  p2->Draw();
219 
220  const double Dmax = getMaximalDistance(detector);
221  const double Rmin = 0.0;
222  const double Rmax = min(parameters.roadWidth_m, 0.4 * Dmax);
223  const double Tmin = min(parameters.TMin_ns, -10.0);
224  const double Tmax = max(parameters.TMax_ns, +100.0);
225  const double Amin = 0.002 * (Tmax - Tmin); // minimal arrow length [ns]
226  const double Amax = 0.8 * (Tmax - Tmin); // maximal arrow length [ns]
227  const double ymin = min(-Amax, Tmin - 0.3 * Amax);
228  const double ymax = max(+Amax, Tmax + 0.5 * Amax);
229 
230  const string Xlabel[NUMBER_OF_PADS] = { "R [m]", "#phi [rad]", "z [m]" };
231  const double Xmin [NUMBER_OF_PADS] = { Rmin, -PI, -0.5 * Dmax };
232  const double Xmax [NUMBER_OF_PADS] = { Rmax, +PI, +0.5 * Dmax };
233 
234  double Xs[NUMBER_OF_PADS];
235 
236  for (size_t i = 0; i != NUMBER_OF_PADS; ++i) {
237  Xs[i] = 0.003 * (Xmax[i] - Xmin[i]) * (0.5 * NUMBER_OF_PMTS); // x-offset arrow as function of PMT number
238  }
239 
240  TH2D H2[NUMBER_OF_PADS];
241  TGraph G2[NUMBER_OF_PADS];
242 
243  for (size_t i = 0; i != NUMBER_OF_PADS; ++i) {
244 
245  H2[i] = TH2D(MAKE_CSTRING("h" << i), NULL, 100, Xmin[i] - Xs[i], Xmax[i] + Xs[i], 100, ymin, ymax);
246 
247  H2[i].GetXaxis()->SetTitle(Xlabel[i].c_str());
248  H2[i].GetYaxis()->SetTitle("#Deltat [ns]");
249 
250  H2[i].GetXaxis()->CenterTitle(true);
251  H2[i].GetYaxis()->CenterTitle(true);
252 
253  H2[i].SetStats(kFALSE);
254 
255  G2[i].Set(2);
256 
257  G2[i].SetPoint(0, H2[i].GetXaxis()->GetXmin(), 0.0);
258  G2[i].SetPoint(1, H2[i].GetXaxis()->GetXmax(), 0.0);
259 
260  p1->cd(i+1);
261 
262  H2[i].Draw("AXIS");
263  G2[i].Draw("SAME");
264  }
265 
266 
267  for (JTreeScanner<Evt> mc(inputFile); inputFile.hasNext(); ) {
268 
269  cout << "event: " << setw(8) << inputFile.getCounter() << endl;
270 
271  multi_pointer_type ps = inputFile.next();
272 
273  JDAQEvent* tev = ps;
274  JEvt* in = ps;
275  Evt* event = NULL;
276 
277  if (mc.getEntries() != 0) {
278  event = mc.getEntry(tev->getCounter()); // Monte Carlo true information
279  }
280 
281  in->select(JHistory::is_event(application));
282 
283  if (!in->empty()) {
284 
285  sort(in->begin(), in->end(), qualitySorter);
286 
287  if (!event_selector(*tev, *in, event)) {
288  continue;
289  }
290 
291 
292  JDataL0_t dataL0;
293 
294  buildL0(*tev, router, true, back_inserter(dataL0));
295 
296  summary.update(*tev);
297 
298  JFit muon; // Monte Carlo true muon
299 
300  if (event != NULL) {
301 
302  const time_converter converter = time_converter(*event, *tev);
303 
304  for (const auto& t1 : event->mc_trks) {
305  if (is_muon(t1)) {
306  if (t1.E > muon.getE()) {
307 
308  JTrack3E ta = getTrack(t1);
309 
310  ta.add(getPosition(offset));
311  ta.add(converter.putTime());
312 
313  muon = getFit(0, ta, 0.0, 0, t1.E, 1);
314 
315  muon.setW(JSTART_LENGTH_METRES, fabs(t1.len));
316  }
317  }
318  }
319  }
320 
321  bool monte_carlo = false; // show Monte Carlo true muon
322  size_t index = 0; // index of fit
323 
324  for (bool next = false; !next; ) {
325 
326  JFit fit;
327 
328  if (!monte_carlo)
329  fit = (*in)[index];
330  else
331  fit = muon;
332 
333  JRotation3D R (getDirection(fit));
334  JLine1Z tz(getPosition (fit).rotate(R), fit.getT());
335  JRange<double> Z_m;
336  /*
337  if (fit.hasW(JSTART_LENGTH_METRES)) {
338  Z_m = JRange<double>(0.0, fit.getW(JSTART_LENGTH_METRES)) + JRange<double>(parameters.ZMin_m, parameters.ZMax_m);
339  }
340  */
341  const JModel<JLine1Z> match(tz, parameters.roadWidth_m, T_ns, Z_m);
342 
343  // hit selection based on fit result
344 
345  JDataW0_t data;
346 
347  for (JDataL0_t::const_iterator i = dataL0.begin(); i != dataL0.end(); ++i) {
348 
349  JHitW0 hit(*i, summary.getRate(i->getPMTIdentifier()));
350 
351  hit.rotate(R);
352 
353  if (match(hit)) {
354  data.push_back(hit);
355  }
356  }
357 
358  // select first hit in PMT
359 
360  sort(data.begin(), data.end(), JHitW0::compare);
361 
362  JDataW0_t::iterator __end = unique(data.begin(), data.end(), equal_to<JDAQPMTIdentifier>());
363 
364  double E_GeV = parameters.E_GeV;
365  /*
366  if (fit.getE() > 0.1) {
367  E_GeV = fit.getE();
368  }
369  */
370 
371  // move fit to geometrical center of hits
372 
373  JRange<double> zs(make_array(data.begin(), __end, &JHitW0::getZ));
374 
375  const double z0 = tz.getZ();
376  const double z1 = 0.5 * (zs.getLowerLimit() + zs.getUpperLimit());
377 
378  tz.setZ(z1, getSpeedOfLight());
379 
380  // graphics
381 
382  ostringstream os;
383  vector<TArrow> arrow [NUMBER_OF_PADS];
384  vector<TMarker> marker[NUMBER_OF_PADS];
385 
386  if (fit.hasW(JSTART_LENGTH_METRES) && fit.getW(JSTART_LENGTH_METRES) > 0.0) {
387 
388  marker[2].push_back(TMarker(z0 - tz.getZ(), 0.0, kFullCircle));
389  marker[2].push_back(TMarker(z0 - tz.getZ() + fit.getW(JSTART_LENGTH_METRES), 0.0, kFullCircle));
390 
391  static_cast<TAttMarker&>(marker[2][0]) = TAttMarker(kRed, kFullCircle, 0.7);
392  static_cast<TAttMarker&>(marker[2][1]) = TAttMarker(kRed, kFullCircle, 0.7);
393  }
394 
395  DEBUG("trk: "
396  << FIXED(7,2) << tz.getX() << ' '
397  << FIXED(7,2) << tz.getY() << ' '
398  << FIXED(7,2) << tz.getZ() << ' '
399  << FIXED(12,2) << tz.getT() << endl);
400 
401  double chi2 = 0;
402 
403  for (JDataW0_t::const_iterator hit = data.begin(); hit != __end; ++hit) {
404 
405  const double x = hit->getX() - tz.getX();
406  const double y = hit->getY() - tz.getY();
407  const double z = hit->getZ() - tz.getZ();
408  const double R = sqrt(x*x + y*y);
409 
410  const double t1 = tz.getT() + (z + R * getTanThetaC()) * getInverseSpeedOfLight();
411 
412  JDirection3D dir(hit->getDX(), hit->getDY(), hit->getDZ()); // PMT orientation
413 
414  dir.rotate(JRotation3Z(-atan2(y,x))); // rotate PMT axis to x-z plane
415 
416  const double theta = dir.getTheta();
417  const double phi = fabs(dir.getPhi()); // rotational symmetry of Cherenkov cone
418 
419  //const double E = gWater.getE(E_GeV, z); // correct for energy loss
420  const double E = E_GeV;
421  const double dt = T_ns.constrain(hit->getT() - t1);
422 
423  JMuonPDF_t::result_type H1 = pdf.calculate(E, R, theta, phi, dt);
424  JMuonPDF_t::result_type H0(hit->getR() * 1e-9, 0.0, T_ns);
425 
426  if (H1.V >= parameters.VMax_npe) {
427  H1 *= parameters.VMax_npe / H1.V;
428  }
429 
430  H1 += H0; // signal + background
431 
432  chi2 += H1.getChi2() - H0.getChi2();
433 
434  DEBUG("hit: "
435  << setw(8) << hit->getModuleID() << '.' << FILL(2,'0') << (int) hit->getPMTAddress() << FILL() << ' '
436  << SCIENTIFIC(8,2) << E << ' '
437  << FIXED(7,2) << R << ' '
438  << FIXED(7,4) << theta << ' '
439  << FIXED(7,4) << phi << ' '
440  << FIXED(7,3) << dt << ' '
441  << FIXED(7,3) << H1.getChi2() << ' '
442  << FIXED(7,3) << H0.getChi2() << endl);
443 
444  const double derivative = H1.getDerivativeOfChi2() - H0.getDerivativeOfChi2();
445 
446  double size = derivative * arrowScale; // size of arrow
447 
448  if (fabs(size) < Amin) {
449  size = (size > 0.0 ? +Amin : -Amin);
450  } else if (fabs(size) > Amax) {
451  size = (size > 0.0 ? +Amax : -Amax);
452  }
453 
454  const double X[NUMBER_OF_PADS] = { R, atan2(y,x), z - R/getTanThetaC() };
455 
456  const double xs = (double) (NUMBER_OF_PMTS - 2 * hit->getPMTAddress()) / (double) NUMBER_OF_PMTS;
457 
458  for (size_t i = 0; i != NUMBER_OF_PADS; ++i) {
459  arrow[i].push_back(TArrow(X[i] + xs*Xs[i], dt, X[i] + xs*Xs[i], dt + size, arrowSize, arrowType.c_str()));
460  }
461  }
462 
463  os << FILL(6,'0') << tev->getRunNumber() << ":" << tev->getFrameIndex() << "/" << tev->getCounter() << FILL();
464  os << " Q = " << FIXED(4,0) << getQuality(chi2);
465  os << " E = " << SCIENTIFIC(7,1) << fit.getE() << " [GeV]";
466  os << " cos(#theta) = " << FIXED(6,3) << fit.getDZ();
467 
468  if (monte_carlo)
469  os << " Monte Carlo";
470  else if (muon.getStatus() >= 0)
471  os << " #Delta#alpha = " << FIXED(6,2) << getAngle(getDirection(muon), getDirection(fit)) << " [deg]";
472 
473 
474  // draw
475 
476  TLatex title(0.05, 0.5, os.str().c_str());
477 
478  title.SetTextAlign(12);
479  title.SetTextFont(42);
480  title.SetTextSize(0.6);
481 
482  p2->cd();
483 
484  title.Draw();
485 
486  for (int i = 0; i != NUMBER_OF_PADS; ++i) {
487 
488  p1->cd(i+1);
489 
490  for (auto& a1 : arrow[i]) {
491  a1.Draw();
492  }
493 
494  for (auto& m1 : marker[i]) {
495  m1.Draw();
496  }
497  }
498 
499  cv->Update();
500 
501 
502  // action
503 
504  if (batch) {
505 
506  cv->SaveAs(replace(outputFile, WILDCARD, MAKE_STRING(inputFile.getCounter())).c_str());
507 
508  next = true;
509 
510  } else {
511 
512  static int count = 0;
513 
514  if (count++ == 0) {
515  cout << endl << "Type '?' for possible options." << endl;
516  }
517 
518  for (bool user = true; user; ) {
519 
520  cout << "\n> " << flush;
521 
522  switch (JKeypress(true).get()) {
523 
524  case '?':
525  cout << endl;
526  cout << "possible options: " << endl;
527  cout << 'q' << " -> " << "exit application" << endl;
528  cout << 'u' << " -> " << "update canvas" << endl;
529  cout << 's' << " -> " << "save graphics to file" << endl;
530  cout << '+' << " -> " << "next fit" << endl;
531  cout << '-' << " -> " << "previous fit" << endl;
532  cout << 'M' << " -> " << "Monte Carlo true muon information" << endl;
533  cout << 'F' << " -> " << "fit information" << endl;
534  if (event_selector.is_valid()) {
535  cout << 'L' << " -> " << "reload event selector" << endl;
536  }
537  cout << 'r' << " -> " << "rewind input file" << endl;
538  cout << 'R' << " -> " << "switch to ROOT mode (quit ROOT to continue)" << endl;
539  cout << ' ' << " -> " << "next event (as well as any other key)" << endl;
540  break;
541 
542  case 'q':
543  cout << endl;
544  return 0;
545 
546  case 'u':
547  cv->Update();
548  break;
549 
550  case 's':
551  cv->SaveAs(replace(outputFile, WILDCARD, MAKE_STRING(inputFile.getCounter())).c_str());
552  break;
553 
554  case '+':
555  monte_carlo = false;
556  index = (index != in->size() - 1 ? index + 1 : 0);
557  user = false;
558  break;
559 
560  case '-':
561  monte_carlo = false;
562  index = (index != 0 ? index - 1 : in->size() - 1);
563  user = false;
564  break;
565 
566  case 'M':
567  if (muon.getStatus() >= 0)
568  monte_carlo = true;
569  else
570  ERROR(endl << "No Monte Carlo muon available." << endl);
571  user = false;
572  break;
573 
574  case 'F':
575  monte_carlo = false;
576  user = false;
577  break;
578 
579  case 'L':
580  if (event_selector.is_valid()) {
581  execute(MAKE_STRING("make -f " << getPath(argv[0]) << "/JMakeEventSelector libs"), 3);
582  event_selector.reload();
583  }
584  break;
585 
586  case 'R':
587  tp->Run(kTRUE);
588  break;
589 
590  case 'r':
591  inputFile.rewind();
592 
593  default:
594  next = true;
595  user = false;
596  break;
597  }
598  }
599  }
600  }
601  }
602  }
603  cout << endl;
604 }
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.
General exception.
Definition: JException.hh:24
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
int main(int argc, char *argv[])
Definition: Main.cc:15
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
Vec getOffset(const JHead &header)
Get offset.
double getQuality(const double chi2, const int NDF)
Get quality of fit.
JTrack3E getTrack(const Trk &track)
Get track.
Template specialisation of L0 builder for JHitL0 data type.
Definition: JBuildL0.hh:102
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.
Detector data structure.
Definition: JDetector.hh:89
bool is_muon(const Trk &track)
Test whether given track is a (anti-)muon.
Router for direct addressing of module data in detector data structure.
Rotation matrix.
Definition: JRotation3D.hh:111
double getRate() const
Get default rate.
then usage $script< input file >[option] nPossible options count
Definition: JVolume1D.sh:31
*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
General purpose class for parallel reading of objects from a single file or multiple files...
#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
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
int getRunNumber() const
Get run number.
3D track with energy.
Definition: JTrack3E.hh:30
Data structure for detector geometry and calibration.
Acoustic single fit.
bool qualitySorter(const JFit &first, const JFit &second)
Comparison of fit results.
#define MAKE_STRING(A)
Make string.
Definition: JPrint.hh:127
int getFrameIndex() const
Get frame index.
JTime & add(const JTime &value)
Addition operator.
static const char WILDCARD
Definition: JDAQTags.hh:56
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
Basic data structure for L0 hit.
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
Auxiliary class for defining the range of iterations of objects.
Definition: JLimit.hh:41
The Vec class is a straightforward 3-d vector, which also works in pyroot.
Definition: Vec.hh:12
I/O formatting auxiliaries.
JAxis3D & rotate(const JRotation3D &R)
Rotate axis.
Definition: JAxis3D.hh:225
Detector file.
Definition: JHead.hh:226
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.
Acoustic event fit.
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
Auxiliary class to test history.
Definition: JHistory.hh:105
static const int JMUONGANDALF
double getTheta() const
Get theta angle.
Definition: JVersor3D.hh:128
Parallel scanning of objects from a single file or multiple files according a format that follows fro...
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.
#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 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.
Auxiliary data structure for muon PDF.
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
Direct access to module in detector data structure.
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
const double getSpeedOfLight()
Get speed of light.
static const int JSTART_LENGTH_METRES
distance between first and last hits in metres from JStart.cc
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
JFit getFit(const int id, const JMODEL::JString &string)
Get fit parameters of string.
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.
const double getInverseSpeedOfLight()
Get inverse speed of light.
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
double getMaximalDistance(const JDetector &detector, const bool option=false)
Get maximal distance between modules in detector.
no fit printf nominal n $STRING awk v X
double getTanThetaC()
Get average tangent of Cherenkov angle of water corresponding to group velocity.
const JLimit & getLimit() const
Get limit.
Definition: JLimit.hh:84
do set_variable DETECTOR_TXT $WORKDIR detector
KM3NeT DAQ constants, bit handling, etc.
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
Definition: JDAQ.hh:26
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:486
JTriggerCounter_t getCounter() const
Get trigger counter.
Wrapper class around ROOT TStyle.
Definition: JStyle.hh:22
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