How to analyze signals sampled by the DAQ

I encountered a difficulty in how to analyze the signals from a scintillator detector collected by the DAQ . The sampling rate of the data acquisition system (DAQ) is approximately 4ns, with each data collection window lasting 20 microseconds, corresponding to 5000 data points. Occasionally, there are instances of two signals occurring within the same time window. I am considering how to remove such signals.
The first figure represents the normal signal in the window;
The second graph represents the collection of two signals within the time window.


Can someone give me some advice?

The following is my program.

//************************************************
//This scrit is used to analyze muon lifetime ****
//filename : data_C1_0327_wave.root           ****
//20us for time window                        ****
//************************************************


void muonLife(TString filename = "data_C1_0327_wave.root"){
TFile* file = TFile::Open(filename);
if(file){
	cout <<"*************************************"<<endl;
	cout <<" File have been opend successfully!!"<<endl;
        cout <<"*************************************"<<endl;
}
TTree* tree = (TTree*)file->Get("tree");
if(!tree)cout<<" Cannot find the tree successfully!!"<<endl;

int nEntries = tree->GetEntriesFast();
cout << " Entries number is  "<<nEntries <<endl;
//--------------------------------------------------------
Bool_t cfdft;                    TBranch* b_cfdft;
UShort_t ltra = 0;                TBranch* b_ltra; 
UShort_t wave[5000] = {0};        TBranch* b_data;
UShort_t evte = 0;                TBranch* b_evte; 
UInt_t qs[8];                     TBranch* b_qs;
Bool_t pileup;                   TBranch* b_pileup;

tree->SetBranchAddress("ltra",&ltra,&b_ltra);
tree->SetBranchAddress("cfdft",&cfdft,&b_cfdft);
tree->SetBranchAddress("data",&wave,&b_data);
tree->SetBranchAddress("evte",&evte,&b_evte);
tree->SetBranchAddress("qs",qs,&b_qs);
tree->SetBranchAddress("pileup",&pileup,&b_pileup);
//---------------------------------------------------------
 TGraph* gr = new TGraph;
 TGraph* singleWave = new TGraph();

 TCanvas* myc = new TCanvas("dynamic wave anayzed","",700,500);
//-------------------------------------------------------------------------
  for(int entry = 0;entry < nEntries;entry++){
             tree->GetEntry(entry);
  if(pileup==1)continue;
    if(evte<=4000)continue;
  if(entry % 10000 ==0) cout <<entry << "  have been analyzed!!"<<endl;
  
       for(Int_t i=0; i<ltra; i++){
             gr->SetPoint(i,i,wave[i]);
     } 
  if(entry == 2046)singleWave = (TGraph*)gr->Clone();
  //---------------------------------  
  // see the dynamic process
  #if 0
    myc->cd();
    gr->SetMarkerColor(kRed);
    gr->SetMarkerStyle(8);
    gr->SetMarkerSize(0.5);
    gr->Draw("AP");
    gr->SetTitle(Form("%d",entry));
    myc->Modified();
    myc->Update();
     
	  gSystem->Sleep(1000); //1s
	  gSystem->ProcessEvents();
 #endif  
  //----------------------------------
  }


//------------------------------------------------------------
TCanvas* canvas1 = new TCanvas();
canvas1->cd();
    singleWave->SetMarkerColor(kBlue);
    singleWave->SetMarkerStyle(8);
    singleWave->SetMarkerSize(0.5);
    singleWave->SetTitle("signle;time(ns);amplitude");
    singleWave->GetXaxis()->CenterTitle();
    singleWave->GetYaxis()->CenterTitle();
singleWave->Draw("AP");

}

Dear @lujifei ,

Thanks for reaching out to the forum! You have an interesting challenge, even though it really doesn’t sound like a question related to ROOT.

In any case, let me try to attempt a suggestion. Have you tried already by evaluating the points of the graph and removing any that are above a certain threshold value?

Cheers,
Vincenzo

I’m trying to set a threshold slightly above the baseline level.Then I want to find peaks by identifying the maxima.But due to the process of iterating through points and only selecting the maximum value, this leads to neglecting the other maxima.
Is there any reasonable method to find the peaks?

Dear @lujifei ,

There are many ways to achieve the result you want. Have you done some research about it? Maybe taking a look at ROOT tutorials, for example this one could be a starting point.

Cheers,
Vincenzo

1 Like

Thank you so much for your time and consideration regarding my question. I will investigate this and if I come to any conclusions I will post them here.