Commit d3787933 authored by Vratislav Chudoba's avatar Vratislav Chudoba

Class AEvent modified. Second constructor added.

parent 580c6137
...@@ -8,17 +8,23 @@ ...@@ -8,17 +8,23 @@
#include "AEvent.h" #include "AEvent.h"
AEvent::AEvent() : fNPoints(1024) { //fNPoints is number of points in one event, 1024 or 1000 AEvent::AEvent() : fNPoints(1024) { //fNPoints is number of points in one event, 1024 or 1000
// TODO Auto-generated constructor stub
Init(); Init();
Reset(); Reset();
} }
AEvent::AEvent(const Int_t npoints) : fNPoints(npoints) {
Init();
Reset();
}
AEvent::~AEvent() { AEvent::~AEvent() {
// TODO Auto-generated destructor stub // TODO Auto-generated destructor stub
delete gSignal; delete gSignal;
delete gCFD; delete gCFD;
delete fInputEvent;
} }
void AEvent::SetRawDataFile(const char* inprawfile, const char* treename) { void AEvent::SetRawDataFile(const char* inprawfile, const char* treename) {
...@@ -44,7 +50,7 @@ void AEvent::ProcessEvent() { ...@@ -44,7 +50,7 @@ void AEvent::ProcessEvent() {
const Double_t *amp = fInputEvent->GetAmp(); const Double_t *amp = fInputEvent->GetAmp();
const Double_t *time = fInputEvent->GetTime(); 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.); fAmpPos[j] = amp[j]*(-1.);
fTime[j] = time[j]; fTime[j] = time[j];
} }
...@@ -53,7 +59,7 @@ void AEvent::ProcessEvent() { ...@@ -53,7 +59,7 @@ void AEvent::ProcessEvent() {
Double_t maxAmpT = 0.; Double_t maxAmpT = 0.;
maxAmp = fAmpPos[0]; maxAmp = fAmpPos[0];
for(Int_t j=0; j < NCELLS; j++) { for(Int_t j=0; j < fNPoints; j++) {
if(fAmpPos[j] > maxAmp) { if(fAmpPos[j] > maxAmp) {
maxAmp = fAmpPos[j]; maxAmp = fAmpPos[j];
maxAmpT = fTime[j]; maxAmpT = fTime[j];
...@@ -72,7 +78,7 @@ void AEvent::ProcessEvent() { ...@@ -72,7 +78,7 @@ void AEvent::ProcessEvent() {
void AEvent::Reset() { void AEvent::Reset() {
for (Int_t i = 0; i < NCELLS; i++) { for (Int_t i = 0; i < fNPoints; i++) {
fAmpPos[i] = 0; fAmpPos[i] = 0;
fTime[i] = 0; fTime[i] = 0;
fAmpCFD[i] = 0; fAmpCFD[i] = 0;
...@@ -93,6 +99,10 @@ void AEvent::SetInputEvent(RawEvent** event) { ...@@ -93,6 +99,10 @@ void AEvent::SetInputEvent(RawEvent** event) {
void AEvent::Init() { void AEvent::Init() {
fAmpPos.Set(fNPoints);
fTime.Set(fNPoints);
fAmpCFD.Set(fNPoints);
gSignal = new TGraph(); gSignal = new TGraph();
gCFD = new TGraph(); gCFD = new TGraph();
fInputEvent = 0; fInputEvent = 0;
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "RawEvent.h" #include "RawEvent.h"
#define NCELLS 1024 //#define NCELLS 1024
using std::cout; using std::cout;
using std::endl; using std::endl;
...@@ -32,11 +32,13 @@ class AEvent { ...@@ -32,11 +32,13 @@ class AEvent {
private: private:
const Int_t fNPoints; //! const Int_t fNPoints; //!
Double_t fAmpPos[NCELLS]; //array for raw amplitudes TArrayD fAmpPos; //array for raw amplitudes
Double_t fTime[NCELLS]; //array for raw times TArrayD fTime; //array for raw times
Double_t fAmpMax; Double_t fAmpMax;
Double_t fTimeAmpMax; 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 Double_t fCFD; //zero-crossing time
TGraph *gSignal; TGraph *gSignal;
...@@ -46,6 +48,7 @@ private: ...@@ -46,6 +48,7 @@ private:
public: public:
AEvent(); AEvent();
AEvent(const Int_t npoints);
virtual ~AEvent(); virtual ~AEvent();
ClassDef(AEvent,1); ClassDef(AEvent,1);
......
...@@ -65,11 +65,11 @@ void RawEvent::SetTime(Double_t t, Int_t i) { ...@@ -65,11 +65,11 @@ void RawEvent::SetTime(Double_t t, Int_t i) {
return; return;
} }
double RawEvent::GetTime(Int_t i) { Double_t RawEvent::GetTime(Int_t i) {
return fTime[i]; return fTime[i];
} }
double RawEvent::GetAmp(Int_t i) { Double_t RawEvent::GetAmp(Int_t i) {
return fAmp[i]; return fAmp[i];
} }
//void RawEvent::SetGraphs() { //void RawEvent::SetGraphs() {
......
...@@ -62,9 +62,9 @@ public: ...@@ -62,9 +62,9 @@ public:
void PrintTime(Int_t i); 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); // void InvertAmp(Double_t a, Int_t i);
//Inverts the amplitudes i.e. makes from negative singals //Inverts the amplitudes i.e. makes from negative singals
......
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