1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 ///////////////////////////////////////////////////////////////////////////////
19 // TPC cluster error, shape and charge parameterization as function
20 // of drift length, and inclination angle //
22 // Following notation is used in following
23 // Int_t dim 0 - y direction
26 // Int_t type 0 - short pads
29 // Float_t z - drift length
31 // Float_t angle - tangent of inclination angle at given dimension
33 // Implemented parameterization
36 // 1. Resolution as function of drift length and inclination angle
37 // 1.a) GetError0(Int_t dim, Int_t type, Float_t z, Float_t angle)
38 // Simple error parameterization as derived from analytical formula
39 // only linear term in drift length and angle^2
40 // The formula is valid only with precission +-5%
41 // Separate parameterization for differnt pad geometry
43 // Parabolic term correction - better precision
45 // 1.c) GetError1 - JUST FOR Study
46 // Similar to GetError1
47 // The angular and diffusion effect is scaling with pad length
48 // common parameterization for different pad length
50 // 2. Error parameterization using charge
53 // adding 1/Q component to diffusion and angluar part
56 // adding 1/Q component to diffusion and angluar part
57 // 2.c) GetErrorQParScaled - Just for study
58 // One parameterization for all pad shapes
59 // Smaller precission as previous one
62 // Example how to retrieve the paramterization:
64 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
65 AliCDBManager::Instance()->SetRun(0)
66 AliTPCClusterParam * param = AliTPCcalibDB::Instance()->GetClusterParam();
70 AliTPCClusterParam::SetInstance(param);
71 TF1 f1("f1","AliTPCClusterParam::SGetError0Par(1,0,x,0)",0,250);
74 // EXAMPLE hot to create parameterization
76 // Note resol is the resolution tree created by AliTPCcalibTracks
78 AliTPCClusterParam *param = new AliTPCClusterParam;
79 param->FitData(Resol);
80 AliTPCClusterParam::SetInstance(param);
86 ///////////////////////////////////////////////////////////////////////////////
87 #include "AliTPCClusterParam.h"
92 #include <TLinearFitter.h>
95 #include <TProfile2D.h>
97 #include <TObjArray.h>
98 #include "AliTPCcalibDB.h"
99 #include "AliTPCParam.h"
101 #include "AliMathBase.h"
103 ClassImp(AliTPCClusterParam)
106 AliTPCClusterParam* AliTPCClusterParam::fgInstance = 0;
110 Example usage fitting parameterization:
111 TFile fres("resol.root"); //tree with resolution and shape
112 TTree * treeRes =(TTree*)fres.Get("Resol");
114 AliTPCClusterParam param;
115 param.SetInstance(¶m);
116 param.FitResol(treeRes);
117 param.FitRMS(treeRes);
118 TFile fparam("TPCClusterParam.root","recreate");
119 param.Write("Param");
122 TFile fparam("TPCClusterParam.root");
123 AliTPCClusterParam *param2 = (AliTPCClusterParam *) fparam.Get("Param");
124 param2->SetInstance(param2);
125 param2->Test(treeRes);
128 treeRes->Draw("(Resol-AliTPCClusterParam::SGetError0(Dim,Pad,Zm,AngleM))/Resol","Dim==0&&QMean<0")
135 //_ singleton implementation __________________________________________________
136 AliTPCClusterParam* AliTPCClusterParam::Instance()
139 // Singleton implementation
140 // Returns an instance of this class, it is created if neccessary
142 if (fgInstance == 0){
143 fgInstance = new AliTPCClusterParam();
149 AliTPCClusterParam::AliTPCClusterParam():
155 fQpadTnorm(0), // q pad normalization - Total charge
156 fQpadMnorm(0) // q pad normalization - Max charge
160 // Default constructor
162 fPosQTnorm[0] = 0; fPosQTnorm[1] = 0; fPosQTnorm[2] = 0;
163 fPosQMnorm[0] = 0; fPosQMnorm[1] = 0; fPosQMnorm[2] = 0;
165 fPosYcor[0] = 0; fPosYcor[1] = 0; fPosYcor[2] = 0;
166 fPosZcor[0] = 0; fPosZcor[1] = 0; fPosZcor[2] = 0;
169 AliTPCClusterParam::AliTPCClusterParam(const AliTPCClusterParam& param):
175 fQpadTnorm(new TVectorD(*(param.fQpadTnorm))), // q pad normalization - Total charge
176 fQpadMnorm(new TVectorD(*(param.fQpadMnorm))) // q pad normalization - Max charge
182 memcpy(this, ¶m,sizeof(AliTPCClusterParam));
183 if (param.fQNorm) fQNorm = (TObjArray*) param.fQNorm->Clone();
184 if (param.fQNormHis) fQNormHis = (TObjArray*) param.fQNormHis->Clone();
186 if (param.fPosQTnorm[0]){
187 fPosQTnorm[0] = new TVectorD(*(param.fPosQTnorm[0]));
188 fPosQTnorm[1] = new TVectorD(*(param.fPosQTnorm[1]));
189 fPosQTnorm[2] = new TVectorD(*(param.fPosQTnorm[2]));
191 fPosQMnorm[0] = new TVectorD(*(param.fPosQMnorm[0]));
192 fPosQMnorm[1] = new TVectorD(*(param.fPosQMnorm[1]));
193 fPosQMnorm[2] = new TVectorD(*(param.fPosQMnorm[2]));
195 if (param.fPosYcor[0]){
196 fPosYcor[0] = new TVectorD(*(param.fPosYcor[0]));
197 fPosYcor[1] = new TVectorD(*(param.fPosYcor[1]));
198 fPosYcor[2] = new TVectorD(*(param.fPosYcor[2]));
200 fPosZcor[0] = new TVectorD(*(param.fPosZcor[0]));
201 fPosZcor[1] = new TVectorD(*(param.fPosZcor[1]));
202 fPosZcor[2] = new TVectorD(*(param.fPosZcor[2]));
208 AliTPCClusterParam & AliTPCClusterParam::operator=(const AliTPCClusterParam& param){
210 // Assignment operator
212 if (this != ¶m) {
213 memcpy(this, ¶m,sizeof(AliTPCClusterParam));
214 if (param.fQNorm) fQNorm = (TObjArray*) param.fQNorm->Clone();
215 if (param.fQNormHis) fQNormHis = (TObjArray*) param.fQNormHis->Clone();
216 if (param.fPosQTnorm[0]){
217 fPosQTnorm[0] = new TVectorD(*(param.fPosQTnorm[0]));
218 fPosQTnorm[1] = new TVectorD(*(param.fPosQTnorm[1]));
219 fPosQTnorm[2] = new TVectorD(*(param.fPosQTnorm[2]));
221 fPosQMnorm[0] = new TVectorD(*(param.fPosQMnorm[0]));
222 fPosQMnorm[1] = new TVectorD(*(param.fPosQMnorm[1]));
223 fPosQMnorm[2] = new TVectorD(*(param.fPosQMnorm[2]));
225 if (param.fPosYcor[0]){
226 fPosYcor[0] = new TVectorD(*(param.fPosYcor[0]));
227 fPosYcor[1] = new TVectorD(*(param.fPosYcor[1]));
228 fPosYcor[2] = new TVectorD(*(param.fPosYcor[2]));
230 fPosZcor[0] = new TVectorD(*(param.fPosZcor[0]));
231 fPosZcor[1] = new TVectorD(*(param.fPosZcor[1]));
232 fPosZcor[2] = new TVectorD(*(param.fPosZcor[2]));
239 AliTPCClusterParam::~AliTPCClusterParam(){
243 if (fQNorm) fQNorm->Delete();
244 if (fQNormCorr) delete fQNormCorr;
245 if (fQNormHis) fQNormHis->Delete();
249 delete fPosQTnorm[0];
250 delete fPosQTnorm[1];
251 delete fPosQTnorm[2];
253 delete fPosQMnorm[0];
254 delete fPosQMnorm[1];
255 delete fPosQMnorm[2];
269 void AliTPCClusterParam::FitResol0(TTree * tree, Int_t dim, Int_t type, Float_t *param0, Float_t *error){
271 // Fit z - angular dependence of resolution
273 // Int_t dim=0, type=0;
275 sprintf(varVal,"Resol:AngleM:Zm");
277 sprintf(varErr,"Sigma:AngleS:Zs");
279 sprintf(varCut,"Dim==%d&&Pad==%d&&QMean<0",dim,type);
281 Int_t entries = tree->Draw(varVal,varCut);
282 Float_t px[10000], py[10000], pz[10000];
283 Float_t ex[10000], ey[10000], ez[10000];
285 tree->Draw(varErr,varCut);
286 for (Int_t ipoint=0; ipoint<entries; ipoint++){
287 ex[ipoint]= tree->GetV3()[ipoint];
288 ey[ipoint]= tree->GetV2()[ipoint];
289 ez[ipoint]= tree->GetV1()[ipoint];
291 tree->Draw(varVal,varCut);
292 for (Int_t ipoint=0; ipoint<entries; ipoint++){
293 px[ipoint]= tree->GetV3()[ipoint];
294 py[ipoint]= tree->GetV2()[ipoint];
295 pz[ipoint]= tree->GetV1()[ipoint];
299 TLinearFitter fitter(3,"hyp2");
300 for (Int_t ipoint=0; ipoint<entries; ipoint++){
301 Float_t val = pz[ipoint]*pz[ipoint];
302 Float_t err = 2*pz[ipoint]*TMath::Sqrt(ez[ipoint]*ez[ipoint]+fRatio*fRatio*pz[ipoint]*pz[ipoint]);
305 x[1] = py[ipoint]*py[ipoint];
306 fitter.AddPoint(x,val,err);
310 fitter.GetParameters(param);
311 param0[0] = param[0];
312 param0[1] = param[1];
313 param0[2] = param[2];
314 Float_t chi2 = fitter.GetChisquare()/entries;
316 error[0] = (fitter.GetParError(0)*TMath::Sqrt(chi2));
317 error[1] = (fitter.GetParError(1)*TMath::Sqrt(chi2));
318 error[2] = (fitter.GetParError(2)*TMath::Sqrt(chi2));
322 void AliTPCClusterParam::FitResol0Par(TTree * tree, Int_t dim, Int_t type, Float_t *param0, Float_t *error){
324 // Fit z - angular dependence of resolution
326 // Int_t dim=0, type=0;
328 sprintf(varVal,"Resol:AngleM:Zm");
330 sprintf(varErr,"Sigma:AngleS:Zs");
332 sprintf(varCut,"Dim==%d&&Pad==%d&&QMean<0",dim,type);
334 Int_t entries = tree->Draw(varVal,varCut);
335 Float_t px[10000], py[10000], pz[10000];
336 Float_t ex[10000], ey[10000], ez[10000];
338 tree->Draw(varErr,varCut);
339 for (Int_t ipoint=0; ipoint<entries; ipoint++){
340 ex[ipoint]= tree->GetV3()[ipoint];
341 ey[ipoint]= tree->GetV2()[ipoint];
342 ez[ipoint]= tree->GetV1()[ipoint];
344 tree->Draw(varVal,varCut);
345 for (Int_t ipoint=0; ipoint<entries; ipoint++){
346 px[ipoint]= tree->GetV3()[ipoint];
347 py[ipoint]= tree->GetV2()[ipoint];
348 pz[ipoint]= tree->GetV1()[ipoint];
352 TLinearFitter fitter(6,"hyp5");
353 for (Int_t ipoint=0; ipoint<entries; ipoint++){
354 Float_t val = pz[ipoint]*pz[ipoint];
355 Float_t err = 2*pz[ipoint]*TMath::Sqrt(ez[ipoint]*ez[ipoint]+fRatio*fRatio*pz[ipoint]*pz[ipoint]);
358 x[1] = py[ipoint]*py[ipoint];
362 fitter.AddPoint(x,val,err);
366 fitter.GetParameters(param);
367 param0[0] = param[0];
368 param0[1] = param[1];
369 param0[2] = param[2];
370 param0[3] = param[3];
371 param0[4] = param[4];
372 param0[5] = param[5];
373 Float_t chi2 = fitter.GetChisquare()/entries;
375 error[0] = (fitter.GetParError(0)*TMath::Sqrt(chi2));
376 error[1] = (fitter.GetParError(1)*TMath::Sqrt(chi2));
377 error[2] = (fitter.GetParError(2)*TMath::Sqrt(chi2));
378 error[3] = (fitter.GetParError(3)*TMath::Sqrt(chi2));
379 error[4] = (fitter.GetParError(4)*TMath::Sqrt(chi2));
380 error[5] = (fitter.GetParError(5)*TMath::Sqrt(chi2));
387 void AliTPCClusterParam::FitResol1(TTree * tree, Int_t dim, Float_t *param0, Float_t *error){
389 // Fit z - angular dependence of resolution - pad length scaling
391 // Int_t dim=0, type=0;
393 sprintf(varVal,"Resol:AngleM*sqrt(Length):Zm/Length");
395 sprintf(varErr,"Sigma:AngleS:Zs");
397 sprintf(varCut,"Dim==%d&&QMean<0",dim);
399 Int_t entries = tree->Draw(varVal,varCut);
400 Float_t px[10000], py[10000], pz[10000];
401 Float_t ex[10000], ey[10000], ez[10000];
403 tree->Draw(varErr,varCut);
404 for (Int_t ipoint=0; ipoint<entries; ipoint++){
405 ex[ipoint]= tree->GetV3()[ipoint];
406 ey[ipoint]= tree->GetV2()[ipoint];
407 ez[ipoint]= tree->GetV1()[ipoint];
409 tree->Draw(varVal,varCut);
410 for (Int_t ipoint=0; ipoint<entries; ipoint++){
411 px[ipoint]= tree->GetV3()[ipoint];
412 py[ipoint]= tree->GetV2()[ipoint];
413 pz[ipoint]= tree->GetV1()[ipoint];
417 TLinearFitter fitter(3,"hyp2");
418 for (Int_t ipoint=0; ipoint<entries; ipoint++){
419 Float_t val = pz[ipoint]*pz[ipoint];
420 Float_t err = 2*pz[ipoint]*TMath::Sqrt(ez[ipoint]*ez[ipoint]+fRatio*fRatio*pz[ipoint]*pz[ipoint]);
423 x[1] = py[ipoint]*py[ipoint];
424 fitter.AddPoint(x,val,err);
428 fitter.GetParameters(param);
429 param0[0] = param[0];
430 param0[1] = param[1];
431 param0[2] = param[2];
432 Float_t chi2 = fitter.GetChisquare()/entries;
434 error[0] = (fitter.GetParError(0)*TMath::Sqrt(chi2));
435 error[1] = (fitter.GetParError(1)*TMath::Sqrt(chi2));
436 error[2] = (fitter.GetParError(2)*TMath::Sqrt(chi2));
439 void AliTPCClusterParam::FitResolQ(TTree * tree, Int_t dim, Int_t type, Float_t *param0, Float_t *error){
441 // Fit z - angular dependence of resolution - Q scaling
443 // Int_t dim=0, type=0;
445 sprintf(varVal,"Resol:AngleM/sqrt(QMean):Zm/QMean");
447 sprintf(varVal0,"Resol:AngleM:Zm");
450 sprintf(varErr,"Sigma:AngleS:Zs");
452 sprintf(varCut,"Dim==%d&&Pad==%d&&QMean>0",dim,type);
454 Int_t entries = tree->Draw(varVal,varCut);
455 Float_t px[20000], py[20000], pz[20000], pu[20000], pt[20000];
456 Float_t ex[20000], ey[20000], ez[20000];
458 tree->Draw(varErr,varCut);
459 for (Int_t ipoint=0; ipoint<entries; ipoint++){
460 ex[ipoint]= tree->GetV3()[ipoint];
461 ey[ipoint]= tree->GetV2()[ipoint];
462 ez[ipoint]= tree->GetV1()[ipoint];
464 tree->Draw(varVal,varCut);
465 for (Int_t ipoint=0; ipoint<entries; ipoint++){
466 px[ipoint]= tree->GetV3()[ipoint];
467 py[ipoint]= tree->GetV2()[ipoint];
468 pz[ipoint]= tree->GetV1()[ipoint];
470 tree->Draw(varVal0,varCut);
471 for (Int_t ipoint=0; ipoint<entries; ipoint++){
472 pu[ipoint]= tree->GetV3()[ipoint];
473 pt[ipoint]= tree->GetV2()[ipoint];
477 TLinearFitter fitter(5,"hyp4");
478 for (Int_t ipoint=0; ipoint<entries; ipoint++){
479 Float_t val = pz[ipoint]*pz[ipoint];
480 Float_t err = 2*pz[ipoint]*TMath::Sqrt(ez[ipoint]*ez[ipoint]+fRatio*fRatio*pz[ipoint]*pz[ipoint]);
483 x[1] = pt[ipoint]*pt[ipoint];
485 x[3] = py[ipoint]*py[ipoint];
486 fitter.AddPoint(x,val,err);
491 fitter.GetParameters(param);
492 param0[0] = param[0];
493 param0[1] = param[1];
494 param0[2] = param[2];
495 param0[3] = param[3];
496 param0[4] = param[4];
497 Float_t chi2 = fitter.GetChisquare()/entries;
499 error[0] = (fitter.GetParError(0)*TMath::Sqrt(chi2));
500 error[1] = (fitter.GetParError(1)*TMath::Sqrt(chi2));
501 error[2] = (fitter.GetParError(2)*TMath::Sqrt(chi2));
502 error[3] = (fitter.GetParError(3)*TMath::Sqrt(chi2));
503 error[4] = (fitter.GetParError(4)*TMath::Sqrt(chi2));
506 void AliTPCClusterParam::FitResolQPar(TTree * tree, Int_t dim, Int_t type, Float_t *param0, Float_t *error){
508 // Fit z - angular dependence of resolution - Q scaling - parabolic correction
510 // Int_t dim=0, type=0;
512 sprintf(varVal,"Resol:AngleM/sqrt(QMean):Zm/QMean");
514 sprintf(varVal0,"Resol:AngleM:Zm");
517 sprintf(varErr,"Sigma:AngleS:Zs");
519 sprintf(varCut,"Dim==%d&&Pad==%d&&QMean>0",dim,type);
521 Int_t entries = tree->Draw(varVal,varCut);
522 Float_t px[20000], py[20000], pz[20000], pu[20000], pt[20000];
523 Float_t ex[20000], ey[20000], ez[20000];
525 tree->Draw(varErr,varCut);
526 for (Int_t ipoint=0; ipoint<entries; ipoint++){
527 ex[ipoint]= tree->GetV3()[ipoint];
528 ey[ipoint]= tree->GetV2()[ipoint];
529 ez[ipoint]= tree->GetV1()[ipoint];
531 tree->Draw(varVal,varCut);
532 for (Int_t ipoint=0; ipoint<entries; ipoint++){
533 px[ipoint]= tree->GetV3()[ipoint];
534 py[ipoint]= tree->GetV2()[ipoint];
535 pz[ipoint]= tree->GetV1()[ipoint];
537 tree->Draw(varVal0,varCut);
538 for (Int_t ipoint=0; ipoint<entries; ipoint++){
539 pu[ipoint]= tree->GetV3()[ipoint];
540 pt[ipoint]= tree->GetV2()[ipoint];
544 TLinearFitter fitter(8,"hyp7");
545 for (Int_t ipoint=0; ipoint<entries; ipoint++){
546 Float_t val = pz[ipoint]*pz[ipoint];
547 Float_t err = 2*pz[ipoint]*TMath::Sqrt(ez[ipoint]*ez[ipoint]+fRatio*fRatio*pz[ipoint]*pz[ipoint]);
550 x[1] = pt[ipoint]*pt[ipoint];
555 x[6] = py[ipoint]*py[ipoint];
557 fitter.AddPoint(x,val,err);
562 fitter.GetParameters(param);
563 param0[0] = param[0];
564 param0[1] = param[1];
565 param0[2] = param[2];
566 param0[3] = param[3];
567 param0[4] = param[4];
568 param0[5] = param[5];
569 param0[6] = param[6];
570 param0[7] = param[7];
572 Float_t chi2 = fitter.GetChisquare()/entries;
574 error[0] = (fitter.GetParError(0)*TMath::Sqrt(chi2));
575 error[1] = (fitter.GetParError(1)*TMath::Sqrt(chi2));
576 error[2] = (fitter.GetParError(2)*TMath::Sqrt(chi2));
577 error[3] = (fitter.GetParError(3)*TMath::Sqrt(chi2));
578 error[4] = (fitter.GetParError(4)*TMath::Sqrt(chi2));
579 error[5] = (fitter.GetParError(5)*TMath::Sqrt(chi2));
580 error[6] = (fitter.GetParError(6)*TMath::Sqrt(chi2));
581 error[7] = (fitter.GetParError(7)*TMath::Sqrt(chi2));
586 void AliTPCClusterParam::FitRMS0(TTree * tree, Int_t dim, Int_t type, Float_t *param0, Float_t *error){
588 // Fit z - angular dependence of resolution
590 // Int_t dim=0, type=0;
592 sprintf(varVal,"RMSm:AngleM:Zm");
594 sprintf(varErr,"sqrt((1./(100.*sqrt(12.))^2)+RMSe0^2):AngleS:Zs");
596 sprintf(varCut,"Dim==%d&&Pad==%d&&QMean<0",dim,type);
598 Int_t entries = tree->Draw(varVal,varCut);
599 Float_t px[10000], py[10000], pz[10000];
600 Float_t ex[10000], ey[10000], ez[10000];
602 tree->Draw(varErr,varCut);
603 for (Int_t ipoint=0; ipoint<entries; ipoint++){
604 ex[ipoint]= tree->GetV3()[ipoint];
605 ey[ipoint]= tree->GetV2()[ipoint];
606 ez[ipoint]= tree->GetV1()[ipoint];
608 tree->Draw(varVal,varCut);
609 for (Int_t ipoint=0; ipoint<entries; ipoint++){
610 px[ipoint]= tree->GetV3()[ipoint];
611 py[ipoint]= tree->GetV2()[ipoint];
612 pz[ipoint]= tree->GetV1()[ipoint];
616 TLinearFitter fitter(3,"hyp2");
617 for (Int_t ipoint=0; ipoint<entries; ipoint++){
618 Float_t val = pz[ipoint]*pz[ipoint];
619 Float_t err = 2*pz[ipoint]*TMath::Sqrt(ez[ipoint]*ez[ipoint]+fRatio*fRatio*pz[ipoint]*pz[ipoint]);
622 x[1] = py[ipoint]*py[ipoint];
623 fitter.AddPoint(x,val,err);
627 fitter.GetParameters(param);
628 param0[0] = param[0];
629 param0[1] = param[1];
630 param0[2] = param[2];
631 Float_t chi2 = fitter.GetChisquare()/entries;
633 error[0] = (fitter.GetParError(0)*TMath::Sqrt(chi2));
634 error[1] = (fitter.GetParError(1)*TMath::Sqrt(chi2));
635 error[2] = (fitter.GetParError(2)*TMath::Sqrt(chi2));
638 void AliTPCClusterParam::FitRMS1(TTree * tree, Int_t dim, Float_t *param0, Float_t *error){
640 // Fit z - angular dependence of resolution - pad length scaling
642 // Int_t dim=0, type=0;
644 sprintf(varVal,"RMSm:AngleM*Length:Zm");
646 sprintf(varErr,"sqrt((1./(100.*sqrt(12.))^2)+RMSe0^2):AngleS:Pad");
648 sprintf(varCut,"Dim==%d&&QMean<0",dim);
650 Int_t entries = tree->Draw(varVal,varCut);
651 Float_t px[10000], py[10000], pz[10000];
652 Float_t type[10000], ey[10000], ez[10000];
654 tree->Draw(varErr,varCut);
655 for (Int_t ipoint=0; ipoint<entries; ipoint++){
656 type[ipoint] = tree->GetV3()[ipoint];
657 ey[ipoint] = tree->GetV2()[ipoint];
658 ez[ipoint] = tree->GetV1()[ipoint];
660 tree->Draw(varVal,varCut);
661 for (Int_t ipoint=0; ipoint<entries; ipoint++){
662 px[ipoint]= tree->GetV3()[ipoint];
663 py[ipoint]= tree->GetV2()[ipoint];
664 pz[ipoint]= tree->GetV1()[ipoint];
668 TLinearFitter fitter(4,"hyp3");
669 for (Int_t ipoint=0; ipoint<entries; ipoint++){
670 Float_t val = pz[ipoint]*pz[ipoint];
671 Float_t err = 2*pz[ipoint]*TMath::Sqrt(ez[ipoint]*ez[ipoint]+fRatio*fRatio*pz[ipoint]*pz[ipoint]);
673 x[0] = (type[ipoint]<0.5)? 0.:1.;
675 x[2] = py[ipoint]*py[ipoint];
676 fitter.AddPoint(x,val,err);
680 fitter.GetParameters(param);
681 param0[0] = param[0];
682 param0[1] = param[0]+param[1];
683 param0[2] = param[2];
684 param0[3] = param[3];
685 Float_t chi2 = fitter.GetChisquare()/entries;
687 error[0] = (fitter.GetParError(0)*TMath::Sqrt(chi2));
688 error[1] = (fitter.GetParError(1)*TMath::Sqrt(chi2));
689 error[2] = (fitter.GetParError(2)*TMath::Sqrt(chi2));
690 error[3] = (fitter.GetParError(3)*TMath::Sqrt(chi2));
693 void AliTPCClusterParam::FitRMSQ(TTree * tree, Int_t dim, Int_t type, Float_t *param0, Float_t *error){
695 // Fit z - angular dependence of resolution - Q scaling
697 // Int_t dim=0, type=0;
699 sprintf(varVal,"RMSm:AngleM/sqrt(QMean):Zm/QMean");
701 sprintf(varVal0,"RMSm:AngleM:Zm");
704 sprintf(varErr,"sqrt((1./(100.*sqrt(12.))^2)+RMSe0^2):AngleS:Zs");
706 sprintf(varCut,"Dim==%d&&Pad==%d&&QMean>0",dim,type);
708 Int_t entries = tree->Draw(varVal,varCut);
709 Float_t px[20000], py[20000], pz[20000], pu[20000], pt[20000];
710 Float_t ex[20000], ey[20000], ez[20000];
712 tree->Draw(varErr,varCut);
713 for (Int_t ipoint=0; ipoint<entries; ipoint++){
714 ex[ipoint]= tree->GetV3()[ipoint];
715 ey[ipoint]= tree->GetV2()[ipoint];
716 ez[ipoint]= tree->GetV1()[ipoint];
718 tree->Draw(varVal,varCut);
719 for (Int_t ipoint=0; ipoint<entries; ipoint++){
720 px[ipoint]= tree->GetV3()[ipoint];
721 py[ipoint]= tree->GetV2()[ipoint];
722 pz[ipoint]= tree->GetV1()[ipoint];
724 tree->Draw(varVal0,varCut);
725 for (Int_t ipoint=0; ipoint<entries; ipoint++){
726 pu[ipoint]= tree->GetV3()[ipoint];
727 pt[ipoint]= tree->GetV2()[ipoint];
731 TLinearFitter fitter(5,"hyp4");
732 for (Int_t ipoint=0; ipoint<entries; ipoint++){
733 Float_t val = pz[ipoint]*pz[ipoint];
734 Float_t err = 2*pz[ipoint]*TMath::Sqrt(ez[ipoint]*ez[ipoint]+fRatio*fRatio*pz[ipoint]*pz[ipoint]);
737 x[1] = pt[ipoint]*pt[ipoint];
739 x[3] = py[ipoint]*py[ipoint];
740 fitter.AddPoint(x,val,err);
745 fitter.GetParameters(param);
746 param0[0] = param[0];
747 param0[1] = param[1];
748 param0[2] = param[2];
749 param0[3] = param[3];
750 param0[4] = param[4];
751 Float_t chi2 = fitter.GetChisquare()/entries;
753 error[0] = (fitter.GetParError(0)*TMath::Sqrt(chi2));
754 error[1] = (fitter.GetParError(1)*TMath::Sqrt(chi2));
755 error[2] = (fitter.GetParError(2)*TMath::Sqrt(chi2));
756 error[3] = (fitter.GetParError(3)*TMath::Sqrt(chi2));
757 error[4] = (fitter.GetParError(4)*TMath::Sqrt(chi2));
761 void AliTPCClusterParam::FitRMSSigma(TTree * tree, Int_t dim, Int_t type, Float_t *param0, Float_t */*error*/){
763 // Fit z - angular dependence of resolution - Q scaling
765 // Int_t dim=0, type=0;
767 sprintf(varVal,"RMSs:RMSm");
770 sprintf(varCut,"Dim==%d&&Pad==%d&&QMean<0",dim,type);
772 Int_t entries = tree->Draw(varVal,varCut);
773 Float_t px[20000], py[20000];
775 tree->Draw(varVal,varCut);
776 for (Int_t ipoint=0; ipoint<entries; ipoint++){
777 px[ipoint]= tree->GetV2()[ipoint];
778 py[ipoint]= tree->GetV1()[ipoint];
780 TLinearFitter fitter(2,"pol1");
781 for (Int_t ipoint=0; ipoint<entries; ipoint++){
782 Float_t val = py[ipoint];
783 Float_t err = fRatio*px[ipoint];
786 if (err>0) fitter.AddPoint(x,val,err);
789 param0[0]= fitter.GetParameter(0);
790 param0[1]= fitter.GetParameter(1);
795 Float_t AliTPCClusterParam::GetError0(Int_t dim, Int_t type, Float_t z, Float_t angle) const {
800 value += fParamS0[dim][type][0];
801 value += fParamS0[dim][type][1]*z;
802 value += fParamS0[dim][type][2]*angle*angle;
803 value = TMath::Sqrt(TMath::Abs(value));
808 Float_t AliTPCClusterParam::GetError0Par(Int_t dim, Int_t type, Float_t z, Float_t angle) const {
813 value += fParamS0Par[dim][type][0];
814 value += fParamS0Par[dim][type][1]*z;
815 value += fParamS0Par[dim][type][2]*angle*angle;
816 value += fParamS0Par[dim][type][3]*z*z;
817 value += fParamS0Par[dim][type][4]*angle*angle*angle*angle;
818 value += fParamS0Par[dim][type][5]*z*angle*angle;
819 value = TMath::Sqrt(TMath::Abs(value));
825 Float_t AliTPCClusterParam::GetError1(Int_t dim, Int_t type, Float_t z, Float_t angle) const {
831 if (type==1) length=1;
832 if (type==2) length=1.5;
833 value += fParamS1[dim][0];
834 value += fParamS1[dim][1]*z/length;
835 value += fParamS1[dim][2]*angle*angle*length;
836 value = TMath::Sqrt(TMath::Abs(value));
840 Float_t AliTPCClusterParam::GetErrorQ(Int_t dim, Int_t type, Float_t z, Float_t angle, Float_t Qmean) const {
845 value += fParamSQ[dim][type][0];
846 value += fParamSQ[dim][type][1]*z;
847 value += fParamSQ[dim][type][2]*angle*angle;
848 value += fParamSQ[dim][type][3]*z/Qmean;
849 value += fParamSQ[dim][type][4]*angle*angle/Qmean;
850 value = TMath::Sqrt(TMath::Abs(value));
856 Float_t AliTPCClusterParam::GetErrorQPar(Int_t dim, Int_t type, Float_t z, Float_t angle, Float_t Qmean) const {
861 value += fParamSQPar[dim][type][0];
862 value += fParamSQPar[dim][type][1]*z;
863 value += fParamSQPar[dim][type][2]*angle*angle;
864 value += fParamSQPar[dim][type][3]*z*z;
865 value += fParamSQPar[dim][type][4]*angle*angle*angle*angle;
866 value += fParamSQPar[dim][type][5]*z*angle*angle;
867 value += fParamSQPar[dim][type][6]*z/Qmean;
868 value += fParamSQPar[dim][type][7]*angle*angle/Qmean;
869 value = TMath::Sqrt(TMath::Abs(value));
875 Float_t AliTPCClusterParam::GetErrorQParScaled(Int_t dim, Int_t type, Float_t z, Float_t angle, Float_t Qmean) const {
880 value += fParamSQPar[dim][type][0];
881 value += fParamSQPar[dim][type][1]*z;
882 value += fParamSQPar[dim][type][2]*angle*angle;
883 value += fParamSQPar[dim][type][3]*z*z;
884 value += fParamSQPar[dim][type][4]*angle*angle*angle*angle;
885 value += fParamSQPar[dim][type][5]*z*angle*angle;
886 value += fParamSQPar[dim][type][6]*z/Qmean;
887 value += fParamSQPar[dim][type][7]*angle*angle/Qmean;
888 Float_t valueMean = GetError0Par(dim,type,z,angle);
889 value -= 0.35*0.35*valueMean*valueMean;
890 value = TMath::Sqrt(TMath::Abs(value));
896 Float_t AliTPCClusterParam::GetRMS0(Int_t dim, Int_t type, Float_t z, Float_t angle) const {
898 // calculate mean RMS of cluster - z,angle - parameters for each pad and dimension separatelly
901 value += fParamRMS0[dim][type][0];
902 value += fParamRMS0[dim][type][1]*z;
903 value += fParamRMS0[dim][type][2]*angle*angle;
904 value = TMath::Sqrt(TMath::Abs(value));
908 Float_t AliTPCClusterParam::GetRMS1(Int_t dim, Int_t type, Float_t z, Float_t angle) const {
910 // calculate mean RMS of cluster - z,angle - pad length scalling
914 if (type==1) length=1;
915 if (type==2) length=1.5;
917 value += fParamRMS1[dim][0];
919 value += fParamRMS1[dim][1];
921 value += fParamRMS1[dim][2]*z;
922 value += fParamRMS1[dim][3]*angle*angle*length*length;
923 value = TMath::Sqrt(TMath::Abs(value));
927 Float_t AliTPCClusterParam::GetRMSQ(Int_t dim, Int_t type, Float_t z, Float_t angle, Float_t Qmean) const {
929 // calculate mean RMS of cluster - z,angle, Q dependence
932 value += fParamRMSQ[dim][type][0];
933 value += fParamRMSQ[dim][type][1]*z;
934 value += fParamRMSQ[dim][type][2]*angle*angle;
935 value += fParamRMSQ[dim][type][3]*z/Qmean;
936 value += fParamRMSQ[dim][type][4]*angle*angle/Qmean;
937 value = TMath::Sqrt(TMath::Abs(value));
941 Float_t AliTPCClusterParam::GetRMSSigma(Int_t dim, Int_t type, Float_t z, Float_t angle, Float_t Qmean) const {
943 // calculates RMS of signal shape fluctuation
945 Float_t mean = GetRMSQ(dim,type,z,angle,Qmean);
946 Float_t value = fRMSSigmaFit[dim][type][0];
947 value+= fRMSSigmaFit[dim][type][1]*mean;
951 Float_t AliTPCClusterParam::GetShapeFactor(Int_t dim, Int_t type, Float_t z, Float_t angle, Float_t Qmean, Float_t rmsL, Float_t rmsM) const {
953 // calculates vallue - sigma distortion contribution
957 Float_t rmsMeanQ = GetRMSQ(dim,type,z,angle,Qmean);
958 if (rmsL<rmsMeanQ) return value;
960 Float_t rmsSigma = GetRMSSigma(dim,type,z,angle,Qmean);
962 if ((rmsM-rmsMeanQ)>2.0*(rmsSigma+fErrorRMSSys[dim])){
963 //1.5 sigma cut on mean
964 value+= rmsL*rmsL+2*rmsM*rmsM-3*rmsMeanQ*rmsMeanQ;
966 if ((rmsL-rmsMeanQ)>3.*(rmsSigma+fErrorRMSSys[dim])){
967 //3 sigma cut on local
968 value+= rmsL*rmsL-rmsMeanQ*rmsMeanQ;
971 return TMath::Sqrt(TMath::Abs(value));
976 void AliTPCClusterParam::FitData(TTree * tree){
978 // make fits for error param and shape param
985 void AliTPCClusterParam::FitResol(TTree * tree){
988 for (Int_t idir=0;idir<2; idir++){
989 for (Int_t itype=0; itype<3; itype++){
993 FitResol0(tree, idir, itype,param0,error0);
994 printf("\nResol\t%d\t%d\tchi2=%f\n",idir,itype,param0[3]);
995 printf("%f\t%f\t%f\n", param0[0],param0[1],param0[2]);
996 printf("%f\t%f\t%f\n", error0[0],error0[1],error0[2]);
997 for (Int_t ipar=0;ipar<4; ipar++){
998 fParamS0[idir][itype][ipar] = param0[ipar];
999 fErrorS0[idir][itype][ipar] = param0[ipar];
1001 // error param with parabolic correction
1002 FitResol0Par(tree, idir, itype,param0,error0);
1003 printf("\nResolPar\t%d\t%d\tchi2=%f\n",idir,itype,param0[6]);
1004 printf("%f\t%f\t%f\t%f\t%f\t%f\n", param0[0],param0[1],param0[2],param0[3],param0[4],param0[5]);
1005 printf("%f\t%f\t%f\t%f\t%f\t%f\n", error0[0],error0[1],error0[2],error0[3],error0[4],error0[5]);
1006 for (Int_t ipar=0;ipar<7; ipar++){
1007 fParamS0Par[idir][itype][ipar] = param0[ipar];
1008 fErrorS0Par[idir][itype][ipar] = param0[ipar];
1011 FitResolQ(tree, idir, itype,param0,error0);
1012 printf("\nResolQ\t%d\t%d\tchi2=%f\n",idir,itype,param0[5]);
1013 printf("%f\t%f\t%f\t%f\t%f\n", param0[0],param0[1],param0[2],param0[3],param0[4]);
1014 printf("%f\t%f\t%f\t%f\t%f\n", error0[0],error0[1],error0[2],error0[3],error0[4]);
1015 for (Int_t ipar=0;ipar<6; ipar++){
1016 fParamSQ[idir][itype][ipar] = param0[ipar];
1017 fErrorSQ[idir][itype][ipar] = param0[ipar];
1020 FitResolQPar(tree, idir, itype,param0,error0);
1021 printf("\nResolQ\t%d\t%d\tchi2=%f\n",idir,itype,param0[8]);
1022 printf("%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\n", param0[0],param0[1],param0[2],param0[3],param0[4],param0[5],param0[6],param0[7]);
1023 printf("%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\n", error0[0],error0[1],error0[2],error0[3],error0[4],error0[5],error0[6],error0[7]);
1024 for (Int_t ipar=0;ipar<9; ipar++){
1025 fParamSQPar[idir][itype][ipar] = param0[ipar];
1026 fErrorSQPar[idir][itype][ipar] = param0[ipar];
1031 printf("Resol z-scaled\n");
1032 for (Int_t idir=0;idir<2; idir++){
1035 FitResol1(tree, idir,param0,error0);
1036 printf("\nResol\t%d\tchi2=%f\n",idir,param0[3]);
1037 printf("%f\t%f\t%f\n", param0[0],param0[1],param0[2]);
1038 printf("%f\t%f\t%f\n", error0[0],error0[1],error0[2]);
1039 for (Int_t ipar=0;ipar<4; ipar++){
1040 fParamS1[idir][ipar] = param0[ipar];
1041 fErrorS1[idir][ipar] = param0[ipar];
1045 for (Int_t idir=0;idir<2; idir++){
1046 printf("\nDirection %d\n",idir);
1047 printf("%d\t%f\t%f\t%f\n", -1,fParamS1[idir][0],fParamS1[idir][1],fParamS1[idir][2]);
1048 for (Int_t itype=0; itype<3; itype++){
1049 Float_t length=0.75;
1050 if (itype==1) length=1;
1051 if (itype==2) length=1.5;
1052 printf("%d\t%f\t%f\t%f\n", itype,fParamS0[idir][itype][0],fParamS0[idir][itype][1]*TMath::Sqrt(length),fParamS0[idir][itype][2]/TMath::Sqrt(length));
1059 void AliTPCClusterParam::FitRMS(TTree * tree){
1062 for (Int_t idir=0;idir<2; idir++){
1063 for (Int_t itype=0; itype<3; itype++){
1066 FitRMS0(tree, idir, itype,param0,error0);
1067 printf("\nRMS\t%d\t%d\tchi2=%f\n",idir,itype,param0[3]);
1068 printf("%f\t%f\t%f\n", param0[0],param0[1],param0[2]);
1069 printf("%f\t%f\t%f\n", error0[0],error0[1],error0[2]);
1070 for (Int_t ipar=0;ipar<4; ipar++){
1071 fParamRMS0[idir][itype][ipar] = param0[ipar];
1072 fErrorRMS0[idir][itype][ipar] = param0[ipar];
1074 FitRMSQ(tree, idir, itype,param0,error0);
1075 printf("\nRMSQ\t%d\t%d\tchi2=%f\n",idir,itype,param0[5]);
1076 printf("%f\t%f\t%f\t%f\t%f\n", param0[0],param0[1],param0[2],param0[3],param0[4]);
1077 printf("%f\t%f\t%f\t%f\t%f\n", error0[0],error0[1],error0[2],error0[3],error0[4]);
1078 for (Int_t ipar=0;ipar<6; ipar++){
1079 fParamRMSQ[idir][itype][ipar] = param0[ipar];
1080 fErrorRMSQ[idir][itype][ipar] = param0[ipar];
1085 printf("RMS z-scaled\n");
1086 for (Int_t idir=0;idir<2; idir++){
1089 FitRMS1(tree, idir,param0,error0);
1090 printf("\nRMS\t%d\tchi2=%f\n",idir,param0[4]);
1091 printf("%f\t%f\t%f\t%f\n", param0[0],param0[1],param0[2], param0[3]);
1092 printf("%f\t%f\t%f\t%f\n", error0[0],error0[1],error0[2], error0[3]);
1093 for (Int_t ipar=0;ipar<5; ipar++){
1094 fParamRMS1[idir][ipar] = param0[ipar];
1095 fErrorRMS1[idir][ipar] = param0[ipar];
1099 for (Int_t idir=0;idir<2; idir++){
1100 printf("\nDirection %d\n",idir);
1101 printf("%d\t%f\t%f\t%f\t%f\n", -1,fParamRMS1[idir][0],fParamRMS1[idir][1],fParamRMS1[idir][2], fParamRMS1[idir][3]);
1102 for (Int_t itype=0; itype<3; itype++){
1103 Float_t length=0.75;
1104 if (itype==1) length=1;
1105 if (itype==2) length=1.5;
1106 if (itype==0) printf("%d\t%f\t\t\t%f\t%f\n", itype,fParamRMS0[idir][itype][0],fParamRMS0[idir][itype][1],fParamRMS0[idir][itype][2]/length);
1107 if (itype>0) printf("%d\t\t\t%f\t%f\t%f\n", itype,fParamRMS0[idir][itype][0],fParamRMS0[idir][itype][1],fParamRMS0[idir][itype][2]/length);
1113 printf("RMS fluctuation parameterization \n");
1114 for (Int_t idir=0;idir<2; idir++){
1115 for (Int_t itype=0; itype<3; itype++){
1118 FitRMSSigma(tree, idir,itype,param0,error0);
1119 printf("\t%d\t%d\t%f\t%f\n", idir, itype, param0[0],param0[1]);
1120 for (Int_t ipar=0;ipar<2; ipar++){
1121 fRMSSigmaFit[idir][itype][ipar] = param0[ipar];
1126 // store systematic error end RMS fluctuation parameterization
1128 TH1F hratio("hratio","hratio",100,-0.1,0.1);
1129 tree->Draw("(RMSm-AliTPCClusterParam::SGetRMSQ(Dim,Pad,Zm,AngleM,QMean))/RMSm>>hratio","Dim==0&&QMean>0");
1130 fErrorRMSSys[0] = hratio.GetRMS();
1131 tree->Draw("(RMSm-AliTPCClusterParam::SGetRMSQ(Dim,Pad,Zm,AngleM,QMean))/RMSm>>hratio","Dim==1&&QMean>0");
1132 fErrorRMSSys[1] = hratio.GetRMS();
1133 TH1F hratioR("hratioR","hratioR",100,0,0.2);
1134 tree->Draw("RMSs/RMSm>>hratioR","Dim==0&&QMean>0");
1135 fRMSSigmaRatio[0][0]=hratioR.GetMean();
1136 fRMSSigmaRatio[0][1]=hratioR.GetRMS();
1137 tree->Draw("RMSs/RMSm>>hratioR","Dim==1&&QMean>0");
1138 fRMSSigmaRatio[1][0]=hratioR.GetMean();
1139 fRMSSigmaRatio[1][1]=hratioR.GetRMS();
1142 void AliTPCClusterParam::Test(TTree * tree, const char *output){
1144 // Draw standard quality histograms to output file
1147 TFile f(output,"recreate");
1150 // 1D histograms - resolution
1152 for (Int_t idim=0; idim<2; idim++){
1153 for (Int_t ipad=0; ipad<3; ipad++){
1158 sprintf(hname1,"Delta0 Dir %d Pad %d",idim,ipad);
1159 sprintf(hcut1,"Dim==%d&&QMean<0&&Pad==%d",idim,ipad);
1160 sprintf(hexp1,"(Resol-AliTPCClusterParam::SGetError0(Dim,Pad,Zm,AngleM))/Resol>>%s",hname1);
1161 TH1F his1DRel0(hname1, hname1, 100,-0.2, 0.2);
1162 sprintf(hname1,"Dim==%d&&QMean<0&&Pad=%d",idim,ipad);
1163 tree->Draw(hexp1,hcut1,"");
1166 sprintf(hname1,"Delta0Par Dir %d Pad %d",idim,ipad);
1167 sprintf(hcut1,"Dim==%d&&QMean<0&&Pad==%d",idim,ipad);
1168 sprintf(hexp1,"(Resol-AliTPCClusterParam::SGetError0Par(Dim,Pad,Zm,AngleM))/Resol>>%s",hname1);
1169 TH1F his1DRel0Par(hname1, hname1, 100,-0.2, 0.2);
1170 sprintf(hname1,"Dim==%d&&QMean<0&&Pad=%d",idim,ipad);
1171 tree->Draw(hexp1,hcut1,"");
1172 his1DRel0Par.Write();
1177 // 2D histograms - resolution
1179 for (Int_t idim=0; idim<2; idim++){
1180 for (Int_t ipad=0; ipad<3; ipad++){
1185 sprintf(hname1,"2DDelta0 Dir %d Pad %d",idim,ipad);
1186 sprintf(hcut1,"Dim==%d&&QMean<0&&Pad==%d",idim,ipad);
1187 sprintf(hexp1,"(Resol-AliTPCClusterParam::SGetError0(Dim,Pad,Zm,AngleM))/Resol:AngleM:Zm>>%s",hname1);
1188 TProfile2D profDRel0(hname1, hname1, 6,0,250,6,0,1);
1189 sprintf(hname1,"Dim==%d&&QMean<0&&Pad=%d",idim,ipad);
1190 tree->Draw(hexp1,hcut1,"");
1193 sprintf(hname1,"2DDelta0Par Dir %d Pad %d",idim,ipad);
1194 sprintf(hcut1,"Dim==%d&&QMean<0&&Pad==%d",idim,ipad);
1195 sprintf(hexp1,"(Resol-AliTPCClusterParam::SGetError0Par(Dim,Pad,Zm,AngleM))/Resol:AngleM:Zm>>%s",hname1);
1196 TProfile2D profDRel0Par(hname1, hname1,6,0,250,6,0,1);
1197 sprintf(hname1,"Dim==%d&&QMean<0&&Pad=%d",idim,ipad);
1198 tree->Draw(hexp1,hcut1,"");
1199 profDRel0Par.Write();
1207 void AliTPCClusterParam::Print(Option_t* /*option*/) const{
1209 // Print param Information
1213 // Error parameterization
1215 printf("\nResolution Scaled factors\n");
1216 printf("Dir\tPad\tP0\t\tP1\t\tP2\t\tchi2\n");
1217 printf("Y\tall\t%f\t%f\t%f\t%f\n", TMath::Sqrt(TMath::Abs(fParamS1[0][0])),TMath::Sqrt(TMath::Abs(fParamS1[0][1])),
1218 TMath::Sqrt(TMath::Abs(fParamS1[0][2])),TMath::Sqrt(TMath::Abs(fParamS1[0][3])));
1219 for (Int_t ipad=0; ipad<3; ipad++){
1220 Float_t length=0.75;
1221 if (ipad==1) length=1;
1222 if (ipad==2) length=1.5;
1223 printf("\t%d\t%f\t%f\t%f\t%f\n", ipad,
1224 TMath::Sqrt(TMath::Abs(fParamS0[0][ipad][0])),
1225 TMath::Sqrt(TMath::Abs(fParamS0[0][ipad][1]*length)),
1226 TMath::Sqrt(TMath::Abs(fParamS0[0][ipad][2]/length)),
1227 TMath::Sqrt(TMath::Abs(fParamS0[0][ipad][3])));
1229 for (Int_t ipad=0; ipad<3; ipad++){
1230 Float_t length=0.75;
1231 if (ipad==1) length=1;
1232 if (ipad==2) length=1.5;
1233 printf("\t%dPar\t%f\t%f\t%f\t%f\n", ipad,
1234 TMath::Sqrt(TMath::Abs(fParamS0Par[0][ipad][0])),
1235 TMath::Sqrt(TMath::Abs(fParamS0Par[0][ipad][1]*length)),
1236 TMath::Sqrt(TMath::Abs(fParamS0Par[0][ipad][2]/length)),
1237 TMath::Sqrt(TMath::Abs(fParamS0Par[0][ipad][6])));
1239 printf("Z\tall\t%f\t%f\t%f\t%f\n", TMath::Sqrt(TMath::Abs(fParamS1[1][0])),TMath::Sqrt(fParamS1[1][1]),
1240 TMath::Sqrt(fParamS1[1][2]), TMath::Sqrt(fParamS1[1][3]));
1242 for (Int_t ipad=0; ipad<3; ipad++){
1243 Float_t length=0.75;
1244 if (ipad==1) length=1;
1245 if (ipad==2) length=1.5;
1246 printf("\t%d\t%f\t%f\t%f\t%f\n", ipad,
1247 TMath::Sqrt(TMath::Abs(fParamS0[1][ipad][0])),
1248 TMath::Sqrt(TMath::Abs(fParamS0[1][ipad][1]*length)),
1249 TMath::Sqrt(TMath::Abs(fParamS0[1][ipad][2]/length)),
1250 TMath::Sqrt(TMath::Abs(fParamS0[1][ipad][3])));
1252 for (Int_t ipad=0; ipad<3; ipad++){
1253 Float_t length=0.75;
1254 if (ipad==1) length=1;
1255 if (ipad==2) length=1.5;
1256 printf("\t%dPar\t%f\t%f\t%f\t%f\n", ipad,
1257 TMath::Sqrt(TMath::Abs(TMath::Abs(fParamS0Par[1][ipad][0]))),
1258 TMath::Sqrt(TMath::Abs(fParamS0Par[1][ipad][1]*length)),
1259 TMath::Sqrt(TMath::Abs(fParamS0Par[1][ipad][2]/length)),
1260 TMath::Sqrt(TMath::Abs(fParamS0Par[1][ipad][6])));
1267 printf("\nRMS Scaled factors\n");
1268 printf("Dir\tPad\tP00\t\tP01\t\tP1\t\tP2\t\tchi2\n");
1269 printf("Y\tall\t%f\t%f\t%f\t%f\t%f\n",
1270 TMath::Sqrt(TMath::Abs(fParamRMS1[0][0])),
1271 TMath::Sqrt(TMath::Abs(fParamRMS1[0][1])),
1272 TMath::Sqrt(TMath::Abs(fParamRMS1[0][2])),
1273 TMath::Sqrt(TMath::Abs(fParamRMS1[0][3])),
1274 TMath::Sqrt(TMath::Abs(fParamRMS1[0][4])));
1275 for (Int_t ipad=0; ipad<3; ipad++){
1276 Float_t length=0.75;
1277 if (ipad==1) length=1;
1278 if (ipad==2) length=1.5;
1280 printf("\t%d\t%f\t%f\t%f\t%f\t%f\n", ipad,
1281 TMath::Sqrt(TMath::Abs(fParamRMS0[0][ipad][0])),
1283 TMath::Sqrt(TMath::Abs(fParamRMS0[0][ipad][1])),
1284 TMath::Sqrt(TMath::Abs(fParamRMS0[0][ipad][2]/(length*length))),
1285 TMath::Sqrt(TMath::Abs(fParamRMS0[0][ipad][3])));
1287 printf("\t%d\t%f\t%f\t%f\t%f\t%f\n", ipad,
1289 TMath::Sqrt(TMath::Abs(fParamRMS0[0][ipad][0])),
1290 TMath::Sqrt(TMath::Abs(fParamRMS0[0][ipad][1])),
1291 TMath::Sqrt(TMath::Abs(fParamRMS0[0][ipad][2]/(length*length))),
1292 TMath::Sqrt(TMath::Abs(fParamRMS0[0][ipad][3])));
1296 printf("Z\tall\t%f\t%f\t%f\t%f\t%f\n",
1297 TMath::Sqrt(TMath::Abs(fParamRMS1[1][0])),
1298 TMath::Sqrt(TMath::Abs(fParamRMS1[1][1])),
1299 TMath::Sqrt(TMath::Abs(fParamRMS1[1][2])),
1300 TMath::Sqrt(TMath::Abs(fParamRMS1[1][3])),
1301 TMath::Sqrt(TMath::Abs(fParamRMS1[1][4])));
1302 for (Int_t ipad=0; ipad<3; ipad++){
1303 Float_t length=0.75;
1304 if (ipad==1) length=1;
1305 if (ipad==2) length=1.5;
1307 printf("\t%d\t%f\t%f\t%f\t%f\t%f\n", ipad,
1308 TMath::Sqrt(TMath::Abs(fParamRMS0[1][ipad][0])),
1310 TMath::Sqrt(TMath::Abs(fParamRMS0[1][ipad][1])),
1311 TMath::Sqrt(TMath::Abs(fParamRMS0[1][ipad][2]/(length*length))),
1312 TMath::Sqrt(TMath::Abs(fParamRMS0[1][ipad][3])));
1314 printf("\t%d\t%f\t%f\t%f\t%f\t%f\n", ipad,
1316 TMath::Sqrt(TMath::Abs(fParamRMS0[1][ipad][0])),
1317 TMath::Sqrt(TMath::Abs(fParamRMS0[1][ipad][1])),
1318 TMath::Sqrt(TMath::Abs(fParamRMS0[1][ipad][2]/(length*length))),
1319 TMath::Sqrt(TMath::Abs(fParamRMS0[1][ipad][3])));
1328 Float_t AliTPCClusterParam::Qnorm(Int_t ipad, Int_t itype, Float_t dr, Float_t ty, Float_t tz){
1329 // get Q normalization
1330 // type - 0 Qtot 1 Qmax
1331 // ipad - 0 (0.75 cm) ,1 (1 cm), 2 (1.5 cm)
1333 //expession formula - TString *strq0 = toolkit.FitPlane(chain,"dedxQ.fElements[2]","dr++ty++tz++dr*ty++dr*tz++++dr*dr++ty*tz++ty^2++tz^2","IPad==0",chi2,npoints,param,covar,0,100000);
1335 if (fQNorm==0) return 0;
1336 TVectorD * norm = (TVectorD*)fQNorm->At(3*itype+ipad);
1337 if (!norm) return 0;
1338 TVectorD &no = *norm;
1356 Float_t AliTPCClusterParam::QnormHis(Int_t ipad, Int_t itype, Float_t dr, Float_t p2, Float_t p3){
1357 // get Q normalization
1358 // type - 0 Qtot 1 Qmax
1359 // ipad - 0 (0.75 cm) ,1 (1 cm), 2 (1.5 cm)
1362 if (fQNormHis==0) return 0;
1363 TH3F * norm = (TH3F*)fQNormHis->At(4*itype+ipad);
1364 if (!norm) return 1;
1366 dr=TMath::Min(dr,Float_t(norm->GetXaxis()->GetXmax()-norm->GetXaxis()->GetBinWidth(0)));
1367 dr=TMath::Max(dr,Float_t(norm->GetXaxis()->GetXmin()+norm->GetXaxis()->GetBinWidth(0)));
1369 p2=TMath::Min(p2,Float_t(norm->GetYaxis()->GetXmax()-norm->GetYaxis()->GetBinWidth(0)));
1370 p2=TMath::Max(p2,Float_t(norm->GetYaxis()->GetXmin()+norm->GetYaxis()->GetBinWidth(0)));
1372 p3=TMath::Min(p3,Float_t(norm->GetZaxis()->GetXmax()-norm->GetZaxis()->GetBinWidth(0)));
1373 p3=TMath::Max(p3,Float_t(norm->GetZaxis()->GetXmin()+norm->GetZaxis()->GetBinWidth(0)));
1375 Double_t res = norm->GetBinContent(norm->FindBin(dr,p2,p3));
1376 if (res==0) res = norm->GetBinContent(norm->FindBin(0.5,0.5,0.5)); // This is just hack - to be fixed entries without
1383 void AliTPCClusterParam::SetQnorm(Int_t ipad, Int_t itype, const TVectorD *const norm){
1385 // set normalization
1387 // type - 0 Qtot 1 Qmax
1388 // ipad - 0 (0.75 cm) ,1 (1 cm), 2 (1.5 cm)
1391 if (fQNorm==0) fQNorm = new TObjArray(6);
1392 fQNorm->AddAt(new TVectorD(*norm), itype*3+ipad);
1395 void AliTPCClusterParam::ResetQnormCorr(){
1399 if (!fQNormCorr) fQNormCorr= new TMatrixD(12,6);
1400 for (Int_t irow=0;irow<12; irow++)
1401 for (Int_t icol=0;icol<6; icol++){
1402 (*fQNormCorr)(irow,icol)=1.; // default - no correction
1403 if (irow>5) (*fQNormCorr)(irow,icol)=0.; // default - no correction
1407 void AliTPCClusterParam::SetQnormCorr(Int_t ipad, Int_t itype, Int_t corrType, Float_t val){
1410 // itype - 0- qtot 1-qmax
1411 // corrType - 0 - s0y corr - eff. PRF corr
1412 // - 1 - s0z corr - eff. TRF corr
1413 // - 2 - d0y - eff. diffusion correction y
1414 // - 3 - d0z - eff. diffusion correction
1415 // - 4 - eff length - eff.length - wire pitch + x diffsion
1416 // - 5 - pad type normalization
1421 // eff shap parameterization matrix
1424 // itype*3+ipad - itype=0 qtot itype=1 qmax ipad=0
1426 if (itype<2) (*fQNormCorr)(itype*3+ipad, corrType) *= val; // multiplicative correction
1427 if (itype>=2) (*fQNormCorr)(itype*3+ipad, corrType)+= val; // additive correction
1430 Double_t AliTPCClusterParam::GetQnormCorr(Int_t ipad, Int_t itype, Int_t corrType) const{
1432 // see AliTPCClusterParam::SetQnormCorr
1434 if (!fQNormCorr) return 0;
1435 return (*fQNormCorr)(itype*3+ipad, corrType);
1439 Float_t AliTPCClusterParam::QnormPos(Int_t ipad,Bool_t isMax, Float_t pad, Float_t time, Float_t z, Float_t sy2, Float_t sz2, Float_t qm, Float_t qt){
1441 // Make Q normalization as function of following parameters
1442 // Fit parameters to be used in corresponding correction function extracted in the AliTPCclaibTracksGain - Taylor expansion
1443 // 1 - dp - relative pad position
1444 // 2 - dt - relative time position
1445 // 3 - di - drift length (norm to 1);
1446 // 4 - dq0 - Tot/Max charge
1447 // 5 - dq1 - Max/Tot charge
1448 // 6 - sy - sigma y - shape
1449 // 7 - sz - sigma z - shape
1452 //The results can be visualized using the debug streamer information of the AliTPCcalibTracksGain -
1453 // Following variable used - correspondance to the our variable conventions
1454 //chain0->SetAlias("dp","((Cl.fPad-int(Cl.fPad)-0.5)/0.5)");
1455 Double_t dp = ((pad-int(pad)-0.5)*2.);
1456 //chain0->SetAlias("dt","((Cl.fTimeBin-int(Cl.fTimeBin)-0.5)/0.5)");
1457 Double_t dt = ((time-int(time)-0.5)*2.);
1458 //chain0->SetAlias("di","(sqrt(1.-abs(Cl.fZ)/250.))");
1459 Double_t di = TMath::Sqrt(1-TMath::Abs(z)/250.);
1460 //chain0->SetAlias("dq0","(0.2*(Cl.fQ+2)/(Cl.fMax+2))");
1461 Double_t dq0 = 0.2*(qt+2.)/(qm+2.);
1462 //chain0->SetAlias("dq1","(5*(Cl.fMax+2)/(Cl.fQ+2))");
1463 Double_t dq1 = 5.*(qm+2.)/(qt+2.);
1464 //chain0->SetAlias("sy","(0.32/sqrt(0.01^2+Cl.fSigmaY2))");
1465 Double_t sy = 0.32/TMath::Sqrt(0.01*0.01+sy2);
1466 //chain0->SetAlias("sz","(0.32/sqrt(0.01^2+Cl.fSigmaZ2))");
1467 Double_t sz = 0.32/TMath::Sqrt(0.01*0.01+sz2);
1471 TVectorD * pvec = 0;
1473 pvec = fPosQMnorm[ipad];
1475 pvec = fPosQTnorm[ipad];
1477 TVectorD ¶m = *pvec;
1479 // Eval part - in correspondance with fit part from debug streamer
1481 Double_t result=param[0];
1484 result+=dp*param[index++]; //1
1485 result+=dt*param[index++]; //2
1486 result+=dp*dp*param[index++]; //3
1487 result+=dt*dt*param[index++]; //4
1488 result+=dt*dt*dt*param[index++]; //5
1489 result+=dp*dt*param[index++]; //6
1490 result+=dp*dt*dt*param[index++]; //7
1491 result+=(dq0)*param[index++]; //8
1492 result+=(dq1)*param[index++]; //9
1495 result+=dp*dp*(di)*param[index++]; //10
1496 result+=dt*dt*(di)*param[index++]; //11
1497 result+=dp*dp*sy*param[index++]; //12
1498 result+=dt*sz*param[index++]; //13
1499 result+=dt*dt*sz*param[index++]; //14
1500 result+=dt*dt*dt*sz*param[index++]; //15
1502 result+=dp*dp*1*sy*sz*param[index++]; //16
1503 result+=dt*sy*sz*param[index++]; //17
1504 result+=dt*dt*sy*sz*param[index++]; //18
1505 result+=dt*dt*dt*sy*sz*param[index++]; //19
1507 result+=dp*dp*(dq0)*param[index++]; //20
1508 result+=dt*1*(dq0)*param[index++]; //21
1509 result+=dt*dt*(dq0)*param[index++]; //22
1510 result+=dt*dt*dt*(dq0)*param[index++]; //23
1512 result+=dp*dp*(dq1)*param[index++]; //24
1513 result+=dt*(dq1)*param[index++]; //25
1514 result+=dt*dt*(dq1)*param[index++]; //26
1515 result+=dt*dt*dt*(dq1)*param[index++]; //27
1517 if (result<0.75) result=0.75;
1518 if (result>1.25) result=1.25;
1528 Float_t AliTPCClusterParam::PosCorrection(Int_t type, Int_t ipad, Float_t pad, Float_t time, Float_t z, Float_t /*sy2*/, Float_t /*sz2*/, Float_t /*qm*/){
1531 // Make postion correction
1532 // type - 0 - y correction
1534 // ipad - 0, 1, 2 - short, medium long pads
1535 // pad - float pad number
1536 // time - float time bin number
1537 // z - z of the cluster
1540 //chainres->SetAlias("dp","(-1+(Cl.fZ>0)*2)*((Cl.fPad-int(Cl.fPad))-0.5)");
1541 //chainres->SetAlias("dt","(-1+(Cl.fZ>0)*2)*((Cl.fTimeBin-0.66-int(Cl.fTimeBin-0.66))-0.5)");
1542 //chainres->SetAlias("sp","(sin(dp*pi)-dp*pi)");
1543 //chainres->SetAlias("st","(sin(dt)-dt)");
1545 //chainres->SetAlias("di","sqrt(1.-abs(Cl.fZ/250.))");
1548 // Derived variables
1550 Double_t dp = (-1+(z>0)*2)*((pad-int(pad))-0.5);
1551 Double_t dt = (-1+(z>0)*2)*((time-0.66-int(time-0.66))-0.5);
1552 Double_t sp = (TMath::Sin(dp*TMath::Pi())-dp*TMath::Pi());
1553 Double_t st = (TMath::Sin(dt)-dt);
1555 Double_t di = TMath::Sqrt(TMath::Abs(1.-TMath::Abs(z/250.)));
1559 TVectorD * pvec = 0;
1561 pvec = fPosYcor[ipad];
1563 pvec = fPosZcor[ipad];
1565 TVectorD ¶m = *pvec;
1572 result+=(dp)*param[index++]; //1
1573 result+=(dp)*di*param[index++]; //2
1575 result+=(sp)*param[index++]; //3
1576 result+=(sp)*di*param[index++]; //4
1579 result+=(dt)*param[index++]; //1
1580 result+=(dt)*di*param[index++]; //2
1582 result+=(st)*param[index++]; //3
1583 result+=(st)*di*param[index++]; //4
1585 if (TMath::Abs(result)>0.05) return 0;
1591 Double_t AliTPCClusterParam::GaussConvolution(Double_t x0, Double_t x1, Double_t k0, Double_t k1, Double_t s0, Double_t s1){
1593 // 2 D gaus convoluted with angular effect
1594 // See in mathematica:
1595 //Simplify[Integrate[Exp[-(x0-k0*xd)*(x0-k0*xd)/(2*s0*s0)-(x1-k1*xd)*(x1-k1*xd)/(2*s1*s1)]/(s0*s1),{xd,-1/2,1/2}]]
1597 //TF1 f1("f1","AliTPCClusterParam::GaussConvolution(x,0,1,0,0.1,0.1)",-2,2)
1598 //TF2 f2("f2","AliTPCClusterParam::GaussConvolution(x,y,1,1,0.1,0.1)",-2,2,-2,2)
1600 const Float_t kEpsilon = 0.0001;
1601 if ((TMath::Abs(k0)+TMath::Abs(k1))<kEpsilon*(s0+s1)){
1602 // small angular effect
1603 Double_t val = (TMath::Gaus(x0,0,s0)*TMath::Gaus(x1,0,s1))/(s0*s1*2.*TMath::Pi());
1606 Double_t sigma2 = k1*k1*s0*s0+k0*k0*s1*s1;
1607 Double_t exp0 = TMath::Exp(-(k1*x0-k0*x1)*(k1*x0-k0*x1)/(2*sigma2));
1609 Double_t sigmaErf = 2*s0*s1*TMath::Sqrt(2*sigma2);
1610 Double_t erf0 = AliMathBase::ErfFast( (k0*s1*s1*(k0-2*x0)+k1*s0*s0*(k1-2*x1))/sigmaErf);
1611 Double_t erf1 = AliMathBase::ErfFast( (k0*s1*s1*(k0+2*x0)+k1*s0*s0*(k1+2*x1))/sigmaErf);
1612 Double_t norm = 1./TMath::Sqrt(sigma2);
1613 norm/=2.*TMath::Sqrt(2.*TMath::Pi());
1614 Double_t val = norm*exp0*(erf0+erf1);
1619 Double_t AliTPCClusterParam::GaussConvolutionTail(Double_t x0, Double_t x1, Double_t k0, Double_t k1, Double_t s0, Double_t s1, Double_t tau){
1621 // 2 D gaus convoluted with angular effect and exponential tail in z-direction
1622 // tail integrated numerically
1623 // Integral normalized to one
1626 // TF1 f1t("f1t","AliTPCClusterParam::GaussConvolutionTail(0,x,0,0,0.5,0.5,0.9)",-5,5)
1627 Double_t sum =1, mean=0;
1628 // the COG of exponent
1629 for (Float_t iexp=0;iexp<5;iexp+=0.2){
1630 mean+=iexp*TMath::Exp(-iexp/tau);
1631 sum +=TMath::Exp(-iexp/tau);
1636 Double_t val = GaussConvolution(x0,x1+mean, k0, k1 , s0,s1);
1637 for (Float_t iexp=0;iexp<5;iexp+=0.2){
1638 val+=GaussConvolution(x0,x1+mean-iexp, k0, k1 , s0,s1)*TMath::Exp(-iexp/tau);
1639 sum+=TMath::Exp(-iexp/tau);
1644 Double_t AliTPCClusterParam::GaussConvolutionGamma4(Double_t x0, Double_t x1, Double_t k0, Double_t k1, Double_t s0, Double_t s1, Double_t tau){
1646 // 2 D gaus convoluted with angular effect and exponential tail in z-direction
1647 // tail integrated numerically
1648 // Integral normalized to one
1651 // TF1 f1g4("f1g4","AliTPCClusterParam::GaussConvolutionGamma4(0,x,0,0,0.5,0.2,1.6)",-5,5)
1652 // TF2 f2g4("f2g4","AliTPCClusterParam::GaussConvolutionGamma4(y,x,0,0,0.5,0.2,1.6)",-5,5,-5,5)
1653 Double_t sum =0, mean=0;
1655 for (Float_t iexp=0;iexp<5;iexp+=0.2){
1656 Double_t g4 = TMath::Exp(-4.*iexp/tau)*TMath::Power(iexp/tau,4.);
1664 for (Float_t iexp=0;iexp<5;iexp+=0.2){
1665 Double_t g4 = TMath::Exp(-4.*iexp/tau)*TMath::Power(iexp/tau,4.);
1666 val+=GaussConvolution(x0,x1+mean-iexp, k0, k1 , s0,s1)*g4;
1672 Double_t AliTPCClusterParam::QmaxCorrection(Int_t sector, Int_t row, Float_t cpad, Float_t ctime, Float_t ky, Float_t kz, Float_t rmsy0, Float_t rmsz0, Float_t effPad, Float_t effDiff){
1675 // cpad - pad (y) coordinate
1676 // ctime - time(z) coordinate
1679 // rmsy0 - RF width in pad units
1680 // rmsz0 - RF width in time bin units
1681 // effLength - contibution of PRF and diffusion
1682 // effDiff - overwrite diffusion
1684 // Response function aproximated by convolution of gaussian with angular effect (integral=1)
1686 // Gaus width sy and sz is determined by RF width and diffusion
1687 // Integral of Q is equal 1
1688 // Q max is calculated at position cpad, ctime
1689 // Example function:
1690 // TF1 f1("f1", "AliTPCClusterParam::QmaxCorrection(0,0.5,x,0,0,0.5,0.6)",0,1000)
1692 AliTPCParam * param = AliTPCcalibDB::Instance()->GetParameters();
1693 Double_t padLength= param->GetPadPitchLength(sector,row);
1694 Double_t padWidth = param->GetPadPitchWidth(sector);
1695 Double_t zwidth = param->GetZWidth();
1696 Double_t effLength= padLength+(param->GetWWPitch(0)+TMath::Sqrt(ctime*zwidth)*param->GetDiffT())*effPad;
1698 // diffusion in pad, time bin units
1699 Double_t diffT=TMath::Sqrt(ctime*zwidth)*param->GetDiffT()/padWidth;
1700 Double_t diffL=TMath::Sqrt(ctime*zwidth)*param->GetDiffL()/zwidth;
1704 // transform angular effect to pad units
1706 Double_t pky = ky*effLength/padWidth;
1707 Double_t pkz = kz*effLength/zwidth;
1708 // position in pad unit
1709 Double_t py = (cpad+0.5)-TMath::Nint(cpad+0.5);
1710 Double_t pz = (ctime+0.5)-TMath::Nint(ctime+0.5);
1713 Double_t sy = TMath::Sqrt(rmsy0*rmsy0+diffT*diffT);
1714 Double_t sz = TMath::Sqrt(rmsz0*rmsz0+diffL*diffL);
1715 //return GaussConvolutionGamma4(py,pz, pky,pkz,sy,sz,tau);
1716 Double_t length = padLength*TMath::Sqrt(1+ky*ky+kz*kz);
1717 return GaussConvolution(py,pz, pky,pkz,sy,sz)*length;
1720 Double_t AliTPCClusterParam::QtotCorrection(Int_t sector, Int_t row, Float_t cpad, Float_t ctime, Float_t ky, Float_t kz, Float_t rmsy0, Float_t rmsz0, Float_t qtot, Float_t thr, Float_t effPad, Float_t effDiff){
1723 // cpad - pad (y) coordinate
1724 // ctime - time(z) coordinate
1727 // rmsy0 - RF width in pad units
1728 // rmsz0 - RF width in time bin units
1729 // qtot - the sum of signal in cluster - without thr correction
1731 // effLength - contibution of PRF and diffusion
1732 // effDiff - overwrite diffusion
1734 // Response function aproximated by convolution of gaussian with angular effect (integral=1)
1736 // Gaus width sy and sz is determined by RF width and diffusion
1737 // Integral of Q is equal 1
1738 // Q max is calculated at position cpad, ctime
1742 AliTPCParam * param = AliTPCcalibDB::Instance()->GetParameters();
1743 Double_t padLength= param->GetPadPitchLength(sector,row);
1744 Double_t padWidth = param->GetPadPitchWidth(sector);
1745 Double_t zwidth = param->GetZWidth();
1746 Double_t effLength= padLength+(param->GetWWPitch(0)+TMath::Sqrt(ctime*zwidth)*param->GetDiffT())*effPad;
1748 // diffusion in pad units
1749 Double_t diffT=TMath::Sqrt(ctime*zwidth)*param->GetDiffT()/padWidth;
1750 Double_t diffL=TMath::Sqrt(ctime*zwidth)*param->GetDiffL()/zwidth;
1754 // transform angular effect to pad units
1755 Double_t pky = ky*effLength/padWidth;
1756 Double_t pkz = kz*effLength/zwidth;
1757 // position in pad unit
1759 Double_t py = (cpad+0.5)-TMath::Nint(cpad+0.5);
1760 Double_t pz = (ctime+0.5)-TMath::Nint(ctime+0.5);
1762 Double_t sy = TMath::Sqrt(rmsy0*rmsy0+diffT*diffT);
1763 Double_t sz = TMath::Sqrt(rmsz0*rmsz0+diffL*diffL);
1767 Double_t sumAll=0,sumThr=0;
1770 Double_t qnorm=qtot;
1771 for (Float_t iy=-3;iy<=3;iy+=1.)
1772 for (Float_t iz=-4;iz<=4;iz+=1.){
1773 // Double_t val = GaussConvolutionGamma4(py-iy,pz-iz, pky,pkz, sy,sz,tau);
1774 Double_t val = GaussConvolution(py-iy,pz-iz, pky,pkz, sy,sz);
1775 Double_t qlocal =qnorm*val;
1776 if (TMath::Abs(iy)<1.5&&TMath::Abs(iz)<1.5){
1777 sumThr+=qlocal; // Virtual charge used in cluster finder
1780 if (qlocal>thr && TMath::Abs(iz)<2.5&&TMath::Abs(iy)<2.5) sumThr+=qlocal;
1784 if (sumAll>0&&sumThr>0) {
1785 corr=(sumThr)/sumAll;
1788 Double_t length = padLength*TMath::Sqrt(1+ky*ky+kz*kz);