44 int main(
int argc, 
char **argv)
 
   50   JMultipleFileScanner<JDAQTimesliceTypes_t> inputFile;
 
   56   JRange<int>        multiplicity;
 
   58   JROOTClassSelector selector;
 
   64     JParser<> zap(
"Monitoring of PMT time-over-threshold distributions.");
 
   66     zap[
'f'] = 
make_field(inputFile,      
"input file.");
 
   68     zap[
'n'] = 
make_field(numberOfEvents)                                                 = JLimit::max();
 
   69     zap[
'a'] = 
make_field(detectorFile,   
"detector file.");
 
   70     zap[
'T'] = 
make_field(T_ns,           
"time window [ns].")                            = JRange<double>(10.0, 25.0);
 
   71     zap[
'c'] = 
make_field(ctMax,          
"maximal cosine space angle between PMT axes.") =   0.0;
 
   72     zap[
'M'] = 
make_field(multiplicity,   
"multiplicity range of hits on DOM.")           = JRange<int>(1, 2);
 
   73     zap[
'D'] = 
make_field(deadTime_us,    
"L0 dead time (us)")                            = 10;
 
   74     zap[
'C'] = 
make_field(selector,       
"timeslice selector, e.g. JDAQTimesliceL1.")    = getROOTClassSelection<JDAQTimesliceTypes_t>();
 
   75     zap[
'O'] = 
make_field(option,         
"hit pre-processing option.")                   = JPreprocessor::getOptions();
 
   80   catch(
const exception &error) {
 
   81     FATAL(error.what() << endl);
 
   90   if (!T_ns.is_valid()) {
 
   91     FATAL(
"Invalid time window [ns] " << T_ns << endl);
 
   94   if (selector == JDAQTimeslice  ::Class_Name() ||
 
   95       selector == JDAQTimesliceL1::Class_Name()) {
 
  102     catch(
const JException& error) {
 
  103       FATAL(
"No trigger parameters from input." << endl);
 
  106     if ((selector == JDAQTimeslice  ::Class_Name() && parameters.
writeL1.
prescale > 0) ||
 
  107         (selector == JDAQTimesliceL1::Class_Name())) {
 
  110         FATAL(
"Option -T <T_ns> = " << T_ns.getUpperLimit() << 
" is larger than in the trigger " << parameters.
TMaxLocal_ns << endl);
 
  115   if (!multiplicity.is_valid())          { 
FATAL(
"Invalid multiplicity " << multiplicity << endl); }
 
  116   if ( multiplicity.getLowerLimit() < 1) { 
FATAL(
"Invalid multiplicity " << multiplicity << endl); }
 
  125     load(detectorFile, detector);
 
  127   catch(
const JException& error) {
 
  131   if (detector.empty()) {
 
  132     FATAL(
"Empty detector." << endl);
 
  135   const JModuleRouter router(detector);
 
  141   const double zmin =   -0.5;   
 
  142   const double zmax =  256.5;   
 
  143   const int    nz   = (int) ((zmax-zmin) / 1.0);
 
  147   typedef JHitR0        hit_type;
 
  148   typedef JSuperFrame2D<hit_type>   JSuperFrame2D_t;
 
  149   typedef JSuperFrame1D<hit_type>   JSuperFrame1D_t;
 
  151   const JMatchL0<hit_type> match(T_ns.getUpperLimit());     
 
  153   const double deadTime_ns  =  deadTime_us * 1e3;
 
  155   JObjectMultiplexer<JDAQTimesliceTypes_t, JDAQTimeslice> in(inputFile, selector);
 
  159   for ( ; in.hasNext() && counter != inputFile.getLimit(); ++counter) {
 
  161     STATUS(
"event: " << setw(10) << counter << 
'\r'); 
DEBUG(endl);
 
  165     for (JDAQTimeslice::const_iterator frame = timeslice->begin(); frame != timeslice->end(); ++frame) {
 
  167       if (router.hasModule(frame->getModuleID())) {
 
  169         TH2D*          h2     = manager[frame->getModuleID()];
 
  170         const JModule& module = router.getModule(frame->getModuleID());
 
  172         JSuperFrame2D_t& buffer = JSuperFrame2D_t::demultiplex(*frame, module);
 
  174         buffer.preprocess(option, match);
 
  176         JSuperFrame1D_t& data = JSuperFrame1D_t::multiplex(buffer);
 
  180         for (JSuperFrame1D_t::const_iterator p = data.begin(), __end = data.end() - 1; p != __end; ) {
 
  182           JSuperFrame1D_t::const_iterator q = p;
 
  184           double ct_max = -1.0;
 
  185           double dt_min =  numeric_limits<double>::max();
 
  187           while (++q != __end && q->getT() - p->getT() < T_ns.getUpperLimit()) {
 
  189             const double ct = 
getDot(module.getPMT(p->getPMT()), module.getPMT(q->getPMT()));
 
  190             const double dt = q->getT() - p->getT();
 
  201           if (multiplicity(
distance(p,q)) && ct_max < ctMax && dt_min > T_ns.getLowerLimit()) {
 
  203             for (JSuperFrame1D_t::const_iterator __p = p; __p != q; ++__p) {
 
  205               if (__p->getT() > t0[__p->getPMT()] + deadTime_ns) {
 
  206                 h2->Fill(__p->getPMT(), __p->getToT());
 
  209               t0[__p->getPMT()] = __p->getT();