From 5eb9075c10d86d66bba9b5c694fbdb722d11105d Mon Sep 17 00:00:00 2001 From: DariaKostyleva Date: Wed, 22 Mar 2017 18:11:02 +0100 Subject: [PATCH] Try to apply manual time-amplitude correction, script walk_corr.C --- macros/histCorrNew01.C | 82 ++++++++++++++++++++++++++++++----- macros/histCorrNew02.C | 10 ++--- macros/histPresent.C | 2 +- macros/integralFormSignal.cpp | 2 +- macros/testShowGraphs.cxx | 22 +++++++++- macros/walk_corr.C | 82 +++++++++++++++++++++++++++++++++++ 6 files changed, 180 insertions(+), 20 deletions(-) create mode 100644 macros/walk_corr.C diff --git a/macros/histCorrNew01.C b/macros/histCorrNew01.C index 9858788..da401bc 100644 --- a/macros/histCorrNew01.C +++ b/macros/histCorrNew01.C @@ -5,16 +5,16 @@ void histCorrNew01 ( //01 means it is used for channels 0 and 1 -// const char *filename = "analysis_07_8.root", //considered non-collimated + const char *filename = "analysis_07_8.root", //considered non-collimated // const char *filename = "analysis_07_2.root", //collimated? // const char *filename = "analysis_07_4.root", - const char *filename = "analysis_08_2.root", +// const char *filename = "analysis_08_2.root", const char *foldername = "7_8/chpair01", // 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 = 1) + const Bool_t can1 = 1, const Bool_t can2 = 0, + const Bool_t can3 = 0, const Bool_t can4 = 0) //const Bool_t can5 = 0, const Bool_t can6 = 0) { using std::cout; @@ -29,11 +29,12 @@ void histCorrNew01 ( if(can1){ TCanvas *c1 = new TCanvas("c1", "Correlation pictures for non-collimated data: delta t and integrals"); - c1->Divide(2,2); +// 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"); +/* c1->cd(1); + TH2F *h1 = new TH2F("h1", "front time tau vs charge TF 0 ", 200, 0 ,1.0e-9, 200, -40, 40 ); + // t->Draw(" Ach0.fTimeFront - Ach1.fTimeFront : Ach0.fChargeTF >> h1","","col"); + t->Draw(" Ach0.fTimeLED - Ach1.fTimeLED : Ach0.fChargeLED >> h1","","col"); //x h1->GetXaxis()->SetTitle("Charge [C]"); h1->GetXaxis()->CenterTitle(); @@ -44,8 +45,9 @@ void histCorrNew01 ( 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"); + TH2F *h2 = new TH2F("h2", "front time tau vs charge TF 1 ", 200, 0, 0.5e-9, 200, -20 ,30); + // t->Draw(" Ach0.fTimeFront - Ach1.fTimeFront : Ach1.fChargeTF >> h2","","col"); + t->Draw(" Ach0.fTimeLED - Ach1.fTimeLED : Ach1.fChargeLED >> h2","","col"); //x h2->GetXaxis()->SetTitle("Charge [C]"); h2->GetXaxis()->CenterTitle(); @@ -56,8 +58,9 @@ void histCorrNew01 ( 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"); + TH2F *h3 = new TH2F("h3", "charge TF 1 vs charge TF 0", 400, 0.02 ,0.7e-9, 400, 0.06, 0.5e-9); + // t->Draw(" Ach0.fChargeTF : Ach1.fChargeTF >> h3","","col"); + t->Draw(" Ach0.fChargeLED : Ach1.fChargeLED >> h3","","col"); //x h3->GetXaxis()->SetTitle("Charge_0 [C]"); h3->GetXaxis()->CenterTitle(); @@ -66,7 +69,62 @@ void histCorrNew01 ( h3->GetYaxis()->CenterTitle(); c1->Update(); +*/ +//pictures for latex report, LED + c1->Divide(2,1); + c1->cd(1); + TH2F *h2 = new TH2F("h2", "time difference (LED method) vs charge of non-trigger channel ", 100, -12 ,5, 100, 0, 0.17e-9); + // t->Draw(" Ach0.fTimeFront - Ach1.fTimeFront : Ach1.fChargeTF >> h2","","col"); + t->Draw(" Ach1.fChargeLED : Ach0.fTimeLED - Ach1.fTimeLED >> h2","","col"); + //x + h2->GetXaxis()->SetTitle("time [ns]"); + h2->GetXaxis()->CenterTitle(); + //y + h2->GetYaxis()->SetTitle("Q [C]"); + h2->GetYaxis()->CenterTitle(); + + c1->Update(); + + c1->cd(2); + TH2F *h3 = new TH2F("h3", "charge of trigger channel vs charge of non-trigger channel", 400, 0.02 ,0.7e-9, 400, 0.06, 0.5e-9); + // t->Draw(" Ach0.fChargeTF : Ach1.fChargeTF >> h3","","col"); + t->Draw(" Ach0.fChargeLED : Ach1.fChargeLED >> h3","","col"); + //x + h3->GetXaxis()->SetTitle("Q_{0} [C]"); + h3->GetXaxis()->CenterTitle(); + //y + h3->GetYaxis()->SetTitle("Q_{1} [C]"); + h3->GetYaxis()->CenterTitle(); + + c1->Update(); + +//pictures for latex report, CFD +/* c1->Divide(2,1); + c1->cd(1); + TH2F *h2 = new TH2F("h2", "time difference (CFD method) vs charge of non-trigger channel ", 100, -12 ,5, 100, 0, 0.17e-9); + // t->Draw(" Ach0.fTimeFront - Ach1.fTimeFront : Ach1.fChargeTF >> h2","","col"); + t->Draw(" Ach1.fChargeCFD : Ach0.fTimeCFD - Ach1.fTimeCFD >> h2","","col"); + //x + h2->GetXaxis()->SetTitle("time [ns]"); + h2->GetXaxis()->CenterTitle(); + //y + h2->GetYaxis()->SetTitle("Q [C]"); + h2->GetYaxis()->CenterTitle(); + + c1->Update(); + c1->cd(2); + TH2F *h3 = new TH2F("h3", "charge of trigger channel vs charge of non-trigger channel", 400, 0.02 ,0.7e-9, 400, 0.06, 0.5e-9); + // t->Draw(" Ach0.fChargeTF : Ach1.fChargeTF >> h3","","col"); + t->Draw(" Ach0.fChargeCFD : Ach1.fChargeCFD >> h3","","col"); + //x + h3->GetXaxis()->SetTitle("Q_{0} [C]"); + h3->GetXaxis()->CenterTitle(); + //y + h3->GetYaxis()->SetTitle("Q_{1} [C]"); + h3->GetYaxis()->CenterTitle(); +*/ + c1->Update(); // c1->Print(Form("../macros/picsDRS4/file%s/time_front_corr1%s", foldername, ext)); } diff --git a/macros/histCorrNew02.C b/macros/histCorrNew02.C index 98d51b1..611fd04 100644 --- a/macros/histCorrNew02.C +++ b/macros/histCorrNew02.C @@ -10,9 +10,9 @@ void histCorrNew02 ( // const char *ext = ".eps", const char *ext = ".gif", - const Bool_t can1 = 0, const Bool_t can2 = 0, + const Bool_t can1 = 1, const Bool_t can2 = 0, const Bool_t can3 = 0, const Bool_t can4 = 0, - const Bool_t can5 = 0 , const Bool_t can6 = 1) + const Bool_t can5 = 0, const Bool_t can6 = 0) { using std::cout; using std::endl; @@ -29,7 +29,7 @@ void histCorrNew02 ( 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 ); + TH2F *h1 = new TH2F("h1", "front time tau vs charge TF 0 ", 200, 0 ,1.0e-9, 200, -40, 40 ); t->Draw(" Ach0.fTimeFront - Ach2.fTimeFront : Ach0.fChargeTF >> h1","","col"); //x h1->GetXaxis()->SetTitle("Charge [C]"); @@ -41,7 +41,7 @@ void histCorrNew02 ( c1->Update(); c1->cd(2); - TH2F *h2 = new TH2F("h2", "front time tau vs charge TF 2 ", 200, 0, 0.5e-9, 200, 5 ,15); + TH2F *h2 = new TH2F("h2", "front time tau vs charge TF 2 ", 200, 0, 0.5e-9, 200, -20 ,30); t->Draw(" Ach0.fTimeFront - Ach2.fTimeFront : Ach2.fChargeTF >> h2","","col"); //x h2->GetXaxis()->SetTitle("Charge [C]"); @@ -53,7 +53,7 @@ void histCorrNew02 ( c1->Update(); c1->cd(3); - TH2F *h3 = new TH2F("h3", "charge TF 2 vs charge TF 0", 200, 0 ,0.5e-9, 200, 0, 0.5e-9); + TH2F *h3 = new TH2F("h3", "charge TF 2 vs charge TF 0", 200, 0 ,2.0e-9, 200, 0, 2.0e-9); t->Draw(" Ach0.fChargeTF : Ach2.fChargeTF >> h3","","col"); //x h3->GetXaxis()->SetTitle("Charge_0 [C]"); diff --git a/macros/histPresent.C b/macros/histPresent.C index 7119e27..80dbc9a 100644 --- a/macros/histPresent.C +++ b/macros/histPresent.C @@ -12,7 +12,7 @@ void histPresent ( // const char *ext = ".eps", const char *ext = ".pdf", - const Bool_t can1 = 0, const Bool_t can2 = 0, + const Bool_t can1 = 1, const Bool_t can2 = 1, const Bool_t can3 = 1, const Bool_t can4 = 0) //const Bool_t can5 = 0/*, const Bool_t can6 = 0*/) { diff --git a/macros/integralFormSignal.cpp b/macros/integralFormSignal.cpp index 51bb917..c91fd91 100644 --- a/macros/integralFormSignal.cpp +++ b/macros/integralFormSignal.cpp @@ -1,7 +1,7 @@ { gSystem->Load("../libData.so"); - TFile *f = new TFile("../data/dataDSR4/Neurad_081216_2NEW.root"); + TFile *f = new TFile("../data/dataDSR4/analysis_07_8.root"); TTree *tr = (TTree*)f->Get("atree"); const Int_t nP = 1024; diff --git a/macros/testShowGraphs.cxx b/macros/testShowGraphs.cxx index 978aba3..9eabe22 100644 --- a/macros/testShowGraphs.cxx +++ b/macros/testShowGraphs.cxx @@ -19,7 +19,7 @@ void testShowGraphs() gSystem->Load("../libData.so"); - const Long64_t kFirstEvent = 140; + const Long64_t kFirstEvent = 110; // TFile fr("../data/dataDSR4/Neurad_7_08_NEW.root"); TFile fr("../data/dataDSR4/analysis_07_8.root"); @@ -98,4 +98,24 @@ void testShowGraphs() //c1->Print(Form("../macros/picsDRS4/%s/Signal_shapes_with_fit%s", foldername, ext)); */ + +// picture for TDR + /* + c1->Divide(1,2); + c1->cd(1); + gr[2]->GetXaxis()->SetRangeUser(130, 175); + gr[2]->GetXaxis()->SetTitle("Time [ns]"); + gr[2]->GetXaxis()->CenterTitle(); + gr[2]->GetYaxis()->SetTitle("Signal [V]"); + gr[2]->GetYaxis()->CenterTitle(); + gr[2]->Draw("AL*"); + + c1->cd(2); + gr[3]->GetXaxis()->SetRangeUser(130, 175); + gr[3]->GetXaxis()->SetTitle("Time [ns]"); + gr[3]->GetXaxis()->CenterTitle(); + gr[3]->GetYaxis()->SetTitle("Signal [V]"); + gr[3]->GetYaxis()->CenterTitle(); + gr[3]->Draw("AL*"); + */ } diff --git a/macros/walk_corr.C b/macros/walk_corr.C new file mode 100644 index 0000000..f93cddf --- /dev/null +++ b/macros/walk_corr.C @@ -0,0 +1,82 @@ +#include "TH2F.h" +#include "TH3F.h" +#include "TStyle.h" + +void walk_corr( +//01 means it is used for channels 0 and 1 + + const char *filename = "analysis_07_8.root", //considered non-collimated +// const char *filename = "analysis_08_2.root", + const Bool_t can1 = 1) + +{ + 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"); + + if(can1){ + + TCanvas *c1 = new TCanvas("c1", "Trying to correct the walk effect"); + +//pictures for latex report, LED +/* c1->Divide(2,1); + c1->cd(1); + TH2F *h2 = new TH2F("h2", "time difference (LED method) vs charge of non-trigger channel ", 100, -12 ,5, 100, 0, 0.14e-9); + t->Draw(" Ach1.fChargeLED : Ach0.fTimeLED - Ach1.fTimeLED >> h2","","col"); + //x + h2->GetXaxis()->SetTitle("time [ns]"); + h2->GetXaxis()->CenterTitle(); + //y + h2->GetYaxis()->SetTitle("Q [C]"); + h2->GetYaxis()->CenterTitle(); + +// c1->cd(2); + TProfile *prof1 = new TProfile("prof1","Profile of y vs x",100, -12, 5, 0, 0.17e-9); + prof1 = h2->ProfileX(); +// prof1->Fit("pol2","","",-6,0); + prof1->Draw("same"); +*/ + +//pictures for latex report, CFD + c1->Divide(2,2); + c1->cd(1); + TH2F *h2 = new TH2F("h2", "time difference (CFD method) vs charge of non-trigger channel ", 100, -12 ,5, 100, 0, 0.17e-9); + t->Draw(" Ach1.fChargeCFD : Ach0.fTimeCFD - Ach1.fTimeCFD >> h2","","col"); + //x + h2->GetXaxis()->SetTitle("time [ns]"); + h2->GetXaxis()->CenterTitle(); + //y + h2->GetYaxis()->SetTitle("Q [C]"); + h2->GetYaxis()->CenterTitle(); + h2->SetMaximum(10); + c1->Update(); + + c1->cd(2); + //TProfile *prof1 = new TProfile("prof1","Profile of y vs x"/*,100, -12, 5, 0, 0.17e-9, "o"*/); + TProfile *prof1 = h2->ProfileX(); + //prof1 = h2->ProfileY(); + TF1 *myfit = new TF1("myfit","[0] - [1]*exp([2]/sqrt(x))"); + myfit->SetRange(0.0, 0.08); + prof1->Fit("pol1","","",-4,0); + //prof1->Fit("myfit","R");//,0,0.06); + prof1->Draw(); + + c1->cd(3); + TH2F *h3 = new TH2F("h3", "time difference (CFD method) vs charge of non-trigger channel AFTER CORRECTION", 100, -12 ,5, 100, 0, 0.17e-9); + h3->SetMaximum(10); + t->Draw("Ach1.fChargeCFD : (Ach0.fTimeCFD - Ach1.fTimeCFD) + 0.550*1.58e-11/Ach1.fChargeCFD >> h3","","col"); + + c1->cd(4); + TH1F *h4 = new TH1F("h4", "time difference AFTER CORRECTION", 50, -8, 8); + t->Draw(" (Ach0.fTimeCFD - Ach1.fTimeCFD) + 0.550*1.58e-11/Ach1.fChargeCFD >> h4","Ach0.fTimeCFD>100. && Ach0.fTimeCFD<160 && Ach1.fTimeCFD>100. && Ach1.fTimeCFD<160",""); + h4->GetXaxis()->SetTitle("Time difference [ns]"); + h4->GetXaxis()->CenterTitle(); + //h4->Fit("gaus","","",-3,1); + h4->Fit("gaus","","",-2,1.5); + gStyle->SetOptFit(); + + } + +} -- 2.18.1