Commit 5eb9075c authored by DariaKostyleva's avatar DariaKostyleva

Try to apply manual time-amplitude correction, script walk_corr.C

parent 7aa6b255
...@@ -5,16 +5,16 @@ ...@@ -5,16 +5,16 @@
void histCorrNew01 ( void histCorrNew01 (
//01 means it is used for channels 0 and 1 //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_2.root", //collimated?
// const char *filename = "analysis_07_4.root", // 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 *foldername = "7_8/chpair01",
// const char *ext = ".eps", // const char *ext = ".eps",
const char *ext = ".gif", 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 = 1) const Bool_t can3 = 0, const Bool_t can4 = 0)
//const Bool_t can5 = 0, const Bool_t can6 = 0) //const Bool_t can5 = 0, const Bool_t can6 = 0)
{ {
using std::cout; using std::cout;
...@@ -29,11 +29,12 @@ void histCorrNew01 ( ...@@ -29,11 +29,12 @@ void histCorrNew01 (
if(can1){ if(can1){
TCanvas *c1 = new TCanvas("c1", "Correlation pictures for non-collimated data: delta t and integrals"); 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); /* 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 - Ach1.fTimeFront : Ach0.fChargeTF >> h1","","col"); // t->Draw(" Ach0.fTimeFront - Ach1.fTimeFront : Ach0.fChargeTF >> h1","","col");
t->Draw(" Ach0.fTimeLED - Ach1.fTimeLED : Ach0.fChargeLED >> h1","","col");
//x //x
h1->GetXaxis()->SetTitle("Charge [C]"); h1->GetXaxis()->SetTitle("Charge [C]");
h1->GetXaxis()->CenterTitle(); h1->GetXaxis()->CenterTitle();
...@@ -44,8 +45,9 @@ void histCorrNew01 ( ...@@ -44,8 +45,9 @@ void histCorrNew01 (
c1->Update(); c1->Update();
c1->cd(2); c1->cd(2);
TH2F *h2 = new TH2F("h2", "front time tau vs charge TF 1 ", 200, 0, 0.5e-9, 200, 5 ,15); 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.fTimeFront - Ach1.fTimeFront : Ach1.fChargeTF >> h2","","col");
t->Draw(" Ach0.fTimeLED - Ach1.fTimeLED : Ach1.fChargeLED >> h2","","col");
//x //x
h2->GetXaxis()->SetTitle("Charge [C]"); h2->GetXaxis()->SetTitle("Charge [C]");
h2->GetXaxis()->CenterTitle(); h2->GetXaxis()->CenterTitle();
...@@ -56,8 +58,9 @@ void histCorrNew01 ( ...@@ -56,8 +58,9 @@ void histCorrNew01 (
c1->Update(); c1->Update();
c1->cd(3); 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); 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.fChargeTF : Ach1.fChargeTF >> h3","","col");
t->Draw(" Ach0.fChargeLED : Ach1.fChargeLED >> h3","","col");
//x //x
h3->GetXaxis()->SetTitle("Charge_0 [C]"); h3->GetXaxis()->SetTitle("Charge_0 [C]");
h3->GetXaxis()->CenterTitle(); h3->GetXaxis()->CenterTitle();
...@@ -66,7 +69,62 @@ void histCorrNew01 ( ...@@ -66,7 +69,62 @@ void histCorrNew01 (
h3->GetYaxis()->CenterTitle(); h3->GetYaxis()->CenterTitle();
c1->Update(); 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)); // c1->Print(Form("../macros/picsDRS4/file%s/time_front_corr1%s", foldername, ext));
} }
......
...@@ -10,9 +10,9 @@ void histCorrNew02 ( ...@@ -10,9 +10,9 @@ void histCorrNew02 (
// const char *ext = ".eps", // const char *ext = ".eps",
const char *ext = ".gif", 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 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::cout;
using std::endl; using std::endl;
...@@ -29,7 +29,7 @@ void histCorrNew02 ( ...@@ -29,7 +29,7 @@ void histCorrNew02 (
c1->Divide(2,2); c1->Divide(2,2);
c1->cd(1); 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"); t->Draw(" Ach0.fTimeFront - Ach2.fTimeFront : Ach0.fChargeTF >> h1","","col");
//x //x
h1->GetXaxis()->SetTitle("Charge [C]"); h1->GetXaxis()->SetTitle("Charge [C]");
...@@ -41,7 +41,7 @@ void histCorrNew02 ( ...@@ -41,7 +41,7 @@ void histCorrNew02 (
c1->Update(); c1->Update();
c1->cd(2); 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"); t->Draw(" Ach0.fTimeFront - Ach2.fTimeFront : Ach2.fChargeTF >> h2","","col");
//x //x
h2->GetXaxis()->SetTitle("Charge [C]"); h2->GetXaxis()->SetTitle("Charge [C]");
...@@ -53,7 +53,7 @@ void histCorrNew02 ( ...@@ -53,7 +53,7 @@ void histCorrNew02 (
c1->Update(); c1->Update();
c1->cd(3); 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"); t->Draw(" Ach0.fChargeTF : Ach2.fChargeTF >> h3","","col");
//x //x
h3->GetXaxis()->SetTitle("Charge_0 [C]"); h3->GetXaxis()->SetTitle("Charge_0 [C]");
......
...@@ -12,7 +12,7 @@ void histPresent ( ...@@ -12,7 +12,7 @@ void histPresent (
// const char *ext = ".eps", // const char *ext = ".eps",
const char *ext = ".pdf", 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 can3 = 1, const Bool_t can4 = 0)
//const Bool_t can5 = 0/*, const Bool_t can6 = 0*/) //const Bool_t can5 = 0/*, const Bool_t can6 = 0*/)
{ {
......
{ {
gSystem->Load("../libData.so"); 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"); TTree *tr = (TTree*)f->Get("atree");
const Int_t nP = 1024; const Int_t nP = 1024;
......
...@@ -19,7 +19,7 @@ void testShowGraphs() ...@@ -19,7 +19,7 @@ void testShowGraphs()
gSystem->Load("../libData.so"); 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/Neurad_7_08_NEW.root");
TFile fr("../data/dataDSR4/analysis_07_8.root"); TFile fr("../data/dataDSR4/analysis_07_8.root");
...@@ -98,4 +98,24 @@ void testShowGraphs() ...@@ -98,4 +98,24 @@ void testShowGraphs()
//c1->Print(Form("../macros/picsDRS4/%s/Signal_shapes_with_fit%s", foldername, ext)); //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*");
*/
} }
#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();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment