RawEvent.cpp 1.37 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
/*
 * RawEvent.cpp
 *
 *  Created on: Dec 27, 2016
 *      Author: vratik
 */

#include "RawEvent.h"

RawEvent::RawEvent() : fNPoints(1024) {
	// TODO Auto-generated constructor stub
	Init();
13
	Reset();
14 15 16 17 18
}

RawEvent::RawEvent(const Int_t npoints) : fNPoints(npoints) {
	// TODO Auto-generated constructor stub
	Init();
19
	Reset();
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
}

RawEvent::~RawEvent() {
	// TODO Auto-generated destructor stub
}

void RawEvent::Init() {
	fAmp.Set(fNPoints);
	fTime.Set(fNPoints);
}

void RawEvent::Reset() {

	for (Int_t i = 0; i < fNPoints; i++) {
		fAmp[i] = 0;
		fTime[i] = 0;
	}

	// TODO how to deal with graphs?
}

void RawEvent::PrintTime(Int_t i) {
		cout << fTime[i] << endl;
}

void RawEvent::PrintAmp(Int_t i) {
		cout << fAmp[i] << endl;
}

void RawEvent::SetAmp(Double_t a, Int_t i) {
50
//	cout << fNPoints << endl;
51
	if (i >= fNPoints) {
52
		Error("RawEvent::SetAmp", "Array with raw amplitudes is overloaded!");
53 54 55 56 57 58 59 60
		return;
	}
	fAmp[i] = a;
	return;
}

void RawEvent::SetTime(Double_t t, Int_t i) {
	if (i >=fNPoints) {
61
		Error("RawEvent::SetTime", "Array with raw times is overloaded!");
62 63 64 65 66 67
		return;
	}
	fTime[i] = t;
	return;
}

68
Double_t RawEvent::GetTime(Int_t i) {
69 70 71
		return fTime[i];
}

72
Double_t RawEvent::GetAmp(Int_t i) {
73 74
		return fAmp[i];
}
75 76 77 78 79 80 81 82 83 84
//void RawEvent::SetGraphs() {
//
//	gAmp->Set(fNPoints);
//
//	for (Int_t i=0; i<fNPoints; i++) {
//		gAmp->SetPoint(i, fTime[i], fAmp[i]);
//	}
//
//	return;
//}