]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PHOS/AliPHOSRawDecoderv1.cxx
adding phi, etaphi plots
[u/mrichter/AliRoot.git] / PHOS / AliPHOSRawDecoderv1.cxx
CommitLineData
77ea1c6f 1/**************************************************************************
2 * Copyright(c) 2007, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/* $Id$ */
17
18// This class decodes the stream of ALTRO samples to extract
19// the PHOS "digits" of current event. Uses fitting procedure
20// to separate reasonable samples
21//
22// Typical use case:
23// AliRawReader* rf = new AliRawReaderDate("2006run2211.raw");
24// AliPHOSRawDecoder dc(rf);
25// while (rf->NextEvent()) {
77ea1c6f 26// dc.SubtractPedestals(kTRUE);
27// while ( dc.NextDigit() ) {
28// Int_t module = dc.GetModule();
29// Int_t column = dc.GetColumn();
30// Int_t row = dc.GetRow();
31// Double_t amplitude = dc.GetEnergy();
32// Double_t time = dc.GetTime();
33// Bool_t IsLowGain = dc.IsLowGain();
34// ..........
35// }
36// }
37
38// Author: Dmitri Peressounko
39
40// --- ROOT system ---
11f2ec15 41#include "TList.h"
77ea1c6f 42#include "TMath.h"
43#include "TMinuit.h"
44
11f2ec15 45#include "TCanvas.h"
46#include "TH1.h"
47#include "TH2.h"
48#include "TF1.h"
49#include "TROOT.h"
50
77ea1c6f 51// --- AliRoot header files ---
11f2ec15 52//#include "AliLog.h"
77ea1c6f 53#include "AliPHOSRawDecoderv1.h"
54#include "AliPHOSPulseGenerator.h"
55
56
57ClassImp(AliPHOSRawDecoderv1)
58
59//-----------------------------------------------------------------------------
11f2ec15 60 AliPHOSRawDecoderv1::AliPHOSRawDecoderv1():AliPHOSRawDecoder(),
61fSampleParamsLow(0x0),fSampleParamsHigh(0x0),fToFit(0x0)
77ea1c6f 62{
63 //Default constructor.
64}
65
66//-----------------------------------------------------------------------------
67AliPHOSRawDecoderv1::AliPHOSRawDecoderv1(AliRawReader* rawReader, AliAltroMapping **mapping):
11f2ec15 68 AliPHOSRawDecoder(rawReader,mapping),
69 fSampleParamsLow(0x0),fSampleParamsHigh(0x0),fToFit(0x0)
77ea1c6f 70{
71 //Construct a decoder object.
72 //Is is user responsibility to provide next raw event
73 //using AliRawReader::NextEvent().
74
75 if(!gMinuit)
76 gMinuit = new TMinuit(100);
70d93620 77 fSampleParamsHigh =new TArrayD(7) ;
78 fSampleParamsHigh->AddAt(2.174,0) ;
79 fSampleParamsHigh->AddAt(0.106,1) ;
80 fSampleParamsHigh->AddAt(0.173,2) ;
81 fSampleParamsHigh->AddAt(0.06106,3) ;
82 //last two parameters are pedestal and overflow
83 fSampleParamsLow=new TArrayD(7) ;
84 fSampleParamsLow->AddAt(2.456,0) ;
85 fSampleParamsLow->AddAt(0.137,1) ;
86 fSampleParamsLow->AddAt(2.276,2) ;
87 fSampleParamsLow->AddAt(0.08246,3) ;
11f2ec15 88 fToFit = new TList() ;
77ea1c6f 89}
90
91//-----------------------------------------------------------------------------
92AliPHOSRawDecoderv1::~AliPHOSRawDecoderv1()
93{
94 //Destructor.
11f2ec15 95 if(fSampleParamsLow){
96 delete fSampleParamsLow ;
97 fSampleParamsLow=0 ;
98 }
99 if(fSampleParamsHigh){
100 delete fSampleParamsHigh ;
101 fSampleParamsHigh=0;
102 }
103 if(fToFit){
104 delete fToFit ;
105 fToFit=0 ;
106 }
77ea1c6f 107}
108
109//-----------------------------------------------------------------------------
110AliPHOSRawDecoderv1::AliPHOSRawDecoderv1(const AliPHOSRawDecoderv1 &phosDecoder ):
11f2ec15 111 AliPHOSRawDecoder(phosDecoder),
112 fSampleParamsLow(0x0),fSampleParamsHigh(0x0),fToFit(0x0)
77ea1c6f 113{
114 //Copy constructor.
11f2ec15 115 fToFit = new TList() ;
116 fSampleParamsLow =new TArrayD(*(phosDecoder.fSampleParamsLow)) ;
117 fSampleParamsHigh=new TArrayD(*(phosDecoder.fSampleParamsHigh)) ;
77ea1c6f 118}
119
120//-----------------------------------------------------------------------------
11f2ec15 121AliPHOSRawDecoderv1& AliPHOSRawDecoderv1::operator = (const AliPHOSRawDecoderv1 &phosDecoder)
77ea1c6f 122{
123 //Assignment operator.
124
11f2ec15 125 // if(this != &phosDecoder) {
77ea1c6f 126 // }
11f2ec15 127 fToFit = new TList() ;
128 if(fSampleParamsLow){
129 fSampleParamsLow = phosDecoder.fSampleParamsLow ;
130 fSampleParamsHigh= phosDecoder.fSampleParamsHigh ;
131 }
132 else{
133 fSampleParamsLow =new TArrayD(*(phosDecoder.fSampleParamsLow)) ;
134 fSampleParamsHigh=new TArrayD(*(phosDecoder.fSampleParamsHigh)) ;
135 }
77ea1c6f 136 return *this;
137}
138
139//-----------------------------------------------------------------------------
140Bool_t AliPHOSRawDecoderv1::NextDigit()
141{
142 //Extract an energy deposited in the crystal,
143 //crystal' position (module,column,row),
144 //time and gain (high or low).
145 //First collects sample, then evaluates it and if it has
146 //reasonable shape, fits it with Gamma2 function and extracts
147 //energy and time.
11f2ec15 148
70d93620 149//Debug=====================
39569d36 150// TCanvas * c = 0; //(TCanvas*)gROOT->FindObjectAny("CSample") ;
70d93620 151// if(!c)
152// c = new TCanvas("CSample","CSample") ;
153//
39569d36 154// TH1D * h = 0 ; //(TH1D*)gROOT->FindObjectAny("hSample") ;
70d93620 155// if(!h)
156// h=new TH1D("hSample","",200,0.,200.) ;
157//
39569d36 158// TF1 * fff = 0 ; //(TF1*)gROOT->FindObjectAny("fff") ;
70d93620 159// if(!fff)
160// fff = new TF1("fff","[0]+[1]*((abs(x-[2]))^[3]*exp(-(x-[2])*[4])+[5]*(x-[2])*(x-[2])*exp(-(x-[2])*[6]))",0.,1000.) ;
161//End debug===========
77ea1c6f 162
163 AliCaloRawStream* in = fCaloStream;
164
70d93620 165 Int_t iBin = fSamples->GetSize() ;
77ea1c6f 166 Int_t tLength = 0;
167 fEnergy = -111;
168 Float_t pedMean = 0;
169 Int_t nPed = 0;
170 Float_t baseLine = 1.0;
171 const Float_t nPreSamples = 10;
70d93620 172 fQuality= 999. ;
173 const Float_t sampleMaxHG=102.332 ; //maximal height of HG sample with given parameterization
174 const Float_t sampleMaxLG=277.196 ; //maximal height of HG sample with given parameterization
39569d36 175 const Float_t maxEtoFit=5 ; //fit only samples above this energy, accept all samples (with good aRMS) below it
77ea1c6f 176
177 while ( in->Next() ) {
178
179 if(!tLength) {
180 tLength = in->GetTimeLength();
181 if(tLength!=fSamples->GetSize()) {
182 delete fSamples ;
70d93620 183 delete fTimes ;
77ea1c6f 184 fSamples = new TArrayI(tLength);
70d93620 185 fTimes = new TArrayI(tLength);
186 iBin= fSamples->GetSize() ;
77ea1c6f 187 }
188 else{
70d93620 189 fSamples->Reset() ;
77ea1c6f 190 }
191 }
192
193 // Fit the full sample
70d93620 194 if(in->IsNewHWAddress() && iBin != fSamples->GetSize()) {
39569d36 195
196 //First remember new sample
197 fNewLowGainFlag = in->IsLowGain();
198 fNewModule = in->GetModule()+1;
199 fNewRow = in->GetRow() +1;
200 fNewColumn = in->GetColumn()+1;
201 fNewAmp = in->GetSignal() ;
202 fNewTime=in->GetTime() ;
203 //new handle already collected
77ea1c6f 204 Double_t pedestal =0. ;
205 if(fPedSubtract){
206 if (nPed > 0)
207 pedestal = (Double_t)(pedMean/nPed);
208 else
209 return kFALSE;
210 }
70d93620 211
212 //calculate time and energy
213 Int_t maxBin=0 ;
214 Int_t maxAmp=0 ;
215 Double_t aMean=0. ;
216 Double_t aRMS=0. ;
39569d36 217 Double_t wts=0 ;
70d93620 218 Int_t tStart = 0 ;
70d93620 219 for(Int_t i=iBin; i<fSamples->GetSize(); i++){
220 if(fSamples->At(i)>0){
221 Double_t de=fSamples->At(i)-pedestal ;
39569d36 222 if(de>1.){
223 aMean+=de*i ;
224 aRMS+=de*i*i ;
225 wts+=de;
226 }
70d93620 227 if(de>2 && tStart==0)
228 tStart=i ;
229 if(maxAmp<fSamples->At(i)){
230 maxBin=i ;
231 maxAmp=fSamples->At(i) ;
232 }
233 }
234 }
39569d36 235 if(maxBin==fSamples->GetSize()-1){//bad "rising" sample
70d93620 236 fEnergy=0. ;
237 fTime=-999.;
238 fQuality= 999. ;
239 return kTRUE ;
240 }
241 fEnergy=Double_t(maxAmp)-pedestal ;
242 fOverflow =0 ; //look for plato on the top of sample
243 if(fEnergy>500 && //this is not fluctuation of soft sample
244 maxBin<fSamples->GetSize()-1 && fSamples->At(maxBin+1)==maxAmp){ //and there is a plato
245 fOverflow = kTRUE ;
77ea1c6f 246 }
70d93620 247
39569d36 248 if(wts>0){
249 aMean/=wts;
250 aRMS=aRMS/wts-aMean*aMean;
77ea1c6f 251 }
39569d36 252
253 //do not take too small energies
254 if(fEnergy < baseLine)
255 fEnergy = 0;
256
257 //do not test quality of too soft samples
258 if(fEnergy<maxEtoFit){
259 fTime=fTimes->At(tStart);
260 if(aRMS<2.) //sigle peak
261 fQuality=999. ;
262 else
263 fQuality= 0. ;
264 return kTRUE ;
265 }
266
77ea1c6f 267
70d93620 268//Debug:=====Draw sample
269//if(fEnergy>pedestal+10.){
39569d36 270//if(fLowGainFlag && fEnergy>2){
271// if(!c)
113139da 272// if(!fLowGainFlag && fRow==32 && fColumn==18){
273// TCanvas *c = new TCanvas("CSample","CSample") ;
70d93620 274// c->cd() ;
275// h->Draw() ;
276// c->Update() ;
39569d36 277// printf("fEnergy=%f, aRMS=%f \n",fEnergy,aRMS) ;
278//getchar() ;
70d93620 279//}
280//======================
281
77ea1c6f 282 //IF sample has reasonable mean and RMS, try to fit it with gamma2
77ea1c6f 283
284 gMinuit->mncler(); // Reset Minuit's list of paramters
285 gMinuit->SetPrintLevel(-1) ; // No Printout
286 gMinuit->SetFCN(AliPHOSRawDecoderv1::UnfoldingChiSquare) ;
287 // To set the address of the minimization function
11f2ec15 288
289 fToFit->Clear() ;
113139da 290 Double_t b,bmin,bmax ;
11f2ec15 291 if(fLowGainFlag){
292 fSampleParamsLow->AddAt(pedestal,4) ;
70d93620 293 if(fOverflow)
294 fSampleParamsLow->AddAt(double(maxAmp),5) ;
295 else
296 fSampleParamsLow->AddAt(double(1023),5) ;
297 fSampleParamsLow->AddAt(double(iBin),6) ;
11f2ec15 298 fToFit->AddFirst((TObject*)fSampleParamsLow) ;
113139da 299 b=fSampleParamsLow->At(2) ;
300 bmin=0.5 ;
301 bmax=10. ;
302 }
303 else{
11f2ec15 304 fSampleParamsHigh->AddAt(pedestal,4) ;
70d93620 305 if(fOverflow)
306 fSampleParamsHigh->AddAt(double(maxAmp),5) ;
307 else
308 fSampleParamsHigh->AddAt(double(1023),5);
309 fSampleParamsHigh->AddAt(double(iBin),6);
11f2ec15 310 fToFit->AddFirst((TObject*)fSampleParamsHigh) ;
113139da 311 b=fSampleParamsHigh->At(2) ;
312 bmin=0.05 ;
313 bmax=0.4 ;
11f2ec15 314 }
315 fToFit->AddLast((TObject*)fSamples) ;
70d93620 316 fToFit->AddLast((TObject*)fTimes) ;
11f2ec15 317
318 gMinuit->SetObjectFit((TObject*)fToFit) ; // To tranfer pointer to UnfoldingChiSquare
77ea1c6f 319 Int_t ierflg ;
113139da 320 gMinuit->mnparm(0, "t0", 1.*tStart, 0.01, 0, 0, ierflg) ;
77ea1c6f 321 if(ierflg != 0){
11f2ec15 322// AliWarning(Form("Unable to set initial value for fit procedure : t0=%e\n",1.*tStart) ) ;
77ea1c6f 323 fEnergy=0. ;
324 fTime=-999. ;
70d93620 325 fQuality=999 ;
77ea1c6f 326 return kTRUE ; //will scan further
327 }
70d93620 328 Double_t amp0;
329 if(fLowGainFlag)
330 amp0=fEnergy/sampleMaxLG;
331 else
332 amp0=fEnergy/sampleMaxHG;
11f2ec15 333
113139da 334 gMinuit->mnparm(1, "Energy", amp0 , 0.01*amp0, 0, 0, ierflg) ;
77ea1c6f 335 if(ierflg != 0){
11f2ec15 336// AliWarning(Form("Unable to set initial value for fit procedure : E=%e\n", amp0)) ;
77ea1c6f 337 fEnergy=0. ;
338 fTime=-999. ;
70d93620 339 fQuality=999 ;
77ea1c6f 340 return kTRUE ; //will scan further
341 }
113139da 342
343 gMinuit->mnparm(2, "p2", b, 0.01*b, bmin, bmax, ierflg) ;
344 if(ierflg != 0){
345// AliWarning(Form("Unable to set initial value for fit procedure : E=%e\n", amp0)) ;
346 fEnergy=0. ;
347 fTime=-999. ;
348 fQuality=999 ;
349 return kTRUE ; //will scan further
350 }
351
77ea1c6f 352
11f2ec15 353 Double_t p0 = 0.0001 ; // "Tolerance" Evaluation stops when EDM = 0.0001*p0 ; The number of function call slightly
77ea1c6f 354 // depends on it.
355 Double_t p1 = 1.0 ;
356 Double_t p2 = 0.0 ;
357 gMinuit->mnexcm("SET STR", &p2, 0, ierflg) ; // force TMinuit to reduce function calls
358 gMinuit->mnexcm("SET GRA", &p1, 1, ierflg) ; // force TMinuit to use my gradient
359 // gMinuit->SetMaxIterations(100);
360 gMinuit->mnexcm("SET NOW", &p2 , 0, ierflg) ; // No Warnings
361
362 gMinuit->mnexcm("MIGRAD", &p0, 0, ierflg) ; // minimize
70d93620 363
77ea1c6f 364
11f2ec15 365 Double_t err,t0err ;
366 Double_t t0,efit ;
367 gMinuit->GetParameter(0,t0, t0err) ;
368 gMinuit->GetParameter(1,efit, err) ;
11f2ec15 369
113139da 370 Double_t bfit, berr ;
371 gMinuit->GetParameter(2,bfit,berr) ;
372
70d93620 373 //Calculate total energy
113139da 374 //this isparameterization of depetendence of pulse height on parameter b
70d93620 375 if(fLowGainFlag)
113139da 376 efit*=99.54910 + 78.65038*bfit ;
70d93620 377 else
113139da 378 efit*=80.33109+128.6433*bfit ;
70d93620 379
380 if(efit<0. || efit > 10000.){
b20d9db0 381//leave energy as previously found max
382// fEnergy=0 ; //bad sample
70d93620 383 fTime=-999.;
384 fQuality=999 ;
385 return kTRUE;
386 }
387
388 //evaluate fit quality
389 Double_t fmin,fedm,errdef ;
390 Int_t npari,nparx,istat;
391 gMinuit->mnstat(fmin,fedm,errdef,npari,nparx,istat) ;
392 fQuality=fmin/(fSamples->GetSize()-iBin) ;
393 //compare quality with some parameterization
113139da 394 if(fLowGainFlag){
395 fQuality/=2.+0.002*fEnergy ;
396 }
397 else{
398 fQuality/=0.75+0.0025*fEnergy ;
399 }
70d93620 400
401//Debug================
113139da 402// Double_t n,alpha,beta ;
70d93620 403// if(fLowGainFlag){
404// n=fSampleParamsLow->At(0) ;
405// alpha=fSampleParamsLow->At(1) ;
70d93620 406// beta=fSampleParamsLow->At(3) ;
407// }
408// else{
409// n=fSampleParamsHigh->At(0) ;
410// alpha=fSampleParamsHigh->At(1) ;
70d93620 411// beta=fSampleParamsHigh->At(3) ;
412// }
413//
113139da 414// if( fQuality > 1 && fEnergy > 20. && !fOverflow){
415// if(!fLowGainFlag && fRow==32 && fColumn==18){
416// printf("Col=%d, row=%d, qual=%f, E=%f, t0=%f, b=%f\n",fColumn,fRow,fQuality,efit,t0,bfit) ;
417// TCanvas * c = new TCanvas("samp") ;
11f2ec15 418// c->cd() ;
419// h->Draw() ;
420// if(fLowGainFlag){
113139da 421// fff->SetParameters(pedestal,efit/sampleMaxLG,t0,n,alpha,bfit,beta) ;
11f2ec15 422// }
423// else{
113139da 424// fff->SetParameters(pedestal,efit/sampleMaxHG,t0,n,alpha,bfit,beta) ;
11f2ec15 425// }
113139da 426//// for(Int_t i=1;i<=h->GetNbinsX(); i++){
427// Double_t x=h->GetBinCenter(i) ;
428// h->SetBinContent(i,h->GetBinContent(i)-fff->Eval(x)) ;
429// }
430// h->SetMinimum(-15.) ;
431// h->SetMaximum(15.) ;
432// h->Draw() ;
11f2ec15 433// fff->Draw("same") ;
434// c->Update();
70d93620 435// getchar() ;
436// }
437//====================
11f2ec15 438
39569d36 439 fEnergy=efit ;
440 fTime=t0 ;
11f2ec15 441
77ea1c6f 442
443 return kTRUE;
444 }
445
446 fLowGainFlag = in->IsLowGain();
77ea1c6f 447 fModule = in->GetModule()+1;
448 fRow = in->GetRow() +1;
449 fColumn = in->GetColumn()+1;
39569d36 450
451 //add previouly taken if coincides
452 if(fLowGainFlag==fNewLowGainFlag && fModule==fNewModule &&
453 fRow==fNewRow && fColumn==fNewColumn){
454 iBin--;
455 if(fPedSubtract && fNewTime < nPreSamples) {
456 pedMean += in->GetSignal();
457 nPed++;
458 }
459 fSamples->AddAt(fNewAmp,iBin);
460 fTimes->AddAt(fNewTime,iBin);
461
462 //Mark that we already take it
463 fNewModule=-1 ;
464 }
77ea1c6f 465
77ea1c6f 466 // Fill array with samples
70d93620 467 iBin--;
468 if(fPedSubtract && (in->GetTime() < nPreSamples)) {
77ea1c6f 469 pedMean += in->GetSignal();
470 nPed++;
471 }
70d93620 472 fSamples->AddAt(in->GetSignal(),iBin);
473 fTimes->AddAt(in->GetTime(),iBin);
474
475//Debug==============
476// h->SetBinContent(iBin,in->GetSignal()) ;
77ea1c6f 477
478 } // in.Next()
479
480 return kFALSE;
481}
482//_____________________________________________________________________________
483void AliPHOSRawDecoderv1::UnfoldingChiSquare(Int_t & /*nPar*/, Double_t * Grad, Double_t & fret, Double_t * x, Int_t iflag)
484{
77ea1c6f 485 // Number of parameters, Gradient, Chi squared, parameters, what to do
486
11f2ec15 487 TList * toFit= (TList*)gMinuit->GetObjectFit() ;
488 TArrayD * params=(TArrayD*)toFit->At(0) ;
489 TArrayI * samples = (TArrayI*)toFit->At(1) ;
70d93620 490 TArrayI * times = (TArrayI*)toFit->At(2) ;
77ea1c6f 491
492 fret = 0. ;
493 if(iflag == 2)
113139da 494 for(Int_t iparam = 0 ; iparam < 3 ; iparam++)
77ea1c6f 495 Grad[iparam] = 0 ; // Will evaluate gradient
496
11f2ec15 497 Double_t t0=x[0] ;
498 Double_t en=x[1] ;
113139da 499 Double_t b=x[2] ;
70d93620 500 Double_t n=params->At(0) ;
11f2ec15 501 Double_t alpha=params->At(1) ;
11f2ec15 502 Double_t beta=params->At(3) ;
113139da 503 Double_t ped=params->At(4) ;
504
505 Double_t overflow=params->At(5) ;
70d93620 506 Int_t iBin = (Int_t) params->At(6) ;
507 Int_t nSamples=TMath::Min(iBin+70,samples->GetSize()) ; //Here we set number of points to fit (70)
77ea1c6f 508
113139da 509 Int_t tStep=times->At(iBin+1)-times->At(iBin) ;
510 Double_t ddt=TMath::Ceil(t0)-t0-tStep ;
511 Double_t exp1=TMath::Exp(-alpha*ddt) ;
512 Double_t exp2=TMath::Exp(-beta*ddt) ;
513 Double_t dexp1=TMath::Exp(-alpha*tStep) ;
514 Double_t dexp2=TMath::Exp(-beta*tStep) ;
515 for(Int_t i = iBin; i<nSamples ; i++) {
516 Double_t fsample = double(samples->At(i)) ;
517// if(fsample>=overflow)
518// continue ;
519 Double_t dt=double(times->At(i))-t0 ;
520 Double_t diff ;
521 if(dt<=0.){
522 diff=fsample - ped ;
523 fret += diff*diff ;
77ea1c6f 524 continue ;
113139da 525 }
526 exp1*=dexp1 ;
527 exp2*=dexp2 ;
528 Double_t dtn=TMath::Power(dt,n) ;
529 Double_t dtnE=dtn*exp1 ;
530 Double_t dt2E=dt*dt*exp2 ;
531 Double_t fit=ped+en*(dtnE + b*dt2E) ;
532 if(fit>=overflow){
533 diff=fsample-overflow ;
534 fret += diff*diff ;
535 //zero gradient here
536 }
537 else{
538 diff = fsample - fit ;
539 fret += diff*diff ;
540 if(iflag == 2){ // calculate gradient
541 Grad[0] += en*diff*(dtnE*(n/dt-alpha)+b*dt2E*(2./dt-beta)) ; //derivative over t0
542 Grad[1] -= diff*(dtnE+b*dt2E) ;
543 Grad[2] -= en*diff*dt2E ;
77ea1c6f 544 }
545 }
77ea1c6f 546 }
113139da 547 if(iflag == 2)
548 for(Int_t iparam = 0 ; iparam < 3 ; iparam++)
549 Grad[iparam] *= 2. ;
77ea1c6f 550}
551//-----------------------------------------------------------------------------
113139da 552Double_t AliPHOSRawDecoderv1::Gamma2(Double_t dt,Double_t en,Double_t b,TArrayD * params){ //Function for fitting samples
77ea1c6f 553 //parameters:
11f2ec15 554 //dt-time after start
77ea1c6f 555 //en-amplutude
11f2ec15 556 //function parameters
557
558 Double_t ped=params->At(4) ;
77ea1c6f 559 if(dt<0.)
11f2ec15 560 return ped ; //pedestal
77ea1c6f 561 else
113139da 562 return ped+en*(TMath::Power(dt,params->At(0))*TMath::Exp(-dt*params->At(1))+b*dt*dt*TMath::Exp(-dt*params->At(3))) ;
77ea1c6f 563}
564