Skip to content
Snippets Groups Projects
Commit 27754977 authored by Cdaq User's avatar Cdaq User
Browse files

add more plots

parent 4a3b36bf
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,46 @@ R__LOAD_LIBRARY(libScandalizer.so)
#include "monitor/ExperimentMonitor.h"
#include "TStyle.h"
struct PlotMeta { int pad; std::string varname, opt; };
struct CanvasMeta { std::string subdir, name, title; int nrow, ncol, nbins; double xmin, xmax; std::vector<PlotMeta> plots; };
static std::vector<CanvasMeta> update_canvases = {
{"cher/", "ch_peaks", "MaPMT Channel Peaks", 4, 4, 400, 0, 4096, {
{1, "Cer11_5_Ppeak", "PFC"}, {2, "Cer12_5_Ppeak", "PFC"}, {3, "Cer13_5_Ppeak", "PFC"}, {4, "Cer14_5_Ppeak", "PFC"},
{5, "Cer21_5_Ppeak", "PFC"}, {6, "Cer22_5_Ppeak", "PFC"}, {7, "Cer23_5_Ppeak", "PFC"}, {8, "Cer24_5_Ppeak", "PFC"},
{9, "Cer31_5_Ppeak", "PFC"}, {10, "Cer32_5_Ppeak", "PFC"}, {11, "Cer33_5_Ppeak", "PFC"}, {12, "Cer34_5_Ppeak", "PFC"},
{13, "Cer41_5_Ppeak", "PFC"}, {14, "Cer42_5_Ppeak", "PFC"}, {15, "Cer43_5_Ppeak", "PFC"}, {16, "Cer44_5_Ppeak", "PFC"},
}},
{"cher/", "ch_times", "MaPMT Channel Timings", 4, 4, 63, 0, 62, {
{1, "Cer11_5_Ptime", "PFC"}, {2, "Cer12_5_Ptime", "PFC"}, {3, "Cer13_5_Ptime", "PFC"}, {4, "Cer14_5_Ptime", "PFC"},
{5, "Cer21_5_Ptime", "PFC"}, {6, "Cer22_5_Ptime", "PFC"}, {7, "Cer23_5_Ptime", "PFC"}, {8, "Cer24_5_Ptime", "PFC"},
{9, "Cer31_5_Ptime", "PFC"}, {10, "Cer32_5_Ptime", "PFC"}, {11, "Cer33_5_Ptime", "PFC"}, {12, "Cer34_5_Ptime", "PFC"},
{13, "Cer41_5_Ptime", "PFC"}, {14, "Cer42_5_Ptime", "PFC"}, {15, "Cer43_5_Ptime", "PFC"}, {16, "Cer44_5_Ptime", "PFC"},
}},
{"ec/", "ec_peaks", "Calorimeter Channel Peaks", 3, 3, 400, 0, 4096, {
{1, "C4_Ppeak", "PFC"}, {2, "C6_1_Ppeak", "PFC"}, {3, "C7_1_Ppeak", "PFC"},
{4, "C5_1_Ppeak", "PFC"}, {5, "C9_1_Ppeak", "PFC"}, {6, "C8_1_Ppeak", "PFC"},
{7, "C1_Ppeak", "PFC"}, {8, "C2_Ppeak", "PFC"}, {9, "C3_Ppeak", "PFC"},
}},
{"ec/", "ec_times", "Calorimeter Channel Timings", 3, 3, 63, 0, 62, {
{1, "C4_Ptime", "PFC"}, {2, "C6_1_Ptime", "PFC"}, {3, "C7_1_Ptime", "PFC"},
{4, "C5_1_Ptime", "PFC"}, {5, "C9_1_Ptime", "PFC"}, {6, "C8_1_Ptime", "PFC"},
{7, "C1_Ptime", "PFC"}, {8, "C2_Ptime", "PFC"}, {9, "C3_Ptime", "PFC"},
}},
{"sc/", "sc_peaks", "Scintillator Channel Peaks", 3, 4, 400, 0, 4096, {
{1, "S2_1_Ppeak", "PFC"}, {2, "S2_2_Ppeak", "PFC"}, {3, "S2_3_Ppeak", "PFC"}, {4, "S2_4_Ppeak", "PFC"},
{5, "S2_5_Ppeak", "PFC"}, {6, "S2_6_Ppeak", "PFC"}, {7, "S2_7_Ppeak", "PFC"}, {8, "S2_8_Ppeak", "PFC"},
{9, "S2_9_Ppeak", "PFC"}, {10, "S2_10_Ppeak", "PFC"}, {11, "S2_11_Ppeak", "PFC"},
}},
{"sc/", "sc_times", "Scintillator Channel Timings", 3, 4, 63, 0, 62, {
{1, "S2_1_Ptime", "PFC"}, {2, "S2_2_Ptime", "PFC"}, {3, "S2_3_Ptime", "PFC"}, {4, "S2_4_Ptime", "PFC"},
{5, "S2_5_Ptime", "PFC"}, {6, "S2_6_Ptime", "PFC"}, {7, "S2_7_Ptime", "PFC"}, {8, "S2_8_Ptime", "PFC"},
{9, "S2_9_Ptime", "PFC"}, {10, "S2_10_Ptime", "PFC"}, {11, "S2_11_Ptime", "PFC"},
}},
};
hallc::MonitoringDisplay *CreateMonitorDisplay(const std::string &root_dir, int port, TTree *tree)
{
gStyle->SetHistFillStyle(3002);
......@@ -25,39 +65,31 @@ hallc::MonitoringDisplay *CreateMonitorDisplay(const std::string &root_dir, int
auto dply = new hallc::MonitoringDisplay(port);
dply->SetRootFolder(root_dir);
// cherenkov channels
dply->CreateDisplayPlot("cher", "cher",
[] (hallc::DisplayPlot& plt) {
plt._plot_data._canvas = new TCanvas("cher", "MaPMT Channels", 1280, 720); // 720p HD
plt._plot_data._canvas->Divide(4, 4);
for (int i = 1; i <= 4; ++i) {
for (int j = 1; j <= 4; ++j) {
plt._plot_data._canvas->cd((i - 1)*4 + j);
auto chn = fmt::format("Cer{}{}_5_Ppeak", i, j);
auto h1f = new TH1F(("h" + chn).c_str(), chn.c_str(), 400, 0, 4096);
for (auto &c : update_canvases) {
dply->CreateDisplayPlot(c.subdir, c.name,
[c] (hallc::DisplayPlot& plt) {
plt._plot_data._canvas = new TCanvas(c.name.c_str(), c.title.c_str(), 1280, 720); // 720p HD
plt._plot_data._canvas->Divide(c.nrow, c.ncol);
for (auto &p : c.plots) {
plt._plot_data._canvas->cd(p.pad);
auto h1f = new TH1F(("h" + p.varname).c_str(), p.varname.c_str(), c.nbins, c.xmin, c.xmax);
plt._plot_data._hists1.push_back(h1f);
h1f->Draw("PFC");
h1f->Draw(p.opt.c_str());
gPad->SetLogy();
h1f->GetYaxis()->SetRangeUser(1, 1e5);
}
}
return 0;
},
[tree] (hallc::DisplayPlot& plt) {
[c, tree] (hallc::DisplayPlot& plt) {
// std::cout << "update canvas" << std::endl;
for (size_t i = 0; i < plt._plot_data._hists1.size(); ++i) {
TH1F *h1f = plt._plot_data._hists1[i];
plt._plot_data._canvas->cd(i + 1);
std::string name = h1f->GetName();
std::string title = h1f->GetTitle();
tree->Draw(fmt::format("{} >> {}", title, name).c_str());
// std::cout << name << ": " << h1f->Integral(1, 400) << std::endl;
for (auto &p : c.plots) {
plt._plot_data._canvas->cd(p.pad);
tree->Draw(fmt::format("{} >> {}", p.varname, "h" + p.varname).c_str());
}
return 0;
}
);
}
return dply;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment