FSUDAQ_Qt6/analyzers
2024-09-30 17:51:57 -04:00
..
Analyser.cpp fixed Eventbuilder for forward eventbuilding and 2D cut loading 2024-09-30 17:51:57 -04:00
Analyser.h fixed Eventbuilder for forward eventbuilding and 2D cut loading 2024-09-30 17:51:57 -04:00
BeamTune.h merge from origin master 2024-09-14 17:17:00 -05:00
CoincidentAnalyzer.h merge from origin master 2024-09-14 17:17:00 -05:00
Cross.h fixed Eventbuilder for forward eventbuilding and 2D cut loading 2024-09-30 17:51:57 -04:00
EncoreAnalyzer.h bug fix on MUSICAnalyzer.h 2024-08-01 16:03:50 -05:00
Isotope.h separate out SplitPoleHit Class for easy reuse in other program 2023-10-20 17:57:03 -04:00
mass20.txt modified splitpoleanalyzer.h 2023-10-20 16:17:50 -04:00
MCP.h full commit at end of c11 experiment, still many bugs etc 2024-09-23 10:20:31 -05:00
MCPandPSD.h full commit at end of c11 experiment, still many bugs etc 2024-09-23 10:20:31 -05:00
MUSICAnalyzer.h bug fix on MUSICAnalyzer.h 2024-08-01 16:03:50 -05:00
NeutronGamma.h added analyzer/README.md, move the isWorking from the custom analyzer to Analyzer, so user don't need to worry 2024-08-29 15:47:07 -04:00
PID.h merge from origin master 2024-09-14 17:17:00 -05:00
RAISOR.h added analyzer/README.md, move the isWorking from the custom analyzer to Analyzer, so user don't need to worry 2024-08-29 15:47:07 -04:00
RAISOR1.h full commit at end of c11 experiment, still many bugs etc 2024-09-23 10:20:31 -05:00
RAISOR2.h full commit at end of c11 experiment, still many bugs etc 2024-09-23 10:20:31 -05:00
README.md full commit at end of c11 experiment, still many bugs etc 2024-09-23 10:20:31 -05:00
SplitPoleAnalyzer.h remove TimingThread, Scope::UpdateScope() in Qthread via a worker. ScalarUpdateTimeinMiliSec in macro.h 2024-08-29 16:49:52 -04:00
SplitPoleHit.h after SPS test 2024-08-13 12:45:24 -04:00
Target.h full commit at end of c11 experiment, still many bugs etc 2024-09-23 10:20:31 -05:00
TEST.h merge from origin master 2024-09-14 17:17:00 -05:00

Introduction

This folder stored all online analyzers. The Analyser.cpp/h is the base class for all analyzer.

The Analyzer.cpp/h has the MultiBuilder (to handle event building) and InfluxDB (to handle pushing data to influxDB database) classes. In Addision, it has a QThread, a AnalyzerWorker, and a QTimer, these three object handle the threading of UpdateHistograms().

The AnalyzerWorker moves to the QThread. QTimer::timeout will trigger AnalyzerWorker::UpdateHistograms().

There is an important bool 'isWorking'. This boolean variable is true when AnalyzerWorker::UpdateHistograms() is running, and it is false when finsihed. This prevent UpdateHistograms() runs twice at the same time.

There are three virual methods

  • SetupCanvas()
  • UpdateHistograms()
  • ReplotHistograms()

Users must implement these two methods in theie custom analyzer.

Intruction to make new Analyzer

The CoindientAnalyzer.h is a good example.

  1. inheirate the Analyzer class
class CustomAnalyzer : public Analyzer{
  Q_OBJECT
public:
  CustomAnalyzer(Digitizer ** digi, unsigned int nDigi, QMainWindow * parent = nullptr): Analyzer(digi, nDigi, parent){
    SetUpdateTimeInSec(1.0); // set histogram update period in sec
    mb->SetTimeWindow(500); // set the event time windows
    // ... other custom stuffs
  }

  void SetUpCanvas();
public slots:
  void UpdateHistograms();
  void ReplotHistograms();

private:

  Histogram2D * h2D;
  Histogram1D * h1D;
  // some priavte variables

}
  1. implement the SetUpCanvas() method
inline void CustomAnalyzer::SetUpCanvas(){
  setWindowTitle("Title");
  setGeometry(0, 0, 1600, 1000);   

  h2D = new Histogram2D("Coincident Plot", "XXX", "YYY", 200, 0, 30000, 200, 0, 30000, this, rawDataPath);

  //layout is inheriatge from Analyzer
  layout->addWidget(h2D, 0, 0); // row-0, col-0

  h1 = new Histogram1D("1D Plot", "XXX", 300, 0, 30000, this);
  h1->SetColor(Qt::darkGreen);
  layout->addWidget(h1, 0, 1); // row-0, col-1

  //other GUI elements
}
  1. implement the UpdateHistograms() method
inline void CustomAnalyzer::UpdateHistograms(){
  // don't update histogram when the windows not visible
  if( this->isVisible() == false ) return; 

  BuildEvents(false); // call the event builder to build events, no verbose

  //check number of event built
  long eventBuilt = mb->eventBuilt;
  if( eventBuilt == 0 ) return;

  //============ Processing data and fill histograms
  long eventIndex = mb->eventIndex;
  long eventStart = eventIndex - eventBuilt + 1;
  if(eventStart < 0 ) eventStart += MaxNEvent;
  
  for( long i = eventStart ; i <= eventIndex; i ++ ){
    std::vector<Hit> event = mb->events[i];

    //analysis and fill historgam 
  }  
}
  1. implement the ReplotHistograms() method
inline void CustomAnalyzer::ReplotHistograms(){
  //Render histograms
  h2D->UpdatePlot();
  h1D->UpdatePlot();
}