Jpp  18.2.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
KM3NETDAQ::JDataWriter::JRunDB Struct Reference

Map run number to trigger parameters. More...

Inheritance diagram for KM3NETDAQ::JDataWriter::JRunDB:
std::map< int, JValue_t >

Public Member Functions

void reset (const int run)
 Remove all entries before given run. More...
 
bool is_written (const int run) const
 Check if trigger parameters have been written for given run. More...
 
void read (const char *const data, const size_t size)
 Read trigger parameters. More...
 
void write (const int run, TFile *file)
 Write trigger parameters for given run if not yet done. More...
 

Detailed Description

Map run number to trigger parameters.

Definition at line 432 of file JDataWriter.cc.

Member Function Documentation

void KM3NETDAQ::JDataWriter::JRunDB::reset ( const int  run)
inline

Remove all entries before given run.

Parameters
runrun number

Definition at line 440 of file JDataWriter.cc.

441  {
442  while (!this->empty() && this->begin()->first < run) {
443  this->erase(this->begin());
444  }
445  }
void run()
Run as run control client following command messages via JNET::JControlHost.
Definition: JDAQClient.hh:690
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
bool KM3NETDAQ::JDataWriter::JRunDB::is_written ( const int  run) const
inline

Check if trigger parameters have been written for given run.

Parameters
runrun number
Returns
true if written; else false.

Definition at line 453 of file JDataWriter.cc.

454  {
455  const_iterator p = this->find(run);
456 
457  return p != this->end() && p->second.is_written;
458  }
void run()
Run as run control client following command messages via JNET::JControlHost.
Definition: JDAQClient.hh:690
void KM3NETDAQ::JDataWriter::JRunDB::read ( const char *const  data,
const size_t  size 
)
inline

Read trigger parameters.

Parameters
datadata
sizesize

Definition at line 466 of file JDataWriter.cc.

467  {
468  using namespace std;
469  using namespace JPP;
470 
471 
472  const string buffer(data, size);
473 
474  istringstream in(buffer);
475 
476  int run = -1;
478 
479  in >> run;
480 
481  if (!in) {
482  THROW(JIOException, "Error reading run number for trigger parameters " << run << endl << in.rdbuf());
483  }
484 
485  in >> parameters;
486 
487  in.clear(std::ios::eofbit);
488 
489  if (!in) {
490  THROW(JIOException, "Error reading trigger parameters " << in.rdbuf());
491  }
492 
493  JValue_t& value = (*this)[run];
494 
495  if (value.count == 0) {
496  value.parameters = parameters;
497  }
498 
499  value.count += 1;
500 
501  if (!parameters.equals(value.parameters)) {
502  THROW(JException, "Inconsistent trigger parameters " << endl << value.parameters << " != " << endl << parameters);
503  }
504  }
General exception.
Definition: JException.hh:24
std::vector< char > buffer
internal buffer for incoming data
Definition: JDataWriter.cc:408
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
*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
Definition: diff-Tuna.sh:38
void run()
Run as run control client following command messages via JNET::JControlHost.
Definition: JDAQClient.hh:690
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
Definition: JCanberra.sh:46
Exception for I/O.
Definition: JException.hh:340
void KM3NETDAQ::JDataWriter::JRunDB::write ( const int  run,
TFile *  file 
)
inline

Write trigger parameters for given run if not yet done.

Parameters
runrun number
filepointer to ROOT file

Definition at line 512 of file JDataWriter.cc.

513  {
514  if (file != NULL) {
515 
516  iterator p = this->find(run);
517 
518  if (p != this->end() && p->second.count != 0 && !p->second.is_written) {
519 
520  file->WriteTObject(&p->second.parameters);
521 
522  p->second.is_written = true;
523  }
524  }
525  }
then usage $script[< detector identifier >< run range >]< QA/QCfile > nExample script to produce data quality plots nWhen a detector identifier and run range are data are downloaded from the database nand subsequently stored in the given QA QC file
Definition: JDataQuality.sh:19
void run()
Run as run control client following command messages via JNET::JControlHost.
Definition: JDAQClient.hh:690

The documentation for this struct was generated from the following file: