9 #include "ERNeuRadAEvent.h" 11 ERNeuRadAEvent::ERNeuRadAEvent() : fNPoints(1024) {
18 ERNeuRadAEvent::ERNeuRadAEvent(
const Int_t npoints) : fNPoints(npoints) {
24 ERNeuRadAEvent::~ERNeuRadAEvent() {
31 void ERNeuRadAEvent::ProcessEvent(Bool_t bSmooth) {
33 if (fInputEvent == NULL) {
34 Warning(
"ERNeuRadAEvent::ProcessEvent",
"Input event wasn't set. Function won't be processed.");
38 const Double_t *amp = fInputEvent->GetAmp();
39 const Double_t *time = fInputEvent->GetTime();
40 fEvent = fInputEvent->GetEvent();
42 for(Int_t j = 0; j < fNPoints; j++) {
43 fAmpPos[j] = amp[j]*(-1.);
49 for(Int_t j = 0; j < fNPoints; j++) {
50 fAmpPos[j] = fAmpPos[j] - fZeroLevel;
56 FindFrontProperties();
59 if (bSmooth == kTRUE) {
76 void ERNeuRadAEvent::Reset() {
78 for (Int_t i = 0; i < fNPoints; i++) {
108 Warning(
"ERNeuRadAEvent::SetInputEvent",
"Input event was set as 0.");
110 fInputEvent = *event;
113 void ERNeuRadAEvent::Init() {
115 fAmpPos.Set(fNPoints);
117 fAmpCFD.Set(fNPoints);
119 fGraphSignal =
new TGraph();
120 fGraphCFD =
new TGraph();
131 void ERNeuRadAEvent::SetGraphs() {
133 fGraphSignal->Set(fNPoints);
135 for (Int_t i=0; i<fNPoints; i++) {
136 fGraphSignal->SetPoint(i, fTime[i], fAmpPos[i]);
141 void ERNeuRadAEvent::SmoothGraphs() {
144 fGraphSignal->Set(fNPoints - fWinSize/2);
146 Int_t winMidSize = fWinSize / 2;
147 Double_t tmin, tmax, meanTime, meanAmp, sumAmp;
149 for(Int_t i = winMidSize; i < fNPoints - winMidSize; ++i) {
155 for(Int_t j = i - winMidSize; j <= (i + winMidSize); ++j) {
156 if (j == i - winMidSize) { tmin = fTime[j]; }
157 if (j == i + winMidSize) { tmax = fTime[j]; }
158 sumAmp += fAmpPos[j];
160 meanTime = (tmax - tmin)*0.5 + tmin;
163 meanAmp = sumAmp / fWinSize;
166 fGraphSignal->SetPoint(i, meanTime, meanAmp);
171 void ERNeuRadAEvent::SetCFD() {
174 Double_t mytime = fCFtimeDelay;
175 fGraphCFD->Set(fNPoints);
178 Double_t maxCFD = 0., minCFD = 0.;
179 Double_t TmaxCFD = 0., TminCFD = 0.;
181 const Double_t timeStep = 0.1;
185 while( mytime < (100. - fCFtimeDelay) ) {
187 ampCFD = fGraphSignal->Eval(mytime)*fCFratio*(-1) + fGraphSignal->Eval(mytime - fCFtimeDelay);
188 fGraphCFD->SetPoint(i, mytime, ampCFD);
191 if( ampCFD > maxCFD) {
197 if( ampCFD < minCFD) {
203 mytime = mytime + timeStep;
208 while( (fGraphCFD->Eval(time) <= 0) && (time <= TmaxCFD) ) {
210 time = time + timeStep;
215 void ERNeuRadAEvent::FindFrontProperties() {
218 const Double_t minHeight = 0.1;
219 const Double_t maxHeight = 0.9;
221 const Double_t timeStep = 0.05;
223 Double_t mytime = 0.;
226 Warning(
"ERNeuRadAEvent::FindFrontProperties",
"Graph was not set");
232 while (fGraphSignal->Eval(time) <= maxHeight*fAmpMax && time<200.) {
234 time = time + timeStep;
238 while( fGraphSignal->Eval(time) >= minHeight*fAmpMax && time>0) {
240 time = time - timeStep;
243 TF1 *fit1 =
new TF1(
"fit1",
"[1]*x+[0]");
244 fit1->SetRange(fTime10,fTime90);
246 fGraphSignal->Fit(fit1,
"RQN",
"goff");
247 fEdgeSlope = fit1->GetParameter(1);
248 fEdgeXi = fit1->GetChisquare();
250 fTimeMid = (fTime90 -fTime10)*0.5 + fTime10;
251 fAmpMid = fGraphSignal->Eval(fTimeMid);
254 Double_t a = 0, b = 0;
255 TF1 *line =
new TF1(
"line",
"[1]*x + [0]");
256 a = fit1->GetParameter(1);
257 b = fit1->GetParameter(0);
258 line->SetParameter(0,b);
259 line->SetParameter(1,a);
261 if( a!= 0. && b!= 0. ) {
262 while(line->Eval(mytime) <= 0 && mytime <= 100.) {
264 mytime = mytime + timeStep;
271 Double_t ERNeuRadAEvent::FindZeroLevel() {
274 Double_t correction = 0;
275 TF1 *fit1 =
new TF1(
"fit1",
"[0]");
276 fit1->SetRange(fNoiseRangeMin,fNoiseRangeMax);
279 Warning(
"ERNeuRadAEvent::FindZeroLevel",
"Graph was not set");
283 fGraphSignal->Fit(fit1,
"RQN",
"goff");
284 correction = fit1->GetParameter(0);
290 void ERNeuRadAEvent::SetChargeCFD(Int_t tmin, Int_t tmax) {
292 Double_t integral = 0.;
293 Double_t time_sig = 0;
294 const Double_t res = 50.;
295 time_sig = (double)(-tmin + tmax)*(1e-9);
297 Int_t imin = 0, imax = 0;
300 while ( fTime[i] < (fTimeCFD + tmin) && (i < (fGraphSignal->GetN()-1)) ) { imin = i; i++; }
301 while ( fTime[i] < (fTimeCFD + tmax) && (i < (fGraphSignal->GetN()-1)) ) { imax = i; i++; }
303 integral = fGraphSignal->Integral(imin, imax);
305 fChargeCFD = integral*time_sig/res;
311 void ERNeuRadAEvent::SetChargeLED(Int_t tmin, Int_t tmax) {
313 Double_t integral = 0.;
314 Double_t time_sig = 0;
315 const Double_t res = 50.;
316 time_sig = (double)(-tmin + tmax)*(1e-9);
318 Int_t imin = 0, imax = 0;
321 while ( fTime[i] < (fTimeLED + tmin) && (i < (fGraphSignal->GetN()-1)) ) { imin = i; i++; }
322 while ( fTime[i] < (fTimeLED + tmax) && (i < (fGraphSignal->GetN()-1)) ) { imax = i; i++; }
324 integral = fGraphSignal->Integral(imin, imax);
326 fChargeLED = integral*time_sig/res;
331 void ERNeuRadAEvent::SetChargeTF(Int_t tmin, Int_t tmax) {
333 Double_t integral = 0.;
334 Double_t time_sig = 0;
335 const Double_t res = 50.;
336 time_sig = (double)(-tmin + tmax)*(1e-9);
338 Int_t imin = 0, imax = 0;
341 while ( fTime[i] < (fTimeFront + tmin) && (i < (fGraphSignal->GetN()-1)) ) { imin = i; i++; }
342 while ( fTime[i] < (fTimeFront + tmax) && (i < (fGraphSignal->GetN()-1)) ) { imax = i; i++; }
344 integral = fGraphSignal->Integral(imin, imax);
346 fChargeTF = integral*time_sig/res;
351 Double_t ERNeuRadAEvent::GetfCFD() {
356 Double_t ERNeuRadAEvent::GetfLED() {
360 Double_t ERNeuRadAEvent::GetOnefTime(Int_t i) {
364 Double_t ERNeuRadAEvent::GetOnefAmpPos(Int_t i) {
368 Double_t ERNeuRadAEvent::GetT_10() {
372 Double_t ERNeuRadAEvent::GetT_90() {
376 Double_t ERNeuRadAEvent::GetEdgeSlope() {
380 Double_t ERNeuRadAEvent::GetEdgeXi() {
384 void ERNeuRadAEvent::SetMaxAmplitudes() {
385 Double_t maxAmp = 0.;
386 Double_t maxAmpT = 0.;
389 for(Int_t j=0; j < fNPoints; j++) {
390 if(fAmpPos[j] > maxAmp) {
396 fTimeAmpMax = maxAmpT;
399 void ERNeuRadAEvent::SetLED(Double_t threshold) {
401 const Double_t timeStep = 0.05;
402 while( time < fTimeAmpMax && fGraphSignal->Eval(time) <= threshold ) {
404 time = time + timeStep;
408 void ERNeuRadAEvent::SetToT() {
409 Double_t time = fTimeMid;
410 Double_t timeBack = 0;
411 const Double_t ns = 15.;
413 const Double_t timeStep = 0.05;
415 while( fGraphSignal->Eval(time) >= fAmpMid && time < fTimeMid + ns) {
417 time = time + timeStep;
419 fToT = timeBack - fTimeMid;
423 void ERNeuRadAEvent::ObtainPE() {
424 SetPETimes(fInputEvent->GetPETimes());
425 SetPEAmps(fInputEvent->GetPEAmps());
429 Double_t ERNeuRadAEvent::GetStartTime() {
433 void ERNeuRadAEvent::SetStartTime(Double_t t) {
438 Double_t ERNeuRadAEvent::GetFinishTime() {
442 void ERNeuRadAEvent::SetFinishTime(Double_t t) {
447 void ERNeuRadAEvent::SetEvent(Int_t t) {
class for processing raw data and getting amp and time properties of signal
class for raw data obtained from measurements or simulations