Skip to content

Commit

Permalink
feat: update online plots for several detectors (star-bnl#678)
Browse files Browse the repository at this point in the history
This constitutes the running Jevp plots at the experiment, with updates
for plots in several detectors. It includes files from pull request star-bnl#674
which hasn't been accepted yet, but of course is running in the
production code online.
  • Loading branch information
jml985 committed Apr 24, 2024
1 parent 1132a84 commit 2677be0
Show file tree
Hide file tree
Showing 8 changed files with 460 additions and 280 deletions.
28 changes: 18 additions & 10 deletions OnlTools/Jevp/StJevpBuilders/fstBuilder.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1357,7 +1357,7 @@ void fstBuilder::event(daqReader *rdr)
}

PCP;
numTb = numTimeBin; //default: 9 timebins
numTb = numTb_default; //default: 9 timebins

//LOG("JEFF", "numbTB=%d", numTimeBin);

Expand Down Expand Up @@ -1401,6 +1401,12 @@ void fstBuilder::event(daqReader *rdr)
}
}
}
//set plotting range for time bin distributions
hEventSumContents.hMaxTimeBin_ZS->GetXaxis()->SetRangeUser(tb_plot_low, tb_plot_high);
hEventSumContents.hMaxTimeBin->GetXaxis()->SetRangeUser(tb_plot_low, tb_plot_high);
for(int index = 0; index < mTbVsAdcHist; index++) hTbVsAdcContents.tbVsAdcArray[index]->GetXaxis()->SetRangeUser(tb_plot_low, tb_plot_high);
for(int index = 0; index < mMaxTimeBinHist; index++) hMaxTimeBinContents.maxTimeBinArray[index]->GetXaxis()->SetRangeUser(tb_plot_low, tb_plot_high);
for(int glbElecApvIdx = 0 ; glbElecApvIdx < totAPV ; glbElecApvIdx++) hMaxTimeBinContents_APV.maxTimeBinArray_APV[glbElecApvIdx]->GetXaxis()->SetRangeUser(tb_plot_low, tb_plot_high);

PCP;

Expand Down Expand Up @@ -2060,10 +2066,11 @@ void fstBuilder::stoprun(daqReader *rdr)
}
}

double entriesTB_123=0, entriesTB_all=0, fraction = 1.0;
if(hMaxTimeBinContents.maxTimeBinArray[j]->GetEntries()>0) {
entriesTB_123 = hMaxTimeBinContents.maxTimeBinArray[j]->Integral(2, numTb-1);
entriesTB_all = hMaxTimeBinContents.maxTimeBinArray[j]->Integral(1, numTb);
double entriesTB_123=0, entriesTB_all=0, fraction = 0.;
entriesTB_all = hMaxTimeBinContents.maxTimeBinArray[j]->Integral(1, numTb);
//if(hMaxTimeBinContents.maxTimeBinArray[j]->Integral(1, numTb)>0) {
if(entriesTB_all>0.) {
entriesTB_123 = hMaxTimeBinContents.maxTimeBinArray[j]->Integral(numTb/2+1, numTb/2+1);
fraction = entriesTB_123/entriesTB_all;
if(fraction<maxTbFracOK) {
//LOG(U_FST,"maxTimeBinFraction::section RDO%d_ARM%d_GROUP%d with fraction %f!", rdoIdx, armIdx, portIdx, fraction);
Expand Down Expand Up @@ -2123,13 +2130,14 @@ void fstBuilder::stoprun(daqReader *rdr)
for(int armIdx=0; armIdx<ArmPerRdo; armIdx++){
for(int refApvIdx=0; refApvIdx<ApvPerArm; refApvIdx++){
int glbElecApvIdx = refApvIdx + armIdx*ApvPerArm + (rdoIdx-1)*ApvPerRdo; // 0-287
double entriesTB_123=0, entriesTB_all=0, fraction = 1.0;
if(hMaxTimeBinContents_APV.maxTimeBinArray_APV[glbElecApvIdx]->GetEntries()>0){
entriesTB_123 = hMaxTimeBinContents_APV.maxTimeBinArray_APV[glbElecApvIdx]->Integral(2, numTb-1);
entriesTB_all = hMaxTimeBinContents_APV.maxTimeBinArray_APV[glbElecApvIdx]->Integral(1, numTb);
double entriesTB_123=0, entriesTB_all=0, fraction = 0.;
entriesTB_all = hMaxTimeBinContents_APV.maxTimeBinArray_APV[glbElecApvIdx]->Integral(1, numTb);
//if(hMaxTimeBinContents_APV.maxTimeBinArray_APV[glbElecApvIdx]->GetEntries()>0){
if(entriesTB_all>0.){
entriesTB_123 = hMaxTimeBinContents_APV.maxTimeBinArray_APV[glbElecApvIdx]->Integral(numTb/2+1,numTb/2+1);
fraction = entriesTB_123/entriesTB_all;
}
hEventSumContents.hMaxTBfractionVsAPV_ZS->SetBinContent(glbElecApvIdx, fraction);
hEventSumContents.hMaxTBfractionVsAPV_ZS->SetBinContent(glbElecApvIdx+1, fraction);
}
}
}
Expand Down
9 changes: 6 additions & 3 deletions OnlTools/Jevp/StJevpBuilders/fstBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ class fstBuilder : public JevpBuilder {
static const int ApvNumOffset = 12; // APV RO number same as IST | used for APV number convertion
static const int ApvRoPerPort = 12; // APV RO number same as IST
static const int ApvRoPerArm = 24; // APV RO number same as IST

static const int numTimeBin = 9; // to be decided
static const int goodChCut = 64; // to be decided
static const int minPedVal = 200; // to be decided
Expand Down Expand Up @@ -129,6 +128,10 @@ class fstBuilder : public JevpBuilder {
static const float rStop[RstripPerMod];
static const float rDelta;

//Time Bin plots plot range
const float tb_plot_low = 0.;
const float tb_plot_high = 3.;

//FST mapping
int fstGeomMapping[totCh]; //FST channel mapping (electronics ID to geometry ID transform)
int fstElecMapping[totCh]; //FST channel mapping (geometry ID & electronics ID transform)
Expand All @@ -137,7 +140,7 @@ class fstBuilder : public JevpBuilder {
float fstPedestal[numTimeBin][totCh];
float fstRmsNoise[numTimeBin][totCh];
float fstRanNoise[numTimeBin][totCh];

//*** Histogram Declarations...
union {
TH2 *adcArray[1]; //ADC value of each module's channels (ADC value vs. channel index)
Expand Down Expand Up @@ -960,7 +963,7 @@ class fstBuilder : public JevpBuilder {

int sumHistogramsFilled;
int numTb;

const int numTb_default = 3;
JLatex* errorMsg;

ClassDef(fstBuilder, 1);
Expand Down
2 changes: 2 additions & 0 deletions OnlTools/Jevp/StJevpBuilders/fttBuilder.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -466,10 +466,12 @@ void fttBuilder::drawStrip( TH2 * h2, int row, int strip, VMMHardwareMap::Quadra

int iy0 = ay->FindBin( y0 + row * rLength );
int iy1 = ay->FindBin( y0 + (row + 1) * rLength - 1 );
/* Does nothing, intened to adjust indexes?
if ( VMMHardwareMap::Quadrant::C == q || VMMHardwareMap::Quadrant::D == q ){
int iy0 = ay->FindBin( y0 + (row - 1) * rLength );
int iy1 = ay->FindBin( y0 + (row) * rLength - 1 );
}
*/
const int ix0 = ax->FindBin( x0 + strip * sPitch );
const int ix1 = ax->FindBin( x0 + (strip) * sPitch );
floodFill( h2, ix0, iy0, ix1, iy1 );
Expand Down
12 changes: 11 additions & 1 deletion OnlTools/Jevp/StJevpBuilders/mtdBuilder.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,13 @@ void mtdBuilder::event(daqReader *rdr) {
int err1 = (int)(contents.MTD_Error1->GetEntries());
int err2 = (int)(contents.MTD_Error2->GetEntries());
int err3 = (int)(contents.MTD_Error3->GetEntries());

bool is_ignore = true;
for(int bin=1; bin<=contents.MTD_Error3->GetNbinsX(); bin++)
{
if(contents.MTD_Error3->GetBinContent(bin)>2)
is_ignore = false;
}

//error1 label
if(err1== 0) {
sprintf(t, "No electronics errors in %d events",nev);
Expand Down Expand Up @@ -703,6 +709,10 @@ void mtdBuilder::event(daqReader *rdr) {
sprintf(t, "No read out errors in %d events",nev);
MTD_Error3_label->SetTextColor(3);
}
else if(is_ignore) {
sprintf(t, "%d read out errors in %d events. Ignore!",err3, nev);
MTD_Error3_label->SetTextColor(4);
}
else {
sprintf(t, "%d read out errors in %d events!",err3, nev);
MTD_Error3_label->SetTextColor(2);
Expand Down
Loading

0 comments on commit 2677be0

Please sign in to comment.