Jpp  17.0.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JCalibrateK40.cc
Go to the documentation of this file.
1 
2 #include <string>
3 #include <iostream>
4 #include <iomanip>
5 #include <limits>
6 
7 #include "TROOT.h"
8 #include "TFile.h"
9 #include "TH1D.h"
10 #include "TH2D.h"
11 
14 
15 #include "JDAQ/JDAQTimesliceIO.hh"
17 #include "JDAQ/JDAQEvaluator.hh"
20 #include "JTrigger/JHitR0.hh"
21 #include "JTrigger/JMatchL0.hh"
22 #include "JTrigger/JHitToolkit.hh"
27 #include "JDetector/JDetector.hh"
34 #include "JSupport/JSupport.hh"
35 #include "JSupport/JMeta.hh"
37 #include "JTools/JRange.hh"
39 
41 #include "JROOT/JRootToolkit.hh"
42 #include "JROOT/JRootFileWriter.hh"
45 
46 #include "Jeep/JPrint.hh"
47 #include "Jeep/JParser.hh"
48 #include "Jeep/JMessage.hh"
49 
50 namespace {
51 
54  using JDETECTOR::JModule;
55 
56  // Methods for background estimation
57 
58  static const char* rates_t = "rates"; //!< singles rates from summary data
59  static const char* count_t = "counts"; //!< singles rates from L0 data
60  static const char* tails_t = "tails"; //!< tails of time residual distribution
61  static const char* rndms_t = "randoms"; //!< random time offsets (only L0 data)
62 
63  /**
64  * Maximal time-over-threshold.
65  */
66  static const double ToTmax_ns = std::numeric_limits<KM3NETDAQ::JDAQHit::JTOT_t>::max();
67 
68  /**
69  * Auxiliary data structure for histogram management.
70  */
71  struct JHistogram :
72  public JCombinatorics
73  {
74  /**
75  * Default constructor.
76  */
77  JHistogram() :
78  h2s(NULL),
79  h1b(NULL),
80  h1L(NULL)
81  {}
82 
83 
84  /**
85  * Constructor.
86  *
87  * \param module module
88  * \param axis axis
89  */
90  JHistogram(const JModule& module, const JAbstractHistogram<Double_t>& axis)
91  {
92  using namespace JPP;
93 
94  // sort the PMT pairs by opening angle in the order largest angle -> smallest angle
95 
96  this->configure(module.size());
97 
98  this->sort(JPairwiseComparator(module));
99 
100  const Int_t nx = this->getNumberOfPairs();
101  const Double_t xmin = -0.5;
102  const Double_t xmax = nx - 0.5;
103 
104  h2s = new TH2D(MAKE_CSTRING(module.getID() << _2S), NULL, nx, xmin, xmax, axis.getNumberOfBins(), axis.getLowerLimit(), axis.getUpperLimit());
105  h1b = new TH1D(MAKE_CSTRING(module.getID() << _1B), NULL, nx, xmin, xmax);
106  h1L = new TH1D(MAKE_CSTRING(module.getID() << _1L), NULL, nx, xmin, xmax);
107 
108  h2s->Sumw2();
109  h1b->Sumw2();
110  h1L->Sumw2();
111  }
112 
113  /**
114  * Check validity.
115  *
116  * \return true if valid; else false
117  */
118  bool is_valid()
119  {
120  return (h2s != NULL &&
121  h1b != NULL &&
122  h1L != NULL);
123  }
124 
125  TH2D* h2s; //!< time distribution per PMT pair
126  TH1D* h1b; //!< background rates per PMT pair
127  TH1D* h1L; //!< livetimes per PMT pair
128  };
129 
130 
131  /**
132  * Get coincidence probability of two PMTs within one module due to random background.
133  *
134  * \param E1 expected counts of 1st PMT
135  * \param E2 expected counts of 2nd PMT
136  * \param ED expected counts of module, excluding PMT 1 and PMT 2
137  * \param M_min multiplicity lower limit
138  * \param M_max multiplicity upper limit
139  * \return probability
140  */
141  inline double getP(const double E1, const double E2, const double ED, const int M_min, const int M_max)
142  {
143  // 1st, always calculate the probability for twofold multiplicity
144 
145  double P = E1 * E2 * exp(-(E1 + E2 + ED));
146 
147  // 2nd, calculate the probability of multiplicity at lower limit
148 
149  int MD = 1;
150 
151  for ( ; MD + 2 <= M_min; ++MD) {
152  P *= ED/MD;
153  }
154 
155  // 3rd, add the probabilities of multiplicities upto upper limit
156 
157  double P_sum = P;
158 
159  for ( ; MD + 2 <= M_max; ++MD) {
160  P *= ED/MD;
161  P_sum += P;
162  }
163 
164  return P_sum;
165  }
166 }
167 
168 
169 /**
170  * \file
171  *
172  * Auxiliary program to determine PMT parameters from K40 data.
173  *
174  * By default, the combinatorial background is estimated from the singles rate.\n
175  * In case L0 data are taken (and no summary data are available),
176  * the singles rate can be determined from the amount of L0 data.\n
177  * One can also estimate the background from the tails in the time residual distribution.\n
178  * In that case, option -B can be used to specify the minimal and maximal time offset in ns.\n
179  * For example -B "10 20".\n
180  * Note that the minimal and maximal time should be larger that the width of
181  * the time residual distribution and less than the time window of the L1 coincidence, respectively.\n
182  * The time window is applied symmetrically around a time offset of zero.\n
183  * Finally, if L0 data are available, one can estimate the background using
184  * the same procedure but with a random (read wrong) time calibration.
185  *
186  * The option -M can be used to specify a range of multiplicities.\n
187  * For example -M "2 2" will strictly select two-fold coincidences.
188  * Note that such a selection can bias the result.
189  *
190  * Also consult <a href="https://common.pages.km3net.de/jpp/JMonitor.PDF">documentation</a>.
191  * \author mdejong
192  */
193 int main(int argc, char **argv)
194 {
195  using namespace std;
196  using namespace JPP;
197  using namespace KM3NETDAQ;
198 
199  JMultipleFileScanner_t inputFile;
200  counter_type numberOfEvents;
201  string outputFile;
202  string detectorFile;
203  Double_t TMax_ns;
204  JRange<double> rateRange_Hz;
205  JRange<double> totRange_ns;
206  JRange<double> Tail_ns;
207  JRange<int> multiplicity;
208  double deadTime_us;
209  JROOTClassSelector selector;
210  string background;
211  JPreprocessor option;
212  int debug;
213 
214  try {
215 
216  JParser<> zap("Auxiliary program to determine PMT parameters from K40 data.");
217 
218  zap['f'] = make_field(inputFile, "input file.");
219  zap['o'] = make_field(outputFile, "output file.") = "calibrate_k40.root";
220  zap['n'] = make_field(numberOfEvents) = JLimit::max();
221  zap['a'] = make_field(detectorFile, "detector file.");
222  zap['T'] = make_field(TMax_ns, "time window [ns].") = 20.0;
223  zap['V'] = make_field(rateRange_Hz, "PMT rate range [Hz].") = JRange<double>(0.0, 20.0e3);
224  zap['t'] = make_field(totRange_ns, "PMT time-over-threshold range [ns].") = JRange<double>(4.0, ToTmax_ns);
225  zap['b'] = make_field(background, "background estimation method.") = rates_t, count_t, tails_t, rndms_t;
226  zap['B'] = make_field(Tail_ns, "time window used for background estimation.") = JRange<double>(15.0, 20.0);
227  zap['M'] = make_field(multiplicity, "multiplicity range of hits on DOM.") = JRange<int>(2, 31);
228  zap['D'] = make_field(deadTime_us, "L1 dead time (us)") = 0.0;
229  zap['C'] = make_field(selector, "timeslice selector, e.g. JDAQTimesliceL1.") = getROOTClassSelection<JDAQTimesliceTypes_t>();
230  zap['O'] = make_field(option, "hit pre-processing option.") = JPreprocessor::getOptions();
231  zap['d'] = make_field(debug, "debug flag.") = 1;
232 
233  zap(argc, argv);
234  }
235  catch(const exception &error) {
236  FATAL(error.what() << endl);
237  }
238 
239  //-----------------------------------------------------------
240  // check the input parameters
241  //-----------------------------------------------------------
242 
243  cout.tie(&cerr);
244 
245  if (selector == JDAQTimesliceL2::Class_Name() ||
246  selector == JDAQTimesliceSN::Class_Name()) {
247  FATAL("Option -C <selector> " << selector << " not compatible with calibration method." << endl);
248  }
249 
250  if (selector == JDAQTimeslice ::Class_Name() ||
251  selector == JDAQTimesliceL1::Class_Name()) {
252 
254 
255  try {
256  parameters = getTriggerParameters(inputFile);
257  }
258  catch(const JException& error) {
259  FATAL("No trigger parameters from input:" << error.what() << endl);
260  }
261 
262  if ((selector == JDAQTimeslice ::Class_Name() && parameters.writeL1.prescale > 0) ||
263  (selector == JDAQTimesliceL1::Class_Name())) {
264 
265  if (parameters.TMaxLocal_ns < TMax_ns) {
266  FATAL("Option -T <TMax_ns> = " << TMax_ns << " is larger than in the trigger " << parameters.TMaxLocal_ns << endl);
267  }
268 
269  if (background == rndms_t ||
270  background == count_t) {
271  FATAL("Option -C <selector> " << selector << " incompatible with option -b <background> " << background << endl);
272  }
273  }
274  }
275 
276  if (!multiplicity.is_valid() || multiplicity.getLowerLimit() < 2 || multiplicity.getUpperLimit() > NUMBER_OF_PMTS) {
277  FATAL("Invalid option -M <multiplicity> " << multiplicity << endl);
278  }
279 
280  if (!totRange_ns.is_valid()) {
281  FATAL("Invalid option -t <totRange_ns> " << totRange_ns << endl);
282  }
283 
284  if (background == tails_t) {
285 
286  if (!Tail_ns.is_valid()) {
287  FATAL("Invalid option -B <Tail_ns> " << Tail_ns << endl);
288  }
289 
290  if (Tail_ns.getUpperLimit() > TMax_ns) {
291  FATAL("Invalid option -B <Tail_ns> " << Tail_ns << "; upper limit larger than option -T <TMax_ns> " << TMax_ns << endl);
292  }
293  }
294 
295  //-----------------------------------------------------------
296  // load detector file
297  //-----------------------------------------------------------
298 
300 
301  try {
302  load(detectorFile, detector);
303  }
304  catch(const JException& error) {
305  FATAL(error);
306  }
307 
308  if (detector.empty()) {
309  FATAL("Empty detector." << endl);
310  }
311 
312  const JModuleRouter router(detector);
313 
314  //-----------------------------------------------------------
315  // determine time offsets for background method rndms_t
316  //-----------------------------------------------------------
317 
318  vector<double> t0; // time offsets for random background evaluation [ns]
319 
320  for (int i = 0; i != NUMBER_OF_PMTS; ++i) {
321  t0.push_back(i * 2 * TMax_ns);
322  }
323 
324  //-----------------------------------------------------------
325  // correction factor for rate due to specified time-over-threshold range
326  //-----------------------------------------------------------
327 
328  const JPMTAnalogueSignalProcessor cpu;
329 
330  const int NPE = 1;
331  const double RTU = (cpu.getIntegralOfChargeProbability(cpu.getNPE(totRange_ns.getLowerLimit()), cpu.getNPE(totRange_ns.getUpperLimit()), NPE)
332  /
333  cpu.getIntegralOfChargeProbability(cpu.getNPE(0.0), cpu.getNPE(ToTmax_ns), NPE));
334 
335 
336  //-----------------------------------------------------------
337  // initialise histograms
338  //-----------------------------------------------------------
339 
340  vector<JHistogram> zmap(detector.size());
341 
342  const Double_t ymin = -floor(TMax_ns) + 0.5;
343  const Double_t ymax = +floor(TMax_ns) - 0.5;
344  const Int_t ny = (Int_t) ((ymax - ymin) / 1.0);
345 
346  for (JDetector::iterator module = detector.begin(); module != detector.end(); ++module) {
347 
348  const JModuleAddress& address = router.getAddress(module->getID());
349 
350  if (!module->empty()) {
351 
352  NOTICE("Booking histograms for module " << module->getID() << endl);
353 
354  zmap[address.first] = JHistogram(*module, JAbstractHistogram<Double_t>(ny, ymin, ymax));
355  }
356  }
357 
358 
359  typedef JHitR0 hit_type;
360  typedef JSuperFrame2D<hit_type> JSuperFrame2D_t;
361  typedef JSuperFrame1D<hit_type> JSuperFrame1D_t;
362 
363  const JMatchL0<hit_type> match(TMax_ns); // time window self-coincidences [ns]
364 
365  const double deadTime_ns = deadTime_us * 1e3;
366 
367 
368  TFile out(outputFile.c_str(), "recreate");
369 
370  putObject(out, JMeta(argc, argv));
371 
372  counter_type counter = 0;
373 
374  for (JMultipleFileScanner_t::const_iterator i = inputFile.begin(); i != inputFile.end(); ++i) {
375 
376  STATUS("Processing: " << *i << endl);
377 
378  JSummaryFileRouter summary(*i);
379 
382 
383  for (JDAQHeader header; in.hasNext() && counter != numberOfEvents; ++counter) {
384 
385  STATUS("event: " << setw(10) << counter << '\r'); DEBUG(endl);
386 
387  const JDAQTimeslice* timeslice = in.next();
388 
389  if (header.getDetectorID() != timeslice->getDetectorID() ||
390  header.getRunNumber () != timeslice->getRunNumber ()) {
391 
392  header = timeslice->getDAQHeader();
393 
394  putObject(out, header);
395  }
396 
397  if (background == rates_t) {
398 
399  summary.update(timeslice->getDAQHeader());
400 
401  if (timeslice->getFrameIndex() != summary.getSummaryslice()->getFrameIndex()) {
402 
403  ERROR("Frame indices do not match at "
404  << "[counter = " << counter << "]"
405  << "[timeslice = " << timeslice->getFrameIndex() << "]"
406  << "[summaryslice = " << summary.getSummaryslice()->getFrameIndex() << "]" << endl);
407 
408  continue;
409  }
410  }
411 
412  for (JDAQTimeslice::const_iterator frame = timeslice->begin(); frame != timeslice->end(); ++frame) {
413 
414  if (router.hasModule(frame->getModuleID())) {
415 
416  const JModule& module = router.getModule(frame->getModuleID());
417 
418  //-----------------------------------------------------------
419  // determine background rates and veto per PMT
420  //-----------------------------------------------------------
421 
422  vector<double> rate_Hz(NUMBER_OF_PMTS, 0.0);
423  vector<bool> veto (NUMBER_OF_PMTS, false);
424 
425  if (background == count_t) {
426 
427  for (JDAQSuperFrame::const_iterator i = frame->begin(); i != frame->end(); ++i) {
428  rate_Hz[i->getPMT()] += RTU * 1e9 / getFrameTime();
429  }
430 
431  } else if (background == tails_t) {
432 
433  // see below
434 
435  } else if (background == rndms_t) {
436 
437  // see below
438 
439  } else if (background == rates_t) {
440 
441  if (summary.hasSummaryFrame(frame->getModuleID())) {
442 
443  const JDAQSummaryFrame& sum = summary.getSummaryFrame(frame->getModuleID());
444 
445  for (int i = 0; i != NUMBER_OF_PMTS; ++i){
446  rate_Hz[i] = RTU * sum.getRate(i);
447  }
448 
449  } else {
450 
451  FATAL("Summary frame of module " << frame->getModuleID() << " not found at frame index " << timeslice->getFrameIndex() << endl);
452  }
453  }
454 
455  const JDAQFrameStatus status = frame->getDAQFrameStatus();
456 
457  // Set veto according DAQ or PMT status and rate;
458  // Hits of PMTs with veto will not be counted in livetime nor coincidences nor background
459 
460  for (int i = 0; i != NUMBER_OF_PMTS; ++i) {
461  if (!getDAQStatus(status, module, i) ||
462  !getPMTStatus(status, module, i) ||
463  !rateRange_Hz(rate_Hz[i])) {
464  veto[i] = true;
465  }
466  }
467 
468  const JHistogram& histogram = zmap[router.getAddress(frame->getModuleID()).first];
469  const JCombinatorics& combinatorics = histogram.getCombinatorics();
470 
471  TH2D* h2s = histogram.h2s;
472  TH1D* h1b = histogram.h1b;
473  TH1D* h1L = histogram.h1L;
474 
475  //-----------------------------------------------------------
476  // process data
477  //-----------------------------------------------------------
478 
479  JSuperFrame2D_t& buffer = JSuperFrame2D_t::demultiplex(*frame, module);
480 
481  buffer.preprocess(option, match);
482 
483  for (JSuperFrame2D_t::iterator i = buffer.begin(); i != buffer.end(); ++i) {
484  if (veto[i->getPMTAddress()]) {
485  i->reset();
486  }
487  }
488 
489  JSuperFrame1D_t& data = JSuperFrame1D_t::multiplex(buffer);
490 
491  DEBUG("Number of hits " << timeslice->getFrameIndex() << ":" << frame->getModuleID() << ' ' << frame->size() << ' ' << data.size() << endl);
492 
493  // Signal;
494  // Hits from PMTs that do not comply with rate cuts have been exluded above
495 
496  size_t numberOfSignalEvents = 0;
497 
498  double t1 = numeric_limits<double>::lowest();
499 
500  for (vector<hit_type>::const_iterator p = data.begin(); p != data.end(); ) {
501 
503 
504  while (++q != data.end() && q->getT() - p->getT() <= TMax_ns) {}
505 
506  const int N = distance(p,q);
507 
508  if (multiplicity(N)) {
509 
510  numberOfSignalEvents += 1;
511 
512  if (p->getT() > t1 + deadTime_ns) {
513 
514  for (vector<hit_type>::const_iterator __p = p; __p != q; ++__p) {
515  for (vector<hit_type>::const_iterator __q = __p; ++__q != q; ) {
516 
517  if (totRange_ns( __p->getToT()) && totRange_ns(__q->getToT())) {
518  h2s->Fill((double) combinatorics.getIndex(__p->getPMT(),__q->getPMT()),
519  JCombinatorics::getSign(__p->getPMT(),__q->getPMT()) * (__q->getT() - __p->getT()));
520  }
521  }
522  }
523 
524  t1 = p->getT();
525  }
526  }
527 
528  p = q;
529  }
530 
531  // Background;
532  // Note that rate cuts and veto have already been accounted for when data buffer was filled
533 
534  if (background == rndms_t) {
535 
536  for (vector<hit_type>::iterator i = data.begin(); i != data.end(); ++i) {
537  *i = hit_type(i->getPMT(), JHit(i->getT() + t0[i->getPMT()], i->getToT()));
538  }
539 
540  sort(data.begin(), data.end());
541 
542  double t1 = numeric_limits<double>::lowest();
543 
544  for (vector<hit_type>::const_iterator p = data.begin(); p != data.end(); ) {
545 
547 
548  while (++q != data.end() && q->getT() - p->getT() <= TMax_ns) {}
549 
550  const int N = distance(p,q);
551 
552  if (multiplicity(N)) {
553 
554  if (p->getT() > t1 + deadTime_ns) {
555 
556  for (vector<hit_type>::const_iterator __p = p; __p != q; ++__p) {
557  for (vector<hit_type>::const_iterator __q = __p; ++__q != q; ) {
558 
559  if (totRange_ns(__p->getToT()) && totRange_ns(__q->getToT())) {
560  h1b->Fill((double) combinatorics.getIndex(p->getPMT(),q->getPMT()), 1.0);
561  }
562  }
563  }
564 
565  t1 = p->getT();
566  }
567  }
568 
569  p = q;
570  }
571 
572  } else if (background == rates_t ||
573  background == count_t) {
574 
575  double Rs = 0.0; // total rate [Hz]
576 
577  for (int i = 0; i != NUMBER_OF_PMTS; ++i) {
578  if (!veto[i]) {
579  Rs += rate_Hz[i]; // [Hz]
580  }
581  }
582 
583  for (int i = 0; i != NUMBER_OF_PMTS; ++i) {
584  for (int j = i; ++j != NUMBER_OF_PMTS; ) {
585 
586  if (!veto[i] && !veto[j]) {
587 
588  const double R1 = rate_Hz[i]; // [Hz]
589  const double R2 = rate_Hz[j]; // [Hz]
590 
591  // evaluate expected counts within a time window of 2 * TMax_ns for the two PMTs and the other PMTs inside the optical module;
592  // expected rate due to random coincidences then is product of the probability for the specific observation and the number of trials
593  // the observation is one hit in PMT 1, one hit in PMT 2 and a number of hits in the other PMTs inside the same module
594  // corresponding to the given multiplicity range
595 
596  const double N = getP((R1) * 2 * TMax_ns * 1e-9,
597  (R2) * 2 * TMax_ns * 1e-9,
598  (Rs - R1 - R2) * 2 * TMax_ns * 1e-9,
599  multiplicity.getLowerLimit(),
600  multiplicity.getUpperLimit()) * getFrameTime() / (2*TMax_ns);
601 
602  h1b->Fill((double) combinatorics.getIndex(i,j), N);
603  }
604  }
605  }
606  }
607 
608  //-----------------------------------------------------------
609  // fill the livetime by PMT pairs
610  //-----------------------------------------------------------
611 
612  const double livetime_s = getFrameTime()*1e-9 * exp(-deadTime_ns * numberOfSignalEvents/getFrameTime());
613 
614  for (size_t i = 0; i < combinatorics.getNumberOfPairs(); ++i) {
615 
616  const int pmt1 = combinatorics.getPair(i).first;
617  const int pmt2 = combinatorics.getPair(i).second;
618 
619  if (!veto[pmt1] && !veto[pmt2]) {
620  h1L->Fill(i, livetime_s);
621  }
622  }
623  }
624  }
625  }
626  }
627  STATUS(endl);
628 
629  if (background == tails_t ) {
630 
631  for (vector<JHistogram>::iterator hist = zmap.begin() ; hist != zmap.end() ; ++hist) {
632 
633  if (hist->is_valid()) {
634 
635  JCombinatorics& combinatorics = *hist;
636 
637  TH2D* h2s = hist->h2s;
638  TH1D* h1b = hist->h1b;
639 
640  for (int i = 0; i != NUMBER_OF_PMTS; ++i) {
641  for (int j = i; ++j != NUMBER_OF_PMTS; ) {
642 
643  double Y = 0.0; // sum of counts in tail regions
644  double W = 0.0; // square of error of Y
645  int N = 0; // number of bins in tail regions
646  int k = combinatorics.getIndex(i,j); // PMT pair index (x-axis of h2s)
647 
648  for (int l = 1; l <= h2s->GetYaxis()->GetNbins(); ++l) {
649 
650  const Double_t dt = h2s->GetYaxis()->GetBinCenter(l) ;
651 
652  if (Tail_ns(fabs(dt))) {
653  Y += h2s->GetBinContent(k+1,l);
654  W += h2s->GetBinError(k+1,l) * h2s->GetBinError(k+1,l);
655  N++;
656  }
657  }
658 
659  h1b->SetBinContent(k+1, Y / N * (2.0*TMax_ns) / ((ymax - ymin)/ny) );
660  h1b->SetBinError (k+1, sqrt(W/N) * (2.0*TMax_ns) / ((ymax - ymin)/ny) );
661  }
662  }
663  }
664  }
665  }
666 
667  //---------------------------------------------
668  // save normalisation constants and store histograms
669  //---------------------------------------------
670 
671  TH1D weights_hist(weights_hist_t, NULL, 3, 0.0, 3.0);
672 
673  weights_hist.GetXaxis()->SetBinLabel(1, W1_overall_t); // [s]
674  weights_hist.GetXaxis()->SetBinLabel(2, WS_t); // [ns]
675  weights_hist.GetXaxis()->SetBinLabel(3, WB_t); // [ns]
676 
677  weights_hist.Fill(W1_overall_t, counter*getFrameTime()*1e-9); // [s]
678  weights_hist.Fill(WS_t, (ymax - ymin)/ny); // [ns]
679  weights_hist.Fill(WB_t, 2.0*TMax_ns); // [ns]
680 
681  out << weights_hist;
682 
683  for (vector<JHistogram>::iterator i = zmap.begin(); i != zmap.end(); ++i) {
684  if (i->is_valid()) {
685  out << *(i->h2s);
686  out << *(i->h1b);
687  out << *(i->h1L);
688  }
689  }
690 
691  out.Write();
692  out.Close();
693 }
Auxiliary class for ROOT I/O of application specific meta data.
Definition: JMeta.hh:70
const double xmax
Definition: JQuadrature.cc:24
Utility class to parse command line options.
Definition: JParser.hh:1500
Auxiliaries for pre-processing of hits.
General exception.
Definition: JException.hh:23
then fatal No hydrophone data file $HYDROPHONE_TXT fi sort gr k
Auxiliary class to convert pair of indices to unique index and back.
JAbscissa_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.
double getRate(const int tdc, const double factor=1.0) const
Get count rate.
Basic data structure for L0 hit.
const JModule & getModule(const JObjectID &id) const
Get module parameters.
Data structure for a composite optical module.
Definition: JModule.hh:68
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
int getDetectorID() const
Get detector identifier.
static const char *const WB_t
Named bin for value of TMax_ns in JCalibrateK40.
L0 match criterion.
Definition: JMatchL0.hh:27
#define STATUS(A)
Definition: JMessage.hh:63
void update(const JDAQHeader &header)
Update router.
Detector data structure.
Definition: JDetector.hh:89
Auxiliary class to select ROOT class based on class name.
Router for direct addressing of module data in detector data structure.
then JShowerPostfit f $INPUT_FILE o $OUTPUT_FILE N
#define R1(x)
*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:151
Long64_t counter_type
Type definition for counter.
then fatal Wrong number of arguments fi set_variable STRING $argv[1] set_variable DETECTORXY_TXT $WORKDIR $DETECTORXY_TXT tail read X Y CHI2 RMS printf optimum n $X $Y $CHI2 $RMS awk v Y
const JDAQSummaryFrame & getSummaryFrame() const
Get default summary frame.
Auxiliary class for multiplexing object iterators.
Simple data structure for histogram binning.
string outputFile
int getNumberOfBins() const
Get number of bins.
int getRunNumber() const
Get run number.
Data structure for detector geometry and calibration.
Tools for handling different hit types.
Acoustics hit.
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
int getFrameIndex() const
Get frame index.
1-dimensional frame with time calibrated data from one optical module.
then JCookie sh JDataQuality D $DETECTOR_ID R $RUNS[*] o $QUALITY_TXT d $DEBUG!fi fi JDataQuality f $QUALITY_TXT Q livetime_s
Definition: JDataQuality.sh:49
int first
index of module in detector data structure
Scanning of objects from a single file according a format that follows from the extension of each fil...
static const char *const WS_t
Named bin for time residual bin width.
I/O formatting auxiliaries.
Auxiliary class to sort pairs of PMT addresses within optical module.
Detector file.
Definition: JHead.hh:224
Reduced data structure for L0 hit.
Definition: JHitR0.hh:25
const JDAQSummaryslice * getSummaryslice() const
Get summary slice.
Hit data structure.
Definition: JDAQHit.hh:34
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
int getIndex(const int first, const int second) const
Get index of pair of indices.
static const char *const _1B
Name extension for 1D background.
double getFrameTime()
Get frame time duration.
Definition: JDAQClock.hh:162
Data storage class for rate measurements of all PMTs in one module.
int getID() const
Get identifier.
Definition: JObjectID.hh:50
bool is_valid(const json &js)
Check validity of JSon data.
ROOT I/O of application specific meta data.
JAbscissa_t getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
#define NOTICE(A)
Definition: JMessage.hh:64
#define ERROR(A)
Definition: JMessage.hh:66
Data time slice.
File router for fast addressing of summary data.
virtual const pointer_type & next() override
Get next element.
Address of module in detector data structure.
int debug
debug level
Definition: JSirene.cc:66
Match operator for consecutive hits.
virtual bool hasNext() override
Check availability of next element.
bool putObject(TDirectory &dir, const TObject &object)
Write object to ROOT directory.
General purpose messaging.
double getP(const double expval, bool hit)
Get Poisson probability to observe a hit or not for given expectation value for the number of hits...
Definition: JFitToolkit.hh:41
#define FATAL(A)
Definition: JMessage.hh:67
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Direct access to module in detector data structure.
static const char *const weights_hist_t
Histogram naming.
static const char *const _1L
Name extension for 1D live time.
const double xmin
Definition: JQuadrature.cc:23
Auxiliary base class for list of file names.
virtual const char * what() const override
Get error message.
Definition: JException.hh:48
bool getPMTStatus(const JStatus &status)
Test status of PMT.
void configure(const T &value, const JAbstractCollection< JAbscissa_t > &bounds, JBool< false > option)
Configuration of value.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Auxiliary class to define a range between two values.
Utility class to parse command line options.
bool hasSummaryFrame(const JDAQModuleIdentifier &module) const
Has summary frame.
const JDAQHeader & getDAQHeader() const
Get DAQ header.
Definition: JDAQHeader.hh:49
static const char *const W1_overall_t
Named bin for duration of the run.
const JModuleAddress & getAddress(const JObjectID &id) const
Get address of module.
bool hasModule(const JObjectID &id) const
Has module.
2-dimensional frame with time calibrated data from one optical module.
PMT analogue signal processor.
Object reading from a list of files.
int j
Definition: JPolint.hh:682
do set_variable DETECTOR_TXT $WORKDIR detector
bool getDAQStatus(const JDAQFrameStatus &frame, const JStatus &status)
Test status of DAQ.
KM3NeT DAQ constants, bit handling, etc.
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
Definition: JDAQ.hh:26
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
Auxiliary class for specifying the way of pre-processing of hits.
const JDAQFrameStatus & getDAQFrameStatus() const
Get DAQ frame status.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable STRING $argv[2] set_array QUANTILES set_variable FORMULA *[0] exp(-0.5 *(x-[1])*(x-[1])/([2]*[2]))" set_variable MODULE `getModule -a $DETECTOR -L "$STRING 0"` source JAcousticsToolkit.sh typeset -A TRIPODS get_tripods $WORKDIR/tripod.txt TRIPODS XMEAN
JTriggerParameters getTriggerParameters(const JMultipleFileScanner_t &file_list)
Get trigger parameters.
then $DIR JPlotNPE PDG P
Definition: JPlotNPE-PDG.sh:62
static const char *const _2S
Name extension for 2D counts.
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
Template definition of histogram object interface.
Definition: JHistogram.hh:27