13 #include <dqm/analysis/modules/DQMHistAutoCanvas.h>
27 DQMHistAutoCanvasModule::DQMHistAutoCanvasModule()
31 addParam(
"AutoCanvasFolders",
m_acfolders,
"List of histograms to automatically create canvases, empty for all",
32 std::vector<std::string>());
33 addParam(
"ExcludeFolders",
m_exclfolders,
"List of folders to exclude from create canvases, empty for none, \"all\" for all",
34 std::vector<std::string>());
35 B2DEBUG(1,
"DQMHistAutoCanvas: Constructor done.");
43 bool give_canvas =
false;
44 TString histoname = it.first;
47 auto split_result =
StringSplit(histoname.Data(),
'/');
48 if (split_result.size() <= 1)
continue;
49 auto dirname = split_result.at(0);
53 bool in_excl_folder =
false;
55 in_excl_folder =
true;
58 if (excl_folder == dirname) {
59 in_excl_folder =
true;
67 B2DEBUG(1,
"==" << wanted_folder <<
"==" << dirname <<
"==");
68 if (wanted_folder == std::string(histoname)) {
79 B2DEBUG(1,
"Auto Hist->Canvas for " << histoname);
80 histoname.ReplaceAll(
"/",
"_");
81 std::string name = histoname.Data();
84 if (split_result.size() > 1) {
85 std::string hname = split_result.at(1);
86 if ((dirname +
"/" + hname) ==
"softwaretrigger/skim") hname =
"skim_hlt";
87 TCanvas* c =
new TCanvas((dirname +
"/c_" + hname).c_str(), (
"c_" + hname).c_str());
88 m_cs.insert(std::pair<std::string, TCanvas*>(name, c));
91 std::string hname = histoname.Data();
92 TCanvas* c =
new TCanvas((
"c_" + hname).c_str(), (
"c_" + hname).c_str());
93 m_cs.insert(std::pair<std::string, TCanvas*>(name, c));
96 TCanvas* c =
m_cs[name];
97 B2DEBUG(1,
"DQMHistAnalysisInput: new canvas " << c->GetName());
102 auto hist = it.second.getHist();
104 if (hist->GetDimension() == 1) {
106 if (hist->GetMinimum() > 0) hist->SetMinimum(0);
108 }
else if (hist->GetDimension() == 2) {
The base class for the histogram analysis module.
std::vector< std::string > StringSplit(const std::string &s, const char delim)
Helper function for string token split.
static HistList & getHistList()
Get the list of the histograms.
void UpdateCanvas(std::string name, bool updated=true)
Mark canvas as updated (or not)
void event() override final
This method is called for each event.
std::map< std::string, TCanvas * > m_cs
The map of histogram names to canvas pointers for output.
std::vector< std::string > m_acfolders
The list of folders for which automatically generate canvases.
std::vector< std::string > m_exclfolders
The list of folders which are excluded from automatically generate canvases.
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.