Commit c16915f3 authored by Muzalevsky I.A's avatar Muzalevsky I.A

Merge branch 'master' of http://er.jinr.ru:90/vratislav.chudoba/NeuRad_tests

Conflicts:
	macros/histCorr.C
	macros/testShowGraphs.cxx
parents 993d076c 1612d04b
...@@ -15,8 +15,8 @@ int main(int argc, char* argv[]) ...@@ -15,8 +15,8 @@ int main(int argc, char* argv[])
//to be extracted from the source as parameters //to be extracted from the source as parameters
const Int_t noBranches = 4; const Int_t noBranches = 4;
const Double_t cfRatio = 0.5; const Double_t cfRatio = 0.2;
const Int_t cfTD = 5; const Double_t cfTD = 0.6; //in ns
Double_t noiseMin = 5; Double_t noiseMin = 5;
Double_t noiseMax = 25; Double_t noiseMax = 25;
...@@ -86,7 +86,7 @@ int main(int argc, char* argv[]) ...@@ -86,7 +86,7 @@ int main(int argc, char* argv[])
for(Long64_t i = 0; i < nentries; i++) { for(Long64_t i = 0; i < nentries; i++) {
tr->GetEntry(i); tr->GetEntry(i);
//cout<<" i "<<i<<endl;
for (Int_t j = 0; j<noBranches; j++) { for (Int_t j = 0; j<noBranches; j++) {
wevent[j]->Reset(); wevent[j]->Reset();
wevent[j]->ProcessEvent(); //here all the analysis is going on so far wevent[j]->ProcessEvent(); //here all the analysis is going on so far
......
...@@ -64,7 +64,7 @@ void AEvent::ProcessEvent() { ...@@ -64,7 +64,7 @@ void AEvent::ProcessEvent() {
SetGraphs(); SetGraphs();
FindFrontProperties(); FindFrontProperties();
SetGraphs(); // SetGraphs();
SetCFD(); SetCFD();
SetChargeCFD(); SetChargeCFD();
...@@ -132,17 +132,46 @@ void AEvent::SetGraphs() { ...@@ -132,17 +132,46 @@ void AEvent::SetGraphs() {
void AEvent::SetCFD() { void AEvent::SetCFD() {
Double_t level = 100.; //is necessary to find cfd amplitude value closest to zero // Double_t level = 100.; //is necessary to find cfd amplitude value closest to zero
Double_t time = 0; Double_t time = 0;
Double_t mytime = fCFtimeDelay;
fGraphCFD->Set(fNPoints); fGraphCFD->Set(fNPoints);
//working variables //working variables
Double_t maxCFD = 0., minCFD = 0.; Double_t maxCFD = 0., minCFD = 0.;
Double_t TmaxCFD = 0., TminCFD = 0.; Double_t TmaxCFD = 0., TminCFD = 0.;
Int_t imax = 0, imin = 0; Double_t ampCFD;
const Double_t timeStep = 0.05; const Double_t timeStep = 0.1;
Int_t i = 0;
for (Int_t i=0; i<fNPoints; i++) { //вместо цикла по точкам нужно сделать "цикл" по графику
while( mytime < (200. - fCFtimeDelay) ) {
// fAmpCFD[i] = fGraphSignal->Eval(mytime)*fCFratio*(-1);
//cout<<"jncfe "<<fGraphSignal->Eval(mytime)*fCFratio*(-1)<<endl;
//fGraphSignal->Eval(mytime)*fCFratio*(-1) + fGraphSignal->Eval(mytime - 0.6)
ampCFD = fGraphSignal->Eval(mytime)*fCFratio*(-1) + fGraphSignal->Eval(mytime - fCFtimeDelay);
fGraphCFD->SetPoint(i, mytime, ampCFD);
//point for max CFD amplitude
if( ampCFD > maxCFD) {
maxCFD = ampCFD;
TmaxCFD = mytime;
}
//point for min CFD amplitude
if( ampCFD < minCFD) {
minCFD = ampCFD;
TminCFD = mytime;
}
i++;
mytime = mytime + timeStep;
}
//
/* for (Int_t i=0; i<fNPoints; i++) {
//CFD method //CFD method
if(i>fCFtimeDelay) { // условие, чтобы не выскочить из размера массива ( обрезает границы на fCFtimeDelay) if(i>fCFtimeDelay) { // условие, чтобы не выскочить из размера массива ( обрезает границы на fCFtimeDelay)
...@@ -155,17 +184,17 @@ void AEvent::SetCFD() { ...@@ -155,17 +184,17 @@ void AEvent::SetCFD() {
if(fAmpCFD[i] > maxCFD) { if(fAmpCFD[i] > maxCFD) {
maxCFD = fAmpCFD[i]; maxCFD = fAmpCFD[i];
TmaxCFD = fTime[i]; TmaxCFD = fTime[i];
imax = i; // imax = i;
} }
//point for min CFD amplitude //point for min CFD amplitude
if(fAmpCFD[i] < minCFD) { if(fAmpCFD[i] < minCFD) {
minCFD = fAmpCFD[i]; minCFD = fAmpCFD[i];
TminCFD = fTime[i]; TminCFD = fTime[i];
imin = i; // imin = i;
} }
} }*/
/* //finding "zero" of CFD amplitude /* //finding "zero" of CFD amplitude
for(Int_t j = imin; j < imax; j++) { for(Int_t j = imin; j < imax; j++) {
...@@ -177,7 +206,7 @@ void AEvent::SetCFD() { ...@@ -177,7 +206,7 @@ void AEvent::SetCFD() {
*/ */
//I want to find zero of CFD using graph and eval //I want to find zero of CFD using graph and eval
time = TminCFD; time = TminCFD;
while( (fGraphCFD->Eval(time) <= 0) && (time <= TmaxCFD) && (time >= TminCFD) ) { while( (fGraphCFD->Eval(time) <= 0) && (time <= TmaxCFD) /*&& (time >= TminCFD)*/ ) {
fTimeCFD = time; fTimeCFD = time;
time = time + timeStep; time = time + timeStep;
} }
......
void histCFDf7_8()
{
gSystem->Load("../libData.so");
TFile *f = new TFile("../data/dataDSR4/analysis_07_8.root");
TTree *t = (TTree*)f->Get("atree");
TCanvas *c = new TCanvas("CFD canvas");
c->Divide(2,2);
c->cd(1);
t->Draw("Ach0.fTimeCFD","","");
c->cd(2);
t->Draw("Ach2.fTimeCFD","","");
c->cd(3);
t->Draw("Ach0.fTimeCFD - Ach2.fTimeCFD","","");
c->cd(4);
}
void histCFDf8_2()
{
gSystem->Load("../libData.so");
TFile *f = new TFile("../data/dataDSR4/analysis_08_2.root");
TTree *t = (TTree*)f->Get("atree");
TCanvas *c = new TCanvas("CFD canvas");
c->Divide(2,2);
c->cd(1);
t->Draw("Ach0.fTimeCFD","","");
c->cd(2);
t->Draw("Ach1.fTimeCFD","","");
c->cd(3);
t->Draw("Ach0.fTimeCFD - Ach1.fTimeCFD","","");
c->cd(4);
}
//#include "TCanvas.h" //#include "TCanvas.h"
<<<<<<< HEAD
void histCorr(const char *filename = "analysis_07_8.root", const char *foldername = "7_8", const char *ext = ".eps", const Bool_t can1 = 0, const Bool_t can2 = 0, const Bool_t can3 = 0, const Bool_t can4 = 0, const Bool_t can5 = 1) void histCorr(const char *filename = "analysis_07_8.root", const char *foldername = "7_8", const char *ext = ".eps", const Bool_t can1 = 0, const Bool_t can2 = 0, const Bool_t can3 = 0, const Bool_t can4 = 0, const Bool_t can5 = 1)
=======
void histCorr(
// const char *filename = "analysis_07_8.root",
const char *filename = "analysis_08_2.root",
// const char *foldername = "7_8",
const char *foldername = "8_2",
// const char *ext = ".eps",
const char *ext = ".gif",
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)
>>>>>>> 1612d04b19c3139e125a1642bdb0763585790d84
{ {
gSystem->Load("../libData.so"); gSystem->Load("../libData.so");
TFile *f = new TFile(Form("../data/dataDSR4/%s", filename)); TFile *f = new TFile(Form("../data/dataDSR4/%s", filename));
...@@ -11,15 +22,16 @@ void histCorr(const char *filename = "analysis_07_8.root", const char *foldernam ...@@ -11,15 +22,16 @@ void histCorr(const char *filename = "analysis_07_8.root", const char *foldernam
TCanvas *c1 = new TCanvas("c1", "Correlation pictures: delta t from CFD vs something"); TCanvas *c1 = new TCanvas("c1", "Correlation pictures: delta t from CFD vs something");
c1->Divide(2,2); c1->Divide(2,2);
TH2F *h1 = new TH2F("h1", "Time difference between two channels vs an integral of the first channel",125, -50., 50., 125, 0., 5e-9); // TH2F *h1 = new TH2F("h1", "Time difference between two channels vs an integral of the first channel",125, -50., 50., 125, 0., 5e-9);
TH2F *h2 = new TH2F("h2", "Time difference between two channels vs an integral of the second channel",125, -50., 50.,125, 0e-9, 5e-9); TH2F *h1 = new TH2F("h1", "Time difference between two channels vs an integral of the first channel",125, -20., 30., 125, 0., 5e-9);
TH2F *h2 = new TH2F("h2", "Time difference between two channels vs an integral of the second channel",125, -10., 30.,125, 0e-9, 5e-9);
TH2F *h3 = new TH2F("h3", "Time difference between two channels vs amplitude of the first channel",125, -100., 100., 125, 0., 0.5); TH2F *h3 = new TH2F("h3", "Time difference between two channels vs amplitude of the first channel",125, -100., 100., 125, 0., 0.5);
TH2F *h4 = new TH2F("h4", "Time difference between two channels vs amplitude of the second channel",125, -100., 100., 125, 0., 0.5); TH2F *h4 = new TH2F("h4", "Time difference between two channels vs amplitude of the second channel",125, -100., 100., 125, 0., 0.5);
c1->cd(1); c1->cd(1);
t->Draw("Ach0.fChargeCFD : ( Ach0.fTimeCFD - Ach2.fTimeCFD ) >> h1","","col"); t->Draw("Ach0.fChargeCFD : ( Ach0.fTimeCFD - Ach1.fTimeCFD ) >> h1","Ach0.fChargeCFD > 0.2e-9","col");
//x //x
h1->GetXaxis()->SetTitle("\\Delta \\tau_{0-2} [ns]"); h1->GetXaxis()->SetTitle("\\Delta \\tau_{0-1} [ns]");
h1->GetXaxis()->CenterTitle(); h1->GetXaxis()->CenterTitle();
//y //y
h1->GetYaxis()->SetTitle("Q_{0} [C]"); h1->GetYaxis()->SetTitle("Q_{0} [C]");
...@@ -27,18 +39,18 @@ void histCorr(const char *filename = "analysis_07_8.root", const char *foldernam ...@@ -27,18 +39,18 @@ void histCorr(const char *filename = "analysis_07_8.root", const char *foldernam
c1->Update(); c1->Update();
c1->cd(2); c1->cd(2);
t->Draw("Ach2.fChargeCFD : ( Ach0.fTimeCFD - Ach2.fTimeCFD ) >> h2","","col"); t->Draw("Ach1.fChargeCFD : ( Ach0.fTimeCFD - Ach1.fTimeCFD ) >> h2","Ach1.fChargeCFD>0.05e-9","col");
h2->GetXaxis()->SetTitle("\\Delta \\tau_{0-2} [ns]"); h2->GetXaxis()->SetTitle("\\Delta \\tau_{0-1} [ns]");
h2->GetXaxis()->CenterTitle(); h2->GetXaxis()->CenterTitle();
//y //y
h2->GetYaxis()->SetTitle("Q_{2} [C]"); h2->GetYaxis()->SetTitle("Q_{1} [C]");
h2->GetYaxis()->CenterTitle(); h2->GetYaxis()->CenterTitle();
c1->Update(); c1->Update();
c1->cd(3); c1->cd(3);
t->Draw("Ach0.fAmpMax: ( Ach0.fTimeCFD - Ach2.fTimeCFD ) >> h3","","col"); t->Draw("Ach0.fAmpMax: ( Ach0.fTimeCFD - Ach1.fTimeCFD ) >> h3","","col");
//x //x
h3->GetXaxis()->SetTitle("\\Delta \\tau_{0-2} [ns]"); h3->GetXaxis()->SetTitle("\\Delta \\tau_{0-1} [ns]");
h3->GetXaxis()->CenterTitle(); h3->GetXaxis()->CenterTitle();
//y //y
h3->GetYaxis()->SetTitle("Max_ampl_{0} [V]"); h3->GetYaxis()->SetTitle("Max_ampl_{0} [V]");
...@@ -46,40 +58,40 @@ void histCorr(const char *filename = "analysis_07_8.root", const char *foldernam ...@@ -46,40 +58,40 @@ void histCorr(const char *filename = "analysis_07_8.root", const char *foldernam
c1->Update(); c1->Update();
c1->cd(4); c1->cd(4);
t->Draw("Ach2.fAmpMax: ( Ach0.fTimeCFD - Ach2.fTimeCFD ) >> h4","","col"); t->Draw("Ach1.fAmpMax: ( Ach0.fTimeCFD - Ach1.fTimeCFD ) >> h4","","col");
//x //x
h4->GetXaxis()->SetTitle("\\Delta \\tau_{0-2} [ns]"); h4->GetXaxis()->SetTitle("\\Delta \\tau_{0-1} [ns]");
h4->GetXaxis()->CenterTitle(); h4->GetXaxis()->CenterTitle();
//y //y
h4->GetYaxis()->SetTitle("Max_ampl_{2} [V]"); h4->GetYaxis()->SetTitle("Max_ampl_{1} [V]");
h4->GetYaxis()->CenterTitle(); h4->GetYaxis()->CenterTitle();
c1->Show(); c1->Show();
c1->Update(); c1->Update();
c1->Print(Form("../macros/picsDRS4/file%s/TimeDiffCFD%s", foldername, ext)); //c1->Print(Form("../macros/picsDRS4/file%s/TimeDiffCFD%s", foldername, ext));
} }
if (can2) { if (can2) {
TCanvas *c2 = new TCanvas("c2", "Correlation pictures: Integrals and amplitudes"); TCanvas *c2 = new TCanvas("c2", "Correlation pictures: Integrals and amplitudes");
c2->Divide(1,2); c2->Divide(2,2);
TH2F *h5 = new TH2F("h5", "Integral of the first channel vs integral of the second channel", 300, 0., 2e-9, 300, 0., 2e-9); TH2F *h5 = new TH2F("h5", "Integral of the first channel vs integral of the second channel", 300, 0., 2e-9, 300, 0., 2e-9);
TH2F *h6 = new TH2F("h6", "Amplitude of the first channel vs amplitude of the second channel", 300, 10, 1e-10, 300, 10, 1e-10); TH2F *h6 = new TH2F("h6", "Amplitude of the first channel vs amplitude of the second channel", 300, 10, 1e-10, 300, 10, 1e-10);
c2->cd(1); c2->cd(1);
t->Draw("Ach0.fChargeCFD : Ach2.fChargeCFD >> h5","","col"); t->Draw("Ach0.fChargeCFD : Ach1.fChargeCFD >> h5","","col1");
//x //x
h5->GetXaxis()->SetTitle("Q_{2} [C]"); h5->GetXaxis()->SetTitle("Q_{1} [C]");
h5->GetXaxis()->CenterTitle(); h5->GetXaxis()->CenterTitle();
//y //y
h5->GetYaxis()->SetTitle("Q_{0} [C]"); h5->GetYaxis()->SetTitle("Q_{0} [C]");
h5->GetYaxis()->CenterTitle(); h5->GetYaxis()->CenterTitle();
c2->Update(); c2->Update();
c2->cd(2); c2->cd(3);
t->Draw("Ach0.fAmpMax : Ach2.fAmpMax >> h6","","col"); t->Draw("Ach0.fAmpMax : Ach1.fAmpMax >> h6","","col");
//x //x
h6->GetXaxis()->SetTitle("Max_ampl_{2} [V]"); h6->GetXaxis()->SetTitle("Max_ampl_{1} [V]");
h6->GetXaxis()->CenterTitle(); h6->GetXaxis()->CenterTitle();
//y //y
h6->GetYaxis()->SetTitle("Max_ampl_{0} [V]"); h6->GetYaxis()->SetTitle("Max_ampl_{0} [V]");
...@@ -96,10 +108,13 @@ void histCorr(const char *filename = "analysis_07_8.root", const char *foldernam ...@@ -96,10 +108,13 @@ void histCorr(const char *filename = "analysis_07_8.root", const char *foldernam
TH1F *h7 = new TH1F("h7", "Time difference between 90 and 10 percent of the rising edge ampl", 100, 0, 5); TH1F *h7 = new TH1F("h7", "Time difference between 90 and 10 percent of the rising edge ampl", 100, 0, 5);
TH2F *h8 = new TH2F("h8", "Time difference between 90 and 10 percent vs integral", 100, 0., 5., 100, 0., 3e-9); TH2F *h8 = new TH2F("h8", "Time difference between 90 and 10 percent vs integral", 100, 0., 5., 100, 0., 3e-9);
TH2F *h9 = new TH2F("h9", "Time difference between 90 and 10: ch0 vs ch1", 100, 0., 5., 100, 0., 5.); // TH2F *h9 = new TH2F("h9", "Time difference between 90 and 10: ch0 vs ch1", 100, 0., 5., 100, 0., 5.);
TH1F *h9 = new TH1F("h9", "Delta tau", 100, -10., 30.);
TH1F *h10 = new TH1F("h10", "Time difference between 90 and 10 > 0 and chi square < 0.0005", 100, 0., 5.);
c3->cd(1); c3->cd(1);
t->Draw("Ach1.fTime90 - Ach1.fTime10 >> h7","((Ach1.fTime90-Ach1.fTime10)>=0)","col"); // t->Draw("Ach1.fTime90 - Ach1.fTime10 >> h7","((Ach1.fTime90-Ach1.fTime10)>=0)","col");
t->Draw("Ach1.fTime90 - Ach1.fTime10 >> h7","((Ach1.fTime90-Ach1.fTime10)>=0) && (Ach1.fEdgeXi < 0.0015)","col"); t->Draw("Ach1.fTime90 - Ach1.fTime10 >> h7","((Ach1.fTime90-Ach1.fTime10)>=0) && (Ach1.fEdgeXi < 0.0015)","col");
// t->Draw("Ach0.fTime90 - Ach0.fTime10 >> h7","","col"); // t->Draw("Ach0.fTime90 - Ach0.fTime10 >> h7","","col");
//x //x
...@@ -118,19 +133,22 @@ void histCorr(const char *filename = "analysis_07_8.root", const char *foldernam ...@@ -118,19 +133,22 @@ void histCorr(const char *filename = "analysis_07_8.root", const char *foldernam
c3->Update(); c3->Update();
c3->cd(2); c3->cd(2);
t->Draw(" (Ach1.fTime90 - Ach1.fTime10) : (Ach1.fTime90 - Ach1.fTime10) >> h9","(Ach1.fTime90 - Ach1.fTime10)>0","col"); // t->Draw(" (Ach1.fTime90 - Ach1.fTime10) : (Ach1.fTime90 - Ach1.fTime10) >> h9","(Ach1.fTime90 - Ach1.fTime10)>0","col");
t->Draw("Ach0.fTimeCFD - Ach1.fTimeCFD >> h9","Ach1.fChargeCFD>0.05e-9 && Ach1.fChargeCFD<0.5e-9","");
//x //x
h9->GetXaxis()->SetTitle("\\Delta \\tau_{0}^{(rise)} [ns]"); h9->GetXaxis()->SetTitle("\\Delta \\tau_{0-1} [ns]");
h9->GetXaxis()->CenterTitle(); h9->GetXaxis()->CenterTitle();
//y TF1 *fGaus = new TF1("f1", "gaus", 8.5, 13.);
h9->GetYaxis()->SetTitle("\\Delta \\tau_{1}^{(rise)} [ns]"); h9->Fit(fGaus, "R");
h9->GetYaxis()->CenterTitle();
c3->Update(); c3->Update();
c3->cd(4); c3->cd(4);
t->Draw("Ach1.fTime90 - Ach1.fTime10","((Ach1.fTime90-Ach1.fTime10)>=0)","col"); t->Draw("Ach1.fTime90 - Ach1.fTime10 >> h10","((Ach1.fTime90-Ach1.fTime10)>=0)","");
t->SetLineColor(kRed); t->SetLineColor(kRed);
t->Draw("Ach1.fTime90 - Ach1.fTime10","((Ach1.fTime90-Ach1.fTime10)>=0) && (Ach1.fEdgeXi < 0.0005)","same"); t->Draw("Ach1.fTime90 - Ach1.fTime10 ","((Ach1.fTime90-Ach1.fTime10)>=0) && (Ach1.fEdgeXi < 0.0005)","same"); //????????
h10->GetXaxis()->SetTitle("\\Delta \\tau_{1}^{(rise)} [ns]");
h10->GetXaxis()->CenterTitle();
c3->Update(); c3->Update();
c3->Print(Form("../macros/picsDRS4/file%s/RisingEdge%s", foldername, ext)); c3->Print(Form("../macros/picsDRS4/file%s/RisingEdge%s", foldername, ext));
// c3->Print("../macros/picsDRS4/file7_8/RisingEdge.eps"); // c3->Print("../macros/picsDRS4/file7_8/RisingEdge.eps");
...@@ -140,17 +158,37 @@ void histCorr(const char *filename = "analysis_07_8.root", const char *foldernam ...@@ -140,17 +158,37 @@ void histCorr(const char *filename = "analysis_07_8.root", const char *foldernam
if (can4) { if (can4) {
TCanvas *c4 = new TCanvas("c4", "Correlation pictures: XiSquares"); TCanvas *c4 = new TCanvas("c4", "Correlation pictures: XiSquares");
TH2F *h10 = new TH2F("h10", "Time difference between two channels vs XiSquare of edge",100, -0., 5., 100, 0., 0.005); TH2F *h11 = new TH2F("h11", "Time difference between two channels vs XiSquare of edge",100, -0., 5., 100, 0., 0.005);
t->Draw("Ach1.fEdgeXi : (Ach1.fTime90 - Ach1.fTime10) >> h11","","col");
t->Draw("Ach1.fEdgeXi : (Ach1.fTime90 - Ach1.fTime10) >> h10","(Ach1.fTime90 - Ach1.fTime10)>0","col"); //t->Draw("Ach1.fEdgeXi : (Ach1.fTime90 - Ach1.fTime10) >> h11","(Ach1.fTime90 - Ach1.fTime10)>0","col");
//x //x
h10->GetXaxis()->SetTitle("\\Delta \\tau_{1}^{(rise)} [ns]"); h11->GetXaxis()->SetTitle("\\Delta \\tau_{1}^{(rise)} [ns]");
h10->GetXaxis()->CenterTitle(); h11->GetXaxis()->CenterTitle();
//y //y
h10->GetYaxis()->SetTitle("fEdgeXi"); h11->GetYaxis()->SetTitle("fEdgeXi");
h10->GetYaxis()->CenterTitle(); h11->GetYaxis()->CenterTitle();
c4->Update(); c4->Update();
c4->Print(Form("../macros/picsDRS4/file%s/XiSquares%s", foldername, ext)); //c4->Print(Form("../macros/picsDRS4/file%s/XiSquares%s", foldername, ext));
}
if (can5) {
TCanvas *c5 = new TCanvas("c5", "Changing CFD parameters");
TH1F *h12 = new TH1F("h12", "Delta tau CFD",100, -10., 30.);
// c5->Divide(1,2);
// c5->cd(1);
t->Draw("Ach0.fTimeCFD - Ach1.fTimeCFD >> h12","Ach1.fChargeCFD>0.05e-9 && Ach1.fChargeCFD<0.5e-9","");
h12->GetXaxis()->SetTitle("\\Delta \\tau_{0-1} [ns]");
h12->GetXaxis()->CenterTitle();
TF1 *fGaus = new TF1("f1", "gaus", 8.5, 13.);
h12->Fit(fGaus, "R");
gStyle->SetOptFit();
c5->Update();
//c5->Print(Form("../macros/picsDRS4/file%s/TimeDiffCFD_0.7_3%s", foldername, ext));
} }
......
{ {
gSystem->Load("../libData.so"); gSystem->Load("../libData.so");
TFile *f = new TFile("../data/dataTektronix/analysisExp7.root"); TFile *f = new TFile("../data/dataDSR4/Neurad_081216_2NEW.root");
TTree *tr = (TTree*)f->Get("atree"); TTree *tr = (TTree*)f->Get("atree");
const Int_t nP = 1024;
const Int_t noBranches = 4; const Int_t noBranches = 4;
Double_t ZeroTime[4],mh[4],RisTime[4],decayT[4]; Double_t ZeroTime[4],mh[4],RisTime[4],decayT[4],tmax[4],timestep,time;
Int_t iZero[4],PosZero[4],deltaT[4],Eh[4],Bh[4]; Int_t iZero[4],PosZero[4],deltaT[4],Eh[4],Bh[4];
TString bName; TString bName;
AEvent *aevent[noBranches]; // pointer to the array (of RawEvent class) in which raw data for each channel will be put AEvent *aevent[noBranches]; // pointer to the array (of RawEvent class) in which raw data for each channel will be put
for (Int_t j = 0; j<noBranches; j++) { for (Int_t j = 0; j<noBranches; j++) {
aevent[j] = new AEvent(1000); //each raw event element is of class RawEvent() aevent[j] = new AEvent(); //each raw event element is of class RawEvent()
bName.Form("Ach%d.", j); bName.Form("Ach%d.", j);
tr->SetBranchAddress(bName.Data(), &aevent[j]); //read the tree tr with raw data and fill array revent with raw data tr->SetBranchAddress(bName.Data(), &aevent[j]); //read the tree tr with raw data and fill array revent with raw data
//cout << tr->SetBranchAddress(bName.Data(), &aevent[j]) << endl; //read the tree tr with raw data and fill array revent with raw data
} }
TString hname,Chname; TString hname,Chname;
TH1F *hist[4]; TH1F *hist[4];
TGraph *gr[4];
for (Int_t i = 0; i < 4; i++) { for (Int_t i = 0; i < 4; i++) {
hname.Form("hist%d",i); hname.Form("hist%d",i);
Chname.Form("CHANNEL%d",i); Chname.Form("CHANNEL%d",i+1);
hist[i] = new TH1F(hname.Data(), Chname.Data(), 2000, -100, 100); hist[i] = new TH1F(hname.Data(), Chname.Data(), 2000, -100, 100);
} }
TH1F *hist01 = new TH1F("hist11", "h1 raw", 2000, -100, 100); TH1F *hist01 = new TH1F("hist11", "h1 raw", 2000, -100, 100);
TH1F *hist11 = new TH1F("hist21", "h2 raw", 2000, -100, 100);
TH1F *hist21 = new TH1F("hist31", "h3 raw", 2000, -100, 100);
TH1F *hist31 = new TH1F("hist41", "h4 raw", 2000, -100, 100);
TF1 *fit1 = new TF1("fit1","-[0]*exp(-x*[1])"); //TH1(const char* name, const char* title, Int_t nbinsx, Double_t xlow, Double_t xup)
fit1->SetParName(1,"tD");
Long64_t nEntries = tr->GetEntries(); Long64_t nEntries = tr->GetEntries();
TH1F *hSumm = new TH1F("hSumm", "integral signal", nP-1, 0, 199);
for(Int_t j=0;j<(nP-1);j++) {hSumm->SetBitContent(j,0);}
timestep = 199/1022; //!!!!!!!!!!! не 1023 а 1022. промежутков меньше на 1 чем точек
//loop over events //loop over events
for (Int_t j = 0; j < nEntries; j++) { for (Int_t j = 0; j < nEntries; j++) {
tr->GetEntry(j); tr->GetEntry(j);
for(Int_t k=0;k<4;k++) { // loop for channels for(Int_t k=0;k<4;k++) { // loop for channels
ZeroTime[k] = aevent[k]->GetfCFD(); // get fCFD for channel №k ZeroTime[k] = aevent[k]->GetfCFD(); // get fCFD for channel №k
iZero[k] = ZeroTime[k]*10; iZero[k] = ZeroTime[k]*10;
if(j==0) { PosZero[k] = iZero[k]; } //if(j==0) { PosZero[k] = iZero[k]; }
deltaT[k] = iZero[k] - PosZero[k]; //deltaT[k] = iZero[k] - PosZero[k]; // количество точек !!!
if(j==0) { PosZero[k] = ZeroTime[k]; }
deltaT[k] = ZeroTime[k] - PosZero[k]; // время в нс
} }
for(Int_t i = 0; i<1000; i++){ gr[0] = new TGraph(*aevent[0]->GetGraphSignal());
if( ((i+deltaT[0])>-1) && ((i+deltaT[0])<1000)) hist[0]->AddBinContent(i+500,aevent[0]->GetOnefAmpPos(i+deltaT[0])); for(Int_t i = 0; i<(nP-1); i++){
hist01->AddBinContent(i+500,aevent[0]->GetOnefAmpPos(i)); //if( ((i+deltaT[0])>-1) && ((i+deltaT[0])<nP)) hist[0]->AddBinContent(i+500,aevent[0]->GetOnefAmpPos(i+deltaT[0]));
//hist01->AddBinContent(i+500,aevent[0]->GetOnefAmpPos(i));
if( ((i+deltaT[1])>-1) && ((i+deltaT[1])<1000)) hist[1]->AddBinContent(i+500,aevent[1]->GetOnefAmpPos(i+deltaT[1])); if( ((timestep*i + deltaT[0])>=0) && ((timestep*i + deltaT[0])<tmax[0])) {
hist11->AddBinContent(i+500,aevent[1]->GetOnefAmpPos(i)); hSumm->AddBinContent( i, fGraphCFD->Eval(timestep*i + deltaT[0]) );
if( ((i+deltaT[2])>-1) && ((i+deltaT[2])<1000)) hist[2]->AddBinContent(i+500,aevent[2]->GetOnefAmpPos(i+deltaT[2]));
hist21->AddBinContent(i+500,aevent[2]->GetOnefAmpPos(i));
if( ((i+deltaT[3])>-1) && ((i+deltaT[3])<1000)) hist[3]->AddBinContent(i+500,aevent[3]->GetOnefAmpPos(i+deltaT[3]));
hist31->AddBinContent(i+500,aevent[3]->GetOnefAmpPos(i));
} }
} }
}
//t->Draw("Ach2.fAmpMax: ( Ach0.fTimeCFD - Ach2.fTimeCFD ) >> h4","","col");
/*for(j=0;j<4;j++) {
for(j=0;j<4;j++) {
// j=0;
mh[j] = hist[j]->GetBinContent(hist[j]->GetMaximumBin()); mh[j] = hist[j]->GetBinContent(hist[j]->GetMaximumBin());
for(i = hist[j].GetMaximumBin(); i>0;i--) { // finding the for(i = hist[j].GetMaximumBin(); i>0;i--) { // finding the
...@@ -78,28 +76,54 @@ ...@@ -78,28 +76,54 @@
} }
RisTime[j] = (Eh[j] - Bh[j])*0.1; // время нарастания RisTime[j] = (Eh[j] - Bh[j])*0.1; // время нарастания
} }
*/
Double_t rMin[4]; Double_t rMin[4];
Double_t rMax[4]; Double_t rMax[4];
rMin[0]=-10.5; rMax[0] = -5; rMin[0]=22.5; rMax[0] = 27.3;
rMin[1]=-15; rMax[1] = -10; rMin[1]=26.6; rMax[1] = 31.7;
rMin[2]=-24; rMax[2] = -18; rMin[2]=19.3; rMax[2] = 24.;
rMin[3]=-14.5; rMax[3] = -9; rMin[3]= 26.5; rMax[3] = 29.6;
TF1 *fit1 = new TF1("fit1","[0]*exp(-x*[1])");
fit1->SetParName(1,"tD");
TCanvas *c1 = new TCanvas("c1","test",10,10,1000,600); /*TCanvas *c1 = new TCanvas("c1","run 071216_8",10,10,1000,600);
c1->Divide(2,2); c1->Divide(2,2);
for(i=0;i<4;i++) { for(i=0;i<4;i++) {
c1->cd(i+1); c1->cd(i+1);
hist[i]->GetXaxis()->SetRangeUser(10, 50);
hist[i]->Draw(); hist[i]->Draw();
fit1->SetParLimits(1,0.1,1);
fit1->SetRange(rMin[i],rMax[i]); fit1->SetRange(rMin[i],rMax[i]);
hist[i]->Fit("fit1","R"); //hist[i]->Fit("fit1","R");
decayT[i] = 1/(fit1->GetParameter(1)); //decayT[i] = 1/(fit1->GetParameter(1));
} }
for(i=0;i<4;i++) { for(i=0;i<4;i++) {
cout<<decayT[i]<<" that's decay time of channel number "<<i<<endl; cout<<decayT[i]<<" that's decay time of channel number "<<i<<endl;
cout<<RisTime[i]<< " that's a RiseTime for this channel "<<i<<endl; cout<<RisTime[i]<< " that's a RiseTime for this channel "<<i<<endl;
} }*/
///////////////////////
TCanvas *c2 = new TCanvas("c2","RAW",10,10,1000,600);
//c2->Divide(2,2);
//c2->cd(1);
//hist01->GetXaxis()->SetRangeUser(10, 55);
//hist01->Draw();
//c2->cd(2);
hSumm->Draw();
/*
c2->cd(2);
hist11->GetXaxis()->SetRangeUser(10, 55);
hist11->Draw();
c2->cd(3);
hist21->GetXaxis()->SetRangeUser(10, 55);
hist21->Draw();
c2->cd(4);
hist31->GetXaxis()->SetRangeUser(10, 55);
hist31->Draw();*/
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -5,16 +5,16 @@ void testShowCFD() ...@@ -5,16 +5,16 @@ void testShowCFD()
const Long64_t kFirstEvent = 128; const Long64_t kFirstEvent = 128;
TFile fr("../data/dataDSR4/analysis_07_8.root"); TFile fr("../data/dataDSR4/analysis_08_2_CFD02_06.root");
TTree *tr = (TTree*)fr.Get("atree"); TTree *tr = (TTree*)fr.Get("atree");
AEvent *revent = new AEvent(); AEvent *revent = new AEvent();
tr->SetBranchAddress("Ach0.",&revent); tr->SetBranchAddress("Ach0.",&revent);
TGraph *gr[10]; TGraph *gr[12];
//loop over events //loop over events
for (Int_t i = 0; i < 10; i++) { for (Int_t i = 0; i < 12; i++) {
gr[i] = 0; gr[i] = 0;
tr->GetEntry(i+kFirstEvent); tr->GetEntry(i+kFirstEvent);
gr[i] = new TGraph(*revent->GetGraphCFD()); gr[i] = new TGraph(*revent->GetGraphCFD());
...@@ -22,9 +22,9 @@ void testShowCFD() ...@@ -22,9 +22,9 @@ void testShowCFD()
TCanvas *c1 = new TCanvas("c1","CFD implementation",10,10,1000,600); TCanvas *c1 = new TCanvas("c1","CFD implementation",10,10,1000,600);
c1->Divide(3,2); c1->Divide(3,4);
for (Int_t i = 0; i < 6; i++) { for (Int_t i = 0; i < 12; i++) {
c1->cd(i+1); c1->cd(i+1);
gr[i]->Draw(""); gr[i]->Draw("");
} }
......
...@@ -3,27 +3,31 @@ void testShowGraphs() ...@@ -3,27 +3,31 @@ void testShowGraphs()
gSystem->Load("../libData.so"); gSystem->Load("../libData.so");
const Long64_t kFirstEvent = 50; const Long64_t kFirstEvent = 128;
// TFile fr("../data/dataDSR4/analysis_07_1.root"); TFile fr("../data/dataDSR4/analysis_08_2.root");
// TFile fr("../data/dataDSR4/analysis_07_8.root"); // TFile fr("../data/dataDSR4/analysis_07_8.root");
<<<<<<< HEAD
TFile fr("../data/dataDSR4/Neurad_081216_2NEW.root"); TFile fr("../data/dataDSR4/Neurad_081216_2NEW.root");
=======
// TFile fr("../data/dataTektronix/exp18.root");
>>>>>>> 1612d04b19c3139e125a1642bdb0763585790d84
// TFile fr("../data/dataTektronix/analysisExp7.root"); // TFile fr("../data/dataTektronix/analysisExp7.root");
TTree *tr = (TTree*)fr.Get("atree"); TTree *tr = (TTree*)fr.Get("atree");
AEvent *revent = new AEvent(); AEvent *revent = new AEvent();
cout << tr->SetBranchAddress("Ach0.",&revent) << endl; cout << tr->SetBranchAddress("Ach0.",&revent) << endl;
TGraph *gr[10]; TGraph *gr[13];
Double_t t10[10]; Double_t t10[13];
Double_t t90[10]; Double_t t90[13];
// cout << "warning" << endl; // cout << "warning" << endl;
cout << tr->GetEntries() << endl; cout << tr->GetEntries() << endl;
//loop over events //loop over events
for (Long64_t i = 0; i < 10; i++) { for (Long64_t i = 0; i < 13; i++) {
gr[i] = 0; gr[i] = 0;
t10[i] = 0; t10[i] = 0;
t90[i] = 0; t90[i] = 0;
...@@ -45,12 +49,20 @@ void testShowGraphs() ...@@ -45,12 +49,20 @@ void testShowGraphs()
// cout << "warning 3" << endl; // cout << "warning 3" << endl;
TCanvas *c1 = new TCanvas("c1","test",10,10,1000,600); TCanvas *c1 = new TCanvas("c1","test",10,10,1000,600);
<<<<<<< HEAD
//c1->Divide(3,2); //c1->Divide(3,2);
=======
c1->Divide(3,4);
>>>>>>> 1612d04b19c3139e125a1642bdb0763585790d84
TF1 *f1 = new TF1("f1name", "[0]+x*[1]"); TF1 *f1 = new TF1("f1name", "[0]+x*[1]");
// TF1 *f1 = new TF1("pol1", ); // TF1 *f1 = new TF1("pol1", );
<<<<<<< HEAD
/*for (Int_t k = 0; k < 6; k++) { /*for (Int_t k = 0; k < 6; k++) {
=======
for (Int_t k = 0; k < 12; k++) {
>>>>>>> 1612d04b19c3139e125a1642bdb0763585790d84
c1->cd(k+1); c1->cd(k+1);
gr[k]->Draw("AL*"); gr[k]->Draw("AL*");
......
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