Commit 1612d04b authored by Kostyleva D.A's avatar Kostyleva D.A

AEvent::SetCFD() modified: signal modifications are now fully based on its...

AEvent::SetCFD() modified: signal modifications are now fully based on its graph and not on graph points
parent 1b0fa3c6
......@@ -15,8 +15,8 @@ int main(int argc, char* argv[])
//to be extracted from the source as parameters
const Int_t noBranches = 4;
const Double_t cfRatio = 0.7;
const Double_t cfTD = 3;
const Double_t cfRatio = 0.2;
const Double_t cfTD = 0.6; //in ns
Double_t noiseMin = 5;
Double_t noiseMax = 25;
......@@ -86,7 +86,7 @@ int main(int argc, char* argv[])
for(Long64_t i = 0; i < nentries; i++) {
tr->GetEntry(i);
//cout<<" i "<<i<<endl;
for (Int_t j = 0; j<noBranches; j++) {
wevent[j]->Reset();
wevent[j]->ProcessEvent(); //here all the analysis is going on so far
......
......@@ -134,15 +134,44 @@ void AEvent::SetCFD() {
// Double_t level = 100.; //is necessary to find cfd amplitude value closest to zero
Double_t time = 0;
Double_t mytime = fCFtimeDelay;
fGraphCFD->Set(fNPoints);
//working variables
Double_t maxCFD = 0., minCFD = 0.;
Double_t TmaxCFD = 0., TminCFD = 0.;
// Int_t imax = 0, imin = 0;
const Double_t timeStep = 0.05;
Double_t ampCFD;
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
if(i>fCFtimeDelay) { // условие, чтобы не выскочить из размера массива ( обрезает границы на fCFtimeDelay)
......@@ -165,7 +194,7 @@ void AEvent::SetCFD() {
// imin = i;
}
}
}*/
/* //finding "zero" of CFD amplitude
for(Int_t j = imin; j < imax; j++) {
......@@ -177,7 +206,7 @@ void AEvent::SetCFD() {
*/
//I want to find zero of CFD using graph and eval
time = TminCFD;
while( (fGraphCFD->Eval(time) <= 0) && (time <= TmaxCFD) && (time >= TminCFD) ) {
while( (fGraphCFD->Eval(time) <= 0) && (time <= TmaxCFD) /*&& (time >= TminCFD)*/ ) {
fTimeCFD = time;
time = time + timeStep;
}
......
......@@ -7,7 +7,7 @@ void histCorr(
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 = 0, const Bool_t can5 = 0)
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)
{
gSystem->Load("../libData.so");
TFile *f = new TFile(Form("../data/dataDSR4/%s", filename));
......@@ -25,7 +25,7 @@ void histCorr(
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);
t->Draw("Ach0.fChargeCFD : ( Ach0.fTimeCFD - Ach1.fTimeCFD ) >> h1","","col");
t->Draw("Ach0.fChargeCFD : ( Ach0.fTimeCFD - Ach1.fTimeCFD ) >> h1","Ach0.fChargeCFD > 0.2e-9","col");
//x
h1->GetXaxis()->SetTitle("\\Delta \\tau_{0-1} [ns]");
h1->GetXaxis()->CenterTitle();
......@@ -164,7 +164,7 @@ void histCorr(
h11->GetYaxis()->SetTitle("fEdgeXi");
h11->GetYaxis()->CenterTitle();
c4->Update();
c4->Print(Form("../macros/picsDRS4/file%s/XiSquares%s", foldername, ext));
//c4->Print(Form("../macros/picsDRS4/file%s/XiSquares%s", foldername, ext));
}
......@@ -184,7 +184,7 @@ void histCorr(
gStyle->SetOptFit();
c5->Update();
c5->Print(Form("../macros/picsDRS4/file%s/TimeDiffCFD_0.7_3%s", foldername, ext));
//c5->Print(Form("../macros/picsDRS4/file%s/TimeDiffCFD_0.7_3%s", foldername, ext));
}
......
......@@ -5,16 +5,16 @@ void testShowCFD()
const Long64_t kFirstEvent = 128;
TFile fr("../data/dataDSR4/analysis_08_2_CFD07_3.root");
TFile fr("../data/dataDSR4/analysis_08_2_CFD02_06.root");
TTree *tr = (TTree*)fr.Get("atree");
AEvent *revent = new AEvent();
tr->SetBranchAddress("Ach0.",&revent);
TGraph *gr[10];
TGraph *gr[12];
//loop over events
for (Int_t i = 0; i < 10; i++) {
for (Int_t i = 0; i < 12; i++) {
gr[i] = 0;
tr->GetEntry(i+kFirstEvent);
gr[i] = new TGraph(*revent->GetGraphCFD());
......@@ -22,9 +22,9 @@ void testShowCFD()
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);
gr[i]->Draw("");
}
......
......@@ -3,7 +3,7 @@ void testShowGraphs()
gSystem->Load("../libData.so");
const Long64_t kFirstEvent = 50;
const Long64_t kFirstEvent = 128;
TFile fr("../data/dataDSR4/analysis_08_2.root");
// TFile fr("../data/dataDSR4/analysis_07_8.root");
......@@ -14,16 +14,16 @@ void testShowGraphs()
AEvent *revent = new AEvent();
cout << tr->SetBranchAddress("Ach0.",&revent) << endl;
TGraph *gr[10];
Double_t t10[10];
Double_t t90[10];
TGraph *gr[13];
Double_t t10[13];
Double_t t90[13];
// cout << "warning" << endl;
cout << tr->GetEntries() << endl;
//loop over events
for (Long64_t i = 0; i < 10; i++) {
for (Long64_t i = 0; i < 13; i++) {
gr[i] = 0;
t10[i] = 0;
t90[i] = 0;
......@@ -45,12 +45,12 @@ void testShowGraphs()
// cout << "warning 3" << endl;
TCanvas *c1 = new TCanvas("c1","test",10,10,1000,600);
c1->Divide(3,2);
c1->Divide(3,4);
TF1 *f1 = new TF1("f1name", "[0]+x*[1]");
// TF1 *f1 = new TF1("pol1", );
for (Int_t k = 0; k < 6; k++) {
for (Int_t k = 0; k < 12; k++) {
c1->cd(k+1);
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