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 time_t now = time(0);
101 strftime(mbstr,
sizeof(mbstr),
"%c", localtime(&now));
102 B2INFO(
"[" << mbstr <<
"] before LoadMemFile");
104 TMemFile* file =
m_memory->LoadMemFile();
107 strftime(mbstr,
sizeof(mbstr),
"%c", localtime(&now));
108 B2INFO(
"[" << mbstr <<
"] after LoadMemFile");
110 const TDatime& mt = file->GetModificationDate();
111 TDatime mmt(mt.Convert());
112 std::string expno(
"UNKNOWN"), runno(
"UNKNOWN"), rtype(
"UNKNOWN");
115 TIter next(file->GetListOfKeys());
119 strftime(mbstr,
sizeof(mbstr),
"%c", localtime(&now));
120 B2INFO(
"[" << mbstr <<
"] before input loop");
122 while ((key = (TKey*)next())) {
123 auto obj = key->ReadObj();
124 if (obj ==
nullptr)
continue;
125 if (!obj->IsA()->InheritsFrom(
"TH1"))
continue;
130 TString a = h->GetName();
131 a.ReplaceAll(
":",
"");
133 B2DEBUG(1,
"DQMHistAnalysisInput: get histo " << a.Data());
136 if (
StringSplit(a.Data(),
'/').size() <= 1)
continue;
141 if (std::string(h->GetName()) == std::string(
"DQMInfo/expno")) expno = h->GetTitle();
142 if (std::string(h->GetName()) == std::string(
"DQMInfo/runno")) runno = h->GetTitle();
143 if (std::string(h->GetName()) == std::string(
"DQMInfo/rtype")) rtype = h->GetTitle();
147 strftime(mbstr,
sizeof(mbstr),
"%c", localtime(&now));
148 B2INFO(
"[" << mbstr <<
"] after input loop");
150 if (expno == std::string(
"UNKNOWN") || runno == std::string(
"UNKNOWN")) {
155 if (
m_c_info != NULL)
m_c_info->SetTitle((
m_memname +
": Exp " + expno +
", Run " + runno +
", RunType " + rtype +
", Last Updated "
156 + mmt.AsString()).c_str());
160 B2INFO(
"DQMHistAnalysisInput: " <<
m_memname +
": Exp " + expno +
", Run " + runno +
", RunType " + rtype +
", Last Updated " +
178 bool anyupdate =
false;
180 anyupdate |=
addHist(
"", h->GetName(), h);
181 B2DEBUG(1,
"Found : " << h->GetName() <<
" : " << h->GetEntries());
190 B2INFO(
"DQMHistAnalysisInput : endRun called");
195 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.
void clearCanvases(void)
Clear content of all Canvases.
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.