Skip to content

Commit

Permalink
Temp fixes to LAD GEM online gui monitoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
cdaq committed Mar 8, 2025
1 parent 02cd386 commit 4b94355
Show file tree
Hide file tree
Showing 4 changed files with 138 additions and 3 deletions.
3 changes: 2 additions & 1 deletion onlineGUI/CONFIG/LAD/PRODUCTION/gem.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
protorootfiles test_ssp.root
# protorootfile ../ROOTfiles/lad_gem_1685_100.root
rootfile ../ROOTfiles/lad_gem_1685_-1.root
guicolor orange
canvassize 1600 800

Expand Down
68 changes: 68 additions & 0 deletions onlineGUI/CONFIG/LAD/PRODUCTION/occupancy.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#include <algorithm>

void occupancy( int module, double Lx, double Ly, int axis=0, double dt_ns = 150.0, const char* spectrometer = "bb", const char* db_append = "gem" ){
//TTree *T = (TTree*) gFile->Get("T");

//gStyle->SetPalette(kRainBow);
//gStyle->SetPalette(53);

gStyle->SetOptStat(0);

gPad->cd();

//TH1D *hnstripskeep = new TH1D("hnstripskeep",

double area_cm2 = Lx*Ly;

TString histname;
if( axis == 0 ){
histname.Form("hClusterMultiplicity_%s_%s_m%d_U", spectrometer, db_append, module);
} else {
histname.Form("hClusterMultiplicity_%s_%s_m%d_V", spectrometer, db_append, module);
}

TH1D *htemp;
gFile->GetObject( histname.Data(), htemp );

double mean = htemp->GetMean();
double rms = htemp->GetRMS();


double xmin = (mean - 10.0*rms > -0.5 ) ? mean - 10.0*rms : -0.5;
double xmax = mean + 10.0*rms;

htemp->GetXaxis()->SetRangeUser( xmin, xmax );

htemp->Draw();

double ymax = htemp->GetBinContent(htemp->GetMaximumBin());

htemp->GetYaxis()->SetRangeUser(0, 1.5*ymax );

// double xmin = std::max( -0.5,mean-10.0*rms);
//double xmax = mean+10.0*rms;

TPaveText *p = new TPaveText( xmin, 1.01*ymax, xmax, 1.5*ymax, "br" );

p->SetFillStyle(0);
p->SetBorderSize(0);

TString text;

text.Form("Module: %i", module);

p->AddText( text.Data() );

double rate = mean / area_cm2 / dt_ns * 1.e6;

text.Form( "Average clusters/event = %6.2f", mean );

p->AddText( text.Data() );

text.Form( "Hit rate = %6.2f (kHz/cm^{2})", rate );

p->AddText( text.Data() );

p->Draw();

}
66 changes: 66 additions & 0 deletions onlineGUI/CONFIG/LAD/PRODUCTION/stripmult.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#include <algorithm>

//Plot raw strip multiplicity and occupancy:
void stripmult( int layer=0, int axis=0, int nstrips=3840) {
//gStyle->SetPalette(kRainBow);
//gStyle->SetPalette(53);

gStyle->SetOptStat(0);
gPad->cd();

TH2D *htemp;
if( axis == 0 ){
gFile->GetObject( "h2_gem_NstripsU_layer", htemp );
} else {
gFile->GetObject( "h2_gem_NstripsV_layer", htemp );
}

TString hnametemp;
TH1D *htemp_yproj = htemp->ProjectionY( hnametemp.Format( "htemp_yproj_layer%d_axis%d", layer, axis ), layer+1, layer+1 );

TString htitle;
if( axis == 0 ){
htemp_yproj->SetTitle( htitle.Format( "Layer %d U strips; Number of strips fired;", layer ) );
} else {
htemp_yproj->SetTitle( htitle.Format( "Layer %d V strips; Number of strips fired;", layer ) );
}

double mean = htemp_yproj->GetMean();
double rms = htemp_yproj->GetRMS();

double xmin = (mean - 10.0*rms > -0.5 ) ? mean - 10.0*rms : -0.5;
double xmax = mean + 10.0*rms;

htemp_yproj->GetXaxis()->SetRangeUser( xmin, xmax );

htemp_yproj->Draw();

double ymax = htemp_yproj->GetBinContent(htemp_yproj->GetMaximumBin());

htemp_yproj->GetYaxis()->SetRangeUser(0, 1.5*ymax );

//double xmin = std::max( -0.5,mean-10.0*rms);
//double xmax = mean+10.0*rms;

TPaveText *p = new TPaveText( xmin, 1.01*ymax, xmax, 1.5*ymax, "br" );

p->SetFillStyle(0);
p->SetBorderSize(0);

TString text;

//double rate = mean / area_cm2 / dt_ns * 1.e6;
//double nstripmean = mean;
double occupancy = mean/double(nstrips);

text.Form( "Raw strip multiplicity = %6.1f", mean );

p->AddText( text.Data() );

text.Form( "Raw occupancy = %6.2f%%", occupancy * 100.0);

p->AddText( text.Data() );

p->Draw();

}
4 changes: 2 additions & 2 deletions onlineGUI/onlineGUI_v1.2.1/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ ALL_LIBS = $(LIBS)
CXXFLAGS += -DSTANDALONE

ifeq ($(ROOTMVERSION), 6)
CXXFLAGS += -std=c++11
MAKEDEPEND += -std=c++11
CXXFLAGS += -std=c++17
MAKEDEPEND += -std=c++17
endif

# Insert extra headers needed by GetRootFileName.C or GetRunNumber.C
Expand Down

0 comments on commit 4b94355

Please sign in to comment.