Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rendering plugins for 2024 HGCAL beam test events #3

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 53 additions & 24 deletions HGCalRenderPlugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,22 @@
class HGCalRenderPlugin : public DQMRenderPlugin {
public:
virtual bool applies(const VisDQMObject &o, const VisDQMImgInfo &) {
if (o.name.find("HGCAL/Digis") != std::string::npos)
if (o.name.find("HGCAL/Modules") != std::string::npos)
return true;
if (o.name.find("HGCAL/Maps") != std::string::npos)
else if (o.name.find("HGCAL/Layers") != std::string::npos)
return true;
if (o.name.find("HGCAL/Summary") != std::string::npos)
else if (o.name.find("HGCAL/Digis") != std::string::npos)
return true;
return false;
else
return false;
}

virtual void preDraw(TCanvas *c, const VisDQMObject &o, const VisDQMImgInfo &, VisDQMRenderInfo &) {
c->cd();
if (o.name.find("HGCAL/Summary/hex") != std::string::npos) {
//printf("[DEBUG] HGCAL/Maps/%s is loaded\n", o.name.c_str());
if (dynamic_cast<TH2Poly *>(o.object)) {
preDrawHex(o);
//printf("[DEBUG] HGCAL/Maps/%s is casted to TH2Poly\n", o.name.c_str());
} else {
//if(o.object) printf("[DEBUG] o.object is NOT empty\n");
//else printf("[DEBUG] o.object is NULL pointer\n");
//printf("[DEBUG] HGCAL/Maps/%s is failed to cast to TH2Poly\n", o.name.c_str());
}
c->SetRightMargin(0.15);

if (dynamic_cast<TH2Poly *>(o.object)) {
preDrawHex(o);
} else if (dynamic_cast<TH2F *>(o.object)) {
preDrawTH2(c, o);
} else if (dynamic_cast<TH1F *>(o.object)) {
Expand All @@ -67,20 +62,28 @@ class HGCalRenderPlugin : public DQMRenderPlugin {

void preDrawHex(const VisDQMObject &o) {
TH2Poly *obj = dynamic_cast<TH2Poly *>(o.object);
TString name(obj->GetName());
assert(obj);

//gStyle->SetPalette(kViridis);
gStyle->SetPalette(kBird);
obj->SetOption("colz");

//if (o.name.find("hex_channelId") !=std::string::npos) {
if (o.name.find("hex_channelId") != std::string::npos || o.name.find("hex_hgcrocPin") != std::string::npos || o.name.find("hex_sicellPadId") != std::string::npos) {
//customize display of hex plots
if (name.Contains("hex_channelId") || name.Contains("hex_hgcrocPin") || name.Contains("hex_sicellPadId")) {
gStyle->SetPaintTextFormat(".0f");
obj->SetMarkerSize(0.7);
obj->SetOption("colztext");
} else if (name.Contains("_layer_")) {
gStyle->SetPaintTextFormat(".2e");
obj->SetMarkerSize(2.0);
obj->SetOption("colztext");
} else {
gStyle->SetPaintTextFormat(".2f");
obj->SetMarkerSize(0.7);
obj->SetOption("colz");
}

obj->SetMarkerSize(0.7);
obj->SetOption("colztext");
obj->SetStats(kFALSE);
obj->GetXaxis()->CenterLabels();
obj->GetYaxis()->CenterLabels();
Expand All @@ -102,11 +105,13 @@ class HGCalRenderPlugin : public DQMRenderPlugin {
gStyle->SetPadBorderSize(0);
gStyle->SetOptStat(10);

if (o.name.find("h2d") != std::string::npos) {
if ( (o.name.find("econd") != std::string::npos) || (o.name.find("Quality") != std::string::npos) ) {
gStyle->SetOptStat(10);
gStyle->SetPalette(kCherry);
TColor::InvertPalette();
obj->SetStats(kFALSE);
obj->SetStats(kTRUE);
} else {
gStyle->SetOptStat(1111);
gStyle->SetPalette(1);
obj->SetStats(kTRUE);
}
Expand All @@ -133,10 +138,34 @@ class HGCalRenderPlugin : public DQMRenderPlugin {
TString name(obj->GetName());
assert(obj);

// printf("[DEBUG-tmp] %s\n", name.Data());
// Get the palette axis
TPaletteAxis *palette = (TPaletteAxis*)obj->GetListOfFunctions()->FindObject("palette");
if (palette) {
// Adjust title offset (moves title away from axis)
obj->GetZaxis()->SetTitleOffset(1.2);

// Rotate the title (angle in degrees)
// obj->GetZaxis()->SetTitleAngle(90); // Vertical title // not working

// You can also adjust other properties
obj->GetZaxis()->SetTitleFont(42);
obj->GetZaxis()->SetTitleSize(0.035);

// Force redraw to apply changes
c->Update();
}

//--------------------------------------------------
// Draw auxiliary lines
//--------------------------------------------------
std::vector<std::vector<double>> x_coords;
std::vector<std::vector<double>> y_coords;

if (name.Contains("LD_0")) {
if (name.Contains("_module_")) {
x_coords = aux::x_coords_LD_full;
y_coords = aux::y_coords_LD_full;
} else if (name.Contains("LD_0")) {
x_coords = aux::x_coords_LD_full;
y_coords = aux::y_coords_LD_full;
} else if (name.Contains("LD_3")) {
Expand All @@ -154,7 +183,7 @@ class HGCalRenderPlugin : public DQMRenderPlugin {
if (drawLine) {
TLine line;
line.SetLineStyle(1);
line.SetLineColor(2);
line.SetLineColor(kRed-7);
line.SetLineWidth(2);

for (unsigned iline = 0; iline < x_coords.size(); ++iline) {
Expand All @@ -173,7 +202,7 @@ class HGCalRenderPlugin : public DQMRenderPlugin {
text.SetTextFont(43);
text.SetTextSize(12);

if (name.Contains("HD")) {
if (name.Contains("HD") || name.Contains("MH")) {
double theta1 = 0.;
double theta2 = 4 * TMath::Pi() / 3.;
double theta3 = 2 * TMath::Pi() / 3.;
Expand Down Expand Up @@ -204,7 +233,7 @@ class HGCalRenderPlugin : public DQMRenderPlugin {
text.DrawText(x, y, v_texts[i]);
}

} else if (name.Contains("LD")) { // LD
} else if (name.Contains("LD") || name.Contains("ML") || name.Contains("_module")) { // LD
double theta1 = -TMath::Pi() / 3.;
double theta2 = TMath::Pi() / 3.;
double theta3 = TMath::Pi();
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ This repository tracks sparse CMS-HGCAL-DQM layouts and rendering plugins for sy
2. The code will be modified from time to time to meet the needs of beam tests at different stages
3. The DQM layout for the HGCAL beam tests differs slightly from the official one

# hgc-dqmgui (outdated)
> [!IMPORTANT]
> Please follow a link here: https://github.com/cms-DQM/dqmgui_prod_deployment/wiki (update: 2024)

Below are instructions on building a DQM GUI for the HGCAL. These commands are based on an official tutorial, [twiki/CMS/DQMGuiForUsers](https://twiki.cern.ch/twiki/bin/viewauth/CMS/DQMGuiForUsers), with additional steps for setting up HGCAL DQM. The procedure includes the following four steps:

- Step1: Deploy a dqmgui
Expand Down
74 changes: 34 additions & 40 deletions hgcal-layouts.py
Original file line number Diff line number Diff line change
@@ -1,45 +1,39 @@
def hgcallayout(i, p, *rows): i["HGCAL/Layouts/" + p] = DQMItem(layout=rows)

########### define varialbles for frequently used strings #############
hgcallink = " >>> <a href=https://twiki.cern.ch/twiki/bin/view/CMS/DQMShiftRPC>Description</a>"
summary = "summary map for hgcal, this is NOT an efficiency measurement. Each bin is normalized to 1 considering disconnected chamber"
noise = "Average number of noisy strip per roll, counted if a occupancy of single strip is greater than 3.5 times the average of a chamber"
hgcalevents = "Events processed by the RPC DQM"
fed = "FED Fatal Errors"
top = "RPC TOP Summary Histogram <br><font color=green><b>GREEN</b> - Good Chamber </font><br> <font color=blue><b>BLUE</b> - Chamber OFF</font><br> <font color=yellow><b>YELLOW</b> - Noisy Strip </font><br> <font color=orange><b>ORANGE</b> - Noisy Chamber </font><br> <font color=pink><b>PINK</b> - Partly Dead Chamber </font><br> <font color=red><b>RED</b> - Fully Dead Chamber </font><br> <font color=aqua><b>LIGHT BLUE</b> - Bad Occupancy Shape </font> <br>"
occupancy = "Occupancy "
clsize = "Cluster Size of RPC system"
nrofcl = "Number of clusters, i.e. reconstructed hits."
nrofdigi = "Number of single hits."
bx = "RPC BX distribution "
emtf = "RPC L1T EMTF information. "
hgcallink = " >>> <a href=https://hgcaldocs.web.cern.ch/>Description</a>"
quality = "summary of module status"
summary = "wafer map for hgcal"
digis = "digis information"

################### Links to TOP Summary Histograms #################################
#hgcallayout(dqmitems, "00-Summary_Map",
# [{ 'path': "HGCAL/Summary/p_adc", 'description': summary + hgcallink }])

hgcallayout(dqmitems, "01-ChannelId-0_1_5_0",
[{ 'path': "HGCAL/Summary/hex_channelId0_1_5_0", 'description': summary + hgcallink }])
hgcallayout(dqmitems, "02-ChannelId-0_2_5_0",
[{ 'path': "HGCAL/Summary/hex_channelId0_2_5_0", 'description': summary + hgcallink }])

hgcallayout(dqmitems, "03-Pedestal-0_1_5_0",
[{ 'path': "HGCAL/Summary/hex_pedestal0_1_5_0", 'description': summary + hgcallink }])
hgcallayout(dqmitems, "04-Pedestal-0_2_5_0",
[{ 'path': "HGCAL/Summary/hex_pedestal0_2_5_0", 'description': summary + hgcallink }])

#hgcallayout(dqmitems, "05-Correlation_Ch22",
# [{ 'path': "HGCAL/Digis/h2d_adc_channel_22", 'description': summary + hgcallink }])

##Noisy summary
#hgcallayout(dqmitems, "01-Noisy_summary_Map",
# [{ 'path': "HGCAL/EventInfo/noisySummaryMap", 'description': noise + hgcallink }])
#
##FED Fatal
#hgcallayout(dqmitems, "02-Fatal_FED_Errors",
# [{ 'path': "HGCAL/FEDIntegrity_EvF/FEDFatal", 'description': fed + hgcallink }])
#
##HGCAL Events
#hgcallayout(dqmitems, "03-HGCAL_Events",
# [{ 'path': "HGCAL/AllHits/HGCALEvents", 'description': hgcalevents + hgcallink }])
#
hgcallayout(dqmitems, "01-econdPayload",
[{ 'path': "HGCAL/Digis/econdPayload", 'description': quality + hgcallink }])
hgcallayout(dqmitems, "02-econdQualityH",
[{ 'path': "HGCAL/Digis/econdQualityH", 'description': quality + hgcallink }])
hgcallayout(dqmitems, "03-cbQualityH",
[{ 'path': "HGCAL/Digis/cbQualityH", 'description': quality + hgcallink }])
hgcallayout(dqmitems, "04-Module0-avgadc",
[{ 'path': "HGCAL/Modules/hex_avgadc_module_0", 'description': summary + hgcallink }])
hgcallayout(dqmitems, "05-Module1-avgadc",
[{ 'path': "HGCAL/Modules/hex_avgadc_module_1", 'description': summary + hgcallink }])
hgcallayout(dqmitems, "06-Module2-avgadc",
[{ 'path': "HGCAL/Modules/hex_avgadc_module_2", 'description': summary + hgcallink }])
hgcallayout(dqmitems, "07-Module3-avgadc",
[{ 'path': "HGCAL/Modules/hex_avgadc_module_3", 'description': summary + hgcallink }])
hgcallayout(dqmitems, "08-Module4-avgadc",
[{ 'path': "HGCAL/Modules/hex_avgadc_module_4", 'description': summary + hgcallink }])
hgcallayout(dqmitems, "09-Module5-avgadc",
[{ 'path': "HGCAL/Modules/hex_avgadc_module_5", 'description': summary + hgcallink }])
hgcallayout(dqmitems, "10-digis0-adc",
[{ 'path': "HGCAL/Digis/adc_module_0", 'description': digis + hgcallink }])
hgcallayout(dqmitems, "11-digis1-adc",
[{ 'path': "HGCAL/Digis/adc_module_1", 'description': digis + hgcallink }])
hgcallayout(dqmitems, "12-digis2-adc",
[{ 'path': "HGCAL/Digis/adc_module_2", 'description': digis + hgcallink }])
hgcallayout(dqmitems, "13-digis3-adc",
[{ 'path': "HGCAL/Digis/adc_module_3", 'description': digis + hgcallink }])
hgcallayout(dqmitems, "14-digis4-adc",
[{ 'path': "HGCAL/Digis/adc_module_4", 'description': digis + hgcallink }])
hgcallayout(dqmitems, "15-digis5-adc",
[{ 'path': "HGCAL/Digis/adc_module_5", 'description': digis + hgcallink }])
48 changes: 16 additions & 32 deletions quick_replacement.sh
Original file line number Diff line number Diff line change
@@ -1,38 +1,22 @@
#!/bin/bash
# script to be executed under current/sw/slc7_amd64_gcc630/cms/dqmgui/
current="."
destination="/data/srv/current/config/dqmgui"
backup="./backup"

dir="9.7.8"
ori_dir="original_9.7.8"
new_dir="new_feature_9.7.8.2"
function update(){
f=$1
d=$2

function copy()
{
file=$1
echo "cp ${new_dir}/${file} ${dir}/${file}"
cp ${new_dir}/${file} ${dir}/${file}
cp -p ${current}/$f $d
ls -lhrt $d/$f
}

function copy_dir()
{
file=$1
echo "cp -r ${new_dir}/${file} ${dir}/${file}"
cp -r ${new_dir}/${file} ${dir}/${file}
}

# backup original directory first
echo "cp -r $dir $ori_dir"
cp -r $dir $ori_dir

# update files for implementing TH2Poly
copy 128/bin/DQMCollector
copy 128/bin/visDQMIndex
copy 128/bin/visDQMRender
copy 128/lib/python2.7/site-packages/Monitoring/DQM/Accelerator.so
copy 128/lib/libDQMGUI.so

# replace the include directory
echo "mv ${dir}/128/include ${dir}/128/tmp"
mv ${dir}/128/include ${dir}/128/tmp
copy_dir 128/include
# backup workspaces-online.py
mkdir -p ${backup}
cp -p "/data/srv/current/config/dqmgui/workspaces-online.py" ${backup}

echo ">>> finished!"
# update rendering plugins for HGCAL DQM plots
update "workspaces-online.py" "${destination}"
update "HGCalRenderPlugin.cc" "${destination}/style"
update "hgcal-layouts.py" "${destination}/layouts"
update "HGCalAuxiliaryInfo.h" "${destination}/style"
34 changes: 21 additions & 13 deletions workspaces-online.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,29 @@
# (I.e.: Don't make a mess.)

# DQM workspaces:
server.workspace('DQMQuality', 0, 'Summaries', 'Summary')
server.workspace('DQMContent', 35, 'Calorimeters', 'HGCAL', '^HGCAL/', '',
# 'HGCAL/Layouts/00-Modules',
# 'HGCAL/Layouts/01-Digis',
"HGCAL/Digis/econdPayload",
"HGCAL/Digis/econdQualityH",
"HGCAL/Digis/cbQualityH",
"HGCAL/Modules/hex_avgadc_module_0",
"HGCAL/Modules/hex_avgadc_module_1",
"HGCAL/Modules/hex_avgadc_module_2",
"HGCAL/Modules/hex_avgadc_module_3",
"HGCAL/Modules/hex_avgadc_module_4",
"HGCAL/Modules/hex_avgadc_module_5",
"HGCAL/Digis/adc_module_0",
"HGCAL/Digis/adc_module_1",
"HGCAL/Digis/adc_module_2",
"HGCAL/Digis/adc_module_3",
"HGCAL/Digis/adc_module_4",
"HGCAL/Digis/adc_module_5",
)

#server.workspace('DQMQuality', 0, 'Summaries', 'Summary')
#server.workspace('DQMSummary', 1, 'Summaries', 'Reports')

server.workspace('DQMShift', 2, 'Summaries', 'Shift')
#server.workspace('DQMShift', 2, 'Summaries', 'Shift')

#server.workspace('DQMContent', 3, 'Summaries', 'Info', '^Info/', '',
# 'Info/Layouts/1 - HV and Beam Status per LumiSection',
Expand All @@ -30,12 +48,6 @@
#
#server.workspace('DQMContent', 4, 'Summaries', 'Everything', '^', '^')

server.workspace('DQMContent', 35, 'Calorimeters', 'HGCAL', '^HGCAL/', '',
'HGCAL/Layouts/00-Summary_Map',
'HGCAL/Layouts/01-ChannelId',
'HGCAL/Layouts/02-Pedestal',
)

# # Trigger workspaces:
# server.workspace('DQMContent', 10, 'Trigger', 'L1T', '^(L1T|L1T2016)/', '',
# # Please add plots to Stage2-QuickCollection layout in layouts/l1t-layouts.py
Expand Down Expand Up @@ -300,10 +312,6 @@
# 'Castor/Layouts/Digi/05 - DigiSize',
# )
#
# server.workspace('DQMContent', 35, 'Calorimeters', 'HGCAL', '^HGCAL/', '',
# 'HGCAL/Layouts/01 - Pedestal in ADC',
# )
#
# # Muons workspaces:
# server.workspace('DQMContent', 40, 'Muons', 'DT', '^DT/', '',
# 'DT/Layouts/00-Summary/00-DataIntegritySummary',
Expand Down