er  dev
testShowGraphs.cxx
1 #include <TTree.h>
2 #include <TGraph.h>
3 #include <TFile.h>
4 #include <TSystem.h>
5 #include <TCanvas.h>
6 #include "TStyle.h"
7 
8 void testShowGraphs()
9 {
10  using std::cout;
11  using std::endl;
12 
13  gStyle->SetCanvasDefH(900);
14  gStyle->SetCanvasDefW(1500);
15 
16  const char *foldername = "7_8";
17  const char *ext = ".gif";
18 
19  //gSystem->Load("../libData.so");
20 
21  const Long64_t kFirstEvent = 1;
22 
23  //TFile fr("../data/dataTektronix/GSItests/1000V_trigg40mv/30_60_10_50_GSI.root");
24  TFile fr("../../NeuRad/oscill/tests/analyze.root");
25  TCanvas *c1 = new TCanvas("c1","test",10,10,1000,600);
26 // c1->Divide(4,4);
27  TTree *tr = (TTree*)fr.Get("cbmsim");
28 
29  AEvent *revent = new AEvent(1000);
30  tr->SetBranchAddress("Ach1.",&revent);
31  Int_t nevents = tr->GetEntries();
32  TGraph *gr[16];
33  // TGraph *gr;
34  // Double_t t10[16];
35  // Double_t t90[16];
36 
37  //loop over events
38  // for (Long64_t i = 0; i <nevents; i++) {
39 
40  //
41 
42  // gr->Draw("AL*");
43  // c1->Update();
44  // delete gr;
45 
46  // }//for over events
47 
48 // for (Int_t k = 0; k < 16; k++){
49  { Int_t k=0;
50  tr->GetEntry(k+kFirstEvent);
51  gr[k] = new TGraph(*revent->GetGraphSignal());
52  // c1->cd(k+1);
53  // gr[k]->GetXaxis()->SetRangeUser(130, 175);
54  // gr[k]->GetXaxis()->SetTitle("Time [ns]");
55  // gr[k]->GetXaxis()->CenterTitle();
56  // gr[k]->GetYaxis()->SetTitle("Signal [V]");
57  // gr[k]->GetYaxis()->CenterTitle();
58  gr[k]->Draw("AL*");
59  // cout << t10[k] << "\t" << t90[k] << endl;
60  // f1->SetRange(t10[k], t90[k]);
61  // gr[k]->Fit(f1, "RQ");
62  }
63 c1->Print("shape.png");
64  //c1->Print(Form("../macros/picsDRS4/file%s/signals%s", foldername, ext));
65 // c1->cd(2);
66 // tr->Draw("gAmp.Draw()","","goff",1,124);
67 }