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",<ra,&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");
}