Skip to content

Commit

Permalink
Added standalone CRV data viewer / prototype artdaq DQM
Browse files Browse the repository at this point in the history
  • Loading branch information
sam-grant committed Feb 10, 2025
1 parent b331f52 commit 4807f6e
Show file tree
Hide file tree
Showing 5 changed files with 459 additions and 0 deletions.
18 changes: 18 additions & 0 deletions otsdaq-mu2e-crv/ArtModules/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
include(BuildPlugins)

cet_build_plugin(CrvDQM art::module LIBRARIES REG
art_root_io::TFileService_service
artdaq_core_mu2e::artdaq-core-mu2e_Data
otsdaq_mu2e::otsdaq-mu2e_ArtModules
otsdaq::NetworkUtilities
ROOT::Hist
ROOT::Tree
ROOT::Core
ROOT::RIO
ROOT::Gui
ROOT::RHTTP
)

install_headers(SUBDIRS detail)
install_source(SUBDIRS detail)
install_fhicl(SUBDIRS fcl)
91 changes: 91 additions & 0 deletions otsdaq-mu2e-crv/ArtModules/CrvDQMStyle.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
// ROOT styling for CRV DQM
// Samuel Grant 2025

#ifndef CRV_DQM_STYLE_H
#define CRV_DQM_STYLE_H

#include "TH1.h"
#include "TH2.h"
#include "TStyle.h"
#include "TCanvas.h"
#include "TPad.h"
#include "TROOT.h"

class CrvDQMStyle {
public:
static void SetStyle() {

TStyle *style = new TStyle("CrvStyle", "CRV DQM styling");

// Basic canvas settings
style->SetCanvasColor(kWhite);
style->SetCanvasBorderMode(0);
style->SetPadColor(kWhite);
style->SetPadBorderMode(0);
style->SetPadTopMargin(0.05);
style->SetPadBottomMargin(0.13);
style->SetPadLeftMargin(0.15);
style->SetPadRightMargin(0.05);

// Font settings
style->SetTextFont(42);
style->SetLabelFont(42, "xyz");
style->SetTitleFont(42, "xyz");

// Text sizes
style->SetTextSize(0.045);
style->SetLabelSize(0.045, "xyz");
style->SetTitleSize(0.05, "xyz");

// Title positioning
style->SetTitleOffset(1.2, "y");
style->SetTitleOffset(1.0, "x");

// Canvas fill
style->SetFillColor(kWhite);
style->SetFillStyle(1001);

// Ticks and divisions
style->SetPadTickX(1);
style->SetPadTickY(1);
style->SetTickLength(0.015);
style->SetNdivisions(505, "xyz");

// Frame
style->SetFrameLineWidth(1);
style->SetLineWidth(1);

style->SetOptStat(0);

// Use current style - this works in 6.30
gROOT->SetStyle("CrvStyle");
gROOT->ForceStyle();
}

static void FormatHist(TH1* hist, const std::string& colour = "blue") {
if (!hist) return;
// Basic histogram-specific formatting
hist->SetStats(0);
hist->SetLineWidth(2);
hist->SetFillStyle(1001);
hist->SetLineStyle(1);
hist->GetYaxis()->SetTitleOffset(1.6);
hist->GetXaxis()->SetTitleOffset(1.2);

// Primary colours
if (colour == "blue") {
hist->SetLineColor(kAzure+2);
hist->SetFillColor(kAzure-9);
}
else if (colour == "green") {
hist->SetLineColor(kGreen+2);
hist->SetFillColor(kGreen-9);
}
else if (colour == "red") {
hist->SetLineColor(kRed+2);
hist->SetFillColor(kRed-9);
}
}
};

#endif
Loading

0 comments on commit 4807f6e

Please sign in to comment.