From 8525a0b79c4c6747407b395ca9236541e4839389 Mon Sep 17 00:00:00 2001 From: Vratislav Chudoba Date: Wed, 28 Dec 2016 19:13:36 +0300 Subject: [PATCH] Script was really added. --- macros/analyse.C | 119 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 macros/analyse.C diff --git a/macros/analyse.C b/macros/analyse.C new file mode 100644 index 0000000..b31a459 --- /dev/null +++ b/macros/analyse.C @@ -0,0 +1,119 @@ +void analyse() +{ + gSystem->Load("../libData.so"); + + TFile *f = new TFile("../data/rawDataDSR4/NeuRad_test_07_1.root"); + TTree *tr = (TTree*)f->Get("rtree"); + + RawData *revent = new RawData(); + tr->SetBranchAddress("rawEvent", &revent); + +// tr->SetMakeClass(1); + + TFile *fw = new TFile("../data/dataDSR4/analysis_07_1.root", "RECREATE"); + TTree *tw = new TTree("drs4analysis", "title of drs4 analysis tree"); + + AnalyzeData *wevent = new AnalyzeData(); + tw->Bronch("AEvent", "AnalyzeData", &wevent); + + Long64_t nentries = tr->GetEntries(); + for(Long64_t i = 0; i < nentries; i++) { + tr->GetEntry(i); + + wevent->ProcessEvent(revent); + + tw->Fill(); + } + + + tw->Write(); + fw->Close(); + + return; + +// tr->SetBranchAddress("amp_ch1", ampl1); +// tr->SetBranchAddress("time_ch1", time1); +// tr->SetBranchAddress("ncell", ncells); + + tw->Branch("maxAmplitude1", &maxAmplitude1, "maxAmplitude1/D"); + tw->Branch("timemaxAmplitude1", &timemaxAmplitude1, "timemaxAmplitude1/D"); + tw->Branch("ampl1_pos", ampl1_pos, "ampl1_pos[1023]/D"); //branch for positive signals + tw->Branch("time1_pos", time1_pos, "time1_pos[1023]/D"); + + const Long64_t nEntries = tr->GetEntries(); + cout <<"Number of entries: "<Divide(3,4); + + for(Int_t i=12; i<24; i++) { + c1->cd(i-11); + tr->GetEntry(i); + TGraph *gr1 = new TGraph(1023, time1, ampl1); + gr1->SetTitle("Signal shape for one event"); + gr1->GetXaxis(); + gr1->Draw("Al*"); + } + + tr->GetEntry(499); + TGraph *gr1 = new TGraph(1023, time1, ampl1); + gr1->SetTitle("Signal shape for one event"); + gr1->Draw("Al*");*/ +//----- + Double_t maxAmpl1 = 0.; + Double_t timemaxAmpl1 = 0.; + + for(Int_t i=0; iGetEntries(); i++) { + tr->GetEntry(i); + + //changing polarity of the signal + for(Int_t j=0; j<1023; j++) { + ampl1_pos[j] = ampl1[j]*(-1.); + time1_pos[j] = time1[j]; + } + + //find maximum by hand + maxAmpl1 = ampl1_pos[0]; + for(Int_t j=0; j<1023; j++) { + if(ampl1_pos[j] > maxAmpl1) { + maxAmpl1 = ampl1_pos[j]; + timemaxAmpl1 = time1_pos[j]; + } + //cout<<"Time "< 0.1*maxAmpl1 && ampl1[k] < 0.9*maxAmpl1) { //we have negative signals, amplitude between 10 and 90 proc from maximum + /*cout<<"rjgnfre"<SetTitle("stupido"); + gr2->Fit("pol1"); + gr2->Draw("Al*");*/ + } + } + + //getting integral + TGraph *gr3 = new TGraph(1023, time1, ampl1_pos); + gr3->Integral(120,180); + cout<<"INtegral "<Integral(120,180)<Fill(); + } + tw->GetEntry(498); + TGraph *gr2 = new TGraph(1023, time1_pos, ampl1_pos); + gr2->SetTitle("Signal shape for one gsgsg event"); + gr2->Draw("Al*"); + + fw->cd(); + tw->Write(); + fw->Close(); +} -- 2.18.1