69 JLimit_t& numberOfEvents = inputFile.getLimit();
74 int numberOfTimeslices;
85 JParser<> zap(
"Example program to search for correlations between triggered events and timeslice data.");
104 catch(
const exception& error) {
142 if (selector ==
"") {
153 NOTICE(
"Selected class " << ps->getClassName() <<
endl);
159 ps->configure(inputFile);
180 ps->setLimit(inputFile.getLimit());
225 buffer[
event->getFrameIndex()].push_back(t0);
232 while (ps->hasNext()) {
238 map_type::const_iterator p = buffer.lower_bound(timeslice->
getFrameIndex() - numberOfTimeslices);
239 map_type::const_iterator q = buffer.upper_bound(timeslice->
getFrameIndex() + numberOfTimeslices);
243 for (map_type::const_iterator i = p; i != q; ++i) {
251 for (JDAQTimeslice::const_iterator frame = timeslice->begin(); frame != timeslice->end(); ++frame) {
263 for (map_type::const_iterator i = p; i != q; ++i) {
264 for (map_type::mapped_type::const_iterator
j = i->second.begin();
j != i->second.end(); ++
j) {
266 const double t0 = *
j;
282 TF1 f1(
"f1",
"[0]*exp(-0.5*(x-[1])*(x-[1])/([2]*[2])) + [3]");
294 status2[
module->getID()] = DEFAULT;
298 if (p ==
manager.end() || p->second->GetEntries() == 0) {
300 status2[
module->getID()] = NODATA;
305 TH1D* h1 = p->second;
314 for (
int i = 1; i != h1->GetNbinsX(); ++i) {
316 const Double_t x = h1->GetBinCenter (i);
317 const Double_t y = h1->GetBinContent(i);
327 ymin /= h1->GetNbinsX();
329 f1.SetParameter(0,
ymax);
330 f1.SetParameter(1, x0);
332 f1.SetParameter(2, sigma);
335 f1.SetParameter(3,
ymin);
337 for (
Int_t i = 0; i != f1.GetNpar(); ++i) {
338 f1.SetParError(i, 0.0);
343 h1->Fit(&f1, option.c_str(),
"same", x0 - 5 * sigma, x0 + 5 * sigma);
345 status = (fabs(f1.GetParameter(1)) <= 0.5*
getFrameTime() &&
346 f1.GetParameter(0) >= f1.GetParameter(3));
348 if (status)
status2[
module->getID()] = IN_SYNC;
355 for (
Int_t i = 1, ns = -(numberOfTimeslices + 1); i <= h1->GetNbinsX(); ++i) {
357 const Double_t x = h1->GetBinCenter (i);
358 const Double_t y = h1->GetBinContent(i);
360 while (x > (ns + 1) *
getFrameTime() - TMax_ns) { ++ns; }
372 const Double_t y = bg.getTotal() * i->second.getCount() / bg.getCount();
373 const Double_t P = TMath::PoissonI(i->second.getTotal(), y);
375 DEBUG(
"Peak at " <<
setw(4) << i->first <<
" [frame time] "
377 <<
FIXED(7,1) << i->second.getTotal() <<
" / "
378 <<
FIXED(7,1) << y <<
' '
387 if (!(
sn.size() == 1 &&
388 sn.begin()->first == 0)) {
394 const Double_t noise = bg.getTotal() * i->second.getCount() / bg.getCount();
396 WARNING(
"Peak at " <<
setw(4) << i->first <<
" [frame time] "
398 <<
FIXED(7,1) << i->second.getTotal() <<
" / "
403 peaksPerDoms[
module->getID()].push_back(i->second.getTotal());
407 status2[
module->getID()] = (sn.size() == 1 ? OUT_SYNC : ERROR);
427 manager[
module->getID()]->Reset("ICESM");
437 NOTICE(
"Managing non-working and OOS DOMs." <<
endl);
451 NOTICE(
"Module " <<
setw(8) << i->first <<
" set QEs of all PMTs to zero." <<
endl);
463 out << parameters <<
endl;
474 ofstream stream(
peaks);
476 stream <<
"#DOM NB_PEAKS TIMESLICE_SHIFT SIGNAL NOISE\n";
479 stream <<
dom->first <<
" ";
481 for (map_type::mapped_type::const_iterator data =
dom->second.begin(); data !=
dom->second.end(); ++data) {
483 ((i%4 == 0) ? stream <<
"\n" : stream <<
" ");