AEvent.h 3.61 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
	Double_t fEdgeXi;
43 44 45
	Double_t fEdgeSlope;	//slope coefficient for the rising edge of the signal
	Double_t fTime10;		//time of 10% of rising edge amplitude in ns
	Double_t fTime90;		//time of 10% of rising edge amplitude in ns
46
	Double_t fTimeMid;		//time point between fTime90 and fTime10
47 48

	TArrayD fAmpCFD;	//array for CFD amplitudes (attenuated, inversed and delayed)
49
	Double_t fTimeCFD;			//zero-crossing time
50 51
	Double_t fChargeCFD;	//!
	Double_t fChargeLED;	//charge of the signal in Coulomb
52
	Double_t fChargeTF;	//
53

54
	Double_t fTimeLED;	//time of LED threshold crossing
55
	Double_t fTimeFront;	//time of front fit crossing zero level
56

57 58
	TGraph *fGraphSignal;
	TGraph *fGraphCFD;
59
//	TGraph *fGraphSmooth;
60 61 62

	RawEvent *fInputEvent;		//!

63
	Double_t fCFratio;		//!
64 65
	Double_t fCFtimeDelay;		//!

66 67
	Double_t fNoiseRangeMin;	//!
	Double_t fNoiseRangeMax;	//!
68
	Int_t fWinSize;			//!
69

70 71
public:
	AEvent();
72
	AEvent(const Int_t npoints);
73 74
	virtual ~AEvent();
	ClassDef(AEvent,1);
75 76
	
	Double_t GetT_10();
77 78
	//returns time of 10% of rising edge amplitude in ns

79
	Double_t GetT_90();
80 81
	//returns time of 90% of rising edge amplitude in ns

82
	Double_t GetEdgeSlope();
83 84
	//returns slope coefficient for the rising edge of the signal

85 86
	Double_t GetEdgeXi();

Muzalevsky I.A's avatar
Muzalevsky I.A committed
87
	Double_t GetfCFD();
88

Muzalevsky I.A's avatar
Muzalevsky I.A committed
89 90
	Double_t GetfLED();

Muzalevsky I.A's avatar
Muzalevsky I.A committed
91
	Double_t GetOnefTime(Int_t i);
92

Muzalevsky I.A's avatar
Muzalevsky I.A committed
93
	Double_t GetOnefAmpPos(Int_t i);
94

Vratislav Chudoba's avatar
Vratislav Chudoba committed
95
	void ProcessEvent(Bool_t bSmooth = kFALSE);
96
	void SetInputEvent(RawEvent** event);
97

98 99 100 101 102
	void SetCFratio(Double_t ratio) { fCFratio = ratio; };	
	//CFD set attenuation coefficient

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

104 105 106
	void SetNoiseRange(Double_t min, Double_t max) { fNoiseRangeMin = min; fNoiseRangeMax = max; };
	//Set noise range to be used in FindZeroLevel()

107 108 109
	void SetSmoothPoints(Int_t numofp) {fWinSize = numofp; };
	//set number of smoothing points

110 111 112
	void Reset();
	 //Resets arrays to zeros

113 114
	TGraph* GetGraphCFD() {

115
		return fGraphCFD;
116
	}
117 118 119 120 121 122
	//draws CFD graphs

	TGraph* GetGraphSignal() {

		return fGraphSignal;
	}
123

124
	/*TGraph* GetGraphSmooth() {
125 126

		return fGraphSmooth;
127
	}*/
128 129
	//draws signal shape graphs

130 131
	void FindFrontProperties();

132
	Double_t FindZeroLevel();
133
	//for zero level correction. one parameter fit between pmin and pmax
134
	//returns fit parameter i.e. number on which amplitude should be corrected
135

136
	void SetChargeCFD(Int_t tmin = -3, Int_t tmax = 17);
137 138 139 140
	//calculates charge of the signal (i.e. its integral 
	//in range of (tmin,tmax) in ns)
	//CFD time is taken as a start point

141 142
	void SetChargeLED(Int_t tmin = -3, Int_t tmax = 17);

143 144 145 146
	void SetChargeTF(Int_t tmin = -3, Int_t tmax = 17);
	//calculates charge of the signal (i.e. its integral 
	//in range of (tmin,tmax) in ns) 
	//time of front fit crossing zero is taken as a start point
147

Muzalevsky I.A's avatar
Muzalevsky I.A committed
148
	//void SetLED(Double_t threshold = 0.001);
149

150
	void SetLED(Double_t threshold = 0.02);
151

152 153
	//leading edge discriminator

154 155
private:
	void Init();
156
	void SetMaxAmplitudes();
157
	void SetGraphs();
158
	void SmoothGraphs();
159
	void SetCFD(); 	//constant fraction discriminator method
160 161 162
};

#endif /* DATACLASSES_AEVENT_H_ */