testShowGraphs.cxx 1.41 KB
Newer Older
1 2 3 4 5
void testShowGraphs()
{

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

6
	const Long64_t kFirstEvent = 50;
7

8
//	TFile fr("../data/dataDSR4/analysis_07_1.root");
9 10
//	TFile fr("../data/dataDSR4/analysis_07_8.root");
	TFile fr("../data/dataDSR4/analysis_08_2.root");
11
//	TFile fr("../data/dataTektronix/analysisExp7.root");
12
	TTree *tr = (TTree*)fr.Get("atree");
13

14
	AEvent *revent = new AEvent();
15
	cout << tr->SetBranchAddress("Ach0.",&revent) << endl;
16 17

	TGraph *gr[10];
18 19
	Double_t t10[10];
	Double_t t90[10];
20

21
//	cout << "warning" << endl;
22 23 24

	cout << tr->GetEntries() << endl;

25
	//loop over events
26
	for (Long64_t i = 0; i < 10; i++) {
27
		gr[i] = 0;
28 29
		t10[i] = 0;
		t90[i] = 0;
30
//	cout << "warning 1" << endl;
31
//		cout << i+kFirstEvent << endl;
32 33 34
		tr->GetEntry(i+kFirstEvent);
//		tr->GetEntry(i);
//	cout << "warning 2" << endl;
35
		gr[i] = new TGraph(*revent->GetGraphSignal());
36 37 38 39 40 41 42
		t10[i] = revent->GetT_10();
		t90[i] = revent->GetT_90();

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


43
	}//for over events
44

45
//	cout << "warning 3" << endl;
46

47
	TCanvas *c1 = new TCanvas("c1","test",10,10,1000,600);
48 49
	c1->Divide(3,2);

50 51 52
	TF1 *f1 = new TF1("f1name", "[0]+x*[1]");
//	TF1 *f1 = new TF1("pol1", );

53 54
	for (Int_t k = 0; k < 6; k++) {
		c1->cd(k+1);
55 56 57 58 59
		gr[k]->Draw("AL*");

		cout << t10[k] << "\t" << t90[k] << endl;
		f1->SetRange(t10[k], t90[k]);
		gr[k]->Fit(f1, "RQ");
60 61 62 63 64
	}

//	c1->cd(2);
//	tr->Draw("gAmp.Draw()","","goff",1,124);
}