From 6833af68c12a7cb90e16e4d1e611efab1012c6fb Mon Sep 17 00:00:00 2001 From: Vratislav Chudoba Date: Fri, 13 Jan 2017 13:55:32 +0300 Subject: [PATCH] Class AEvent repaired. --- convertDRS4/read_root.C | 109 -------------------------------------- dataClasses/AEvent.cpp | 14 ++--- dataClasses/AEvent.h | 5 +- macros/testShowCFD.cxx | 2 +- macros/testShowGraphs.cxx | 3 +- 5 files changed, 12 insertions(+), 121 deletions(-) delete mode 100644 convertDRS4/read_root.C diff --git a/convertDRS4/read_root.C b/convertDRS4/read_root.C deleted file mode 100644 index 38b1299..0000000 --- a/convertDRS4/read_root.C +++ /dev/null @@ -1,109 +0,0 @@ -void read_root() -{ - TFile *f = new TFile("/home/dariak/NeuRad_tests/data/rawDataDSR4/NeuRad_test_07_1.root"); - TTree *tr = (TTree*)f->Get("rtree"); - tr->SetMakeClass(1); - -// TArrayD ampl1; -// TArrayD time1; -// ampl1.Set(ncellMax); -// time1.Set(ncellMax); - - const int ncellMax = 1030; -// int ncells; - Double_t ampl1[1023]; - Double_t time1[1023]; - Double_t ampl1_pos[1023]; //branch for positive signals - Double_t maxAmplitude1; - Double_t timemaxAmplitude1; - Double_t time1_pos[1023]; - - TFile *fw = new TFile("/home/dariak/NeuRad_tests/data/dataDSR4/analysis_07_1.root", "RECREATE"); - TTree *tw = new TTree("drs4analysis", "title of drs4 analysis tree"); - - 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(); - std::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); - std::cout << "INtegral "<Integral(120,180)<< std::endl; - - - tw->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(); -} diff --git a/dataClasses/AEvent.cpp b/dataClasses/AEvent.cpp index cf07fee..ab8c04a 100644 --- a/dataClasses/AEvent.cpp +++ b/dataClasses/AEvent.cpp @@ -94,7 +94,7 @@ void AEvent::Reset() { fTimeAmpMax = 0.; fTimeCFD = 0.; fZeroLevel = 0.; - fCharge = 0.; + fChargeCFD = 0.; } void AEvent::SetInputEvent(RawEvent** event) { @@ -195,17 +195,17 @@ Double_t AEvent::FindZeroLevel(Int_t pmin, Int_t pmax) { void AEvent::SetChargeCFD(Int_t tmin, Int_t tmax) { - Double_t integral = 0.; //voltage - Double_t time_sig = 0; //approximate signal duration in seconds - Double_t res = 50.; //resistance 50 Om - time_sig = (double)(tmin + tmax)*(1e-9); + Double_t integral = 0.; //voltage + Double_t time_sig = 0; //approximate signal duration in seconds + const Double_t res = 50.; //resistance 50 Om + time_sig = (double)(-tmin + tmax)*(1e-9); for(Int_t i = 0; i < fNPoints; i++) { - if( fTime[i] > (fTimeCFD - tmin) && fTime[i] < (fTimeCFD + tmax) ) { + if( fTime[i] > (fTimeCFD + tmin) && fTime[i] < (fTimeCFD + tmax) ) { integral = integral + fAmpPos[i]; } } - fCharge = integral*time_sig/res; + fChargeCFD = integral*time_sig/res; // cout<