AEvent.h 3.02 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 47

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

52 53
	Double_t fTimeLED;	//time of LED threshold crossing

54 55
	TGraph *fGraphSignal;
	TGraph *fGraphCFD;
56 57 58

	RawEvent *fInputEvent;		//!

59
	Double_t fCFratio;		//!
60 61
	Double_t fCFtimeDelay;		//!

62 63 64
	Double_t fNoiseRangeMin;	//!
	Double_t fNoiseRangeMax;	//!

65 66
public:
	AEvent();
67
	AEvent(const Int_t npoints);
68 69
	virtual ~AEvent();
	ClassDef(AEvent,1);
70 71
	
	Double_t GetT_10();
72 73
	//returns time of 10% of rising edge amplitude in ns

74
	Double_t GetT_90();
75 76
	//returns time of 90% of rising edge amplitude in ns

77
	Double_t GetEdgeSlope();
78 79
	//returns slope coefficient for the rising edge of the signal

80 81
	Double_t GetEdgeXi();

Muzalevsky I.A's avatar
Muzalevsky I.A committed
82
	Double_t GetfCFD();
83

Muzalevsky I.A's avatar
Muzalevsky I.A committed
84 85
	Double_t GetfLED();

Muzalevsky I.A's avatar
Muzalevsky I.A committed
86
	Double_t GetOnefTime(Int_t i);
87

Muzalevsky I.A's avatar
Muzalevsky I.A committed
88
	Double_t GetOnefAmpPos(Int_t i);
89

90 91
	void ProcessEvent();
	void SetInputEvent(RawEvent** event);
92

93 94 95 96 97
	void SetCFratio(Double_t ratio) { fCFratio = ratio; };	
	//CFD set attenuation coefficient

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

99 100 101
	void SetNoiseRange(Double_t min, Double_t max) { fNoiseRangeMin = min; fNoiseRangeMax = max; };
	//Set noise range to be used in FindZeroLevel()

102 103 104
	void Reset();
	 //Resets arrays to zeros

105 106
	TGraph* GetGraphCFD() {

107
		return fGraphCFD;
108
	}
109 110 111 112 113 114 115 116
	//draws CFD graphs

	TGraph* GetGraphSignal() {

		return fGraphSignal;
	}
	//draws signal shape graphs

117 118
	void FindFrontProperties();

119
	Double_t FindZeroLevel();
120
	//for zero level correction. one parameter fit between pmin and pmax
121
	//returns fit parameter i.e. number on which amplitude should be corrected
122

123
	void SetChargeCFD(Int_t tmin = -3, Int_t tmax = 17);
124 125 126 127
	//calculates charge of the signal (i.e. its integral 
	//in range of (tmin,tmax) in ns)
	//CFD time is taken as a start point

128 129 130
	void SetChargeLED(Int_t tmin = -3, Int_t tmax = 17);


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

133
	void SetLED(Double_t threshold = 0.02);
134

135 136
	//leading edge discriminator

137 138
private:
	void Init();
139
	void SetMaxAmplitudes();
140
	void SetGraphs();
141
	void SetCFD(); 	//constant fraction discriminator method
142 143 144
};

#endif /* DATACLASSES_AEVENT_H_ */