From d4f67dde69a4049193d99b42fffc32a49a6ae5be Mon Sep 17 00:00:00 2001 From: "Muzalevsky I.A" Date: Mon, 17 Apr 2017 11:10:53 +0300 Subject: [PATCH] macro for drawing 1elec signals added --- macros/DrawElNoizeSignal.cxx | 126 +++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 macros/DrawElNoizeSignal.cxx diff --git a/macros/DrawElNoizeSignal.cxx b/macros/DrawElNoizeSignal.cxx new file mode 100644 index 0000000..4e7c8d6 --- /dev/null +++ b/macros/DrawElNoizeSignal.cxx @@ -0,0 +1,126 @@ +#include +#include +#include +#include +#include +#include "TStyle.h" + +void testShowGraphs() +{ + using std::cout; + using std::endl; + + gStyle->SetCanvasDefH(900); + gStyle->SetCanvasDefW(1500); + + const char *foldername = "7_8"; + const char *ext = ".gif"; + + gSystem->Load("../libData.so"); + + const Long64_t kFirstEvent = 0; + +// TFile fr("../data/dataDSR4/analysis_08_2.root"); + //TFile fr("../data/dataTektronix/GSItests/1000V_trigg40mv/30_60_10_50_GSI.root"); + //TFile fr("../data/dataTektronix/GSItests/1000V_trigg20mv/analyze.root"); +// /data/dataTektronix/GSItests/1000V_trigg5mv + TFile fr("../data/dataTektronix/GSItests/1000V_trigg5mv/analize1.root"); + + TTree *tr = (TTree*)fr.Get("atree"); + + AEvent *revent = new AEvent(1000); + AEvent *revent1 = new AEvent(1000); + tr->SetBranchAddress("Ach0.",&revent); + tr->SetBranchAddress("Ach1.",&revent1); + + TGraph *gr[16]; + TGraph *gr1[16]; + Double_t t10[16]; + Double_t t90[16]; + Double_t charge0, charge1; + Int_t counter = 0; + Long64_t nEntries = tr->GetEntries(); + + TCanvas *c1 = new TCanvas("c1","test",10,10,1000,600); + c1->Divide(4,4); + + //loop over events + for (Int_t j = 0 + kFirstEvent; j < nEntries; j++) { + tr->GetEntry(j); + charge0 = revent->GetfChargeCFD(); + charge1 = revent1->GetfChargeCFD(); + if( ((charge0 - charge1) < 0.1) && ((charge0 - charge1) > -0.1) ) continue; // отбор по событиям по заряду + + gr[counter] = new TGraph(*revent->GetGraphSignal()); + gr1[counter] = new TGraph(*revent1->GetGraphSignal()); + if(counter == 7) break; + counter++; + } +// cout<GetXaxis()->SetTitle("Time [ns]"); + gr[k]->GetXaxis()->CenterTitle(); + gr[k]->GetYaxis()->SetTitle("Signal [V]"); + gr[k]->GetYaxis()->CenterTitle(); + + gr1[k]->GetXaxis()->SetTitle("Time1 [ns]"); + gr1[k]->GetXaxis()->CenterTitle(); + gr1[k]->GetYaxis()->SetTitle("Signal1 [V]"); + gr1[k]->GetYaxis()->CenterTitle(); + + c1->cd(k+1); + gr[k]->Draw("AL*"); + + c1->cd(k+9); + gr1[k]->Draw("AL*"); + } +//return; +} + //loop over events + /*for (Long64_t i = 0; i < 8; i++) { + gr[i] = 0; +// t10[i] = 0; +// t90[i] = 0; + tr->GetEntry(i+kFirstEvent); + gr[i] = new TGraph(*revent->GetGraphSignal()); +// t10[i] = revent->GetT_10(); +// t90[i] = revent->GetT_90(); + +// cout << t10[i] << "\t" << t90[i] << endl; +// cout << revent->GetEdgeSlope() << endl; + + }//for over events + + for (Long64_t i = 8; i < 16; i++) { + gr[i] = 0; + tr->GetEntry(i+kFirstEvent-8); + gr[i] = new TGraph(*revent1->GetGraphSignal()); + }//for over events + + + + + +// TF1 *f1 = new TF1("f1name", "[0]+x*[1]"); +// TF1 *f1 = new TF1("pol1", ); + +//k=0; + for (Int_t k = 0; k < 16; k++) + { + c1->cd(k+1); + //gr[k]->GetXaxis()->SetRangeUser(130, 175); + gr[k]->GetXaxis()->SetTitle("Time [ns]"); + gr[k]->GetXaxis()->CenterTitle(); + gr[k]->GetYaxis()->SetTitle("Signal [V]"); + gr[k]->GetYaxis()->CenterTitle(); + gr[k]->Draw("AL*"); + //cout << t10[k] << "\t" << t90[k] << endl; + //f1->SetRange(t10[k], t90[k]); + //gr[k]->Fit(f1, "RQ"); + } + //c1->Print(Form("../macros/picsDRS4/file%s/signals%s", foldername, ext)); +// c1->cd(2); +// tr->Draw("gAmp.Draw()","","goff",1,124);*/ +//} -- 2.18.1