58 using namespace KM3NETDAQ;
 
   59 using namespace JSUPERNOVA;
 
   66 int main(
int argc, 
char **argv)
 
   70   JLimit_t&              numberOfEvents = inputFile.getLimit();
 
   78   bool                   globalOutputOnly;
 
   86     JParser<> zap(
"Example program to examine rates as a function of time on ms-level timescales.");
 
   89     zap[
'o'] = 
make_field(outputFile)          = 
"ripple.root";
 
   90     zap[
'n'] = 
make_field(numberOfEvents)      = JLimit::max();
 
   92     zap[
'C'] = 
make_field(selector)            = getROOTClassSelection<JDAQTimesliceTypes_t>();
 
   93     zap[
'T'] = 
make_field(TMax_ns,       
"Time window for local coincidences (if 0 run in L0 mode)")  =    0.0;
 
   94     zap[
'B'] = 
make_field(binWidth_ms,   
"Bin width (experimental)")                                     =      1;
 
   95     zap[
'V'] = 
make_field(backVeto,      
"Apply retroactive veto.");
 
   96     zap[
'D'] = 
make_field(mode2D,        
"L1 mode: create 2D histogram with time differences of coincidences (heavy memory usage, ignored if TMax_ns = 0)");
 
   97     zap[
'O'] = 
make_field(globalOutputOnly,  
"Write only aggregate histograms");
 
   98     zap[
'M'] = 
make_field(multiplicityRange, 
"L1 mode: multiplicity range (ignored if TMax_ns = 0)")   = 
JRange<int>(2,31);
 
  105   catch(
const exception &error) {
 
  106     FATAL(error.what() << endl);
 
  112     FATAL(
"Frame time must be an integer multiple of bin width");
 
  118     load(detectorFile, detector);
 
  132   pts->configure(inputFile);
 
  134   int fEnd   = pts->rbegin()->getFrameIndex();
 
  135   int fStart = pts->begin( )->getFrameIndex();
 
  137   if (fEnd > inputFile.getUpperLimit()) {
 
  138     fEnd = fStart + inputFile.getUpperLimit();
 
  142   double tStart_ms = (fStart - 1) * 
getFrameTime() / 1.0e6;
 
  144   int     runNumber   = pts->begin()->getRunNumber();
 
  146   TString runTag      = Form(
"%d" , runNumber);
 
  148   double tRun_ms = tEnd_ms - tStart_ms; 
 
  150   NOTICE(
"START/END/DURATION [s]: " << tStart_ms / 1000 << 
" " << tEnd_ms / 1000 << 
" " << tRun_ms / 1000 << endl);
 
  169   int nx = (tEnd_ms - tStart_ms) / binWidth_ms;
 
  171   JManager_t RT_DOM(
new TH1F(
"RT_%", NULL, nx      , tStart_ms, tEnd_ms));  
 
  172   JManager_t NC_DOM(
new TH1F(
"NC_%", NULL, nx / 100, tStart_ms, tEnd_ms));  
 
  174   TString rt_tag = runTag + TString(
".RT_DET_%");
 
  175   TString nc_tag = runTag + TString(
".NC_DET_%"); 
 
  177   JManager_t RT_DET(
new TH1F(rt_tag, NULL, nx,       tStart_ms, tEnd_ms));  
 
  178   JManager_t NC_DET(
new TH1F(nc_tag, NULL, nx / 100, tStart_ms, tEnd_ms));  
 
  189     if (nx >= max_size) {
 
  190       FATAL(
"2D histogram size not supported by ROOT file output; limit input size (-n) below " << floor(max_size / 100.0) << endl);
 
  193     TString rt2d_tag = runTag + TString(
".RT2D_DET"); 
 
  195     hT = 
new h2d_t(rt2d_tag, NULL, nx, tStart_ms, tEnd_ms, ny, -TMax_ns, +TMax_ns);
 
  210   if (pts->hasNext()) {
 
  211     curr = *(pts->next());
 
  214     FATAL(
"Input file is too short.");
 
  219   for ( ; pts->hasNext() && counter != inputFile.getLimit(); ++counter) {
 
  221     STATUS(
"timeslice: " << setw(10) << counter << 
'\r'); 
DEBUG(endl);
 
  235     if (backVeto && ((in - ic) == 1)) { 
 
  237       summaryRouter.
update(nextSummary);
 
  242     for (JDAQTimeslice::const_iterator frame = curr.begin(); frame != curr.end(); ++frame) {
 
  244       const int      moduleID    = frame->getModuleID();
 
  246       const string   moduleLabel = 
getLabel(module); 
 
  248       TH1F* RD = RT_DOM[moduleLabel];
 
  254       if (frame->testHighRateVeto() || frame->testFIFOStatus()) {
 
  256           veto[pmt] = ( frame->testHighRateVeto(pmt) || frame->testFIFOStatus(pmt) );
 
  262       if (nextSummary != NULL) {
 
  276       NC_DOM[moduleLabel]->Fill(tTimeslice_ms, 
count(veto.begin(), veto.end(), 
false));
 
  280       JSuperFrame2D_t& buffer2D = JSuperFrame2D_t::demultiplex(*frame, module, totSelector_ns);
 
  282       for (JSuperFrame2D_t::iterator i = buffer2D.begin(); i != buffer2D.end(); ++i) {
 
  283         if (veto[i->getPMTAddress()]) { 
 
  288       buffer2D.preprocess(JPreprocessor::join_t, match);
 
  290       JSuperFrame1D_t& data = JSuperFrame1D_t::multiplex(buffer2D); data.pop_back();
 
  295       if (data.size() > 1) {
 
  300           sort(data.begin(), data.end());
 
  307           const double tHit_ms = tTimeslice_ms + (p->getT() / 1.0e6);
 
  309           if (TMax_ns == 0.0) { 
 
  317             while (++q != data.end() && q->getT() - p->getT() <= TMax_ns) {}
 
  321             if (multiplicityRange(M)) {
 
  333                     double dt = JCombinatorics::getSign(__p->getPMT(), __q->getPMT()) * (__q->getT() - __p->getT());
 
  335                     hT->Fill(tHit_ms, dt, 1.0 / W);
 
  353     if (nextSummary != NULL) { 
delete nextSummary; }
 
  366   NOTICE(
"Processing histograms." << endl);
 
  368   for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
 
  370     string moduleLabel = 
getLabel(*module);
 
  372     if (RT_DOM.count(moduleLabel) && NC_DOM.count(moduleLabel)) {
 
  374       TH1F* rt = RT_DOM.at(moduleLabel);
 
  375       TH1F* nc = NC_DOM.at(moduleLabel);
 
  377       for (
int b = 1; b <= rt->GetXaxis()->GetNbins(); b++) {
 
  379         double r = rt->GetBinContent(b);
 
  380         double t = rt->GetBinCenter( b);
 
  382         RT_DET[
"SUM"]->Fill(t, r);
 
  387       for (
int b = 1; b <= nc->GetXaxis()->GetNbins(); b++) {
 
  389         double n = nc->GetBinContent(b);
 
  390         double t = nc->GetBinCenter( b);
 
  392         NC_DET[
"SUM"]->Fill(t, n);
 
  398       DEBUG(moduleLabel << 
" not active." << endl);
 
  404   NOTICE(
"Writing output file" << endl);
 
  406   if (outputFile != 
"") {
 
  408     TFile out(outputFile.c_str(), 
"RECREATE");
 
  410     NOTICE(
"Writing 1D histograms" << endl);
 
  415     NOTICE(
"Writing 2D histogram" << endl);
 
  421     if (!globalOutputOnly) {
 
  423       TString dir_tag = runTag + TString(
".Modules");
 
  425       NOTICE(
"Writing individual modules histograms" << endl);
 
  427       TDirectory* dir = out.mkdir(dir_tag);
 
  432     NOTICE(
"Closing file" << endl);
 
Utility class to parse command line options. 
 
void update(const JDAQSummaryslice *ps)
Update router. 
 
int main(int argc, char *argv[])
 
ROOT TTree parameter settings of various packages. 
 
Basic data structure for L0 hit. 
 
const JModule & getModule(const JObjectID &id) const 
Get module parameters. 
 
Data structure for a composite optical module. 
 
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance. 
 
std::string getLabel(const JLocation &location)
Get module label for monitoring and other applications. 
 
Auxiliary class to select ROOT class based on class name. 
 
Router for direct addressing of module data in detector data structure. 
 
const JDAQSummaryFrame & getSummaryFrame(const JDAQModuleIdentifier &module) const 
Get summary frame. 
 
Long64_t counter_type
Type definition for counter. 
 
Dynamic ROOT object management. 
 
Auxiliary class for a type holder. 
 
double getTimeOfRTS(const JDAQChronometer &chronometer)
Get time of last RTS in ns since start of run for a given chronometer. 
 
Template definition for direct access of elements in ROOT TChain. 
 
Data structure for detector geometry and calibration. 
 
long long int factorial(const long long int n)
Determine factorial. 
 
Auxiliary interface 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. 
 
1-dimensional frame with time calibrated data from one optical module. 
 
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...
 
I/O formatting auxiliaries. 
 
Reduced data structure for L0 hit. 
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
 
double getFrameTime()
Get frame time duration. 
 
Data storage class for rate measurements of all PMTs in one module. 
 
Match operator for consecutive hits. 
 
Router for fast addressing of summary data in JDAQSummaryslice data structure as a function of the op...
 
General purpose messaging. 
 
Auxiliary class to select JTreeScanner based on ROOT class name. 
 
Scanning of objects from multiple files according a format that follows from the extension of each fi...
 
bool testHighRateVeto() const 
Test high-rate veto status. 
 
void load(const std::string &file_name, JDetector &detector)
Load detector from input file. 
 
Utility class to parse command line options. 
 
alias put_queue eval echo n
 
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
 
2-dimensional frame with time calibrated data from one optical module. 
 
Auxiliary class to select DAQ hits based on time-over-treshold value. 
 
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 source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
 
const unsigned int h2d_limit
 
bool testFIFOStatus() const 
Test FIFO status.