14 #include <dqm/analysis/modules/DQMHistAnalysisOutputImages.h>
33 DQMHistAnalysisOutputImagesModule::DQMHistAnalysisOutputImagesModule()
36 setDescription(
"Module to produce output images during 'events' for dqm steering scripts.");
45 B2DEBUG(20,
"DQMHistAnalysisOutputImages: Constructor done.");
50 B2DEBUG(20,
"DQMHistAnalysisOutputImages: event called.");
52 TSeqCollection* seq = gROOT->GetListOfCanvases();
60 int saved_canvases = 0;
62 while ((obj = (TObject*)nextkey())) {
63 if (obj->IsA()->InheritsFrom(
"TCanvas")) {
64 TCanvas* c = (TCanvas*) obj;
67 auto it = clist.find(c->GetName());
68 if (it != clist.end()) {
69 process_canvas = it->second;
71 if (!process_canvas)
continue;
74 if (
m_asPNG) c->Print((outpath + c->GetName() +
".png").c_str());
75 if (
m_asJPEG) c->Print((outpath + c->GetName() +
".jpg").c_str());
76 if (
m_asPDF) c->Print((outpath + c->GetName() +
".pdf").c_str());
77 if (
m_asROOT) c->Print((outpath + c->GetName() +
".root").c_str());
78 if (
m_asJSON) c->Print((outpath + c->GetName() +
".json").c_str());
81 B2INFO(
"Saved " << saved_canvases <<
" of " << seq->GetEntries() <<
" objects.");
The base class for the histogram analysis module.
static const CanvasUpdatedList & getCanvasUpdatedList()
Get the list of the canvas update status.
bool m_asPDF
flag: save as pdf file
bool m_asPNG
flag: save as png file
bool m_asROOT
flag: save as root file
bool m_asJSON
flag: save as json file
bool m_asJPEG
flag: save as jpeg file
bool m_canvasSaveDefault
Save untagged canvase by default.
void event() override final
This method is called for each event.
std::string m_outputPath
Output path for saving images in sub-folders.
void setDescription(const std::string &description)
Sets the description of the module.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.