Skip to content

Commit

Permalink
Merge pull request #64 from JeffersonLab/CcalMonitoring
Browse files Browse the repository at this point in the history
Ccal monitoring
  • Loading branch information
sdobbs authored Dec 11, 2018
2 parents 7787091 + b523491 commit deaa20a
Show file tree
Hide file tree
Showing 6 changed files with 227 additions and 1 deletion.
97 changes: 97 additions & 0 deletions src/plugins/monitoring/lowlevel_online/HistMacro_CCAL_lowlevel.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
// hnamepath: /lowlevel_online/CCAL/ccal_adc_multi
// hnamepath: /lowlevel_online/CCAL/ccal_adc_pedestal
// hnamepath: /lowlevel_online/CCAL/ccal_adc_time
// hnamepath: /lowlevel_online/CCAL/ccal_adc_integral

{
TDirectory *locInitDirectory = gDirectory;
TDirectory *locDirectory = (TDirectory*)locInitDirectory->FindObjectAny("lowlevel_online");
if(locDirectory == NULL)
return;

//Get/Make Canvas
TCanvas *locCanvas = NULL;
if(TVirtualPad::Pad() == NULL)
locCanvas = new TCanvas("CCAL", "CCAL", 1200, 800); //for testing
else
locCanvas = gPad->GetCanvas();
locCanvas->Divide(2, 2);


TH1I* locHist_ADCmulti = (TH1I*)locDirectory->Get("CCAL/ccal_adc_multi");
TH1I* locHist_ADCpedestal = (TH1I*)locDirectory->Get("CCAL/ccal_adc_pedestal");
TH1I* locHist_ADCtime = (TH1I*)locDirectory->Get("CCAL/ccal_adc_time");
TH1I* locHist_ADCintegral = (TH1I*)locDirectory->Get("CCAL/ccal_adc_integral");

//# ADC hits
locCanvas->cd(1);
gPad->SetTicks();
//gPad->SetGrid();
if(locHist_ADCmulti != NULL)
{
locHist_ADCmulti->SetTitle("CCAL ADC Multiplicity");
//locHist_ADCmulti->Rebin(2);
//locHist_ADCmulti->GetYaxis()->SetRangeUser(0.0, 1.05*locHist_ADCmulti->GetBinContent(locHist_ADCmulti->GetMaximumBin()));
locHist_ADCmulti->GetXaxis()->SetTitleSize(0.05);
locHist_ADCmulti->GetXaxis()->SetTitle("# ADC Hits");
//locHist_ADCmulti->GetYaxis()->SetTitle("");
locHist_ADCmulti->GetXaxis()->SetLabelSize(0.05);
locHist_ADCmulti->GetYaxis()->SetLabelSize(0.05);
locHist_ADCmulti->SetFillColor(kYellow);
locHist_ADCmulti->Draw("");
}

//# ADC hits
locCanvas->cd(2);
gPad->SetTicks();
//gPad->SetGrid();
if(locHist_ADCpedestal != NULL)
{
locHist_ADCpedestal->SetTitle("CCAL ADC Pedestal");
//locHist_ADCpedestal->Rebin(2);
//locHist_ADCpedestal->GetYaxis()->SetRangeUser(0.0, 1.05*locHist_ADCpedestal->GetBinContent(locHist_ADCpedestal->GetMaximumBin()));
locHist_ADCpedestal->GetXaxis()->SetRangeUser(0.0, 1000.);
locHist_ADCpedestal->GetXaxis()->SetTitleSize(0.05);
locHist_ADCpedestal->GetXaxis()->SetTitle("# ADC Hits");
//locHist_ADCpedestal->GetYaxis()->SetTitle("");
locHist_ADCpedestal->GetXaxis()->SetLabelSize(0.05);
locHist_ADCpedestal->GetYaxis()->SetLabelSize(0.05);
locHist_ADCpedestal->SetFillColor(kYellow);
locHist_ADCpedestal->Draw("");
}

//ADC integral
locCanvas->cd(3);
gPad->SetTicks();
//gPad->SetLogy();
//gPad->SetGrid();
if(locHist_ADCintegral != NULL)
{
locHist_ADCintegral->SetTitle("CCAL ADC Integral");
//locHist_ADCintegral->Rebin(2);
locHist_ADCintegral->GetXaxis()->SetRangeUser(0.0, 10000.);
locHist_ADCintegral->GetXaxis()->SetTitleSize(0.05);
//locHist_ADCintegral->GetYaxis()->SetTitle("");
locHist_ADCintegral->GetXaxis()->SetLabelSize(0.05);
locHist_ADCintegral->GetYaxis()->SetLabelSize(0.05);
locHist_ADCintegral->SetFillColor(kYellow);
locHist_ADCintegral->Draw("");
}

//ADC time
locCanvas->cd(4);
gPad->SetTicks();
//gPad->SetGrid();
if(locHist_ADCtime != NULL)
{
locHist_ADCtime->SetTitle("CCAL ADC Time");
//locHist_ADCtime->Rebin(5);
//locHist_ADCtime->GetXaxis()->SetRangeUser(0, 1500);
locHist_ADCtime->GetXaxis()->SetTitleSize(0.05);
//locHist_ADCtime->GetYaxis()->SetTitle("");
locHist_ADCtime->GetXaxis()->SetLabelSize(0.05);
locHist_ADCtime->GetYaxis()->SetLabelSize(0.05);
locHist_ADCtime->SetFillColor(kYellow);
locHist_ADCtime->Draw("");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ using namespace jana;

#include <BCAL/DBCALDigiHit.h>
#include <BCAL/DBCALTDCDigiHit.h>
#include <CCAL/DCCALDigiHit.h>
#include <CDC/DCDCDigiHit.h>
#include <FDC/DFDCCathodeDigiHit.h>
#include <FDC/DFDCWireDigiHit.h>
Expand Down Expand Up @@ -159,6 +160,21 @@ jerror_t JEventProcessor_lowlevel_online::init(void)

bcal_num_events = new TH1I("bcal_num_events", "BCAL number of events", 1, 0.0, 1.0);

//------------------------ CCAL -----------------------
if(ANALYZE_F250_DATA) {
maindir->cd();
gDirectory->mkdir("CCAL")->cd();

ccal_adc_multi = new TH1I("ccal_adc_multi", "CCAL ADC Multiplicity", 250, 0, 250);

ccal_adc_integral = new TH1I("ccal_adc_integral", "CCAL fADC250 Pulse Integral;Integral (fADC counts)", 1000, 0, 40000);
ccal_adc_peak = new TH1I("ccal_adc_peak", "CCAL fADC250 Pulse Peak;Peak (fADC counts)", 500, 0, 1000);
ccal_adc_time = new TH1I("ccal_adc_time", "CCAL fADC250 Pulse Time;Time (ns)", 1000, 0, 10000);
ccal_adc_pedestal = new TH1I("ccal_adc_pedestal", "CCAL fADC250 Summed Pedestal;Pedestal Sum (fADC counts)", 200, 0, 6000);

ccal_num_events = new TH1I("ccal_num_events", "CCAL number of events", 1, 0.0, 1.0);
}

//------------------------ CDC ------------------------
if(ANALYZE_F125_DATA) {
maindir->cd();
Expand Down Expand Up @@ -570,6 +586,7 @@ jerror_t JEventProcessor_lowlevel_online::evnt(JEventLoop *loop, uint64_t eventn
{
vector<const DBCALDigiHit*> bcaldigihits;
vector<const DBCALTDCDigiHit*> bcaltdcdigihits;
vector<const DCCALDigiHit*> ccaldigihits;
vector<const DCDCDigiHit*> cdcdigihits;
vector<const DFDCCathodeDigiHit*> fdccathodehits;
vector<const DFDCWireDigiHit*> fdcwirehits;
Expand Down Expand Up @@ -599,6 +616,7 @@ jerror_t JEventProcessor_lowlevel_online::evnt(JEventLoop *loop, uint64_t eventn
// Get hit data
loop->Get(bcaldigihits);
loop->Get(bcaltdcdigihits);
loop->Get(ccaldigihits);
loop->Get(cdcdigihits);
loop->Get(fdccathodehits);
loop->Get(fdcwirehits);
Expand Down Expand Up @@ -716,6 +734,23 @@ jerror_t JEventProcessor_lowlevel_online::evnt(JEventLoop *loop, uint64_t eventn
bcal_tdc_time->Fill(digihit->time);
}

//------------------------ CCAL -----------------------

ccal_num_events->Fill(0.5);
ccal_adc_multi->Fill(ccaldigihits.size());

for(size_t loc_i = 0; loc_i < ccaldigihits.size(); ++loc_i){
const DCCALDigiHit *hit = ccaldigihits[loc_i];

if(hit->pulse_peak < F250_THRESHOLD) continue;

ccal_adc_integral->Fill(hit->pulse_integral);
ccal_adc_peak->Fill(hit->pulse_peak);
ccal_adc_time->Fill(hit->pulse_time);
ccal_adc_pedestal->Fill(hit->pedestal);
}


//------------------------ FCAL -----------------------
map<int, vector<const Df250PulseData*> > fcalhitmap;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ class JEventProcessor_lowlevel_online:public jana::JEventProcessor{
TH1I *bcal_adc_emudelta_coarsetime;
TH1I *bcal_adc_emudelta_finetime;

//------------------------ CCAL -----------------------
TH1I *ccal_adc_multi;
TH1I *ccal_num_events;
TH1I *ccal_adc_integral;
TH1I *ccal_adc_time;
TH1I *ccal_adc_peak;
TH1I *ccal_adc_pedestal;


//------------------------ CDC ------------------------
TH1I *cdc_adc_multi;
Expand Down
70 changes: 70 additions & 0 deletions src/plugins/monitoring/occupancy_online/CCAL_occupancy.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
//
// Guidance: --------------------------------------------
//
// End Guidance: ----------------------------------------
//
//
//
// The following are special comments used by RootSpy to know
// which histograms to fetch for the macro.
//
// hnamepath: /occupancy/fcal_occ
// hnamepath: /occupancy/fcal_num_events
//
// e-mail: davidl@jlab.org
// e-mail: staylor@jlab.org
// e-mail: somov@jlab.org
// e-mail: tbritton@jlab.org
//

{
// RootSpy saves the current directory and style before
// calling the macro and restores it after so it is OK to
// change them and not change them back.
TDirectory *savedir = gDirectory;
TDirectory *dir = (TDirectory*)gDirectory->FindObjectAny("occupancy");
if(dir) dir->cd();

TH2I *ccal_occ = (TH2I*)gDirectory->FindObjectAny("ccal_occ");
TH1I *ccal_num_events = (TH1I*)gDirectory->FindObjectAny("ccal_num_events");

double Nevents = 1.0;
if(ccal_num_events) Nevents = (double)ccal_num_events->GetBinContent(1);

TLegend *legend_sa = new TLegend(0.1,0.85,0.3,0.9);
if(ccal_occ)legend_sa->AddEntry(ccal_occ, "fADC","f");

// Just for testing
if(gPad == NULL){
TCanvas *c1 = new TCanvas("c1");
c1->cd(0);
c1->Draw();
c1->Update();
}
if(!gPad) {savedir->cd(); return;}

TCanvas *c1 = gPad->GetCanvas();
c1->cd(0);
c1->Clear();

gPad->SetTicks();
gPad->SetGrid();
gPad->SetRightMargin(2.0);
gPad->SetLeftMargin(2.0);
if(ccal_occ){
ccal_occ->SetStats(0);
TH1* h = ccal_occ->DrawCopy("colz");
h->Scale(1./Nevents);
h->GetZaxis()->SetRangeUser(0.0001, 0.25);

char str[256];
sprintf(str,"%0.0f events", Nevents);
TLatex lat(30.0, 61.75, str);
lat.SetTextAlign(22);
lat.SetTextSize(0.035);
lat.Draw();
}

legend_sa->Draw();

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ using namespace jana;

#include <BCAL/DBCALDigiHit.h>
#include <BCAL/DBCALTDCDigiHit.h>
#include <CCAL/DCCALDigiHit.h>
#include <CDC/DCDCDigiHit.h>
#include <FDC/DFDCCathodeDigiHit.h>
#include <FDC/DFDCWireDigiHit.h>
Expand Down Expand Up @@ -39,6 +40,7 @@ using namespace jana;
#define DigiHitTypes(X) \
X(DBCALDigiHit) \
X(DBCALTDCDigiHit) \
X(DCCALDigiHit) \
X(DCDCDigiHit) \
X(DFDCCathodeDigiHit) \
X(DFDCWireDigiHit) \
Expand Down Expand Up @@ -137,6 +139,10 @@ jerror_t JEventProcessor_occupancy_online::init(void)
}
bcal_num_events = new TH1I("bcal_num_events", "BCAL number of events", 1, 0.0, 1.0);

//------------------------ CCAL -----------------------
ccal_occ = new TH2F("ccal_occ", "CCAL Occupancy; column; row", 14, -1.5, 12.5, 14, -1.5, 12.5);
ccal_num_events = new TH1I("ccal_num_events", "CCAL number of events", 1, 0.0, 1.0);

//------------------------ CDC ------------------------
int Nstraws[28] = {42, 42, 54, 54, 66, 66, 80, 80, 93, 93, 106, 106, 123, 123,
135, 135, 146, 146, 158, 158, 170, 170, 182, 182, 197, 197, 209, 209};
Expand Down Expand Up @@ -332,6 +338,12 @@ jerror_t JEventProcessor_occupancy_online::evnt(JEventLoop *loop, uint64_t event
bcal_tdc_occ->Fill(ix, iy);
}

//------------------------ CCAL -----------------------
ccal_num_events->Fill(0.5);
for(size_t loc_i = 0; loc_i < vDCCALDigiHit.size(); ++loc_i){
ccal_occ->Fill(vDCCALDigiHit[loc_i]->column, vDCCALDigiHit[loc_i]->row);
}

//------------------------ CDC ------------------------
cdc_num_events->Fill(0.5);
for(uint32_t i=0; i<vDCDCDigiHit.size(); i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ class JEventProcessor_occupancy_online:public jana::JEventProcessor{
//------------------------ BCAL -----------------------
TH1I *bcal_num_events;
TH2I *bcal_adc_occ;
TH2I *bcal_tdc_occ;
TH2I *bcal_tdc_occ;

//------------------------ CCAL -----------------------
TH1I *ccal_num_events;
TH2F* ccal_occ;

//------------------------ CDC ------------------------
TH1I *cdc_num_events;
Expand Down

0 comments on commit deaa20a

Please sign in to comment.