diff --git a/data/dataDSR4/analysis_07_1.root b/data/dataDSR4/analysis_07_1.root index 3afe6e14ee3731c3ffbe3c1b59b852b6c6b9dfe7..1a9e7d6a47e2682a16771d4d4ddc8a2f2cc22530 100644 Binary files a/data/dataDSR4/analysis_07_1.root and b/data/dataDSR4/analysis_07_1.root differ diff --git a/dataClasses/AEvent.cpp b/dataClasses/AEvent.cpp index c0039c12ff84a0397fc13b74860fb5131e133529..362afefd7a34801d8b4e8a4b6b06a4372a05a4bf 100644 --- a/dataClasses/AEvent.cpp +++ b/dataClasses/AEvent.cpp @@ -22,8 +22,8 @@ AEvent::AEvent(const Int_t npoints) : fNPoints(npoints) { AEvent::~AEvent() { // TODO Auto-generated destructor stub - delete gSignal; - delete gCFD; + delete fGraphSignal; + delete fGraphCFD; delete fInputEvent; } @@ -86,6 +86,7 @@ void AEvent::Reset() { fAmpMax = 0.; fTimeAmpMax = 0.; + fCFD = 0.; } void AEvent::SetInputEvent(RawEvent** event) { @@ -103,60 +104,68 @@ void AEvent::Init() { fTime.Set(fNPoints); fAmpCFD.Set(fNPoints); - gSignal = new TGraph(); - gCFD = new TGraph(); + fGraphSignal = new TGraph(); + fGraphCFD = new TGraph(); fInputEvent = 0; + fCFratio = 0.; + fCFtimeDelay = 0.; + } void AEvent::SetGraphs() { - gSignal->Set(fNPoints); + fGraphSignal->Set(fNPoints); for (Int_t i=0; iSetPoint(i, fTime[i], fAmpPos[i]); + fGraphSignal->SetPoint(i, fTime[i], fAmpPos[i]); } return; } -void AEvent::SetCFD(/*Double_t c, Int_t td*/) { +void AEvent::SetCFD() { +// Double_t c = 0.5; //attenuation coefficient +// Int_t td = 5; //time of delay in points + Double_t level = 100.; //todo what is it? + + fGraphCFD->Set(fNPoints); + + //working variables + Double_t maxCFD = 0., minCFD = 0.; + Int_t imax = 0, imin = 0; - gCFD->Set(fNPoints); - Double_t c = 0.5; //attenuation coefficient - Int_t td = 5; //time of delay in points - Double_t maxCFD, minCFD, imax, imin, tmax, tmin, level; - maxCFD = 0.; - minCFD = 0.; - level = 100.; for (Int_t i=0; itd) { - fAmpCFD[i] = fAmpPos[i]*c*(-1); - fAmpCFD[i] = fAmpCFD[i] + fAmpPos[i - td]; - gCFD->SetPoint(i, fTime[i], fAmpCFD[i]); + //CFD method + if(i>fCFtimeDelay) { +// fAmpCFD[i] = fAmpPos[i]*cfRatio*(-1); + fAmpCFD[i] = fAmpPos[i]*fCFratio*(-1); +// fAmpCFD[i] = fAmpCFD[i] + fAmpPos[i - timeDelay]; + fAmpCFD[i] = fAmpCFD[i] + fAmpPos[i - fCFtimeDelay]; + fGraphCFD->SetPoint(i, fTime[i], fAmpCFD[i]); } - //point for max CFD amplitude + //point for max CFD amplitude if(fAmpCFD[i] > maxCFD) { - maxCFD = fAmpCFD[i]; - imax = i; - tmax = fTime[i]; + maxCFD = fAmpCFD[i]; + imax = i; } - //point for min CFD amplitude + //point for min CFD amplitude if(fAmpCFD[i] < minCFD) { - minCFD = fAmpCFD[i]; - imin = i; - tmin = fTime[i]; + minCFD = fAmpCFD[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]); fCFD = fTime[j];} + if(abs(fAmpCFD[j]) < level) { + level = abs(fAmpCFD[j]); + fCFD = fTime[j]; + } } return; diff --git a/dataClasses/AEvent.h b/dataClasses/AEvent.h index 12a8c8621885f4c67ea50fa6519aad37e33e2680..145155835643c8896a402e8a98cdb1d35658e317 100644 --- a/dataClasses/AEvent.h +++ b/dataClasses/AEvent.h @@ -41,11 +41,14 @@ private: TArrayD fAmpCFD; //array for CFD amplitudes (attenuated, inversed and delayed) Double_t fCFD; //zero-crossing time - TGraph *gSignal; - TGraph *gCFD; + TGraph *fGraphSignal; + TGraph *fGraphCFD; RawEvent *fInputEvent; //! + Double_t fCFratio; //! + Double_t fCFtimeDelay; //! + public: AEvent(); AEvent(const Int_t npoints); @@ -56,18 +59,23 @@ public: void ProcessEvent(); // void Integral() void SetInputEvent(RawEvent** event); + + void SetCFratio(Double_t ratio) { fCFratio = ratio; }; + void SetCFtimeDelay(Double_t timeDelay) { fCFtimeDelay = timeDelay; }; + void Reset(); //Resets arrays to zeros TGraph* GetGraph() { - return gCFD; + //todo + return fGraphCFD; // return gSignal; } private: void Init(); void SetGraphs(); - void SetCFD(/*Double_t c = 0.5, Int_t td = 5*/); + void SetCFD(); }; #endif /* DATACLASSES_AEVENT_H_ */ diff --git a/macros/analyse.C b/macros/analyse.C index 9b8ffd542cf5f5d2214ae1c2f5f86ef89f40d350..a648d693c41f2cc09869b0d0bf82f9084bdc0ea0 100644 --- a/macros/analyse.C +++ b/macros/analyse.C @@ -6,6 +6,8 @@ void analyse() TTree *tr = (TTree*)f->Get("rtree"); const Int_t noBranches = 4; + const Double_t cfRatio = 0.5; + const Int_t cfTD = 5; TString bName; RawEvent *revent[noBranches]; // pointer to the array (of RawEvent class) in which raw data for each channel will be put @@ -25,6 +27,8 @@ void analyse() wevent[j] = new AEvent(); bName.Form("Ach%d.", j); wevent[j]->SetInputEvent(&revent[j]); //takes raw event from RawEvent + wevent[j]->SetCFratio(cfRatio); + wevent[j]->SetCFtimeDelay(cfTD); tw->Bronch(bName.Data(), "AEvent", &wevent[j]); // create branches in atree to hold analyzed data } diff --git a/macros/testShowCFD.cxx b/macros/testShowCFD.cxx index c289167cae58c92f6f6c5222ae78b382b576861f..503cbeb1be5de3c826a10acab1d6fdb9d23005fc 100644 --- a/macros/testShowCFD.cxx +++ b/macros/testShowCFD.cxx @@ -26,7 +26,7 @@ void testShowCFD() for (Int_t i = 0; i < 6; i++) { c1->cd(i+1); - gr[i]->Draw(); + gr[i]->Draw(""); } // c1->cd(2);