er  dev
ERNeuRadAEvent.h
1 /********************************************************************************
2  * Copyright (C) Joint Institute for Nuclear Research *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence version 3 (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 
9 #ifndef ERNeuRadAEvent_H
10 #define ERNeuRadAEvent_H
11 
12 #include <iostream>
13 #include <fstream>
14 #include <iomanip>
15 #include <sstream>
16 
17 #include "TError.h"
18 #include "TString.h"
19 #include "TTree.h"
20 #include "TFile.h"
21 #include "TF1.h"
22 
23 #include "ERNeuRadRawEvent.h"
24 
25 using std::cout;
26 using std::endl;
27 
28 class TError;
29 class TString;
30 class TTree;
31 class TFile;
32 class TF1;
33 
34 class ERNeuRadRawEvent;
35 
41 class ERNeuRadAEvent : public TNamed {
42 
43 private:
44 
45  const Int_t fNPoints;
46  TArrayD fAmpPos; //array for raw amplitudes
47  TArrayD fTime; //array for raw times
48 
49  Double_t fAmpMax;
50  Double_t fTimeAmpMax;
51  Double_t fZeroLevel;
52  Double_t fEdgeXi;
53  Double_t fEdgeSlope; //slope coefficient for the rising edge of the signal
54  Double_t fTime10; //time of 10% of rising edge amplitude in ns
55  Double_t fTime90; //time of 10% of rising edge amplitude in ns
56  Double_t fTimeMid; //time point between fTime90 and fTime10
57  Double_t fAmpMid; //amplitude in fTimeMid point. Used in ToT on 50% of rising edge determination
58  Double_t fToT;
59 
60  TArrayD fAmpCFD; //array for CFD amplitudes (attenuated, inversed and delayed)
61  Double_t fTimeCFD; //zero-crossing time
62  Double_t fChargeCFD; //
63  Double_t fChargeLED; //charge of the signal in Coulomb
64  Double_t fChargeTF; //
65 
66  Double_t fTimeLED; //time of LED threshold crossing
67  Double_t fTimeFront; //time of front fit crossing zero level
68 
69  TGraph *fGraphSignal;
70  TGraph *fGraphCFD;
71 
72  ERNeuRadRawEvent *fInputEvent;
73 
74  Double_t fCFratio;
75  Double_t fCFtimeDelay;
76 
77  Double_t fNoiseRangeMin;
78  Double_t fNoiseRangeMax;
79  Int_t fWinSize;
80 
81  TArrayF fPEAmps;
82  TArrayF fPETimes;
83 
84  TArrayF fPEAmp;
85  TArrayF fPETime;
86  //Массив амплитуд фотоэлектронов сигнала
87  Float_t fPEAmplitudes[1024];
88  //Массив времен прихоа на анод фотоэлектронов сигнала
89  Float_t fPEAnodeTimes[1024];
90  //Количество фотоэлектронов в сигнале
91  Int_t fPECount;
92  // start time of the signal
93  Double_t fStartTime;
94  Double_t fFinishTime;
95  Int_t fEvent;
96 public:
98  ERNeuRadAEvent(const Int_t npoints);
99  virtual ~ERNeuRadAEvent();
100  ClassDef(ERNeuRadAEvent,1);
101 
102  Double_t GetT_10();
103  //returns time of 10% of rising edge amplitude in ns
104 
105  Double_t GetT_90();
106  //returns time of 90% of rising edge amplitude in ns
107 
108  Double_t GetEdgeSlope();
109  //returns slope coefficient for the rising edge of the signal
110 
111  Double_t GetEdgeXi();
112 
113  Double_t GetfCFD();
114 
115  Double_t GetfLED();
116 
117  Double_t GetOnefTime(Int_t i);
118 
119  Double_t GetOnefAmpPos(Int_t i);
120 
121  void ProcessEvent(Bool_t bSmooth = kFALSE);
122  void SetInputEvent(ERNeuRadRawEvent** event);
123 
124  void SetCFratio(Double_t ratio) { fCFratio = ratio; };
125  //CFD set attenuation coefficient
126 
127  void SetCFtimeDelay(Double_t timeDelay) { fCFtimeDelay = timeDelay; };
128  //CFD set time delay (in points)
129 
130  void SetNoiseRange(Double_t min, Double_t max) { fNoiseRangeMin = min; fNoiseRangeMax = max; };
131  //Set noise range to be used in FindZeroLevel()
132 
133  void SetSmoothPoints(Int_t numofp) {fWinSize = numofp; };
134  //set number of smoothing points
135 
136  void SetToT();
137  //calculate time-over-threshold. the threshold value is fTimeMid - middle point of the rising edge
138  //ToT is calculated within 15 ns range in order to consider all the weirdness of the signal form
139 
140  void Reset();
141  //Resets arrays to zeros
142 
143  TGraph* GetGraphCFD() {
144  return fGraphCFD;
145  }
146  //draws CFD graphs
147 
148  TGraph* GetGraphSignal() {
149  return fGraphSignal;
150  }
151  //draws signal shape graphs
152 
153  void FindFrontProperties();
154 
155  Double_t FindZeroLevel();
156  //for zero level correction. one parameter fit between pmin and pmax
157  //returns fit parameter i.e. number on which amplitude should be corrected
158 
159  void SetChargeCFD(Int_t tmin = -3, Int_t tmax = 17);
160  //calculates charge of the signal (i.e. its integral
161  //in range of (tmin,tmax) in ns)
162  //CFD time is taken as a start point
163 
164  void SetChargeLED(Int_t tmin = -3, Int_t tmax = 17);
165 
166  void SetChargeTF(Int_t tmin = -3, Int_t tmax = 17);
167  //calculates charge of the signal (i.e. its integral
168  //in range of (tmin,tmax) in ns)
169  //time of front fit crossing zero is taken as a start point
170 
171  //void SetLED(Double_t threshold = 0.001);
172 
173  void SetLED(Double_t threshold = 0.2);
174 
175  //leading edge discriminator
176 
177  TArrayF GetPEAmps() {return fPEAmps;}
178  TArrayF GetPETimes() {return fPETimes;}
179  void SetPETimes(TArrayF& fPETimesOLD) {fPETimesOLD.Copy(fPETimes);}
180  void SetPEAmps(TArrayF& fPEAmpsOLD) {fPEAmpsOLD.Copy(fPEAmps);}
181 
182  void ObtainPE();
183  Double_t GetStartTime();
184  void SetStartTime(Double_t t);
185  Double_t GetFinishTime();
186  void SetFinishTime(Double_t t);
187  void SetEvent(Int_t t);
188  Int_t GetEvent() {return fEvent;}
189 
190 private:
191  void Init();
192  void SetMaxAmplitudes();
193  void SetGraphs();
194  void SmoothGraphs();
195  void SetCFD(); //constant fraction discriminator method
196 };
197 
198 #endif /* ERNeuRadAEventT_H */
class for processing raw data and getting amp and time properties of signal
class for raw data obtained from measurements or simulations