AEvent.h 2.26 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
/*
 * AEvent.h
 *
 *  Created on: Dec 28, 2016
 *      Author: daria
 */

#ifndef DATACLASSES_AEVENT_H_
#define DATACLASSES_AEVENT_H_

#include <iostream>
#include <fstream>
#include <iomanip>
#include <sstream>

#include "TError.h"
#include "TString.h"
#include "TTree.h"
#include "TFile.h"
20
#include "TF1.h"
21 22 23 24 25
//#include "TMath.h"


#include "RawEvent.h"

26
//#define NCELLS 1024
27 28 29 30 31 32 33 34 35

using std::cout;
using std::endl;

class AEvent {

private:

	const Int_t fNPoints;	//!
36 37 38
	TArrayD fAmpPos;	//array for raw amplitudes
	TArrayD fTime;		//array for raw times

39 40
	Double_t fAmpMax;
	Double_t fTimeAmpMax;
41
	Double_t fZeroLevel;
42 43

	TArrayD fAmpCFD;	//array for CFD amplitudes (attenuated, inversed and delayed)
44
	Double_t fTimeCFD;			//zero-crossing time
45
	Double_t fChargeCFD;	//charge of the signal in Coulomb
46

47 48
	TGraph *fGraphSignal;
	TGraph *fGraphCFD;
49 50 51

	RawEvent *fInputEvent;		//!

52
	Double_t fCFratio;		//!
53 54
	Double_t fCFtimeDelay;		//!

55 56 57
	Double_t fNoiseRangeMin;	//!
	Double_t fNoiseRangeMax;	//!

58 59
public:
	AEvent();
60
	AEvent(const Int_t npoints);
61 62
	virtual ~AEvent();
	ClassDef(AEvent,1);
Muzalevsky I.A's avatar
Muzalevsky I.A committed
63 64 65
	Double_t GetfCFD();
	Double_t GetOnefTime(Int_t i);
	Double_t GetOnefAmpPos(Int_t i);
66 67 68
	void SetRawDataFile(const char* inprawfile, const char* treename);
	void ProcessEvent();
	void SetInputEvent(RawEvent** event);
69

70 71 72 73 74
	void SetCFratio(Double_t ratio) { fCFratio = ratio; };	
	//CFD set attenuation coefficient

	void SetCFtimeDelay(Double_t timeDelay) { fCFtimeDelay = timeDelay; };	
	//CFD set time delay (in points)
75

76 77 78
	void SetNoiseRange(Double_t min, Double_t max) { fNoiseRangeMin = min; fNoiseRangeMax = max; };
	//Set noise range to be used in FindZeroLevel()

79 80 81
	void Reset();
	 //Resets arrays to zeros

82 83
	TGraph* GetGraphCFD() {

84
		return fGraphCFD;
85
	}
86 87 88 89 90 91 92 93
	//draws CFD graphs

	TGraph* GetGraphSignal() {

		return fGraphSignal;
	}
	//draws signal shape graphs

94
	Double_t FindZeroLevel();
95
	//for zero level correction. one parameter fit between pmin and pmax
96
	//returns fit parameter i.e. number on which amplitude should be corrected
97

98
	void SetChargeCFD(Int_t tmin = -3, Int_t tmax = 17);
99 100 101 102
	//calculates charge of the signal (i.e. its integral 
	//in range of (tmin,tmax) in ns)
	//CFD time is taken as a start point

103 104
private:
	void Init();
105
	void SetMaxAmplitudes();
106
	void SetGraphs();
107
	void SetCFD();
108 109 110
};

#endif /* DATACLASSES_AEVENT_H_ */