Commit 07d2b501 authored by Kostyleva D.A's avatar Kostyleva D.A

Some cleaning in AEvent is made, 3d histo in histCorr.C is added

parent 1612d04b
...@@ -27,18 +27,6 @@ AEvent::~AEvent() { ...@@ -27,18 +27,6 @@ AEvent::~AEvent() {
delete fInputEvent; delete fInputEvent;
} }
void AEvent::SetRawDataFile(const char* inprawfile, const char* treename) {
TString iFileName = inprawfile;
TFile *fraw = new TFile(iFileName.Data());
if ( !fraw->IsOpen() ) {
Error("SetRawDataFile", "File %s was not opened and won't be processed", iFileName.Data());
}
TTree *traw = (TTree*)fraw->Get(treename);
if (!traw) {
Error("SetRawDataFile", "Tree %s was not found in file %s", treename, iFileName.Data());
}
}
void AEvent::ProcessEvent() { void AEvent::ProcessEvent() {
...@@ -132,7 +120,6 @@ void AEvent::SetGraphs() { ...@@ -132,7 +120,6 @@ 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 time = 0; Double_t time = 0;
Double_t mytime = fCFtimeDelay; Double_t mytime = fCFtimeDelay;
fGraphCFD->Set(fNPoints); fGraphCFD->Set(fNPoints);
...@@ -142,15 +129,11 @@ void AEvent::SetCFD() { ...@@ -142,15 +129,11 @@ void AEvent::SetCFD() {
Double_t TmaxCFD = 0., TminCFD = 0.; Double_t TmaxCFD = 0., TminCFD = 0.;
Double_t ampCFD; Double_t ampCFD;
const Double_t timeStep = 0.1; const Double_t timeStep = 0.1;
Int_t i = 0; Int_t i = 0; //for graph
//вместо цикла по точкам нужно сделать "цикл" по графику //while goes by the graph with the step of timeStep
while( mytime < (200. - fCFtimeDelay) ) { 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); ampCFD = fGraphSignal->Eval(mytime)*fCFratio*(-1) + fGraphSignal->Eval(mytime - fCFtimeDelay);
fGraphCFD->SetPoint(i, mytime, ampCFD); fGraphCFD->SetPoint(i, mytime, ampCFD);
...@@ -169,42 +152,8 @@ void AEvent::SetCFD() { ...@@ -169,42 +152,8 @@ void AEvent::SetCFD() {
i++; i++;
mytime = mytime + timeStep; mytime = mytime + timeStep;
} }
//
/* for (Int_t i=0; i<fNPoints; i++) {
//CFD method
if(i>fCFtimeDelay) { // условие, чтобы не выскочить из размера массива ( обрезает границы на fCFtimeDelay)
fAmpCFD[i] = fAmpPos[i]*fCFratio*(-1);
fAmpCFD[i] = fAmpCFD[i] + fAmpPos[i - fCFtimeDelay];
fGraphCFD->SetPoint(i, fTime[i], fAmpCFD[i]);
}
//point for max CFD amplitude
if(fAmpCFD[i] > maxCFD) {
maxCFD = fAmpCFD[i];
TmaxCFD = fTime[i];
// imax = i;
}
//point for min CFD amplitude //looking for the first point with the closest values to 0 and writing to fTimeCFD
if(fAmpCFD[i] < minCFD) {
minCFD = fAmpCFD[i];
TminCFD = fTime[i];
// imin = i;
}
}*/
/* //finding "zero" of CFD amplitude
for(Int_t j = imin; j < imax; j++) {
if(abs(fAmpCFD[j]) < level) {
level = abs(fAmpCFD[j]);
fTimeCFD = fTime[j];
}
}
*/
//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;
...@@ -221,7 +170,6 @@ void AEvent::FindFrontProperties() { ...@@ -221,7 +170,6 @@ void AEvent::FindFrontProperties() {
const Double_t timeStep = 0.05; //in ns const Double_t timeStep = 0.05; //in ns
Double_t time = 0; //in ns Double_t time = 0; //in ns
// Int_t NumM = 0.;
if (!fGraphSignal) { if (!fGraphSignal) {
Warning("AEvent::FindFrontProperties", "Graph was not set"); Warning("AEvent::FindFrontProperties", "Graph was not set");
...@@ -229,10 +177,8 @@ void AEvent::FindFrontProperties() { ...@@ -229,10 +177,8 @@ void AEvent::FindFrontProperties() {
} }
//TODO search of minimum should be done from the lower edge on the time axis //TODO search of minimum should be done from the lower edge on the time axis
// cout << "Event!!!!!!!!!!!!!" << endl;
// while( fGraphSignal->Eval(time) >= minHeight*fAmpMax && time>0) {
while (fGraphSignal->Eval(time) <= maxHeight*fAmpMax && time<200.) { while (fGraphSignal->Eval(time) <= maxHeight*fAmpMax && time<200.) {
// cout << fAmpMax << "\t" << fGraphSignal->Eval(time) << "\t" << fTimeAmpMax << "\t" << time << endl;
fTime90 = time; fTime90 = time;
time = time + timeStep; time = time + timeStep;
}; };
...@@ -242,23 +188,17 @@ void AEvent::FindFrontProperties() { ...@@ -242,23 +188,17 @@ void AEvent::FindFrontProperties() {
fTime10 = time; fTime10 = time;
time = time - timeStep; time = time - timeStep;
} }
// cout << "Found time10 " << fTime10 << "\t" << fGraphSignal->Eval(fTime10) << "\t" << minHeight*fAmpMax << "\t" << fAmpMax << endl;
// cout << "Found time10 " << fTime10 << "\t" << TMath::Abs(fGraphSignal->Eval(fTime10) - minHeight*fAmpMax) / fAmpMax * 100 << endl;
// cout << "Found time90 " << fTime90 << "\t" << GetT_90() << endl;
// cout<< "Time90 - time10 "<< fTime90 - fTime10 << endl;
// if(fTime90 - fTime10 == 0.25 ) { cout<< "Zero !!"<<endl; }
TF1 *fit1 = new TF1("fit1","[1]*x+[0]"); //function for one parameter fitting in the range of pmin-pmax TF1 *fit1 = new TF1("fit1","[1]*x+[0]"); //function for one parameter fitting in the range of pmin-pmax
fit1->SetRange(fTime10,fTime90); fit1->SetRange(fTime10,fTime90);
// fGraphSignal->Fit(fit1,"RQ","goff");
fGraphSignal->Fit(fit1,"RQN","goff"); fGraphSignal->Fit(fit1,"RQN","goff");
fEdgeSlope = fit1->GetParameter(1); fEdgeSlope = fit1->GetParameter(1);
fEdgeXi = fit1->GetChisquare(); fEdgeXi = fit1->GetChisquare();
delete fit1; delete fit1;
} }
////////
Double_t AEvent::FindZeroLevel() { Double_t AEvent::FindZeroLevel() {
SetGraphs(); SetGraphs();
...@@ -291,8 +231,6 @@ void AEvent::SetChargeCFD(Int_t tmin, Int_t tmax) { ...@@ -291,8 +231,6 @@ void AEvent::SetChargeCFD(Int_t tmin, Int_t tmax) {
} }
} }
fChargeCFD = integral*time_sig/res; fChargeCFD = integral*time_sig/res;
// cout<<fCharge<<endl;
// printf("\nIntegral is %f , charge is %lf \n", integral, fCharge);
return; return;
......
...@@ -77,9 +77,11 @@ public: ...@@ -77,9 +77,11 @@ public:
Double_t GetEdgeXi(); Double_t GetEdgeXi();
Double_t GetfCFD(); Double_t GetfCFD();
Double_t GetOnefTime(Int_t i); Double_t GetOnefTime(Int_t i);
Double_t GetOnefAmpPos(Int_t i); Double_t GetOnefAmpPos(Int_t i);
void SetRawDataFile(const char* inprawfile, const char* treename);
void ProcessEvent(); void ProcessEvent();
void SetInputEvent(RawEvent** event); void SetInputEvent(RawEvent** event);
...@@ -118,11 +120,14 @@ public: ...@@ -118,11 +120,14 @@ public:
//in range of (tmin,tmax) in ns) //in range of (tmin,tmax) in ns)
//CFD time is taken as a start point //CFD time is taken as a start point
void SetLED(Double_t threshold = 0.001);
//leading edge discriminator
private: private:
void Init(); void Init();
void SetMaxAmplitudes(); void SetMaxAmplitudes();
void SetGraphs(); void SetGraphs();
void SetCFD(); void SetCFD(); //constant fraction discriminator method
}; };
#endif /* DATACLASSES_AEVENT_H_ */ #endif /* DATACLASSES_AEVENT_H_ */
...@@ -7,7 +7,7 @@ void histCorr( ...@@ -7,7 +7,7 @@ void histCorr(
const char *foldername = "8_2", const char *foldername = "8_2",
// const char *ext = ".eps", // const char *ext = ".eps",
const char *ext = ".gif", 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) 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)
{ {
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));
...@@ -170,6 +170,8 @@ void histCorr( ...@@ -170,6 +170,8 @@ void histCorr(
if (can5) { if (can5) {
TCanvas *c5 = new TCanvas("c5", "Changing CFD parameters"); TCanvas *c5 = new TCanvas("c5", "Changing CFD parameters");
c5->Divide(1,2);
c5->cd(1);
TH1F *h12 = new TH1F("h12", "Delta tau CFD",100, -10., 30.); TH1F *h12 = new TH1F("h12", "Delta tau CFD",100, -10., 30.);
...@@ -183,6 +185,19 @@ void histCorr( ...@@ -183,6 +185,19 @@ void histCorr(
h12->Fit(fGaus, "R"); h12->Fit(fGaus, "R");
gStyle->SetOptFit(); gStyle->SetOptFit();
c5->cd(2);
TH3F *h3d = new TH3F("h3d","3d histo", 100, -10, 30, 125, 0, 5e-9, 125, 0, 5e-9);
t->Draw("Ach1.fChargeCFD : Ach0.fChargeCFD : (Ach0.fTimeCFD - Ach1.fTimeCFD) >> h3d","","");
h3d->GetXaxis()->SetTitle("\\Delta \\tau_{0-1} [ns]");
h3d->GetXaxis()->CenterTitle();
h3d->GetYaxis()->SetTitle("Q_{0} [C]");
h3d->GetYaxis()->CenterTitle();
h3d->GetZaxis()->SetTitle("Q_{1} [C]");
h3d->GetZaxis()->CenterTitle();
c5->Update(); 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));
......
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