From bd45314e265107a11a76582696bd5f054b163895 Mon Sep 17 00:00:00 2001 From: "Kostyleva D.A" Date: Thu, 2 Feb 2017 13:06:11 +0300 Subject: [PATCH] AEvent: function for calculating charge by front time value is added. Script histCorrNew.C for new pictures is made --- dataClasses/AEvent.cpp | 23 +++++++ dataClasses/AEvent.h | 5 ++ macros/histCorr.C | 4 +- macros/histCorrNew.C | 132 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 162 insertions(+), 2 deletions(-) create mode 100644 macros/histCorrNew.C diff --git a/dataClasses/AEvent.cpp b/dataClasses/AEvent.cpp index 2625ee5..5056d25 100644 --- a/dataClasses/AEvent.cpp +++ b/dataClasses/AEvent.cpp @@ -57,6 +57,7 @@ void AEvent::ProcessEvent() { SetCFD(); SetChargeCFD(); SetChargeLED(); + SetChargeTF(); return; @@ -297,6 +298,28 @@ void AEvent::SetChargeLED(Int_t tmin, Int_t tmax) { // tmin = -3, tmax = 17 } +void AEvent::SetChargeTF(Int_t tmin, Int_t tmax) { // tmin = -3, tmax = 17 + + 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); + + Int_t imin = 0, imax = 0; + + Int_t i = 0; + while ( fTime[i] < (fTimeFront + tmin) && (i < (fGraphSignal->GetN()-1)) ) { imin = i; i++; } +// i = 0; + while ( fTime[i] < (fTimeFront + tmax) && (i < (fGraphSignal->GetN()-1)) ) { imax = i; i++; } + + integral = fGraphSignal->Integral(imin, imax); + + fChargeTF = integral*time_sig/res; + + return; + +} + Double_t AEvent::GetfCFD() { return fTimeCFD; } diff --git a/dataClasses/AEvent.h b/dataClasses/AEvent.h index dc4cd11..1ca0c1d 100644 --- a/dataClasses/AEvent.h +++ b/dataClasses/AEvent.h @@ -48,6 +48,7 @@ private: Double_t fTimeCFD; //zero-crossing time Double_t fChargeCFD; //! Double_t fChargeLED; //charge of the signal in Coulomb + Double_t fChargeTF; // Double_t fTimeLED; //time of LED threshold crossing Double_t fTimeFront; //time of front fit crossing zero level @@ -128,6 +129,10 @@ public: void SetChargeLED(Int_t tmin = -3, Int_t tmax = 17); + void SetChargeTF(Int_t tmin = -3, Int_t tmax = 17); + //calculates charge of the signal (i.e. its integral + //in range of (tmin,tmax) in ns) + //time of front fit crossing zero is taken as a start point //void SetLED(Double_t threshold = 0.001); diff --git a/macros/histCorr.C b/macros/histCorr.C index d8bf6bb..8c2ccde 100644 --- a/macros/histCorr.C +++ b/macros/histCorr.C @@ -13,8 +13,8 @@ void histCorr( // const char *ext = ".eps", const char *ext = ".gif", - const Bool_t can1 = 0, const Bool_t can2 = 0, - const Bool_t can3 = 0, const Bool_t can4 = 0, + const Bool_t can1 = 1, const Bool_t can2 = 1, + const Bool_t can3 = 1, const Bool_t can4 = 1, const Bool_t can5 = 1, const Bool_t can6 = 1) { using std::cout; diff --git a/macros/histCorrNew.C b/macros/histCorrNew.C new file mode 100644 index 0000000..a1ead1c --- /dev/null +++ b/macros/histCorrNew.C @@ -0,0 +1,132 @@ +#include "TH2F.h" +#include "TH3F.h" +#include "TStyle.h" + +void histCorrNew ( + + const char *filename = "analysis_08_2.root", +// const char *foldername = "report", + const char *foldername = "8_2", +// const char *ext = ".eps", + const char *ext = ".gif", + + const Bool_t can1 = 0, const Bool_t can2 = 0, + const Bool_t can3 = 1, const Bool_t can4 = 0, + const Bool_t can5 = 0, const Bool_t can6 = 0) +{ + using std::cout; + using std::endl; + gSystem->Load("../libData.so"); + TFile *f = new TFile(Form("../data/dataDSR4/%s", filename)); + TTree *t = (TTree*)f->Get("atree"); + + //gStyle->SetCanvasDefH(900); + //gStyle->SetCanvasDefW(1500); + + if(can1){ + + TCanvas *c1 = new TCanvas("c1", "Correlation pictures for collimated data: Integrals and amplitudes"); + c1->Divide(2,2); + + c1->cd(1); + TH2F *h1 = new TH2F("h1", "front time tau vs charge TF 0 ", 200, 0 ,0.5e-9, 100, 5, 15 ); + t->Draw(" Ach0.fTimeFront - Ach1.fTimeFront : Ach0.fChargeTF >> h1","","col"); + //x + h1->GetXaxis()->SetTitle("Charge [C]"); + h1->GetXaxis()->CenterTitle(); + //y + h1->GetYaxis()->SetTitle("tau_TF [ns]"); + h1->GetYaxis()->CenterTitle(); + + c1->Update(); + + c1->cd(2); + TH2F *h2 = new TH2F("h2", "front time tau vs charge TF 1 ", 200, 0, 0.5e-9, 200, 5 ,15); + t->Draw(" Ach0.fTimeFront - Ach1.fTimeFront : Ach1.fChargeTF >> h2","","col"); + //x + h2->GetXaxis()->SetTitle("Charge [C]"); + h2->GetXaxis()->CenterTitle(); + //y + h2->GetYaxis()->SetTitle("tau_TF [V]"); + h2->GetYaxis()->CenterTitle(); + + c1->Update(); + + c1->cd(3); + TH2F *h3 = new TH2F("h3", "charge TF 1 vs charge TF 0", 200, 0 ,0.5e-9, 200, 0, 0.5e-9); + t->Draw(" Ach0.fChargeTF : Ach1.fChargeTF >> h3","","col"); + //x + h3->GetXaxis()->SetTitle("Charge_0 [C]"); + h3->GetXaxis()->CenterTitle(); + //y + h3->GetYaxis()->SetTitle("Charge_1 [C]"); + h3->GetYaxis()->CenterTitle(); + + c1->Update(); + + c1->Print(Form("../macros/picsDRS4/file%s/time_front_corr1%s", foldername, ext)); + } + + if(can2) { + TCanvas *c2 = new TCanvas("c2", "Correlation pictures for collimated data: Integrals and amplitudes"); + c2->Divide(2,2); + + c2->cd(1); + TH2F *h4 = new TH2F("h4", "front time tau vs amplitude 0", 200, 0, 0.5, 200, 5 ,15); + t->Draw("Ach0.fTimeFront - Ach1.fTimeFront : Ach0.fAmpMax >> h4","","col"); + //x + h4->GetXaxis()->SetTitle("Max_ampl_{0} [V]"); + h4->GetXaxis()->CenterTitle(); + //y + h4->GetYaxis()->SetTitle("tau_TF"); + h4->GetYaxis()->CenterTitle(); + + c2->cd(2); + TH2F *h5 = new TH2F("h5", "front time tau vs amplitude 1", 200, 0, 0.5, 200, 5 ,15); + t->Draw("Ach0.fTimeFront - Ach1.fTimeFront : Ach1.fAmpMax >> h5","","col"); + //x + h5->GetXaxis()->SetTitle("Max_ampl_{1} [V]"); + h5->GetXaxis()->CenterTitle(); + //y + h5->GetYaxis()->SetTitle("tau_TF"); + h5->GetYaxis()->CenterTitle(); + + c2->Update(); + + c2->cd(3); + TH2F *h6 = new TH2F("h6", "amplitude 0 vs amplitude 1", 200, 0 ,0.1, 200, 0, 0.2); + t->Draw("Ach0.fAmpMax : Ach1.fAmpMax >> h6","","col"); + //x + h6->GetXaxis()->SetTitle("Max_ampl_{1} [V]"); + h6->GetXaxis()->CenterTitle(); + //y + h6->GetYaxis()->SetTitle("Max_ampl_{0} [V]"); + h6->GetYaxis()->CenterTitle(); + + c2->Print(Form("../macros/picsDRS4/file%s/time_front_corr2%s", foldername, ext)); + } + + if(can3) { + TCanvas *c3 = new TCanvas ("c3", "Correlation pictures for collimated data: time difference"); + c3->Divide(2,2); + + c3->cd(1); + TH1F *h7 = new TH1F("h7", "tau TF", 100, -5 , 25); + t->Draw("Ach0.fTimeFront - Ach1.fTimeFront >> h7","Ach0.fTimeFront>100. && Ach0.fTimeFront < 150 && Ach1.fTimeFront>100 && Ach1.fTimeFront < 150 && Ach0.fEdgeSlope > 0.01 && Ach1.fEdgeSlope > 0.01",""); + h7->Fit("gaus", "","",7,14); + gStyle->SetOptFit(); + + c3->cd(2); + TH1F *h8 = new TH1F("h8", "tau TF", 100, -5 , 25); + t->Draw("Ach0.fTimeFront - Ach1.fTimeFront >> h8","Ach0.fTimeFront>100. && Ach0.fTimeFront < 150 && Ach1.fTimeFront>100 && Ach1.fTimeFront < 150 && Ach0.fChargeTF > 0.05e-9 && Ach1.fChargeTF > 0.025e-9",""); + h8->Fit("gaus","","",7,14); + gStyle->SetOptFit(); + + c3->Print(Form("../macros/picsDRS4/file%s/time_front_corr3%s", foldername, ext)); + + + } + + + +} -- 2.18.1