Commit d4f67dde authored by Muzalevsky I.A's avatar Muzalevsky I.A

macro for drawing 1elec signals added

parent 8122863f
#include <TTree.h>
#include <TGraph.h>
#include <TFile.h>
#include <TSystem.h>
#include <TCanvas.h>
#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<<counter<<endl;
// return;
for (Int_t k = 0; k < 8; k++)
{
gr[k]->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);*/
//}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment