From b30e87392f5dba97e5ac52596a00a541fde0debe Mon Sep 17 00:00:00 2001 From: "Calem@RAISOR" Date: Sat, 14 Sep 2024 10:52:18 -0500 Subject: [PATCH] small mods trying to get influx working and channels set for raisor run --- analyzers/BeamTune.h | 8 ++++---- analyzers/Cross.h | 34 +++++++++++++++++----------------- analyzers/Target.h | 10 +++++----- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/analyzers/BeamTune.h b/analyzers/BeamTune.h index eb54292..08a0e0e 100644 --- a/analyzers/BeamTune.h +++ b/analyzers/BeamTune.h @@ -11,7 +11,7 @@ #include #include "math.h" #include -#include "TLine.h" +//#include "TLine.h" //#include #include #include @@ -188,7 +188,7 @@ inline void BeamTune::UpdateHistograms(){ // Create the line and store it in the vector - TLine *line = new TLine(Xr, Yr, X2, Y2); + //TLine *line = new TLine(Xr, Yr, X2, Y2); //line->SetLineColor(kBlack); // Set line color based on Y2 value /* @@ -213,8 +213,8 @@ inline void BeamTune::UpdateHistograms(){ //markers.push_back(endMarker); - hFrame->Fill(Xr,Yr, sX2,Y2); - hFrame1->Fill(X2,Y2); + //hFrame->Fill(Xr,Yr, sX2,Y2); + //hFrame1->Fill(X2,Y2); // Draw all the lines after the loop diff --git a/analyzers/Cross.h b/analyzers/Cross.h index 8d58ac8..10790e9 100644 --- a/analyzers/Cross.h +++ b/analyzers/Cross.h @@ -28,7 +28,7 @@ public: evtbder->SetTimeWindow(500); //========== use the influx from the Analyzer - influx = new InfluxDB("https://fsunuc.physics.fsu.edu/influx/"); + influx = new InfluxDB("http://localhost:8086"); dataBaseName = "testing"; SetUpCanvas(); // see below @@ -145,9 +145,9 @@ inline void Cross::UpdateHistograms(){ for( int k = 0; k < (int) event.size(); k++ ){ //event[k].Print(); - if( event[k].ch == 6 ) {ch1 = event[k].energy; t1 = event[k].timestamp;} // Reads channel 6 of the digitizer corresponding to dE - if( event[k].ch == 7 ) {ch4 = event[k].energy; t4 = event[k].timestamp;} // Reads channel 7 of the digitizer corresponding to E - if( event[k].ch == 1 ) {ch7 = event[k].energy; t7 = event[k].timestamp;} + if( event[k].ch == 0 ) {ch1 = event[k].energy; t1 = event[k].timestamp;} // Reads channel 0 of the digitizer corresponding to dE + if( event[k].ch == 2 ) {ch4 = event[k].energy; t4 = event[k].timestamp;} // Reads channel 2 of the digitizer corresponding to E + if( event[k].ch == 7 ) {ch7 = event[k].energy; t7 = event[k].timestamp;} //RF Timing if setup } @@ -157,9 +157,9 @@ inline void Cross::UpdateHistograms(){ hdE->Fill(ch1); hE->Fill(ch4); hdT->Fill(ch7); - hTotE->Fill(ch1*0.25*0.25 + ch4); + hTotE->Fill(ch1 + ch4); hdEE->Fill(ch4,ch1); - hdEtotE->Fill(ch1*0.25*0.25 + ch4,ch1); + hdEtotE->Fill(ch1 + ch4,ch1); hdEdT->Fill((t7-t1)*1e9,ch1); hTWin->Fill((t4-t1)*1e9); @@ -210,21 +210,21 @@ inline void Cross::UpdateHistograms(){ hdEtotE->UpdatePlot(); hdEdT->UpdatePlot(); hTWin->UpdatePlot(); - /* + //========== output to Influx - QList cutNameList = hPID->GetCutNameList(); - for( int p = 0; p < cutList.count(); p ++){ - if( cutList[p].isEmpty() ) continue; - double dT = (tMax[p]-tMin[p]) * tick2ns / 1e9; // tick to sec - double rate = count[p]*1.0/(dT); - //printf("%llu %llu, %f %d\n", tMin[p], tMax[p], dT, count[p]); - //printf("%10s | %d | %f Hz \n", cutNameList[p].toStdString().c_str(), count[p], rate); + QList cutNameList1 = hdEE->GetCutNameList(); + for( int p = 0; p < cutList1.count(); p ++){ + if( cutList1[p].isEmpty() ) continue; + double dT = (tMax1[p]-tMin1[p]) / 1e9; // tick to sec + double rate = count1[p]*1.0/(dT); + //printf("%llu %llu, %f %d\n", tMin1[p], tMax1[p], dT, count1[p]); + printf("%10s | %d | %f Hz \n", cutNameList1[p].toStdString().c_str(), count1[p], rate); - influx->AddDataPoint("Cut,name=" + cutNameList[p].toStdString()+ " value=" + std::to_string(rate)); - influx->WriteData(dataBaseName); + influx->AddDataPoint("Cut,name=" + cutNameList1[p].toStdString()+ " value=" + std::to_string(rate)); + influx->WriteData("testing"); influx->ClearDataPointsBuffer(); } - */ + } diff --git a/analyzers/Target.h b/analyzers/Target.h index f3962de..7a54be0 100644 --- a/analyzers/Target.h +++ b/analyzers/Target.h @@ -145,9 +145,9 @@ inline void Target::UpdateHistograms(){ for( int k = 0; k < (int) event.size(); k++ ){ //event[k].Print(); - if( event[k].ch == 6 ) {ch1 = event[k].energy; t1 = event[k].timestamp;} // Reads channel 6 of the digitizer corresponding to dE - if( event[k].ch == 7 ) {ch4 = event[k].energy; t4 = event[k].timestamp;} // Reads channel 7 of the digitizer corresponding to E - if( event[k].ch == 1 ) {ch7 = event[k].energy; t7 = event[k].timestamp;} + if( event[k].ch == 4 ) {ch1 = event[k].energy; t1 = event[k].timestamp;} // Reads channel 6 of the digitizer corresponding to dE + if( event[k].ch == 6 ) {ch4 = event[k].energy; t4 = event[k].timestamp;} // Reads channel 7 of the digitizer corresponding to E + if( event[k].ch == 7 ) {ch7 = event[k].energy; t7 = event[k].timestamp;} } @@ -157,9 +157,9 @@ inline void Target::UpdateHistograms(){ hdE->Fill(ch1); hE->Fill(ch4); hdT->Fill(ch7); - hTotE->Fill(ch1*0.25*0.25 + ch4); + hTotE->Fill(ch1 + ch4); hdEE->Fill(ch4,ch1); - hdEtotE->Fill(ch1*0.25*0.25 + ch4,ch1); + hdEtotE->Fill(ch1 + ch4,ch1); hdEdT->Fill((t7-t1)*1e9,ch1); hTWin->Fill((t4-t1)*1e9);