From d3787933d6c2287e256d40b21c8bef5949f13cd1 Mon Sep 17 00:00:00 2001 From: Vratislav Chudoba Date: Wed, 11 Jan 2017 13:24:21 +0300 Subject: [PATCH] Class AEvent modified. Second constructor added. --- dataClasses/AEvent.cpp | 18 ++++++++++++++---- dataClasses/AEvent.h | 11 +++++++---- dataClasses/RawEvent.cpp | 4 ++-- dataClasses/RawEvent.h | 4 ++-- 4 files changed, 25 insertions(+), 12 deletions(-) diff --git a/dataClasses/AEvent.cpp b/dataClasses/AEvent.cpp index 64088bd..c0039c1 100644 --- a/dataClasses/AEvent.cpp +++ b/dataClasses/AEvent.cpp @@ -8,17 +8,23 @@ #include "AEvent.h" AEvent::AEvent() : fNPoints(1024) { //fNPoints is number of points in one event, 1024 or 1000 - // TODO Auto-generated constructor stub Init(); Reset(); } +AEvent::AEvent(const Int_t npoints) : fNPoints(npoints) { + + Init(); + Reset(); +} + AEvent::~AEvent() { // TODO Auto-generated destructor stub delete gSignal; delete gCFD; + delete fInputEvent; } void AEvent::SetRawDataFile(const char* inprawfile, const char* treename) { @@ -44,7 +50,7 @@ void AEvent::ProcessEvent() { const Double_t *amp = fInputEvent->GetAmp(); const Double_t *time = fInputEvent->GetTime(); - for(Int_t j = 0; j < NCELLS; j++) { + for(Int_t j = 0; j < fNPoints; j++) { fAmpPos[j] = amp[j]*(-1.); fTime[j] = time[j]; } @@ -53,7 +59,7 @@ void AEvent::ProcessEvent() { Double_t maxAmpT = 0.; maxAmp = fAmpPos[0]; - for(Int_t j=0; j < NCELLS; j++) { + for(Int_t j=0; j < fNPoints; j++) { if(fAmpPos[j] > maxAmp) { maxAmp = fAmpPos[j]; maxAmpT = fTime[j]; @@ -72,7 +78,7 @@ void AEvent::ProcessEvent() { void AEvent::Reset() { - for (Int_t i = 0; i < NCELLS; i++) { + for (Int_t i = 0; i < fNPoints; i++) { fAmpPos[i] = 0; fTime[i] = 0; fAmpCFD[i] = 0; @@ -93,6 +99,10 @@ void AEvent::SetInputEvent(RawEvent** event) { void AEvent::Init() { + fAmpPos.Set(fNPoints); + fTime.Set(fNPoints); + fAmpCFD.Set(fNPoints); + gSignal = new TGraph(); gCFD = new TGraph(); fInputEvent = 0; diff --git a/dataClasses/AEvent.h b/dataClasses/AEvent.h index c85cbd9..12a8c86 100644 --- a/dataClasses/AEvent.h +++ b/dataClasses/AEvent.h @@ -22,7 +22,7 @@ #include "RawEvent.h" -#define NCELLS 1024 +//#define NCELLS 1024 using std::cout; using std::endl; @@ -32,11 +32,13 @@ class AEvent { private: const Int_t fNPoints; //! - Double_t fAmpPos[NCELLS]; //array for raw amplitudes - Double_t fTime[NCELLS]; //array for raw times + TArrayD fAmpPos; //array for raw amplitudes + TArrayD fTime; //array for raw times + Double_t fAmpMax; Double_t fTimeAmpMax; - Double_t fAmpCFD[NCELLS]; //array for CFD amplitudes (attenuated, inversed and delayed) + + TArrayD fAmpCFD; //array for CFD amplitudes (attenuated, inversed and delayed) Double_t fCFD; //zero-crossing time TGraph *gSignal; @@ -46,6 +48,7 @@ private: public: AEvent(); + AEvent(const Int_t npoints); virtual ~AEvent(); ClassDef(AEvent,1); diff --git a/dataClasses/RawEvent.cpp b/dataClasses/RawEvent.cpp index 695bbbc..945124f 100644 --- a/dataClasses/RawEvent.cpp +++ b/dataClasses/RawEvent.cpp @@ -65,11 +65,11 @@ void RawEvent::SetTime(Double_t t, Int_t i) { return; } -double RawEvent::GetTime(Int_t i) { +Double_t RawEvent::GetTime(Int_t i) { return fTime[i]; } -double RawEvent::GetAmp(Int_t i) { +Double_t RawEvent::GetAmp(Int_t i) { return fAmp[i]; } //void RawEvent::SetGraphs() { diff --git a/dataClasses/RawEvent.h b/dataClasses/RawEvent.h index b1a9367..eb24862 100644 --- a/dataClasses/RawEvent.h +++ b/dataClasses/RawEvent.h @@ -62,9 +62,9 @@ public: void PrintTime(Int_t i); - double GetTime(Int_t i); + Double_t GetTime(Int_t i); - double GetAmp(Int_t i); + Double_t GetAmp(Int_t i); // void InvertAmp(Double_t a, Int_t i); //Inverts the amplitudes i.e. makes from negative singals -- 2.18.1