diff --git a/dataClasses/AEvent.cpp b/dataClasses/AEvent.cpp index 64088bd7c9f2e938ad288729bd92d10c053f146c..c0039c12ff84a0397fc13b74860fb5131e133529 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 c85cbd957aa6ba80c5ea9ce2c3bae4d04a7fbf2a..12a8c8621885f4c67ea50fa6519aad37e33e2680 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 695bbbcfdfad84f594b92a3dfaec90524ee9c7e5..945124f7c9aa90feb9e82cc7dc1e9ff9d59ac8f4 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 b1a9367b347654eed842cb867e49fd902aebdb4f..eb248628bdb2345ff4987447ec2c36c0ef360cc9 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