testShowCFD.cxx 1.52 KB
Newer Older
1 2 3 4 5
void testShowCFD()
{

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

6 7 8
	const Long64_t kFirstEvent = 133;
	const char *foldername = "nustar_present";
	const char *ext = ".pdf";
9

10
//	TFile fr("../data/dataDSR4/analysis_08_2_CFD02_06.root");
11 12
//	TFile fr("../data/dataDSR4/analysis_08_2.root");
	TFile fr("../data/dataDSR4/analysis_08_2_smooth.root");
13 14 15 16 17
	TTree *tr = (TTree*)fr.Get("atree");

	AEvent *revent = new AEvent();
	tr->SetBranchAddress("Ach0.",&revent);

18
	TGraph *gr[12];
19 20

	//loop over events
21
	for (Int_t i = 0; i < 12; i++) {
22 23
		gr[i] = 0;
		tr->GetEntry(i+kFirstEvent);
24
		gr[i] = new TGraph(*revent->GetGraphCFD());
25 26 27
	}//for over events


28
	TCanvas *c1 = new TCanvas("c1","CFD implementation",10,10,1000,600);
29

30 31 32 33
// four event picture
/*	c1->Divide(2,2);

	for (Int_t i = 0; i < 4; i++) {
34
		c1->cd(i+1);
35 36 37 38 39 40 41

		gr[i]->GetXaxis()->SetRangeUser(130, 175);
		gr[i]->GetXaxis()->SetTitle("Time [ns]");
		gr[i]->GetXaxis()->CenterTitle();
		gr[i]->GetYaxis()->SetTitle("Signal CFD [V]");
		gr[i]->GetYaxis()->CenterTitle();
		gr[i]->Draw("AL*");
42
	}
43 44 45 46 47 48 49 50 51 52 53 54
	c1->Print(Form("../macros/picsDRS4/%s/Signal_shapes_CFD%s", foldername, ext));*/

//one event picture
	gr[2]->GetXaxis()->SetRangeUser(130, 160);
	gr[2]->GetXaxis()->SetTitle("Time [ns]");
	gr[2]->GetXaxis()->CenterTitle();
	gr[2]->GetYaxis()->SetTitle("Signal [V]");
	gr[2]->GetYaxis()->CenterTitle();
	gr[2]->Draw("AL*");
	//f1->SetRange(t10[2], t90[2]);
	//gr[2]->Fit(f1, "RQ");
	c1->Print(Form("../macros/picsDRS4/%s/CFD_one_signal_shape%s", foldername, ext));
55 56 57 58

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