From 795a80d3a43c7d981dcbefafdf7429c1c851d0ba Mon Sep 17 00:00:00 2001 From: "Ryan@WorkStation" Date: Fri, 22 Sep 2023 18:35:14 -0400 Subject: [PATCH] tested PSD data readout. OK! next UI --- ClassDigitizer2Gen.cpp | 3 ++- Event.h | 38 +++++++++++++++++++++++++++++++++----- script.C | 42 ++++++++++++++++++++++++++---------------- test.cpp | 2 +- 4 files changed, 62 insertions(+), 23 deletions(-) diff --git a/ClassDigitizer2Gen.cpp b/ClassDigitizer2Gen.cpp index 938162a..823f61c 100644 --- a/ClassDigitizer2Gen.cpp +++ b/ClassDigitizer2Gen.cpp @@ -584,7 +584,8 @@ int Digitizer2Gen::ReadStat(){ void Digitizer2Gen::PrintStat(){ printf("ch | Real Time[ns] | Dead Time[ns] | Live Time[ns] | Trigger | Saved | Rate[Hz] | Self Trig Rate [Hz] \n"); for( int i = 0; i < nChannels; i++){ - if( triggerCount[i] == 0 ) continue; + //if( triggerCount[i] == 0 ) continue; + if( atoi(chSettings[i][0].GetValue().c_str()) == 0 ) continue; printf("%02d | %13lu | %13lu | %13lu | %7u | %7u | %8.3f | %d\n", i, realTime[i], deadTime[i], liveTime[i], triggerCount[i], savedEventCount[i], triggerCount[i]*1e9*1.0/realTime[i], atoi(chSettings[i][0].GetValue().c_str())); } diff --git a/Event.h b/Event.h index 2b55be4..2f63a4b 100644 --- a/Event.h +++ b/Event.h @@ -164,8 +164,12 @@ class Event { default : return "none"; } }else if (DPPType == DPPType::PSD){ - - + switch(probeType){ + case 0: return "ADC"; + case 9: return "Baseline"; + case 10: return "CFD"; + default : return "none"; + } }else{ return "none"; } @@ -191,7 +195,21 @@ class Event { default : return "none"; } }else if (DPPType == DPPType::PSD){ - + switch(probeType){ + case 0: return "Trigger"; + case 1: return "CFD Filter Armed"; + case 2: return "Re-trigger guard"; + case 3: return "ADC Input Baseline freeze"; + case 20: return "ADC Input OverThreshold"; + case 21: return "Charge Ready"; + case 22: return "Long Gate"; + case 7: return "Pile-Up Trig."; + case 24: return "Short Gate"; + case 25: return "Energy Saturation"; + case 26: return "Charge over-range"; + case 27: return "ADC Input Neg. OverThreshold"; + default : return "none"; + } }else{ return "none"; @@ -216,9 +234,19 @@ class Event { //TODO LowPriority void PrintAll(){ - printf("============= Type : %u\n", dataType); + + switch(dataType){ + case DataFormat::ALL : printf("============= Type : ALL\n"); break; + case DataFormat::OneTrace : printf("============= Type : OneTrace\n"); break; + case DataFormat::NoTrace : printf("============= Type : NoTrace\n"); break; + case DataFormat::Minimum : printf("============= Type : Minimum\n"); break; + case DataFormat::RAW : printf("============= Type : RAW\n"); return; break; + default : return; + } + printf("ch : %2d (0x%02X), fail: %d, flush: %d\n", channel, channel, board_fail, flush); - printf("energy: %u, timestamp: %lu, fine_timestamp: %u \n", energy, timestamp, fine_timestamp); + if( DPPType == DPPType::PHA ) printf("energy: %u, timestamp: %lu, fine_timestamp: %u \n", energy, timestamp, fine_timestamp); + if( DPPType == DPPType::PSD ) printf("energy: %u, energy_S : %u, timestamp: %lu, fine_timestamp: %u \n", energy, energy_short, timestamp, fine_timestamp); printf("flag (high): 0x%02X, (low): 0x%03X, traceLength: %lu\n", flags_high_priority, flags_low_priority, traceLenght); printf("Agg counter : %u, trigger Thr.: %u, downSampling: %u \n", aggCounter, trigger_threashold, downSampling); printf("AnaProbe Type: %s(%u), %s(%u)\n", AnaProbeType(analog_probes_type[0]).c_str(), analog_probes_type[0], diff --git a/script.C b/script.C index 262bba8..503ec06 100644 --- a/script.C +++ b/script.C @@ -7,9 +7,9 @@ #include "TGraph.h" -void script(){ +void script(std::string fileName){ - SolReader * reader = new SolReader("/home/ryan/analysis/data_raw/test_000_01_21233_000.sol"); + SolReader * reader = new SolReader(fileName); Event * evt = reader->evt; printf("----------file size: %u Byte\n", reader->GetFileSize()); @@ -26,16 +26,20 @@ void script(){ double duration = double(endTime - startTime)*8./1e9; printf("============== %lu ns = %.4f sec.\n", (endTime - startTime)*8, duration); - printf(" avarge rate (16ch): %f Hz\n", reader->GetTotalNumBlock()/duration/16); + printf(" avarge rate : %f Hz\n", reader->GetTotalNumBlock()/duration); reader->RewindFile(); - TH1F * hid = new TH1F("hid", "hid", 64, 0, 64); - TH1F * h1 = new TH1F("h1", "h1", duration, startTime, endTime); - TH2F * h2 = new TH2F("h2", "h2", 1000, startTime, endTime, 1000, 0, reader->GetTotalNumBlock()); - TH1F * hTdiff = new TH1F("hTdiff", "hTdiff", 400, 0, 200000); + TH1F * hid = new TH1F("hid", "Ch-ID", 64, 0, 64); + TH1F * h1 = new TH1F("h1", "Rate [Hz]; time [s] ; Hz", ceil(duration)+2, startTime*8/1e9 - 1 , ceil(endTime*8/1e9) + 1); + TH2F * h2 = new TH2F("h2", "Time vs Entry ; time [s] ; Entry", 1000, startTime*8/1e9, endTime*8/1e9 + 1, 1000, 0, reader->GetTotalNumBlock()); TGraph * g1 = new TGraph(); + TGraph * g2 = new TGraph(); g2->SetLineColor(2); + TGraph * ga = new TGraph(); ga->SetLineColor(4); + TGraph * gb = new TGraph(); gb->SetLineColor(5); + TGraph * gc = new TGraph(); gc->SetLineColor(6); + TGraph * gd = new TGraph(); gd->SetLineColor(7); uint64_t tOld = startTime; @@ -53,18 +57,18 @@ void script(){ } hid->Fill(evt->channel); - if( evt->channel == 0 ) h1->Fill(evt->timestamp); - h2->Fill(evt->timestamp, i); + if( evt->channel == 0 ) h1->Fill(evt->timestamp*8/1e9); + h2->Fill(evt->timestamp*8/1e9, i); - if( i > 0 ){ - hTdiff->Fill(evt->timestamp - tOld); - if( evt->timestamp < tOld) printf("-------- time not sorted."); - tOld = evt->timestamp; - } if( i == 0){ for( int i = 0; i < evt->traceLenght; i++){ g1->AddPoint(i*8, evt->analog_probes[0][i]); + g2->AddPoint(i*8, evt->analog_probes[1][i]); + ga->AddPoint(i*8, 10000+5000*evt->digital_probes[0][i]); + gb->AddPoint(i*8, 20000+5000*evt->digital_probes[1][i]); + gc->AddPoint(i*8, 30000+5000*evt->digital_probes[2][i]); + gd->AddPoint(i*8, 40000+5000*evt->digital_probes[3][i]); } } } @@ -75,8 +79,14 @@ void script(){ canvas->Divide(2,2); canvas->cd(1); hid->Draw(); canvas->cd(2); h1->SetMinimum(0); h1->Draw(); - canvas->cd(3); hTdiff->Draw(); - canvas->cd(4); g1->Draw("APl"); + canvas->cd(3); h2->Draw(); + canvas->cd(4); g1->Draw("APl"); + g1->GetYaxis()->SetRangeUser(0, 80000); + g2->Draw("same"); + ga->Draw("same"); + gb->Draw("same"); + gc->Draw("same"); + gd->Draw("same"); //printf("reader traceLength : %lu \n", evt->traceLenght); /* diff --git a/test.cpp b/test.cpp index 78dbab4..802fb87 100644 --- a/test.cpp +++ b/test.cpp @@ -101,7 +101,7 @@ int main(int argc, char* argv[]){ digi->PrintChannelSettings(0); - digi->SetDataFormat(DataFormat::OneTrace); + digi->SetDataFormat(DataFormat::ALL); digi->OpenOutFile("haha");