testShowGraphs.cxx 1.95 KB
Newer Older
Muzalevsky I.A's avatar
Muzalevsky I.A committed
1 2 3 4 5 6 7
#include <TTree.h>
#include <TGraph.h>
#include <TFile.h>
#include <TSystem.h>
#include <TCanvas.h>
#include "TStyle.h"

8 9
void testShowGraphs()
{
Muzalevsky I.A's avatar
Muzalevsky I.A committed
10 11 12 13 14 15 16 17
	using std::cout;
	using std::endl;

	gStyle->SetCanvasDefH(900);
	gStyle->SetCanvasDefW(1500);

	const char *foldername = "7_8";
	const char *ext = ".gif";
18 19 20

	gSystem->Load("../libData.so");

21
	const Long64_t kFirstEvent = 128;
22

23
//	TFile fr("../data/dataDSR4/Neurad_7_08_NEW.root");
24
//	TFile fr("../data/dataDSR4/analysis_07_8.root");
Kostyleva D.A's avatar
Kostyleva D.A committed
25 26 27

//	TFile fr("../data/dataDSR4/Neurad_081216_2NEW.root");

28
//	TFile fr("../data/dataTektronix/exp18.root");
Kostyleva D.A's avatar
Kostyleva D.A committed
29

30
	TFile fr("../data/dataDSR4/analysis_07_8.root");
Muzalevsky I.A's avatar
Muzalevsky I.A committed
31

Muzalevsky I.A's avatar
Muzalevsky I.A committed
32
//	TFile fr("../data/dataDSR4/Neurad_081216_2NEW.root");
33
//	TFile fr("../data/dataTektronix/exp18.root");
Muzalevsky I.A's avatar
Muzalevsky I.A committed
34

35
//	TFile fr("../data/dataTektronix/analysisExp7.root");
36
	TTree *tr = (TTree*)fr.Get("atree");
37

38
	AEvent *revent = new AEvent();
Muzalevsky I.A's avatar
Muzalevsky I.A committed
39
	tr->SetBranchAddress("Ach0.",&revent);
40

41 42 43
	TGraph *gr[13];
	Double_t t10[13];
	Double_t t90[13];
44

45
	//loop over events
46
	for (Long64_t i = 0; i < 13; i++) {
47
		gr[i] = 0;
48 49
		t10[i] = 0;
		t90[i] = 0;
Muzalevsky I.A's avatar
Muzalevsky I.A committed
50

51
		tr->GetEntry(i+kFirstEvent);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
52

53
		gr[i] = new TGraph(*revent->GetGraphSignal());
54 55 56 57 58 59 60
		t10[i] = revent->GetT_10();
		t90[i] = revent->GetT_90();

//		cout << t10[i] << "\t" << t90[i] << endl;
//		cout << revent->GetEdgeSlope() << endl;


61
	}//for over events
62 63


64
	TCanvas *c1 = new TCanvas("c1","test",10,10,1000,600);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
65
	c1->Divide(2,2);
Kostyleva D.A's avatar
Kostyleva D.A committed
66

67

68 69 70
	TF1 *f1 = new TF1("f1name", "[0]+x*[1]");
//	TF1 *f1 = new TF1("pol1", );

Kostyleva D.A's avatar
Kostyleva D.A committed
71

Muzalevsky I.A's avatar
Muzalevsky I.A committed
72
	for (Int_t k = 0; k < 4; k++) {
73
		c1->cd(k+1);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
74 75 76 77 78
		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();
79
		gr[k]->Draw("AL*");
Muzalevsky I.A's avatar
Muzalevsky I.A committed
80 81 82
		//cout << t10[k] << "\t" << t90[k] << endl;
		//f1->SetRange(t10[k], t90[k]);
		//gr[k]->Fit(f1, "RQ");
Kostyleva D.A's avatar
Kostyleva D.A committed
83
	}
84
	//c1->Print(Form("../macros/picsDRS4/file%s/signals%s", foldername, ext));
85 86 87
//	c1->cd(2);
//	tr->Draw("gAmp.Draw()","","goff",1,124);
}