From 580c61376ca4824a95c5c6c7a7976b48d884fd5c Mon Sep 17 00:00:00 2001 From: "Muzalevsky I.A" Date: Wed, 11 Jan 2017 10:48:32 +0300 Subject: [PATCH] script for painting summ of amplitudes of every channel added --- convertTektronix/analyseRawData.cpp | 54 +++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 convertTektronix/analyseRawData.cpp diff --git a/convertTektronix/analyseRawData.cpp b/convertTektronix/analyseRawData.cpp new file mode 100644 index 0000000..9ad034b --- /dev/null +++ b/convertTektronix/analyseRawData.cpp @@ -0,0 +1,54 @@ +void analyseRawData() +{ + gSystem->Load("../libData.so"); + + TFile *f = new TFile("../data/rawDataTektronix/exp2.root"); + TTree *tr = (TTree*)f->Get("rtree"); + + const Int_t noBranches = 4; + + TString bName; + RawEvent *revent[noBranches]; // pointer to the array (of RawEvent class) in which raw data for each channel will be put + for (Int_t j = 0; jSetBranchAddress(bName.Data(), &revent[j]); //read the tree tr with raw data and fill array revent with raw data + } + + TH1F *hist1 = new TH1F("hist1", "h1 title", 1000, 0, 100); + TH1F *hist2 = new TH1F("hist2", "h2 title", 1000, 0, 100); + TH1F *hist3 = new TH1F("hist3", "h3 title", 1000, 0, 100); + TH1F *hist4 = new TH1F("hist4", "h4 title", 1000, 0, 100); + + TF1 *fit1 = new TF1("fit1","-[0]*exp(-x*[1])"); + fit1->SetRange(34,50); + fit1->SetParName(1,"tD"); + + Long64_t nEntries = tr->GetEntries(); + + //loop over events + for (j = 0; j < nEntries; j++) { + tr->GetEntry(j); + for(Int_t i =0;i<1000;i++){ + //hist->SetBinContent(i,revent[0]->GetAmp(i)); + hist1->AddBinContent(i,revent[0]->GetAmp(i)); + hist2->AddBinContent(i,revent[1]->GetAmp(i)); + hist3->AddBinContent(i,revent[2]->GetAmp(i)); + hist4->AddBinContent(i,revent[3]->GetAmp(i)); + } + } + + TCanvas *c1 = new TCanvas("c1","test",10,10,1000,600); + c1->Divide(2,2); + + c1->cd(1); + hist1->Draw(); + c1->cd(2); + hist2->Draw(); + hist2->Fit("fit1","R",""); + c1->cd(3); + hist3->Draw(); + c1->cd(4); + hist4->Draw(); + +} -- 2.18.1