43 #include <TClonesArray.h> 47 #include <TObjArray.h> 49 #include <Riostream.h> 63 Double_t lowestPixelCharge,
64 Double_t lowestPadCharge,
65 Double_t lowestClusterCharge)
69 fDetElemId(detElemId),
74 fLowestPixelCharge(lowestPixelCharge),
75 fLowestPadCharge(lowestPadCharge),
76 fLowestClusterCharge(lowestClusterCharge)
96 fMathieson->SetSqrtKx3AndDeriveKx2Kx4(kx3);
97 fMathieson->SetSqrtKy3AndDeriveKy2Ky4(ky3);
112 Int_t ic, Int_t jc, Int_t mode,
117 Int_t nx = mlem->GetNbinsX();
118 Int_t ny = mlem->GetNbinsY();
119 Double_t cont1, cont = mlem->GetBinContent(mlem->GetBin(jc,ic));
122 Int_t ie = TMath::Min(ic+1,ny), je = TMath::Min(jc+1,nx);
123 for (Int_t i = TMath::Max(ic-1,1); i <= ie; ++i) {
124 for (Int_t j = TMath::Max(jc-1,1); j <= je; ++j) {
125 if (i != ic && j != jc)
continue;
126 if (used[(i-1)*nx+j-1])
continue;
127 cont1 = mlem->GetBinContent(mlem->GetBin(j,i));
128 if (mode && cont1 > cont)
continue;
129 used[(i-1)*nx+j-1] = kTRUE;
131 if (pix) pix->Add(
BinToPix(mlem,j,i));
133 pixPtr =
new AliMUONPad (mlem->GetXaxis()->GetBinCenter(j),
134 mlem->GetYaxis()->GetBinCenter(i), 0, 0, cont1);
137 AddBin(mlem, i, j, mode, used, pix);
146 Bool_t *used, Int_t *clustNumb, Int_t &nCoupled)
150 for (Int_t i = 0; i < nclust; ++i) {
151 if (used[i])
continue;
154 clustNumb[nCoupled++] = i;
155 AddCluster(i, nclust, aijcluclu, used, clustNumb, nCoupled);
166 Double_t yc = mlem->GetYaxis()->GetBinCenter(ic);
167 Double_t xc = mlem->GetXaxis()->GetBinCenter(jc);
169 Int_t nPix =
fPixArray->GetEntriesFast();
173 for (Int_t i = 0; i < nPix; ++i) {
176 if (TMath::Abs(pixPtr->
Coord(0)-xc)<1.e-4 && TMath::Abs(pixPtr->
Coord(1)-yc)<1.e-4)
182 AliError(Form(
" Something wrong ??? %f %f ", xc, yc));
195 TVector2 upperRight(lowerLeft + pad.
Dimensions()*2.0);
198 upperRight.X(),upperRight.Y());
204 Int_t & , Double_t * ,
205 Double_t &
f, Double_t *par, Int_t iflag)
210 Double_t charge, delta, coef=0,
chi2=0, qTot = 0;
211 static Double_t qAver = 0;
214 for (Int_t j = 0; j < mult; ++j)
219 pad->
Charge() == 0 )
continue;
221 if ( pad->
IsReal() ) npads++;
225 for (Int_t i = 0; i <= iend; ++i)
233 delta = charge - pad->
Charge();
238 if (iflag == 0 && npads) qAver = qTot / npads;
239 if (!npads && iflag==0)
241 AliError(Form(
"Got npads=0. Please check"));
251 if (
fNpar == 2)
return 1.;
252 if (
fNpar == 5)
return icand==0 ? par[2] : TMath::Max(1.-par[2],0.);
253 if (icand == 0)
return par[2];
254 if (icand == 1)
return TMath::Max((1.-par[2])*par[5], 0.);
255 return TMath::Max(1.-par[2]-coef,0.);
261 Int_t iSimple, Int_t nfit,
262 const Int_t *clustFit,
TObjArray **clusters,
270 Double_t xmin = mlem->GetXaxis()->GetXmin() - mlem->GetXaxis()->GetBinWidth(1);
271 Double_t xmax = mlem->GetXaxis()->GetXmax() + mlem->GetXaxis()->GetBinWidth(1);
272 Double_t ymin = mlem->GetYaxis()->GetXmin() - mlem->GetYaxis()->GetBinWidth(1);
273 Double_t ymax = mlem->GetYaxis()->GetXmax() + mlem->GetYaxis()->GetBinWidth(1);
276 Int_t npads = 0, nVirtual = 0, nfit0 = nfit;
279 for (Int_t i = 0; i < mult; ++i )
282 if ( !pad->
IsReal() ) ++nVirtual;
294 if (npads < 2)
return 0;
334 Long_t nofPads = cluster.
NofPads(kStatusToTest);
345 cout <<
" Number of pads to fit: " << npadOK << endl;
346 cout <<
" nInX and Y: " << nInX <<
" " << nInY << endl;
350 nfitMax = TMath::Min (nfitMax, (npads + 1) / 3);
352 if (((nInX < 3) && (nInY < 3)) || ((nInX == 3) && (nInY < 3)) || ((nInX < 3) && (nInY == 3))) nfitMax = 1;
354 if (nfit > nfitMax) nfit = nfitMax;
360 Double_t cont, cmax = 0, xseed = 0, yseed = 0, errOk[8], qq = 0;
362 for (
int i = 0; i < 8; ++i ) errOk[i]=0.0;
364 Double_t xyseed[3][2], qseed[3], xyCand[3][2] = {{0},{0}}, sigCand[3][2] = {{0},{0}};
366 for (Int_t ifit = 1; ifit <= nfit0; ++ifit)
369 pix = clusters[clustFit[ifit-1]];
370 npxclu = pix->GetEntriesFast();
372 for (Int_t clu = 0; clu < npxclu; ++clu)
380 xseed = pixPtr->
Coord(0);
381 yseed = pixPtr->
Coord(1);
384 xyCand[0][0] += pixPtr->
Coord(0) * cont;
385 xyCand[0][1] += pixPtr->
Coord(1) * cont;
386 sigCand[0][0] += pixPtr->
Coord(0) * pixPtr->
Coord(0) * cont;
387 sigCand[0][1] += pixPtr->
Coord(1) * pixPtr->
Coord(1) * cont;
389 xyseed[ifit-1][0] = xseed;
390 xyseed[ifit-1][1] = yseed;
391 qseed[ifit-1] = cmax;
396 sigCand[0][0] = sigCand[0][0]/qq - xyCand[0][0]*xyCand[0][0];
397 sigCand[0][0] = sigCand[0][0] > 0 ? TMath::Sqrt (sigCand[0][0]) : 0;
398 sigCand[0][1] = sigCand[0][1]/qq - xyCand[0][1]*xyCand[0][1];
399 sigCand[0][1] = sigCand[0][1] > 0 ? TMath::Sqrt (sigCand[0][1]) : 0;
400 if (
fDebug) cout << xyCand[0][0] <<
" " << xyCand[0][1] <<
" " << sigCand[0][0] <<
" " << sigCand[0][1] << endl;
402 Int_t nDof, maxSeed[3];
404 if ( nfit0 < 0 || nfit0 > 3 ) {
408 TMath::Sort(nfit0, qseed, maxSeed, kTRUE);
410 Double_t step[3]={0.01,0.002,0.02}, fmin, chi2o = 9999, chi2n;
411 Double_t *gin = 0, func0, func1, param[8]={0}, step0[8]={0};
412 Double_t param0[2][8]={{0},{0}}, deriv[2][8]={{0},{0}};
413 Double_t shift[8]={0}, stepMax, derMax, parmin[8]={0}, parmax[8]={0}, func2[2]={0}, shift0;
414 Double_t delta[8]={0}, scMax, dder[8], estim, shiftSave = 0;
415 Int_t min, max, nCall = 0, nLoop, idMax = 0, nFail;
416 Double_t rad, dist[3] = {0};
421 for (Int_t iseed = 0; iseed < nfit; ++iseed)
424 Int_t memory[8] = {0};
427 for (Int_t j = 0; j <
fNpar; ++j)
432 parmin[
fNpar] = 1E-9;
438 param[
fNpar] = xyCand[0][0];
442 param[
fNpar] = xyseed[maxSeed[iseed]][0];
445 parmin[
fNpar] = xmin;
446 parmax[
fNpar++] = xmax;
449 param[
fNpar] = xyCand[0][1];
453 param[
fNpar] = xyseed[maxSeed[iseed]][1];
456 parmin[
fNpar] = ymin;
457 parmax[
fNpar++] = ymax;
459 for (Int_t j = 0; j <
fNpar; ++j)
461 step0[j] = shift[j] = step[j%3];
466 for (Int_t j = 0; j <
fNpar; ++j)
472 for (Int_t j = 0; j <
fNpar; ++j) cout << param[j] <<
" ";
477 min = nLoop = 1; stepMax = func2[1] = derMax = 999999; nFail = 0;
482 Fcn1(cluster,fNpar, gin, func0, param, iflag); nCall++;
487 for (Int_t j = 0; j <
fNpar; ++j)
489 param0[max][j] = param[j];
491 param[j] += delta[j] / 10;
492 if (j > 0) param[j-1] -= delta[j-1] / 10;
493 Fcn1(cluster,fNpar, gin, func1, param, iflag); nCall++;
494 deriv[max][j] = (func1 - func0) / delta[j] * 10;
496 dder[j] = param0[0][j] != param0[1][j] ? (deriv[0][j] - deriv[1][j]) /
497 (param0[0][j] - param0[1][j]) : 0;
499 param[fNpar-1] -= delta[fNpar-1] / 10;
500 if (nCall > 2000)
break;
502 min = func2[0] < func2[1] ? 0 : 1;
503 nFail = min == max ? 0 : nFail + 1;
505 stepMax = derMax = estim = 0;
506 for (Int_t j = 0; j <
fNpar; ++j)
512 shift[j] = TMath::Sign (step0[j], -deriv[max][j]);
514 else if (TMath::Abs(deriv[0][j]) < 1.e-3 && TMath::Abs(deriv[1][j]) < 1.e-3)
518 else if (((deriv[min][j]*deriv[!min][j] > 0) && (TMath::Abs(deriv[min][j]) > TMath::Abs(deriv[!min][j])))
519 || (TMath::Abs(deriv[0][j]-deriv[1][j]) < 1.e-3) || (TMath::Abs(dder[j]) < 1.e-6))
521 shift[j] = -TMath::Sign (shift[j], (func2[0]-func2[1]) * (param0[0][j]-param0[1][j]));
533 shift[j] = dder[j] != 0 ? -deriv[min][j] / dder[j] : 0;
537 Double_t es = TMath::Abs(shift[j]) / step0[j];
544 if (TMath::Abs(shift[j])/step0[j] > 10) shift[j] = TMath::Sign(10.,shift[j]) * step0[j];
550 param[j] = param0[min][j];
551 if (TMath::Abs(shift[j]+shift0) > 0.1*step0[j])
553 shift[j] = (shift[j] + shift0) / 2;
562 if (TMath::Abs(shift[j]*deriv[min][j]) > func2[min])
564 shift[j] = TMath::Sign (func2[min]/deriv[min][j], shift[j]);
570 scMax = 1 + 4 / TMath::Max(nLoop/2.,1.);
571 if (TMath::Abs(shift0) > 0 && TMath::Abs(shift[j]/shift0) > scMax)
573 shift[j] = TMath::Sign (shift0*scMax, shift[j]);
576 param[j] += shift[j];
578 if (param[j] < parmin[j])
580 shift[j] = parmin[j] - param[j];
581 param[j] = parmin[j];
583 else if (param[j] > parmax[j])
585 shift[j] = parmax[j] - param[j];
586 param[j] = parmax[j];
589 stepMax = TMath::Max (stepMax, TMath::Abs(shift[j]/step0[j]));
590 if (TMath::Abs(deriv[min][j]) > derMax)
593 derMax = TMath::Abs (deriv[min][j]);
597 if (((estim < 1) && (derMax < 2)) || nLoop > 150)
break;
602 if (shift[idMax] == 0)
604 shift[idMax] = step0[idMax]/10;
605 param[idMax] += shift[idMax];
609 if (!memory[idMax] && derMax > 0.5 && nLoop > 10)
611 if (dder[idMax] != 0 && TMath::Abs(deriv[min][idMax]/dder[idMax]/shift[idMax]) > 10)
613 if (min == max) dder[idMax] = -dder[idMax];
614 shift[idMax] = -deriv[min][idMax] / dder[idMax] / 10;
615 param[idMax] += shift[idMax];
616 stepMax = TMath::Max (stepMax, TMath::Abs(shift[idMax])/step0[idMax]);
617 if (min == max) shiftSave = shift[idMax];
621 param[idMax] -= shift[idMax];
622 shift[idMax] = 4 * shiftSave * (gRandom->Rndm(0) - 0.5);
623 param[idMax] += shift[idMax];
630 nDof = npads - fNpar + nVirtual;
633 if (
fDebug) cout <<
" Chi2 " << chi2n <<
" " << fNpar << endl;
637 if (fNpar > 2 && (chi2n > chi2o || ((iseed == nfit-1)
638 && (chi2n * (1+TMath::Min(1-param0[min][fNpar-3],0.25)) > chi2o))))
639 { fNpar -= 3;
break; }
646 for (Int_t i=0; i<
fNpar; ++i)
if (i == 0 || i == 2 || i == 5)
647 param0[min][i] = xyCand[0][0];
652 for (Int_t i=0; i<
fNpar; ++i)
if (i == 1 || i == 3 || i == 6)
653 param0[min][i] = xyCand[0][1];
681 for (Int_t i = 0; i <
fNpar; ++i) {
682 parOk[i] = param0[min][i];
686 parOk[i] = TMath::Max (parOk[i], parmin[i]);
687 parOk[i] = TMath::Min (parOk[i], parmax[i]);
691 if (fmin < 0.1)
break;
695 for (Int_t i=0; i<
fNpar; ++i) {
696 if (i == 4 || i == 7) {
697 if ((i == 7) || ((i == 4) && (fNpar < 7))) cout << parOk[i] << endl;
698 else cout << parOk[i] * (1-parOk[7]) << endl;
701 cout << parOk[i] <<
" " << errOk[i] << endl;
704 nfit = (
fNpar + 1) / 3;
705 dist[0] = dist[1] = dist[2] = 0;
709 dist[0] = dist[1] = TMath::Sqrt ((parOk[0]-parOk[2])*
711 +(parOk[1]-parOk[3])*
712 (parOk[1]-parOk[3]));
714 dist[2] = TMath::Sqrt ((parOk[0]-parOk[5])*
716 +(parOk[1]-parOk[6])*
717 (parOk[1]-parOk[6]));
718 rad = TMath::Sqrt ((parOk[2]-parOk[5])*
720 +(parOk[3]-parOk[6])*
721 (parOk[3]-parOk[6]));
722 if (dist[2] < dist[0]) dist[0] = dist[2];
723 if (rad < dist[1]) dist[1] = rad;
724 if (rad < dist[2]) dist[2] = rad;
732 for (Int_t j = 0; j < nfit; ++j) {
749 cluster1->
SetPosition(TVector2(parOk[indx],parOk[indx+1]),TVector2(sigCand[0][0],sigCand[0][1]));
751 Int_t idx = TMath::LocMin(nfit,dist);
752 if ( idx < 0 || idx > 2 ) {
761 AliDebug(2,Form(
"Adding RawCluster detElemId %4d mult %2d charge %5d (xl,yl)=(%9.6g,%9.6g)",
765 clusterList.Add(cluster1);
785 TH2 *mlem, Double_t *coef,
792 Int_t nx = mlem->GetNbinsX();
793 Int_t ny = mlem->GetNbinsY();
794 Int_t nPix =
fPixArray->GetEntriesFast();
797 Int_t nclust = 0, indx, indx1, nxy = ny * nx;
798 Bool_t *used =
new Bool_t[nxy];
800 for (Int_t j = 0; j < nxy; ++j) used[j] = kFALSE;
806 for (Int_t i = 1; i <= ny; ++i)
808 for (Int_t j = 1; j <= nx; ++j)
810 indx = (i-1)*nx + j - 1;
811 if (used[indx])
continue;
812 cont = mlem->GetBinContent(mlem->GetBin(j,i));
817 AddBin(mlem, i, j, 0, used, pix);
818 if (nclust >= 200)
AliFatal(
" Too many clusters !!!");
819 clusters[nclust++] = pix;
822 if (
fDebug) cout << nclust << endl;
845 TMatrixD aijclupad(nclust,npad);
848 for (Int_t iclust = 0; iclust < nclust; ++iclust)
850 pix = clusters[iclust];
851 npxclu = pix->GetEntriesFast();
852 for (Int_t i = 0; i < npxclu; ++i)
854 indx =
fPixArray->IndexOf(pix->UncheckedAt(i));
855 for (Int_t j = 0; j < npad; ++j)
860 aijclupad(iclust,j) += coef[j*nPix+indx];
866 TMatrixD aijcluclu(nclust,nclust);
868 for (Int_t iclust = 0; iclust < nclust; ++iclust)
870 for (Int_t j = 0; j < npad; ++j)
876 for (Int_t iclust1=iclust+1; iclust1<nclust; iclust1++)
879 aijcluclu(iclust,iclust1) +=
880 TMath::Sqrt (aijclupad(iclust,j)*aijclupad(iclust1,j));
884 for (Int_t iclust = 0; iclust < nclust; ++iclust)
886 for (Int_t iclust1 = iclust+1; iclust1 < nclust; ++iclust1)
888 aijcluclu(iclust1,iclust) = aijcluclu(iclust,iclust1);
892 if (
fDebug && nclust > 1) aijcluclu.Print();
895 used =
new Bool_t[nclust];
896 for (Int_t j = 0; j < nclust; ++j) used[j] = kFALSE;
898 Int_t *clustNumb =
new Int_t[nclust];
899 Int_t nCoupled, nForFit, minGroup[3], clustFit[3], nfit = 0;
901 Double_t parOk[8] = {0};
903 for (Int_t igroup = 0; igroup < nclust; ++igroup)
905 if (used[igroup])
continue;
906 used[igroup] = kTRUE;
907 clustNumb[0] = igroup;
910 AddCluster(igroup, nclust, aijcluclu, used, clustNumb, nCoupled);
913 cout <<
" nCoupled: " << nCoupled << endl;
914 for (Int_t i=0; i<nCoupled; ++i) cout << clustNumb[i] <<
" "; cout << endl;
924 for (Int_t i = 0; i < nCoupled; ++i) clustFit[i] = clustNumb[i];
931 for (Int_t j = 0; j < 3; ++j) minGroup[j] = -1;
932 Double_t coupl =
MinGroupCoupl(nCoupled, clustNumb, aijcluclu, minGroup);
936 while (nForFit < 3 && minGroup[nForFit] >= 0)
938 if (
fDebug) cout << clustNumb[minGroup[nForFit]] <<
" ";
939 clustFit[nForFit] = clustNumb[minGroup[nForFit]];
940 clustNumb[minGroup[nForFit]] -= 999;
943 if (
fDebug) cout <<
" nForFit " << nForFit <<
" " << coupl << endl;
947 if (
SelectPad(cluster,nCoupled, nForFit, clustNumb, clustFit, aijclupad) < 3 && nCoupled > 1)
950 for (Int_t j = 0; j < npad; ++j)
961 Merge(cluster,nForFit, nCoupled, clustNumb, clustFit, clusters, aijcluclu, aijclupad);
966 nfit =
Fit(cluster,0, nForFit, clustFit, clusters, parOk, clusterList, mlem);
978 for (Int_t j = 0; j < npad; ++j)
988 Int_t beg = 0, end = nCoupled - 1;
991 if (clustNumb[beg] >= 0) { ++beg;
continue; }
992 for (Int_t j = end; j > beg; --j)
994 if (clustNumb[j] < 0)
continue;
996 indx = clustNumb[beg];
997 clustNumb[beg] = clustNumb[j];
1004 nCoupled -= nForFit;
1008 for (Int_t iclust = nCoupled; iclust < nCoupled+nForFit; ++iclust)
1010 indx = clustNumb[iclust] + 999;
1011 for (Int_t iclust1 = 0; iclust1 < nCoupled; ++iclust1)
1013 indx1 = clustNumb[iclust1];
1014 aijcluclu(indx,indx1) = aijcluclu(indx1,indx) = 0;
1020 for (Int_t j = 0; j < npad; ++j)
1025 for (Int_t iclust=0; iclust<nCoupled; ++iclust)
1027 indx = clustNumb[iclust];
1029 for (Int_t iclust1 = iclust+1; iclust1 < nCoupled; ++iclust1)
1031 indx1 = clustNumb[iclust1];
1034 aijcluclu(indx,indx1) -=
1035 TMath::Sqrt (aijclupad(indx,j)*aijclupad(indx1,j));
1036 aijcluclu(indx1,indx) = aijcluclu(indx,indx1);
1046 for (Int_t iclust = 0; iclust < nclust; ++iclust)
1048 pix = clusters[iclust];
1052 delete [] clustNumb;
1060 Int_t nForFit, Int_t nCoupled,
1061 const Int_t *clustNumb,
const Int_t *clustFit,
1063 TMatrixD& aijcluclu, TMatrixD& aijclupad)
1067 Int_t indx, indx1, npxclu, imax=0;
1071 for (Int_t icl = 0; icl < nForFit; ++icl)
1073 indx = clustFit[icl];
1074 pix = clusters[indx];
1075 npxclu = pix->GetEntriesFast();
1077 for (Int_t icl1 = 0; icl1 < nCoupled; ++icl1)
1079 indx1 = clustNumb[icl1];
1080 if (indx1 < 0)
continue;
1081 if ( aijcluclu(indx,indx1) > couplMax)
1083 couplMax = aijcluclu(indx,indx1);
1088 pix1 = clusters[imax];
1090 for (Int_t i = 0; i < npxclu; ++i)
1092 pix1->Add(pix->UncheckedAt(i));
1097 for (Int_t icl1 = 0; icl1 < nCoupled; ++icl1)
1099 indx1 = clustNumb[icl1];
1100 if (indx1 < 0 || indx1 == imax)
continue;
1101 aijcluclu(indx1,imax) += aijcluclu(indx,indx1);
1102 aijcluclu(imax,indx1) = aijcluclu(indx1,imax);
1104 aijcluclu(indx,imax) = aijcluclu(imax,indx) = 0;
1108 for (Int_t j = 0; j < mult; ++j)
1113 aijclupad(imax,j) += aijclupad(indx,j);
1114 aijclupad(indx,j) = 0;
1123 const TMatrixD& aijcluclu, Int_t *minGroup)
1127 Int_t i123max = TMath::Min(3,nCoupled/2);
1128 Int_t indx, indx1, indx2, indx3, nTot = 0;
1129 Double_t *coupl1 = 0, *coupl2 = 0, *coupl3 = 0;
1131 for (Int_t i123 = 1; i123 <= i123max; ++i123) {
1134 coupl1 =
new Double_t [nCoupled];
1135 for (Int_t i = 0; i < nCoupled; ++i) coupl1[i] = 0;
1137 else if (i123 == 2) {
1138 nTot = nCoupled*nCoupled;
1139 coupl2 =
new Double_t [nTot];
1140 for (Int_t i = 0; i < nTot; ++i) coupl2[i] = 9999;
1142 nTot = nTot*nCoupled;
1143 coupl3 =
new Double_t [nTot];
1144 for (Int_t i = 0; i < nTot; ++i) coupl3[i] = 9999;
1147 for (Int_t i = 0; i < nCoupled; ++i) {
1148 indx1 = clustNumb[i];
1149 for (Int_t j = i+1; j < nCoupled; ++j) {
1150 indx2 = clustNumb[j];
1152 coupl1[i] += aijcluclu(indx1,indx2);
1153 coupl1[j] += aijcluclu(indx1,indx2);
1155 else if (i123 == 2) {
1156 indx = i*nCoupled + j;
1157 coupl2[indx] = coupl1[i] + coupl1[j];
1158 coupl2[indx] -= 2 * (aijcluclu(indx1,indx2));
1160 for (Int_t k = j+1; k < nCoupled; ++k) {
1161 indx3 = clustNumb[k];
1162 indx = i*nCoupled*nCoupled + j*nCoupled + k;
1163 coupl3[indx] = coupl2[i*nCoupled+j] + coupl1[k];
1164 coupl3[indx] -= 2 * (aijcluclu(indx1,indx3)+aijcluclu(indx2,indx3));
1172 Double_t couplMin = 9999;
1175 for (Int_t i123 = 1; i123 <= i123max; ++i123) {
1177 locMin = TMath::LocMin(nCoupled, coupl1);
1178 couplMin = coupl1[locMin];
1179 minGroup[0] = locMin;
1182 else if (i123 == 2) {
1183 locMin = TMath::LocMin(nCoupled*nCoupled, coupl2);
1184 if (coupl2[locMin] < couplMin) {
1185 couplMin = coupl2[locMin];
1186 minGroup[0] = locMin/nCoupled;
1187 minGroup[1] = locMin%nCoupled;
1191 locMin = TMath::LocMin(nTot, coupl3);
1192 if (coupl3[locMin] < couplMin) {
1193 couplMin = coupl3[locMin];
1194 minGroup[0] = locMin/nCoupled/nCoupled;
1195 minGroup[1] = locMin%(nCoupled*nCoupled)/nCoupled;
1196 minGroup[2] = locMin%nCoupled;
1207 Int_t nCoupled, Int_t nForFit,
1208 const Int_t *clustNumb,
const Int_t *clustFit,
1209 const TMatrixD& aijclupad)
1215 Double_t *padpix = 0;
1219 padpix =
new Double_t[npad];
1220 for (Int_t i = 0; i < npad; ++i) padpix[i] = 0.;
1223 Int_t nOK = 0, indx, indx1;
1224 for (Int_t iclust = 0; iclust < nForFit; ++iclust)
1226 indx = clustFit[iclust];
1227 for (Int_t j = 0; j < npad; ++j)
1248 for (Int_t iclust1 = 0; iclust1 < nCoupled; ++iclust1)
1250 indx1 = clustNumb[iclust1];
1251 if (indx1 < 0)
continue;
1253 padpix[j] += aijclupad(indx1,j);
1258 if (nCoupled < 4)
return nOK;
1261 for (Int_t j = 0; j < npad; ++j)
1276 Int_t , Double_t *par)
1281 Double_t charge, coef=0;
1283 for (Int_t j = 0; j < mult; ++j)
1291 for (Int_t i = 0; i <= iend; ++i)
static AliMq::Station12Type GetStation12Type(Int_t detElemId)
void Merge(const AliMUONCluster &cluster, Int_t nForFit, Int_t nCoupled, const Int_t *clustNumb, const Int_t *clustFit, TObjArray **clusters, TMatrixD &aijcluclu, TMatrixD &aijclupad)
Bool_t IsReal() const
Return info whether this is a real pad or a virtual one.
Double_t fLowestPadCharge
! minimum allowed pad charge
void SetStatus(Int_t status)
Set status word.
void Fcn1(const AliMUONCluster &cluster, Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
static Float_t Pitch()
Return wire pitch.
Double_t fLowestClusterCharge
! minimum allowed cluster charge
Double_t MinGroupCoupl(Int_t nCoupled, const Int_t *clustNumb, const TMatrixD &aijcluclu, Int_t *minGroup)
Bool_t IsSaturated() const
Return info whether this pad is saturated or not.
Float_t IntXY(Float_t xi1, Float_t yi1, Float_t xi2, Float_t yi2) const
Charge integration on region (x1,y1,x2,y2).
static Int_t GetCoupledFlag()
Return coupled pad flag.
TObject * BinToPix(TH2 *mlem, Int_t jc, Int_t ic)
A group of adjacent pads.
static Float_t SqrtKy3St1()
Return SqrtKy3 for Station 1 & 2.
static Float_t SqrtKx3()
Return SqrtKx3 for Slat.
static Int_t GetUseForFitFlag()
Return should be used for fit flag.
Implementation of Mathieson response.
Double_t fQtot
! total charge
TVector2 Dimensions() const
Return half dimensions in x and y (cm)
void Split(const AliMUONCluster &cluster, TH2 *mlem, Double_t *coef, TObjArray &clusterList)
Splitter class for the MLEM algorithm.
Int_t Multiplicity() const
void SetPosition(const TVector2 &pos, const TVector2 &errorOnPos)
Set (x,y) of that cluster and errors.
Int_t fNpar
! number of fit parameters
static Float_t PitchSt1()
Return wire pitch for Station 1 & 2.
static Float_t SqrtKy3()
Return SqrtKy3 for Slat.
void AddBin(TH2 *mlem, Int_t ic, Int_t jc, Int_t mode, Bool_t *used, TObjArray *pix)
static Float_t SqrtKx3St1()
Return SqrtKx3 for Station 1 & 2.
static Int_t GetOverFlag()
Return processing is over flag.
void SetCharge(Double_t charge)
Set charge.
static Int_t GetZeroFlag()
Return pad "basic" state flag.
Int_t SelectPad(const AliMUONCluster &cluster, Int_t nCoupled, Int_t nForFit, const Int_t *clustNumb, const Int_t *clustFit, const TMatrixD &aijclupad)
static const Double_t fgkCouplMin
threshold on coupling
void SetPitch(Float_t p1)
void SetCharge(Float_t chargeCath0, Float_t chargeCath1)
Set cathode (re)computed charges.
Double_t Param2Coef(Int_t icand, Double_t coef, Double_t *par) const
void UpdatePads(const AliMUONCluster &cluster, Int_t nfit, Double_t *par)
#define AliFatal(message)
static Int_t GetModifiedFlag()
Return modified pad charge flag.
TVector2 Position() const
Return (x,y) of that cluster.
void AddCluster(Int_t ic, Int_t nclust, TMatrixD &aijcluclu, Bool_t *used, Int_t *clustNumb, Int_t &nCoupled)
void SetChi2(Float_t chi2)
Set chi2 of the RawCharge fit.
TVector2 Position() const
Return positions in x and y (cm)
#define AliDebug(logLevel, message)
Long_t NofPads(Int_t cathode, Int_t statusMask, Bool_t matchMask) const
Compute number of pads in X and Y direction for a given cathode.
AliMUONMathieson * fMathieson
! Mathieson
virtual ~AliMUONClusterSplitterMLEM()
Int_t PairFirst(MpPair_t pair)
Decode the first integer from encoded pair.
Int_t fDebug
! debug level
Double_t Charge() const
Return pad charge.
Int_t Fit(const AliMUONCluster &cluster, Int_t iSimple, Int_t nfit, const Int_t *clustFit, TObjArray **clusters, Double_t *parOk, TObjArray &clusterList, TH2 *mlem)
Double_t Coord(Int_t ixy) const
Double_t fLowestPixelCharge
! minimum allowed pixel charge
Float_t ChargeIntegration(Double_t x, Double_t y, const AliMUONPad &pad)
#define AliError(message)
Int_t PairSecond(MpPair_t pair)
Decode the second integer from encoded pair.
Int_t Status() const
Return status word.
AliMUONPad * Pad(Int_t index) const
Combination of digit and mppad informations.
Int_t fnCoupled
! number of coupled pixels ?
Int_t fDetElemId
! detection element we are working on