64   using namespace KM3NETDAQ;
 
   72   int                numberOfTimeslices;
 
   83     JParser<> zap(
"Example program to search for correlations between triggered events and timeslice data.");
 
   88     zap[
'n'] = 
make_field(numberOfEvents)      = JLimit::max();
 
   91     zap[
'N'] = 
make_field(numberOfTimeslices)  = 100;
 
   94     zap[
'C'] = 
make_field(selector)            = 
"", getROOTClassSelection<JDAQTimesliceTypes_t>();
 
  100     zap.read(argc, argv);
 
  102   catch(
const exception& error) {
 
  103     FATAL(error.what() << endl);
 
  128   const Double_t 
xmin = -(numberOfTimeslices + 1) * 
getFrameTime() - 0.5*binWidth_ns;
 
  129   const Double_t 
xmax = +(numberOfTimeslices + 1) * 
getFrameTime() + 0.5*binWidth_ns;
 
  130   const Int_t    nx   = (Int_t) ((
xmax - 
xmin) / binWidth_ns);
 
  132   JManager_t manager(
new TH1D(
"M_%", NULL, nx, 
xmin, 
xmax));
 
  140   if (selector == 
"") {
 
  148       FATAL(
"No timeslice data." << endl);
 
  151     NOTICE(
"Selected class " << ps->getClassName() << endl);
 
  157     ps->configure(inputFile);
 
  178   ps->setLimit(inputFile.getLimit());
 
  185   map_type peaksPerDoms;
 
  193   for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  194     oosDomsId[module->getID()] = 
false;
 
  200       STATUS(
"event: " << setw(10) << 
in.getCounter() << 
'\r'); 
DEBUG(endl);
 
  207       bool test_OOS = 
false; 
 
  210         t0 += 
getTime(*hit, router.getPMT(*hit));
 
  212         if(oosDomsId[hit->getModuleID()]) {
 
  218       if(test_OOS) 
continue; 
 
  223       buffer[
event->getFrameIndex()].push_back(t0);
 
  230     while (ps->hasNext()) {
 
  232       STATUS(
"event: " << setw(10) << ps->getCounter() << 
'\r'); 
DEBUG(endl);
 
  236       map_type::const_iterator p = buffer.lower_bound(timeslice->
getFrameIndex() - numberOfTimeslices);
 
  237       map_type::const_iterator q = buffer.upper_bound(timeslice->
getFrameIndex() + numberOfTimeslices);
 
  239       int number_of_events = 0;
 
  241       for (map_type::const_iterator i = p; i != q; ++i) {
 
  242         number_of_events += i->second.size();
 
  245       if (number_of_events == 0) {
 
  249       for (JDAQTimeslice::const_iterator frame = timeslice->begin(); frame != timeslice->end(); ++frame) {
 
  253         buildL1(*frame, router.getModule(frame->getModuleID()), back_inserter(
data));
 
  255         TH1D* h1 = manager[frame->getModuleID()];
 
  259           const double t1 = *hit + frame->getFrameIndex() * 
getFrameTime();
 
  261           for (map_type::const_iterator i = p; i != q; ++i) {
 
  262             for (map_type::mapped_type::const_iterator 
j = i->second.begin(); 
j != i->second.end(); ++
j) {
 
  264               const double t0 = *
j;
 
  277     Double_t most_OOS_peak = 0;
 
  278     Int_t most_OOS_ID = 0;
 
  280     TF1 
f1(
"f1", 
"[0]*exp(-0.5*(x-[1])*(x-[1])/([2]*[2])) + [3]");
 
  288     for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  292       status2[module->getID()] = DEFAULT;
 
  294       JManager_t::iterator p = manager.find(module->getID());
 
  296       if (p == manager.end() || p->second->GetEntries() == 0) {
 
  298         status2[module->getID()] = NODATA;
 
  303       TH1D* h1       = p->second;
 
  309       Double_t 
sigma = 250.0;    
 
  312       for (
int i = 1; i != h1->GetNbinsX(); ++i) {
 
  314         const Double_t 
x = h1->GetBinCenter (i);
 
  315         const Double_t 
y = h1->GetBinContent(i);
 
  325       ymin /= h1->GetNbinsX();
 
  327       f1.SetParameter(0, ymax);
 
  328       f1.SetParameter(1, x0);
 
  329       if (binWidth_ns < sigma) 
 
  330         f1.SetParameter(2, sigma);
 
  332         f1.FixParameter(2, binWidth_ns/sqrt(12.0));
 
  333       f1.SetParameter(3, ymin);
 
  337       h1->Fit(&
f1, option.c_str(), 
"same", x0 - 5 * 
sigma, x0 + 5 * 
sigma);
 
  340                 f1.GetParameter(0)       >= 
f1.GetParameter(3)); 
 
  342       if (status) status2[module->getID()] = IN_SYNC;
 
  349       for (Int_t i = 1, 
ns = -(numberOfTimeslices + 1); i <= h1->GetNbinsX(); ++i) {
 
  351         const Double_t x = h1->GetBinCenter (i);
 
  352         const Double_t y = h1->GetBinContent(i);
 
  362       DEBUG(
"Module " << setw(8) << module->getID() << endl);
 
  367         const Double_t 
P = TMath::PoissonI(i->second.getTotal(), 
y);
 
  369         DEBUG(
"Peak at " << setw(4) << i->first << 
" [frame time] " 
  371               << 
FIXED(7,1) << i->second.getTotal() << 
" / " 
  372               << 
FIXED(7,1) << y                    << 
' ' 
  375         if (P < Pmin && i->second.getTotal() > 
y) 
 
  381       if (!(sn.size()         == 1 &&
 
  382             sn.begin()->first == 0)) {
 
  384         WARNING(
"Module " << setw(8) << module->getID() << 
" number of peaks " << sn.size() << endl);
 
  388           const Double_t noise = bg.
getTotal() * i->second.getCount() / bg.
getCount();
 
  390           WARNING(
"Peak at " << setw(4) << i->first << 
" [frame time] " 
  392                   << 
FIXED(7,1) << i->second.getTotal()                                 << 
" / " 
  393                   << 
FIXED(7,1) << noise << endl);
 
  395           peaksPerDoms[module->getID()].push_back(sn.size());
 
  396           peaksPerDoms[module->getID()].push_back(i->first);
 
  397           peaksPerDoms[module->getID()].push_back(i->second.getTotal());
 
  398           peaksPerDoms[module->getID()].push_back(noise);
 
  401         status2[module->getID()] = (sn.size() == 1 ? OUT_SYNC : 
ERROR);
 
  408         if ((
f1.GetParameter(0) > most_OOS_peak) && !(oosDomsId[module->getID()])){
 
  410           most_OOS_peak = 
f1.GetParameter(0);
 
  411           most_OOS_ID = module->getID();
 
  416     if (most_OOS_ID != 0) {
 
  417       oosDomsId[most_OOS_ID] = 
true;
 
  420       for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  421         manager[module->getID()]->Reset(
"ICESM");
 
  423       peaksPerDoms.clear();
 
  431   NOTICE(
"Managing non-working and OOS DOMs." << endl);
 
  437       parameters.
load(pmtFile.c_str());
 
  443       if (i->second != IN_SYNC) {
 
  445         NOTICE(
"Module " << setw(8) << i->first << 
" set QEs of all PMTs to zero." << endl);
 
  453     ofstream out(pmtFile.c_str());
 
  457     out << parameters << endl;
 
  468     ofstream stream(peaks);
 
  470     stream << 
"#DOM NB_PEAKS TIMESLICE_SHIFT SIGNAL NOISE\n";
 
  472     for (map_type::const_iterator dom = peaksPerDoms.begin(); dom != peaksPerDoms.end(); ++dom) {
 
  473       stream << dom->first << 
"  ";
 
  475       for (map_type::mapped_type::const_iterator 
data = dom->second.begin(); 
data != dom->second.end(); ++
data) {
 
  477         ((i%4 == 0) ? stream << 
"\n" : stream <<  
"  ");
 
  489     if (i->second == IN_SYNC) {
 
  492     if (i->second != IN_SYNC &&
 
  493         i->second != NODATA) {
 
  498   NOTICE(
"Number of modules out/in sync " << nout << 
'/' << nin << endl);
 
  500   QAQC(nin << 
' ' << nout << endl);
 
Utility class to parse command line options. 
 
Auxiliary class to select ROOT class based on class name. 
 
*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
 
Auxialiary class to assert type conversion. 
 
Auxiliary class for a type holder. 
 
Auxiliary data structure for floating point format specification. 
 
double getTime(const Hit &hit)
Get true time of hit. 
 
Template definition for direct access of elements in ROOT TChain. 
 
Simple wrapper around JModuleRouter class for direct addressing of PMT data in detector data structur...
 
int getFrameIndex() const 
Get frame index. 
 
The template JSinglePointer class can be used to hold a pointer to an object. 
 
const JPolynome f1(1.0, 2.0, 3.0)
Function. 
 
Auxiliary class for defining the range of iterations of objects. 
 
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys...
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
 
double getFrameTime()
Get frame time duration. 
 
Auxiliary class for map of PMT parameters. 
 
double getMaximalTime(const double R_Hz)
Get maximal time for given rate. 
 
Auxiliary class to select JTreeScanner based on ROOT class name. 
 
void load(const char *file_name)
Load from input file. 
 
void load(const std::string &file_name, JDetector &detector)
Load detector from input file. 
 
#define QAQC(A)
QA/QC output macro. 
 
Auxiliary data structure for L1 build parameters. 
 
const JLimit & getLimit() const 
Get limit. 
 
do set_variable DETECTOR_TXT $WORKDIR detector
 
static const int NUMBER_OF_PMTS
Total number of PMTs in module. 
 
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
 
Auxiliary data structure for floating point format specification. 
 
int qaqc
QA/QC file descriptor. 
 
#define DEBUG(A)
Message macros.