#ifndef __JDB_JRUNQUALITY__ #define __JDB_JRUNQUALITY__ #include #include #include #include #include "JDB/JRunSummaryNumbers.hh" /** * \author mdejong */ namespace JDATABASE {} namespace JPP { using namespace JDATABASE; } namespace KM3NeT { namespace DB { class ResultSet; } } namespace JDATABASE { using KM3NeT::DB::ResultSet; /** * Auxiliary data structure for data quality. * * For ASCII I/O, the number, order and type of the data members of this data structure * should be compatible with the output of the script JQAQC.sh. */ struct JRunQuality : public TObject { static const char* const getName() { return JRunSummaryNumbers::getName(); } //!< Table name struct JPrescaler : public TObject { JPrescaler() : prescale(0) {} int prescale; ClassDef(JPrescaler, 1); }; struct JEnabled : public TObject { JEnabled() : enabled(0) {} int enabled; ClassDef(JEnabled, 1); }; JRunQuality() : GIT("?"), JPP("?"), nb_of_meta(0), UUID("?"), detector(0), run(0), livetime_s(0.0), UTCMin_s(0.0), UTCMax_s(0.0), trigger3DMuon(), trigger3DShower(), triggerMXShower(), triggerNB(), writeL0(), writeL1(), writeL2(), writeSN(), JDAQTimeslice(0), JDAQTimesliceL0(0), JDAQTimesliceL1(0), JDAQTimesliceL2(0), JDAQTimesliceSN(0), JDAQSummaryslice(0), JDAQEvent(0), JTriggerReprocessor(0), JTrigger3DShower(0), JTriggerMXShower(0), JTrigger3DMuon(0), JTriggerNB(0), in_sync(0), out_sync(0), DAQ(0.0), WR(0.0), HRV(0.0), FIFO(0.0), PMTs(0.0), MEAN_Rate_Hz(0.0), RMS_Rate_Hz(0.0), hrv_fifo_failures(0), duplic_timeslices(0), Acoustics(0), zero_AHRS(0), mean_AHRS(0.0), name("?"), value(0.0), in_usync(0), out_usync(0), event_duration(0.0) {} /** * Constructor. * * \param ID detector identifier * \param run run number */ JRunQuality(const int ID, const int run) : JRunQuality() { this->detector = ID; this->run = run; } /** * Put value at given key. * * \param key key * \param value value */ void put(const std::string& key, const std::string& value); std::string GIT; ///< GIT version used to write QA/QC data std::string JPP; ///< Jpp version used to take data (see JPrintMeta.cc) int nb_of_meta; ///< Number of JMeta objects (see JPrintMeta.cc) std::string UUID; ///< UUID of raw data file int detector; ///< detector identifier int run; ///< run number double livetime_s; ///< livetime of data takig run (as determined from KM3NETDAQ::JDAQSummaryslice data) double UTCMin_s; ///< minimal UTC time (from "runs" table) double UTCMax_s; ///< maximal UTC time (from "runs" table) JEnabled trigger3DMuon; ///< enable (1) or disable (0) of 3D-muon trigger JEnabled trigger3DShower; ///< enable (1) or disable (0) of 3D-shower trigger JEnabled triggerMXShower; ///< enable (1) or disable (0) of L1/L0 mixed trigger JEnabled triggerNB; ///< enable (1) or disable (0) of nano-beacon trigger JPrescaler writeL0; ///< pre-scaling of L0 data (0 implies off) JPrescaler writeL1; ///< pre-scaling of L1 data (0 implies off) JPrescaler writeL2; ///< pre-scaling of L2 data (0 implies off) JPrescaler writeSN; ///< pre-scaling of Supernova data (0 implies off) int JDAQTimeslice; ///< number of timeslices (reserved for rejected data) int JDAQTimesliceL0; ///< number of L0 timeslices int JDAQTimesliceL1; ///< number of L1 timeslices int JDAQTimesliceL2; ///< number of L2 timeslices int JDAQTimesliceSN; ///< number of Supernova timeslices int JDAQSummaryslice; ///< number of summary slices int JDAQEvent; ///< number of events int JTriggerReprocessor; ///< number of events following re-triggering of the data (see JTriggerReprocessor.cc) int JTrigger3DShower; ///< number of 3D-muon triggers (see JTriggerMonitor.cc) int JTriggerMXShower; ///< number of 3D-shower triggers (see JTriggerMonitor.cc) int JTrigger3DMuon; ///< number of L1/L0 mixed triggers (see JTriggerMonitor.cc) int JTriggerNB; ///< number of nano-beacon triggers (see JTriggerMonitor.cc) int in_sync; ///< number of modules in synchronisation with master clock (see JTurbot.cc) int out_sync; ///< number of modules out of synchronisation with master clock (see JTurbot.cc) double DAQ; ///< fraction of data frames with correct DAQ status (see JSummaryMonitor.cc) double WR; ///< fraction of data frames with correct White Rabbit status (see JSummaryMonitor.cc) double HRV; ///< fraction of PMTs with high-rate veto (see JSummaryMonitor.cc) double FIFO; ///< fraction of PMTs with FIFO (almost) full (see JSummaryMonitor.cc) double PMTs; ///< average number of PMTs with valid data (see JSummaryMonitor.cc) double MEAN_Rate_Hz; ///< mean rate from PMTs with valid data (see JSummaryMonitor.cc) double RMS_Rate_Hz; ///< RMS of rate from PMTs with valid data (see JSummaryMonitor.cc) int hrv_fifo_failures; ///< Number of PMT/timeslices with a rate > 50 kHz (after veto filter) (see JSummaryMonitor.cc) int duplic_timeslices; ///< Number of duplicated timeslices (see JSummaryMonitor.cc) int Acoustics; ///< number of acoustic events (see JAcousticsEventBuilder.cc) int zero_AHRS; ///< number of non-working compass (see software/JCompass/JAHRSMonitor.cc) double mean_AHRS; ///< mean number of compass measurements per working compass (see software/JCompass/JAHRSMonitor.cc) std::string name; ///< setup name (see JRunsetups) double value; ///< setup identifier (see JRunsetups) int in_usync; ///< number of modules in micro-synchronisation with master clock (see JSquid.cc) int out_usync; ///< number of modules out of micro-synchronisation with master clock (see JSquid.cc) int event_duration; ///< number of events with event duration exceeding preset value (see JMermaid.cc) ClassDef(JRunQuality, 4); }; /** * Less-than operator. * * \param first first run quality * \param second second run quality * \return true if first run quality less than second; else false */ inline bool operator<(const JRunQuality& first, const JRunQuality& second) { if (first.detector == second.detector) return first.run < second.run; else return first.detector < second.detector; } } #endif