RawEvent.cpp 1.24 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 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
/*
 * RawEvent.cpp
 *
 *  Created on: Dec 27, 2016
 *      Author: vratik
 */

#include "RawEvent.h"

RawEvent::RawEvent() : fNPoints(1024) {
	// TODO Auto-generated constructor stub
	Init();
}

RawEvent::RawEvent(const Int_t npoints) : fNPoints(npoints) {
	// TODO Auto-generated constructor stub
	Init();
}

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) {
48
//	cout << fNPoints << endl;
49
	if (i >= fNPoints) {
50
		Error("RawEvent::SetAmp", "Array with raw amplitudes is overloaded!");
51 52 53 54 55 56 57 58
		return;
	}
	fAmp[i] = a;
	return;
}

void RawEvent::SetTime(Double_t t, Int_t i) {
	if (i >=fNPoints) {
59
		Error("RawEvent::SetTime", "Array with raw times is overloaded!");
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
		return;
	}
	fTime[i] = t;
	return;
}

//void RawEvent::SetGraphs() {
//
//	gAmp->Set(fNPoints);
//
//	for (Int_t i=0; i<fNPoints; i++) {
//		gAmp->SetPoint(i, fTime[i], fAmp[i]);
//	}
//
//	return;
//}