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