39   using namespace KM3NETDAQ;
 
   48   int       statPrintInterval_s;
 
   55   int       preTriggerThreshold;
 
   59   const string outputTag = 
"SNT";
 
   63     JParser<> zap(
"Supernova realtime monitor");
 
   65     zap[
'H'] = 
make_field(controlhost, 
"CH server (input)")         = 
"localhost";
 
   66     zap[
'L'] = 
make_field(ligier, 
"Ligier server (output)")         = 
"";
 
   70     zap[
'C'] = 
make_field(selector)         = getROOTClassSelection<JDAQTimesliceTypes_t>();
 
   71     zap[
'Q'] = 
make_field(queueLength,  
"number of timeslices of trigger queue")          = 100;
 
   72     zap[
'W'] = 
make_field(windowLength, 
"number of timeslices of trigger sliding window") = 5;
 
   73     zap[
'T'] = 
make_field(TMax_ns, 
"coincidence time window [ns]") = 10;
 
   75     zap[
'S'] = 
make_field(preTriggerThreshold, 
"muon veto multiplicity threshold") = 4;
 
   76     zap[
'V'] = 
make_field(TVeto_ns, 
"muon veto time interval") = 1000;
 
   77     zap[
's'] = 
make_field(summaryFile, 
"summary output file") = 
"";
 
   78     zap[
'P'] = 
make_field(statPrintInterval_s, 
"statistics & file print interval [s]") = 30;
 
   85   catch(
const exception &error) {
 
   86     FATAL(error.what() << endl);
 
   89   if (queueLength < windowLength) {
 
   90     FATAL(
"Length of the trigger window must be smaller than the queue.");
 
   96   using namespace JSUPERNOVA;
 
  117   const int detectorSize = 
detector.size();
 
  127   typedef priority_queue<trigger_type, vector<trigger_type>, greater<trigger_type> > queue_type;
 
  129   typedef deque<trigger_type> window_type; 
 
  138   window_type trgWindow;
 
  145   long int counter_live_ts = 0;
 
  146   long int counter_lost_ts = 0;
 
  166     const double asyncTimeout_us = 1000.0;
 
  182     for (
int i = 0; 
i != numberOfTimeouts; ) {
 
  186         data_type* timeslice = 
in.next();
 
  188         DEBUG(timeslice->getDAQHeader() << endl);
 
  190         int timesliceSize = timeslice->size();
 
  196         const int r = timeslice->getRunNumber();
 
  202             NOTICE(
"RUN CHANGE" << endl);
 
  204             while (trgQueue.size() > 0) { trgQueue.pop(); }
 
  224         while ( sm.hasNext() ) {
 
  232           for (JDAQSummaryslice::const_iterator summary_frame = summary->begin();
 
  233                summary_frame != summary->end();
 
  236             int DOMID = summary_frame->getModuleID();
 
  239               rates[frame_index][DOMID] += summary_frame->getRate(ipmt, 1.0/1000);
 
  242             pmts[frame_index] += summary_frame->countActiveChannels();
 
  247         DEBUG(
"LOADING EVENTS" << endl);
 
  249         while ( ev.hasNext() ) {
 
  253           DEBUG(
"EVT " << event->getDAQHeader() << endl);
 
  255           int frame_index = 
event->getFrameIndex();
 
  257           veto[frame_index].push_back(
JVeto(*event, hitRouter));
 
  265         JDataSN preTrigger(TMax_ns, preTriggerThreshold);
 
  267         preTrigger(timeslice, moduleRouter);
 
  273         trgQueue.push(trigger);
 
  279         if (trgQueue.size() >= (unsigned) queueLength) {
 
  281           while (trgWindow.size() <= (unsigned) windowLength) {
 
  283             trigger_type pending = trgQueue.top();
 
  285             if ( trgWindow.size() == 0 || pending > trgWindow.back() ) {
 
  287               trgWindow.push_back( pending );
 
  302           int trg_cc_counts   = 0;
 
  303           int trg_cc_modules  = 0;
 
  306           int trg_ev_counts   = 0;
 
  307           int trg_ev_modules  = 0;
 
  311           for (
int its = 0; its < windowLength; its++) {
 
  313             const int frame_index = trgWindow[its].frameIndex;
 
  316             if (veto.count(frame_index)) { 
 
  317               vetoSet = veto.at(frame_index);
 
  322             set<int> cc_vec = trgWindow[its].getModules(F_M1);
 
  323             set<int> ev_vec = trgWindow[its].getModules(F_MV);
 
  325             cc_modules.insert(cc_vec.begin(), cc_vec.end());
 
  326             ev_modules.insert(ev_vec.begin(), ev_vec.end());
 
  328             trg_cc_counts += count_if(trgWindow[its].begin(), trgWindow[its].end(), F_M1);
 
  329             trg_ev_counts += count_if(trgWindow[its].begin(), trgWindow[its].end(), F_MV);
 
  333           trg_cc_modules = cc_modules.size();
 
  334           trg_ev_modules = ev_modules.size();
 
  338           int currentFrame             = trgWindow[0].frameIndex;
 
  341           trgWindow.pop_front();
 
  345           ++stats[trg_cc_counts];
 
  349           int    activeModules =  -1;
 
  350           double detectorRate  = 0.0;
 
  352           if (!rates.empty()          &&
 
  353                 rates.count(currentFrame)) {
 
  358                  p != rates.at(currentFrame).end(); p++ ) {
 
  360               detectorRate  += p->second;
 
  362               activeModules += (p->second > 0);
 
  367             activeModules = timesliceSize;
 
  376           jd[
"active_doms"]        = activeModules;
 
  377           jd[
"detector_rate_MHz"]  = int(detectorRate / 1000.0);
 
  378           jd[
"run_number"]         = 
RUN;
 
  379           jd[
"frame_index"]        = currentFrame;
 
  381           jd[
"trigger"][
"cc"][
"c"] = trg_cc_counts;
 
  382           jd[
"trigger"][
"cc"][
"m"] = trg_cc_modules;
 
  383           jd[
"trigger"][
"ev"][
"c"] = trg_ev_counts;
 
  384           jd[
"trigger"][
"ev"][
"m"] = trg_ev_modules;
 
  385           jd[
"active_pmts"]        = pmts[currentFrame];
 
  387           string msg = jd.dump();
 
  399           if ( (counter_live_ts % ((
int)(statPrintInterval_s / frameTime_s)) == 0 ) ) {
 
  401             double livetime = counter_live_ts * frameTime_s;
 
  403             stats.setLiveTime(livetime);
 
  407             NOTICE(
"=> discarded out-of-order timeslices = " << counter_lost_ts << endl);          
 
  409             if (summaryFile != 
"") {
 
  410               ofstream of(summaryFile.c_str());
 
  411               of << stats.toSummaryFile();
 
  418           NOTICE(
"Filling trigger queue: " << trgQueue.size() << 
"/" << queueLength << 
'\r'); 
 
  423         NOTICE(
"timeout " << setw(3) << 
i << endl);
 
Utility class to parse command line options. 
 
int MyId(const std::string &nick_name)
Identify. 
 
Auxiliary class to define a veto time window on a set of optical modules. 
 
Auxiliary class to select ROOT class based on class name. 
 
SN filter based on veto window. 
 
Router for direct addressing of module data in detector data structure. 
 
virtual void reset() override
Reset pointer. 
 
Data structure for UTC time. 
 
Simple wrapper around JModuleRouter class for direct addressing of PMT data in detector data structur...
 
int getFrameIndex() const 
Get frame index. 
 
Auxiliary class for time values. 
 
void setDAQLongprint(const bool option)
Set DAQ print option. 
 
The template JSinglePointer class can be used to hold a pointer to an object. 
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
 
SN trigger statistics, the information is stored in the form of a count as a function of the trigger ...
 
double getFrameTime()
Get frame time duration. 
 
then rm i $OUTPUT_FILE fi let RUN
 
Auxiliary class to apply the supernova trigger to SN data. 
 
SN filter based on multiplicity selection optional suppression of multi-module coincidences WARNING: ...
 
Timeslice data structure for SN data. 
 
Object iteration through ControlHost. 
 
Auxiliary class to build the supernova trigger dataset. 
 
virtual const char * what() const override
Get error message. 
 
Normalisation of MUPAGE events. 
 
void load(const std::string &file_name, JDetector &detector)
Load detector from input file. 
 
std::string to_string(const T &value)
Convert value to string. 
 
do set_variable DETECTOR_TXT $WORKDIR detector
 
static const int NUMBER_OF_PMTS
Total number of PMTs in module. 
 
std::vector< JHit > data_type
 
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
 
int PutFullString(const JTag &tag, const std::string &buffer)
Send string. 
 
JTriggerCounter_t next()
Increment trigger counter. 
 
#define DEBUG(A)
Message macros. 
 
Auxiliary class to manage a set of vetoes.