8 #include <daq/dqm/DqmMasterCallback.h>
9 #include <framework/pcore/EvtMessage.h>
10 #include <framework/pcore/MsgHandler.h>
25 static int m_running = 0;
30 void* RunDqmMasterLogger(
void*)
34 DqmMasterCallback::DqmMasterCallback(
ConfigFile& config)
36 m_hltdir = config.get(
"dqmmaster.hltdir");
37 m_erecodir = config.get(
"dqmmaster.erecodir");
39 printf(
"DqmMasterCallback : hltdir = %s, erecodir = %s\n", m_hltdir.c_str(), m_erecodir.c_str());
50 DqmMasterCallback::~DqmMasterCallback()
55 void DqmMasterCallback::load(
const DBObject& ,
const std::string& runtype)
60 void DqmMasterCallback::start(
int expno,
int runno)
68 TText rc_clear(0, 0,
"DQMRC:CLEAR");
69 hdl.add(&rc_clear,
"DQMRC:CLEAR");
71 TText subdir(0, 0,
"DQMInfo");
72 hdl.add(&subdir,
"SUBDIR:DQMInfo") ;
74 TH1F h_expno(
"expno", to_string(m_expno).c_str(), 1, 0, 1);
75 hdl.add(&h_expno,
"expno");
77 TH1F h_runno(
"runno", to_string(m_runno).c_str(), 1, 0, 1);
78 hdl.add(&h_runno,
"runno");
80 TH1F h_rtype(
"rtype", m_runtype.c_str(), 1, 0, 1);
81 hdl.add(&h_rtype,
"rtype");
83 TText command(0, 0,
"COMMAND:EXIT");
84 hdl.add(&command,
"SUBDIR:EXIT");
86 TText rc_merge(0, 0,
"DQMRC:MERGE");
87 hdl.add(&rc_merge,
"DQMRC:MERGE");
91 (msg->
header())->reserved[0] = 0;
92 (msg->
header())->reserved[1] = numobjs;
94 m_sock_hlt->send(msg);
95 m_sock_reco->send(msg);
98 printf(
"expno = %d, runno = %d\n", m_expno, m_runno);
102 void DqmMasterCallback::stop()
105 if (m_running == 0)
return;
114 TMemFile* hlttmem = m_hltdqm->LoadMemFile();
115 TMemFile* erecotmem = m_erecodqm->LoadMemFile();
121 sprintf(outfile,
"%s/hltdqm_e%4.4dr%6.6d.root", m_hltdir.c_str(), m_expno, m_runno);
122 TFile* dqmtfile =
new TFile(outfile,
"RECREATE");
123 printf(
"HLT dqm file = %s\n", outfile);
126 TIter next(hlttmem->GetListOfKeys());
128 while ((key = (TKey*)next())) {
129 TH1* hist = (TH1*)key->ReadObj();
130 printf(
"HistTitle %s : entries = %f\n", hist->GetName(), hist->GetEntries());
131 TH1* cpyhst = (TH1*)hist->Clone();
140 }
else if (proc1 < 0) {
141 perror(
"DQMMASTER : fork HLTDQM writing");
148 sprintf(outfile,
"%s/erecodqm_e%4.4dr%6.6d.root", m_erecodir.c_str(), m_expno, m_runno);
150 TFile* erdqmtfile =
new TFile(outfile,
"RECREATE");
151 printf(
"ERECO dqm file = %s\n", outfile);
154 TIter ernext(erecotmem->GetListOfKeys());
156 while ((erkey = (TKey*)ernext())) {
157 TH1* hist = (TH1*)erkey->ReadObj();
158 printf(
"HistTitle %s : entries = %f\n", hist->GetName(), hist->GetEntries());
159 TH1* cpyhst = (TH1*)hist->Clone();
168 }
else if (proc2 < 0) {
169 perror(
"DQMMASTER : fork ERECODQM writing");
173 int status1, status2;
174 waitpid(proc1, &status1, 0);
175 waitpid(proc2, &status2, 0);
181 void DqmMasterCallback::abort()
Class to manage streamed object.
EvtHeader * header()
Get pointer to EvtHeader.
A class to encode/decode an EvtMessage.
Abstract base class for different kinds of events.