From 7aa6b255c0e3df0fc226221c52cacae66bc4a69f Mon Sep 17 00:00:00 2001 From: "Kostyleva D.A" Date: Mon, 6 Mar 2017 19:04:54 +0300 Subject: [PATCH] Collecting all the recent changes --- dataClasses/AEvent.h | 2 +- macros/histPresent.C | 181 ++++++++++++++++++++++++++++++++++++++ macros/testShowCFD.cxx | 33 +++++-- macros/testShowGraphs.cxx | 42 ++++++--- 4 files changed, 238 insertions(+), 20 deletions(-) create mode 100644 macros/histPresent.C diff --git a/dataClasses/AEvent.h b/dataClasses/AEvent.h index e2d86f8..c8eb5d2 100644 --- a/dataClasses/AEvent.h +++ b/dataClasses/AEvent.h @@ -49,7 +49,7 @@ private: TArrayD fAmpCFD; //array for CFD amplitudes (attenuated, inversed and delayed) Double_t fTimeCFD; //zero-crossing time - Double_t fChargeCFD; //! + Double_t fChargeCFD; // Double_t fChargeLED; //charge of the signal in Coulomb Double_t fChargeTF; // diff --git a/macros/histPresent.C b/macros/histPresent.C new file mode 100644 index 0000000..7119e27 --- /dev/null +++ b/macros/histPresent.C @@ -0,0 +1,181 @@ +#include "TH2F.h" +#include "TH3F.h" +#include "TStyle.h" + +void histPresent ( + + const char *filename = "analysis_07_8.root", +// const char *filename = "analysis_07_8_smooth.root", +// const char *filename = "analysis_08_2.root", +// const char *filename = "analysis_08_2_smooth.root", + const char *foldername = "nustar_present", +// const char *ext = ".eps", + const char *ext = ".pdf", + + 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"); + + if(can1){ + + TCanvas *c1 = new TCanvas("c1", "canvas 1"); + c1->Divide(2,2); + + c1->cd(1); + //TH1F *h1 = new TH1F("h1", "CFD", 50, -15, 15); + TH1F *h1 = new TH1F("h1", "CFD", 50, 0, 20); + t->Draw("Ach0.fTimeCFD - Ach1.fTimeCFD >> h1","Ach0.fTimeCFD>100. && Ach0.fTimeCFD<160 && Ach1.fTimeCFD>100. && Ach1.fTimeCFD<160",""); + //x + h1->GetXaxis()->SetTitle("Time difference [ns]"); + h1->GetXaxis()->CenterTitle(); + //h1->Fit("gaus", "","",-3,2); + h1->Fit("gaus", "","",8,13); + gStyle->SetOptFit(); + + c1->Update(); + + c1->cd(2); + //TH1F *h2 = new TH1F("h2", "LED",50, -10, 10); + TH1F *h2 = new TH1F("h2", "LED",50, 0, 20); + t->Draw("Ach0.fTimeLED - Ach1.fTimeLED >> h2","Ach0.fTimeLED>100. && Ach0.fTimeLED < 150 && Ach1.fTimeLED>100 && Ach1.fTimeLED < 150","col"); + //x + h2->GetXaxis()->SetTitle("Time difference [ns]"); + h2->GetXaxis()->CenterTitle(); + //h2->Fit("gaus", "","",-3,1); + h2->Fit("gaus", "","",7,12); + gStyle->SetOptFit(); + + c1->Update(); + +/* c1->cd(3); + //TH1F *h3 = new TH1F("h3", "Front edge fit crossing zero level", 100, -20, 20); + TH1F *h3 = new TH1F("h3", "Front edge fit crossing zero level", 100,0, 20); + t->Draw("Ach0.fTimeFront - Ach1.fTimeFront >> h3","Ach0.fTimeFront>100. && Ach0.fTimeFront < 150 && Ach1.fTimeFront>100 && Ach1.fTimeFront < 150","col"); + //x + h3->GetXaxis()->SetTitle("Time difference [ns]"); + h3->GetXaxis()->CenterTitle(); + //h3->Fit("gaus", "","",-3,2); + h3->Fit("gaus", "","",9,12); + gStyle->SetOptFit();*/ + + c1->cd(3); + //TH1F *h3 = new TH1F("h3", "Front edge fit crossing zero level", 100, -20, 20); + TH1F *h3 = new TH1F("h3", "Middle point of front level", 100,1, 20); + t->Draw("Ach0.fTimeMid - Ach1.fTimeMid >> h3","","col"); + //x + h3->GetXaxis()->SetTitle("Time difference [ns]"); + h3->GetXaxis()->CenterTitle(); + //h3->Fit("gaus", "","",-3,2); + h3->Fit("gaus", "","",9,12); + gStyle->SetOptFit(); + + c1->Update(); + + c1->cd(4); + //TH1F *h4 = new TH1F("h4", "the middle point of front edge", 50, -10, 10); + TH1F *h4 = new TH1F("h4", "the 10 percent point of front edge", 80, 1, 20); + t->Draw("Ach0.fTime10 - Ach1.fTime10 >> h4","",""); + h4->GetXaxis()->SetTitle("Time difference [ns]"); + h4->GetXaxis()->CenterTitle(); + //h4->Fit("gaus","","",-3,1); + h4->Fit("gaus","","",9,13); + gStyle->SetOptFit(); + + + + c1->Print(Form("../macros/picsDRS4/%s/Smoothed_deltas%s", foldername, ext)); + } + + if(can2){ + + TCanvas *c2 = new TCanvas("c2", "canvas 2"); + c2->Divide(2,2); + + c2->cd(1); + //TH1F *h1 = new TH1F("h1", "CFD", 50, -15, 15); + TH1F *h5 = new TH1F("h5", "ToT", 50, 0, 12); + t->Draw("Ach0.fToT >> h5","Ach0.fToT > 0",""); + //x + h5->GetXaxis()->SetTitle("Time over threshold [ns]"); + h5->GetXaxis()->CenterTitle(); + //h1->Fit("gaus", "","",-3,2); + //h1->Fit("gaus", "","",8,13); + //gStyle->SetOptFit(); + + c2->Update(); + + c2->cd(2); + //TH1F *h2 = new TH1F("h2", "LED",50, -10, 10); + TH1F *h6 = new TH1F("h6", "ToT",50, 0, 12); + t->Draw("Ach1.fToT >> h6","Ach1.fToT > 0","col"); + //x + h6->GetXaxis()->SetTitle("Time over threshold [ns]"); + h6->GetXaxis()->CenterTitle(); + //h2->Fit("gaus", "","",-3,1); + //h2->Fit("gaus", "","",7,12); + //gStyle->SetOptFit(); + + c2->Update(); + + c2->cd(3); + //TH1F *h3 = new TH1F("h3", "Front edge fit crossing zero level", 100, -20, 20); + TH1F *h7 = new TH1F("h7", "Middle point of front level", 80,1, 20); + t->Draw("Ach0.fTimeMid - Ach1.fTimeMid >> h7","Ach0.fToT > 2. && Ach0.fToT < 6. && Ach1.fToT > 2. && Ach1.fToT < 6. ","col"); + //x + h7->GetXaxis()->SetTitle("Time difference [ns]"); + h7->GetXaxis()->CenterTitle(); + //h3->Fit("gaus", "","",-3,2); + h7->Fit("gaus", "","",9,12); + gStyle->SetOptFit(); + + c2->Update(); + + c2->cd(4); + //TH1F *h4 = new TH1F("h4", "the middle point of front edge", 50, -10, 10); + TH1F *h8 = new TH1F("h8", "the 10 percent point of front edge", 80, 1, 20); + t->Draw("Ach0.fTime10 - Ach1.fTime10 >> h8"," Ach0.fToT > 2. && Ach0.fToT < 6. && Ach1.fToT > 2. && Ach1.fToT < 6.",""); + h8->GetXaxis()->SetTitle("Time difference [ns]"); + h8->GetXaxis()->CenterTitle(); + //h4->Fit("gaus","","",-3,1); + h8->Fit("gaus","","",9,13); + gStyle->SetOptFit(); + + c2->Print(Form("../macros/picsDRS4/%s/Smoothed_deltas_tot_corr%s", foldername, ext)); + + } + + + if(can3){ + + TCanvas *c3 = new TCanvas("c3", "canvas 3"); + c3->Divide(2,2); + + c3->cd(1); + TH1F *h9 = new TH1F("h9", "Charge CFD", 200, 0 ,0.5e-9); + t->Draw("Ach0.fChargeCFD >> h9","",""); + c3->Update(); + + c3->cd(2); + TH1F *h10 = new TH1F("h10", "Charge LED",200, 0 ,0.5e-9); + t->Draw("Ach0.fChargeLED >> h10","",""); + c3->Update(); + + c3->cd(3); + TH1F *h11 = new TH1F("h11", "Sum of charges CFD for 4 channels",200, 0 ,10e-9); + t->Draw("Ach0.fChargeCFD + Ach1.fChargeCFD + Ach2.fChargeCFD + Ach3.fChargeCFD >> h11","",""); + c3->Update(); + + c3->cd(4); + TH1F *h12 = new TH1F("h12", "Sum of charges LED for 4 channels",200, 0 ,10e-9); + t->Draw("Ach0.fChargeLED + Ach1.fChargeLED + Ach2.fChargeLED + Ach3.fChargeLED >> h12","",""); + c3->Update(); + + } + +} diff --git a/macros/testShowCFD.cxx b/macros/testShowCFD.cxx index af19fa9..8d6efef 100644 --- a/macros/testShowCFD.cxx +++ b/macros/testShowCFD.cxx @@ -3,10 +3,13 @@ void testShowCFD() gSystem->Load("../libData.so"); - const Long64_t kFirstEvent = 128; + const Long64_t kFirstEvent = 133; + const char *foldername = "nustar_present"; + const char *ext = ".pdf"; // TFile fr("../data/dataDSR4/analysis_08_2_CFD02_06.root"); - TFile fr("../data/dataDSR4/analysis_08_2.root"); +// TFile fr("../data/dataDSR4/analysis_08_2.root"); + TFile fr("../data/dataDSR4/analysis_08_2_smooth.root"); TTree *tr = (TTree*)fr.Get("atree"); AEvent *revent = new AEvent(); @@ -23,12 +26,32 @@ void testShowCFD() TCanvas *c1 = new TCanvas("c1","CFD implementation",10,10,1000,600); - c1->Divide(3,4); - for (Int_t i = 0; i < 12; i++) { +// four event picture +/* c1->Divide(2,2); + + for (Int_t i = 0; i < 4; i++) { c1->cd(i+1); - gr[i]->Draw(""); + + gr[i]->GetXaxis()->SetRangeUser(130, 175); + gr[i]->GetXaxis()->SetTitle("Time [ns]"); + gr[i]->GetXaxis()->CenterTitle(); + gr[i]->GetYaxis()->SetTitle("Signal CFD [V]"); + gr[i]->GetYaxis()->CenterTitle(); + gr[i]->Draw("AL*"); } + c1->Print(Form("../macros/picsDRS4/%s/Signal_shapes_CFD%s", foldername, ext));*/ + +//one event picture + gr[2]->GetXaxis()->SetRangeUser(130, 160); + gr[2]->GetXaxis()->SetTitle("Time [ns]"); + gr[2]->GetXaxis()->CenterTitle(); + gr[2]->GetYaxis()->SetTitle("Signal [V]"); + gr[2]->GetYaxis()->CenterTitle(); + gr[2]->Draw("AL*"); + //f1->SetRange(t10[2], t90[2]); + //gr[2]->Fit(f1, "RQ"); + c1->Print(Form("../macros/picsDRS4/%s/CFD_one_signal_shape%s", foldername, ext)); // c1->cd(2); // tr->Draw("gAmp.Draw()","","goff",1,124); diff --git a/macros/testShowGraphs.cxx b/macros/testShowGraphs.cxx index 7d80297..978aba3 100644 --- a/macros/testShowGraphs.cxx +++ b/macros/testShowGraphs.cxx @@ -13,21 +13,22 @@ void testShowGraphs() gStyle->SetCanvasDefH(900); gStyle->SetCanvasDefW(1500); - const char *foldername = "7_8"; - const char *ext = ".gif"; +// const char *foldername = "7_8"; + const char *foldername = "nustar_present"; + const char *ext = ".pdf"; gSystem->Load("../libData.so"); - const Long64_t kFirstEvent = 128; + const Long64_t kFirstEvent = 140; // 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"); // TFile fr("../data/dataDSR4/Neurad_081216_2NEW.root"); // TFile fr("../data/dataTektronix/exp18.root"); - TFile fr("../data/dataDSR4/analysis_07_8.root"); + //TFile fr("../data/dataDSR4/analysis_07_8_smooth.root"); // TFile fr("../data/dataDSR4/Neurad_081216_2NEW.root"); // TFile fr("../data/dataTektronix/exp18.root"); @@ -60,15 +61,13 @@ void testShowGraphs() }//for over events - - TCanvas *c1 = new TCanvas("c1","test",10,10,1000,600); - c1->Divide(2,2); - - TF1 *f1 = new TF1("f1name", "[0]+x*[1]"); -// TF1 *f1 = new TF1("pol1", ); + TCanvas *c1 = new TCanvas("c1","Signal shape",10,10,1000,600); + //c1->Divide(3,4); +// four event picture + c1->Divide(2,2); for (Int_t k = 0; k < 4; k++) { c1->cd(k+1); gr[k]->GetXaxis()->SetRangeUser(130, 175); @@ -81,7 +80,22 @@ void testShowGraphs() //f1->SetRange(t10[k], t90[k]); //gr[k]->Fit(f1, "RQ"); } - //c1->Print(Form("../macros/picsDRS4/file%s/signals%s", foldername, ext)); -// c1->cd(2); -// tr->Draw("gAmp.Draw()","","goff",1,124); + c1->Print(Form("../macros/picsDRS4/%s/Signal_shapes_bad%s", foldername, ext)); + +// one event picture +/* gr[4]->GetXaxis()->SetRangeUser(130, 160); + gr[4]->GetXaxis()->SetTitle("Time [ns]"); + gr[4]->GetXaxis()->CenterTitle(); + gr[4]->GetYaxis()->SetTitle("Signal [V]"); + gr[4]->GetYaxis()->CenterTitle(); + gr[4]->Draw("AL*"); + f1->SetRange(t10[4], t90[4]); + gr[4]->Fit(f1, "RQ"); + c1->Print(Form("../macros/picsDRS4/%s/One_signal_shape%s", foldername, ext)); + + + + + //c1->Print(Form("../macros/picsDRS4/%s/Signal_shapes_with_fit%s", foldername, ext)); +*/ } -- 2.18.1