Example program to test generation of KM3NETDAQ::JDAQTimeslice with random data.  
More...
#include <string>
#include <iostream>
#include <iomanip>
#include <vector>
#include "TROOT.h"
#include "TFile.h"
#include "TH1D.h"
#include "TH2D.h"
#include "TRandom3.h"
#include "km3net-dataformat/online/JDAQ.hh"
#include "km3net-dataformat/online/JDAQClock.hh"
#include "km3net-dataformat/online/JDAQTimeslice.hh"
#include "JTimeslice/JRandomTimeslice.hh"
#include "JROOT/JManager.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
 
Go to the source code of this file.
 | 
| int  | main (int argc, char **argv) | 
|   | 
Example program to test generation of KM3NETDAQ::JDAQTimeslice with random data. 
- Author
 - mdejong 
 
Definition in file examples/JTimeslice/JRandomTimesliceWriter.cc.
 
      
        
          | int main  | 
          ( | 
          int  | 
          argc,  | 
        
        
           | 
           | 
          char **  | 
          argv  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Definition at line 29 of file examples/JTimeslice/JRandomTimesliceWriter.cc.
   33   using namespace KM3NETDAQ;
 
   36   Long64_t               numberOfSlices;
 
   44     JParser<> zap(
"Example program to test generation of time slices with random data.");
 
   48     zap[
'B'] = 
make_field(rate_Hz,             
"background rate [Hz]");
 
   49     zap[
'N'] = 
make_field(recycling,           
"number of recycles / time interval for sampling data") = make_pair(0, 0.0);
 
   55   catch(
const exception &error) {
 
   56     FATAL(error.what() << endl);
 
   60   gRandom->SetSeed(seed);
 
   66   for (Long64_t counter = 0; counter != numberOfSlices; ++counter) {
 
   68     STATUS(
"slice: " << setw(10) << counter << 
'\r'); 
DEBUG(endl);
 
   81       for (
double t1 = 0.0 * 
getFrameTime() + gRandom->Exp(period_ns); t1 < 0.5 * 
getFrameTime(); t1 += gRandom->Exp(period_ns)) {
 
   82         buffer.push_back(
JDAQHit(PMT_L0[0], t1, 0));
 
   87       for (
double t1 = 0.5 * 
getFrameTime() + gRandom->Exp(period_ns); t1 < 1.0 * 
getFrameTime(); t1 += gRandom->Exp(period_ns)) {
 
   88         buffer.push_back(
JDAQHit(PMT_L0[1], t1, 0));
 
   92     timeslice[0].
add(buffer.size(), buffer.data());
 
   97       h0->Fill((Double_t) hit->getT());
 
  100     for (
size_t i = 1; i <= recycling.first; ++i) {
 
  102       timeslice.
recycle(recycling.second);
 
  107         h0->Fill((Double_t) hit->getT());
 
Utility class to parse command line options. 
 
JDAQTimeslice & add(const JDAQTimeslice ×lice)
Add another timeslice. 
 
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. 
 
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
 
static const int NUMBER_OF_PMTS
Total number of PMTs in module. 
 
Timeslice with random data. 
 
unsigned char JPMT_t
PMT channel in FPGA. 
 
void recycle(const double T_ns)
Recycle time slice by randomly shuffling time intervals of data.