14#include <dqm/analysis/modules/DQMHistAnalysisOutputImages.h>
37 setDescription(
"Module to produce output images during 'events' for dqm steering scripts.");
47 B2DEBUG(20,
"DQMHistAnalysisOutputImages: Constructor done.");
57 B2DEBUG(20,
"DQMHistAnalysisOutputImages: event called.");
59 B2ERROR(
"No valid EventMetaData.");
63 TSeqCollection* seq = gROOT->GetListOfCanvases();
72 int saved_canvases = 0;
74 while ((obj = (TObject*)nextkey())) {
75 if (obj->IsA()->InheritsFrom(
"TCanvas")) {
76 TCanvas* c = (TCanvas*) obj;
79 auto it = clist.find(c->GetName());
80 if (it != clist.end()) {
81 process_canvas = it->second;
83 if (!process_canvas)
continue;
86 std::string cname = c->GetName();
87 create_directories((outpath / cname).parent_path());
88 if (
m_asPNG) c->Print((outpath / (cname +
".png")).c_str());
89 if (
m_asJPEG) c->Print((outpath / (cname +
".jpg")).c_str());
90 if (
m_asPDF) c->Print((outpath / (cname +
".pdf")).c_str());
91 if (
m_asROOT) c->Print((outpath / (cname +
".root")).c_str());
92 if (
m_asJSON) c->Print((outpath / (cname +
".json")).c_str());
95 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
void initialize(void) override final
Initializer.
StoreObjPtr< EventMetaData > m_evtMetaDataPtr
The metadata for each event.
bool m_asJSON
flag: save as json file
bool m_asJPEG
flag: save as jpeg file
bool m_canvasSaveDefault
Save untagged canvas by default.
DQMHistAnalysisOutputImagesModule()
Constructor.
bool m_useExpRun
use and exp/run/ prefix
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.