Commit 89696c5a authored by Muzalevsky I.A's avatar Muzalevsky I.A

script for obtaining RiseTime and Decay time of SummSignal modified

parent bae4d8e6
void integralFormSignal()
{ {
gSystem->Load("../libData.so"); gSystem->Load("../libData.so");
...@@ -6,8 +5,8 @@ void integralFormSignal() ...@@ -6,8 +5,8 @@ void integralFormSignal()
TTree *tr = (TTree*)f->Get("atree"); TTree *tr = (TTree*)f->Get("atree");
const Int_t noBranches = 4; const Int_t noBranches = 4;
Double_t ZeroTime[4]; Double_t ZeroTime[4],mh[4],RisTime[4],decayT[4];
Int_t iZero[4],PosZero[4],deltaT[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++) {
...@@ -16,20 +15,27 @@ void integralFormSignal() ...@@ -16,20 +15,27 @@ void integralFormSignal()
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 //cout << tr->SetBranchAddress(bName.Data(), &aevent[j]) << endl; //read the tree tr with raw data and fill array revent with raw data
} }
TH1F *hist0 = new TH1F("hist1", "h1 title", 2000, -100, 100); TString hname,Chname;
TH1F *hist1 = new TH1F("hist2", "h2 title", 2000, -100, 100); TH1F *hist[4];
TH1F *hist2 = new TH1F("hist3", "h3 title", 2000, -100, 100); for (Int_t i = 0; i < 4; i++) {
TH1F *hist3 = new TH1F("hist4", "h4 title", 2000, -100, 100); hname.Form("hist%d",i);
Chname.Form("CHANNEL%d",i);
hist[i] = new TH1F(hname.Data(), Chname.Data(), 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])"); TF1 *fit1 = new TF1("fit1","-[0]*exp(-x*[1])");
fit1->SetRange(-15,-5);
fit1->SetParName(1,"tD"); fit1->SetParName(1,"tD");
Long64_t nEntries = tr->GetEntries(); Long64_t nEntries = tr->GetEntries();
//loop over events //loop over events
for (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
...@@ -39,30 +45,61 @@ void integralFormSignal() ...@@ -39,30 +45,61 @@ void integralFormSignal()
} }
for(Int_t i = 0; i<1000; i++){ for(Int_t i = 0; i<1000; i++){
if( ((i+deltaT[0])>-1) && ((i+deltaT[0])<1000)) hist0->AddBinContent(i+500,aevent[0]->GetOnefAmpPos(i+deltaT[0])); if( ((i+deltaT[0])>-1) && ((i+deltaT[0])<1000)) hist[0]->AddBinContent(i+500,aevent[0]->GetOnefAmpPos(i+deltaT[0]));
if( ((i+deltaT[1])>-1) && ((i+deltaT[1])<1000)) hist1->AddBinContent(i+500,aevent[1]->GetOnefAmpPos(i+deltaT[1])); hist01->AddBinContent(i+500,aevent[0]->GetOnefAmpPos(i));
hist2->AddBinContent(i+500,aevent[0]->GetOnefAmpPos(i));
hist3->AddBinContent(i+500,aevent[1]->GetOnefAmpPos(i)); if( ((i+deltaT[1])>-1) && ((i+deltaT[1])<1000)) hist[1]->AddBinContent(i+500,aevent[1]->GetOnefAmpPos(i+deltaT[1]));
hist11->AddBinContent(i+500,aevent[1]->GetOnefAmpPos(i));
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));
} }
} }
TCanvas *c1 = new TCanvas("c1","test",10,10,1000,600); for(j=0;j<4;j++) {
c1->Divide(2,2); // j=0;
mh[j] = hist[j]->GetBinContent(hist[j]->GetMaximumBin());
for(i = hist[j].GetMaximumBin(); i>0;i--) { // finding the
if( hist[j]->GetBinContent(i)<0.9*mh[j] ) {
Eh[j] = i+1;
break;
}
}
c1->cd(1); for(i = hist[j].GetMaximumBin(); i>0;i--) { // finding the
hist0->Draw(); if( hist[j]->GetBinContent(i)<0.1*mh[j] ) {
//hist1->Fit("fit1","R",""); Bh[j] = i+1;
break;
}
}
RisTime[j] = (Eh[j] - Bh[j])*0.1; // время нарастания
}
c1->cd(2); Double_t rMin[4];
//hist2->Draw(); Double_t rMax[4];
//hist2->Fit("fit1","R",""); rMin[0]=-10.5; rMax[0] = -5;
//tr->Draw("Ach1.fCFD"); rMin[1]=-15; rMax[1] = -10;
hist1->Draw(); rMin[2]=-24; rMax[2] = -18;
rMin[3]=-14.5; rMax[3] = -9;
c1->cd(3);
hist2->Draw();
c1->cd(4); TCanvas *c1 = new TCanvas("c1","test",10,10,1000,600);
hist3->Draw(); c1->Divide(2,2);
for(i=0;i<4;i++) {
c1->cd(i+1);
hist[i]->Draw();
fit1->SetRange(rMin[i],rMax[i]);
hist[i]->Fit("fit1","R");
decayT[i] = 1/(fit1->GetParameter(1));
}
for(i=0;i<4;i++) {
cout<<decayT[i]<<" that's decay time of channel number "<<i<<endl;
cout<<RisTime[i]<< " that's a RiseTime for this channel "<<i<<endl;
}
} }
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