19 #include "NovaTimingUtilities/TimingUtilities.h" 20 #include "DAQDataFormats/RawEvent.h" 21 #include "DAQDataFormats/RawTrigger.h" 55 void HistoList(std::list<std::string>& hlist);
59 std::vector<int>& dcm,
60 std::vector<int>& feb,
61 std::vector<int>& pix);
79 void NewRunNumber(
unsigned int run,
unsigned int subrun);
80 void NewSubrunNumber(
unsigned int run,
unsigned int subrun);
136 std::vector<int>&
dcm,
137 std::vector<int>&
feb,
138 std::vector<int>& pix) {
194 if (flatdaq_handle->size()!=1) {
195 std::cerr <<
"Required to have one and only one flat daq data object" 199 rawevt.readData((*flatdaq_handle)[0].getRawBufferPointer());
213 if (run==0 && subrun==0)
return;
223 sprintf(buff,
"fardet_nearline_r%.8d_s%.3d.onmon.root", run, subrun);
225 sprintf(buff,
"neardet_nearline_r%.8d_s%.3d.onmon.root", run, subrun);
227 sprintf(buff,
"ndos_nearline_r%.8d_s%.3d.onmon.root", run, subrun);
229 sprintf(buff,
"testbeam_nearline_r%.8d_s%.3d.onmon.root", run, subrun);
232 std::cout <<
"Writing end-of-run histograms to root file " 242 uint64_t RoundedTime = 0.;
244 unsigned long long RoundedTime = 0;
252 fStartHour = (double)hour + (
double)min/60.0 + (double)sec/3600.0
264 fEndHour = (double)hour + (
double)min/60.0 + (double)sec/3600.0
265 + (
long double)(
fEndNOvATime-RoundedTime)/64.0e6/3600.0;
277 TFile*
f =
new TFile(buff,
"RECREATE");
280 fHeader->Write(
"Header",TObject::kOverwrite,0);
303 if (run==0 && subrun==0)
return;
313 sprintf(buff,
"fardet_nearline_r%.8d_s%.3d.onmon.root", run, subrun);
315 sprintf(buff,
"neardet_nearline_r%.8d_s%.3d.onmon.root", run, subrun);
317 sprintf(buff,
"ndos_nearline_r%.8d_s%.3d.onmon.root", run, subrun);
319 sprintf(buff,
"testbeam_nearline_r%.8d_s%.3d.onmon.root", run, subrun);
322 std::cout <<
"Writing end-of-subrun histograms to root file " 332 uint64_t RoundedTime = 0.;
334 unsigned long long RoundedTime = 0;
342 fStartHour = (double)hour + (
double)min/60.0 + (double)sec/3600.0
354 fEndHour = (double)hour + (
double)min/60.0 + (double)sec/3600.0
355 + (
long double)(
fEndNOvATime-RoundedTime)/64.0e6/3600.0;
367 TFile*
f =
new TFile(buff,
"RECREATE");
370 fHeader->Write(
"Header",TObject::kOverwrite,0);
387 std::cout <<
"Removing inactive WatchList items: ";
404 for(
int i = 0;
i < 4; ++
i) {
406 case 0: csvpath =
"./";
break;
407 case 1: csvpath =
"./util/";
break;
409 csvpath =
getenv(
"SRT_PRIVATE_CONTEXT");
410 csvpath +=
"/OnlineMonitoring/util/";
413 csvpath =
getenv(
"SRT_PUBLIC_CONTEXT");
414 csvpath +=
"/OnlineMonitoring/util/";
418 if(access(csvpath.c_str(), F_OK) != -1) {
437 bool debug = p.
get<
bool > (
"Debug");
454 fHeader =
new TTree(
"Header",
"Header Information");
504 if (aok==
false)
return;
506 unsigned int run = rawevt.getRunNumber();
507 unsigned int subrun = rawevt.getSubrun();
508 unsigned int event = rawevt.getEventNumber();
509 unsigned int partition = rawevt.getPartition();
510 unsigned long int time = rawevt.getTrigger()->getTriggerStart();
542 if( rawevt.getHeader()->isEventIncomplete() ) {
549 static unsigned int count = 0;
553 << run <<
"/" << subrun <<
"/" <<
event <<
" " 555 << rawevt.getEventType() <<
":" 556 << rawevt.getEventSize()
std::vector< int > fIncompleteEvents
Header: a list of incomplete events.
void analyze(art::Event const &e)
uint16_t fEndDay
Header: day of last processed event (day of the month 1-31)
bool UnpackRawDaqData(art::Event const &evt, daqdataformats::RawEvent &rawevt)
Unpack the DAQ data, prepare summaries, and post data.
OnMonProd(fhicl::ParameterSet const &p)
TH1F * FindTH1F(const char *nm)
void PostResources(unsigned int run, unsigned int subrun, unsigned int event)
Class to manage the shared memory segment.
std::string fSHMname
Shared memory for communication.
int fLastEvent
Header: last event processed.
void Remove(int db, int dcm, int feb, int pix)
void AddToWatchList(int db, int dcm, int feb, int pix)
void WriteToRootFile(TFile *f)
static constexpr Double_t nm
struct IPCBlock * fIPC
Pointer to struct.
bool fWriteToFile
Output histogram file?
void SetDebug(bool debug)
void Update(unsigned int run, unsigned int subrun)
void GetList(std::vector< int > &db, std::vector< int > &dcm, std::vector< int > &feb, std::vector< int > &pix)
DEFINE_ART_MODULE(TestTMapFile)
bool convertNovaTimeToUnixTime(uint64_t const &inputNovaTime, struct timespec &outputUnixTime)
::xsd::cxx::tree::time< char, simple_type > time
void CurrentWatchList(std::vector< int > &db, std::vector< int > &dcm, std::vector< int > &feb, std::vector< int > &pix)
unsigned int fPartition
Partition of last event analyzed.
void NewRunNumber(unsigned int run, unsigned int subrun)
unsigned int fLastSubrun
Last subrun number analyzed.
TTree * fHeader
Header object to be written to disk with the histograms.
int fNevents
Header: number of events processed.
static const int kIPC_SERVER
Class to read, hold, and deliver histogram data.
void Add(int db, int dcm, int feb, int pix)
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
void NewSubrunNumber(unsigned int run, unsigned int subrun)
void RemoveFromWatchList(int db, int dcm, int feb, int pix)
double fStartHour
Header: hour of first processed event (since midnight 0.0 - 23.99999)
void UnpackRawEvent(daqdataformats::RawEvent &rawevt)
std::string getenv(std::string const &name)
T get(std::string const &key) const
double fEndHour
Header: hour of last processed event (since midnight 0.0 - 23.99999)
Notify subscribers when certain time/event intervals have elapsed.
void beginRun(const art::Run &R)
unsigned long int fStartNOvATime
Header: time of first processed event (in NOvA time - 64 MHz clock ticks) - initalized to -1 to make ...
A simple object that conatins all the global settings.
void HistoList(std::list< std::string > &hlist)
static Ticker & Instance()
static float min(const float a, const float b, const float c)
uint32_t fStartYear
Header: year of first processed event (actual years since 0 A.D.)
int fFirstEvent
Header: first event processed.
uint16_t fStartMonth
Header: month of first processed event (actual month 1-12)
uint16_t fStartDay
Header: day of first processed event (day of the month 1-31)
unsigned int fLastRun
Last run number analyzed.
static RawEventUnpacker & Instance()
void reconfigure(fhicl::ParameterSet const &p)
bool fTickerOn
Turned on in the control room.
static WatchListManager & Instance()
TH1F * FindTH1F(const char *nm)
TH2F * FindTH2F(const char *nm)
OnMonProdIPC(int m, const char *hdl)
static HistoSet & Instance()
static HistoTable & Instance(const char *f=0, Detector_t d=kALLDET)
OnMonProdIPC * fIPC
Communicates with viewer.
Hold the collection of histograms created by the producer.
uint32_t fEndYear
Header: year of last processed event (actual years since 0 A.D.)
unsigned long int fEndNOvATime
Header: time of last processed event (in NOvA time - 64 MHz clock ticks)
static Settings & Instance()
void GetNames(std::list< std::string > &h)
Online Monitoring package header.
bool fuseSHM
Use SHM to communicate with a viewer?
uint16_t fEndMonth
Header: month of last processed event (actual month 1-12)
bool convertUnixTimeToNovaTime(struct timespec const &inputUnixTime, uint64_t &outputNovaTime)
TH2F * FindTH2F(const char *nm)