14 #include <dqm/analysis/shminput/modules/DQMHistAnalysisInput.h>
36 addParam(
"HistMemoryPath",
m_mempath,
"Path to Input Hist memory", std::string(
""));
38 addParam(
"HistMemoryName",
m_memname,
"Name of Input Hist memory", std::string(
""));
39 addParam(
"HistMemoryUser",
m_username,
"Name of Input Hist memory owner", std::string(
"dqmdaq"));
45 B2DEBUG(1,
"DQMHistAnalysisInput: Constructor done.");
55 B2INFO(
"Open HistMemoryPath " <<
m_mempath);
62 B2INFO(
"Open HistMemoryName for user " <<
m_username <<
" Name " <<
m_memname <<
" Path " << pathname);
68 B2INFO(
"Open Shared Memory ID " <<
m_shm_id <<
" Semaphore ID " <<
m_sem_id);
71 B2FATAL(
"Information for shared memory is missing, either name or ID is needed!");
75 m_c_info =
new TCanvas(
"DQMInfo/c_info",
"");
81 B2INFO(
"DQMHistAnalysisInput: initialized.");
87 B2INFO(
"DQMHistAnalysisInput: beginRun called.");
100 strftime(mbstr,
sizeof(mbstr),
"%c", localtime(&now));
101 B2INFO(
"[" << mbstr <<
"] before LoadMemFile");
103 TMemFile* file =
m_memory->LoadMemFile();
106 strftime(mbstr,
sizeof(mbstr),
"%c", localtime(&now));
107 B2INFO(
"[" << mbstr <<
"] after LoadMemFile");
109 const TDatime& mt = file->GetModificationDate();
110 TDatime mmt(mt.Convert());
111 std::string expno(
"UNKNOWN"), runno(
"UNKNOWN"), rtype(
"UNKNOWN");
114 TIter next(file->GetListOfKeys());
118 strftime(mbstr,
sizeof(mbstr),
"%c", localtime(&now));
119 B2INFO(
"[" << mbstr <<
"] before input loop");
121 while ((key = (TKey*)next())) {
122 auto obj = key->ReadObj();
123 if (obj ==
nullptr)
continue;
124 if (!obj->IsA()->InheritsFrom(
"TH1"))
continue;
129 TString a = h->GetName();
130 a.ReplaceAll(
":",
"");
132 B2DEBUG(1,
"DQMHistAnalysisInput: get histo " << a.Data());
135 if (
StringSplit(a.Data(),
'/').size() <= 1)
continue;
140 if (std::string(h->GetName()) == std::string(
"DQMInfo/expno")) expno = h->GetTitle();
141 if (std::string(h->GetName()) == std::string(
"DQMInfo/runno")) runno = h->GetTitle();
142 if (std::string(h->GetName()) == std::string(
"DQMInfo/rtype")) rtype = h->GetTitle();
146 strftime(mbstr,
sizeof(mbstr),
"%c", localtime(&now));
147 B2INFO(
"[" << mbstr <<
"] after input loop");
149 if (expno == std::string(
"UNKNOWN") || runno == std::string(
"UNKNOWN")) {
154 if (
m_c_info != NULL)
m_c_info->SetTitle((
m_memname +
": Exp " + expno +
", Run " + runno +
", RunType " + rtype +
", Last Updated "
155 + mmt.AsString()).c_str());
159 B2INFO(
"DQMHistAnalysisInput: " <<
m_memname +
": Exp " + expno +
", Run " + runno +
", RunType " + rtype +
", Last Updated " +
177 bool anyupdate =
false;
179 anyupdate |=
addHist(
"", h->GetName(), h);
180 B2DEBUG(1,
"Found : " << h->GetName() <<
" : " << h->GetEntries());
189 B2INFO(
"DQMHistAnalysisInput : endRun called");
191 TIter nextckey(gROOT->GetListOfCanvases());
192 TObject* cobj = NULL;
194 while ((cobj =
dynamic_cast<TObject*
>(nextckey()))) {
195 if (cobj->IsA()->InheritsFrom(
"TCanvas")) {
196 (
dynamic_cast<TCanvas*
>(cobj))->Clear();
203 B2INFO(
"terminate called");
The base class for the histogram analysis module.
static void clearHistList(void)
Clears the list of histograms.
std::vector< std::string > StringSplit(const std::string &s, const char delim)
Helper function for string token split.
void setRunType(std::string &t)
Set the Run Type.
static bool addHist(const std::string &dirname, const std::string &histname, TH1 *h)
Add histogram.
static void initHistListBeforeEvent(void)
Reset the list of histograms.
void ExtractEvent(std::vector< TH1 * > &hs)
Extract event processed from daq histogram, called from input module.
void setReturnValue(int value)
Sets the return value for this module as integer.
REG_MODULE(arichBtest)
Register the Module.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Abstract base class for different kinds of events.