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 =
dynamic_cast<TObject*
>(nextkey()))) {
75 if (
auto c =
dynamic_cast<TCanvas*
>(obj); c !=
nullptr) {
78 auto it = clist.find(c->GetName());
79 if (it != clist.end()) {
80 process_canvas = it->second;
82 if (!process_canvas)
continue;
85 std::string cname = c->GetName();
86 create_directories((outpath / cname).parent_path());
87 if (
m_asPNG) c->Print((outpath / (cname +
".png")).c_str());
88 if (
m_asJPEG) c->Print((outpath / (cname +
".jpg")).c_str());
89 if (
m_asPDF) c->Print((outpath / (cname +
".pdf")).c_str());
90 if (
m_asROOT) c->Print((outpath / (cname +
".root")).c_str());
91 if (
m_asJSON) c->Print((outpath / (cname +
".json")).c_str());
94 B2INFO(
"Saved " << saved_canvases <<
" of " << seq->GetEntries() <<
" objects.");
static const CanvasUpdatedList & getCanvasUpdatedList()
Get the list of the canvas update status.
DQMHistAnalysisModule()
Constructor / Destructor.
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.