testShowSmooth.C 1.52 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
#include <TTree.h>
#include <TGraph.h>
#include <TFile.h>
#include <TSystem.h>
#include <TCanvas.h>
#include "TStyle.h"

void testShowSmooth()
{
	gSystem->Load("../libData.so");
	const Long64_t kFirstEvent = 128;

	TFile fr("../data/dataDSR4/analysis_07_1.root");
	TTree *tr = (TTree*)fr.Get("atree");

	AEvent *revent = new AEvent();
	tr->SetBranchAddress("Ach0.",&revent);
	TGraph *grs[12];	//smoothed graphs
	TGraph *gr[12];		//normal graphs

	for (Long64_t i = 0; i < 12; i++) {
		grs[i] = 0;
		gr[i] = 0;

		tr->GetEntry(i+kFirstEvent);

		grs[i] = new TGraph(*revent->GetGraphSmooth());
		gr[i] = new TGraph(*revent->GetGraphSignal());
	}

	TCanvas *c1 = new TCanvas("c1","smoothed graphs",10,10,1000,600);
	c1->Divide(2,2);

	for (Int_t k = 0; k < 4; k++) {
		c1->cd(k+1);
		grs[k]->GetXaxis()->SetTitle("Time [ns]");
		grs[k]->GetXaxis()->CenterTitle();
		grs[k]->GetYaxis()->SetTitle("Amplitude [V]");
		grs[k]->GetYaxis()->CenterTitle();
		grs[k]->GetXaxis()->SetRangeUser(120, 160);
		grs[k]->SetMarkerStyle(7);
		grs[k]->Draw("");

		//gr[k]->SetMarkerColor(2);
		//gr[k]->Draw("");
	}

	TCanvas *c2 = new TCanvas("c2","non-smoothed graphs",10,10,1000,600);
	c2->Divide(2,2);

	for (Int_t k = 0; k < 4; k++) {
		c2->cd(k+1);
		gr[k]->GetXaxis()->SetTitle("Time [ns]");
		gr[k]->GetXaxis()->CenterTitle();
		gr[k]->GetYaxis()->SetTitle("Amplitude [V]");
		gr[k]->GetYaxis()->CenterTitle();
		gr[k]->GetXaxis()->SetRangeUser(120, 160);
		gr[k]->SetMarkerStyle(7);
		gr[k]->Draw("");

		//gr[k]->SetMarkerColor(2);
		//gr[k]->Draw("");
	}


}