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 **************************************************************************/
18 #include "AliRICHClusterFinder.h"
21 #include "AliRICHHit.h"
22 #include "AliRICHHitMapA1.h"
23 #include "AliRICHCerenkov.h"
24 #include "AliRICHSDigit.h"
25 #include "AliRICHDigit.h"
26 #include "AliRICHRawCluster.h"
34 #include <TPostScript.h>
37 //----------------------------------------------------------
38 static AliSegmentation* gSegmentation;
39 static AliRICHResponse* gResponse;
40 static Int_t gix[500];
41 static Int_t giy[500];
42 static Float_t gCharge[500];
44 static Int_t gFirst=kTRUE;
45 static TMinuit *gMyMinuit ;
46 void fcn(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag);
47 static Int_t gChargeTot;
49 ClassImp(AliRICHClusterFinder)
51 AliRICHClusterFinder::AliRICHClusterFinder
52 (AliSegmentation *segmentation, AliRICHResponse *response,
53 TClonesArray *digits, Int_t chamber)
56 // Constructor for Cluster Finder object
58 fSegmentation=segmentation;
62 fNdigits = fDigits->GetEntriesFast();
64 fRawClusters=new TClonesArray("AliRICHRawCluster",10000);
73 AliRICHClusterFinder::AliRICHClusterFinder()
76 // Default constructor
84 fRawClusters=new TClonesArray("AliRICHRawCluster",10000);
94 AliRICHClusterFinder::AliRICHClusterFinder(const AliRICHClusterFinder& ClusterFinder)
99 AliRICHClusterFinder::~AliRICHClusterFinder()
107 void AliRICHClusterFinder::AddRawCluster(const AliRICHRawCluster c)
110 // Add a raw cluster copy to the list
112 AliRICH *pRICH=(AliRICH*)gAlice->GetModule("RICH");
113 pRICH->AddRawCluster(fChamber,c);
119 void AliRICHClusterFinder::Decluster(AliRICHRawCluster *cluster)
123 // Decluster algorithm
125 Int_t mul = cluster->fMultiplicity;
126 // printf("Decluster - multiplicity %d \n",mul);
128 if (mul == 1 || mul ==2) {
130 // Nothing special for 1- and 2-clusters
132 cluster->fNcluster[0]=fNPeaks;
133 cluster->fNcluster[1]=0;
135 AddRawCluster(*cluster);
137 } else if (mul ==3) {
139 // 3-cluster, check topology
140 // printf("\n 3-cluster, check topology \n");
141 if (fDeclusterFlag) {
142 if (Centered(cluster)) {
143 // ok, cluster is centered
145 // cluster is not centered, split into 2+1
149 cluster->fNcluster[0]=fNPeaks;
150 cluster->fNcluster[1]=0;
152 AddRawCluster(*cluster);
157 // 4-and more-pad clusters
159 if (mul <= fClusterSize) {
160 if (fDeclusterFlag) {
161 SplitByLocalMaxima(cluster);
164 cluster->fNcluster[0]=fNPeaks;
165 cluster->fNcluster[1]=0;
167 AddRawCluster(*cluster);
175 Bool_t AliRICHClusterFinder::Centered(AliRICHRawCluster *cluster)
178 // Is the cluster centered?
181 dig= (AliRICHDigit*)fDigits->UncheckedAt(cluster->fIndexMap[0]);
182 Int_t ix=dig->PadX();
183 Int_t iy=dig->PadY();
185 Int_t x[kMaxNeighbours], y[kMaxNeighbours], xN[kMaxNeighbours], yN[kMaxNeighbours];
187 fSegmentation->Neighbours(ix,iy,&nn,x,y);
189 for (Int_t i=0; i<nn; i++) {
190 if (fHitMap->TestHit(x[i],y[i]) == kUsed) {
195 //printf("Getting: %d %d %d\n",i,x[i],y[i]);
200 // cluster is centered !
202 cluster->fNcluster[0]=fNPeaks;
203 cluster->fNcluster[1]=0;
206 AddRawCluster(*cluster);
211 // Highest signal on an edge, split cluster into 2+1
213 // who is the neighbour ?
215 //printf("Calling GetIndex with x:%d y:%d\n",xN[0], yN[0]);
217 Int_t nind=fHitMap->GetHitIndex(xN[0], yN[0]);
218 Int_t i1= (nind==cluster->fIndexMap[1]) ? 1:2;
219 Int_t i2= (nind==cluster->fIndexMap[1]) ? 2:1;
222 AliRICHRawCluster cnew;
224 cnew.fNcluster[0]=-1;
225 cnew.fNcluster[1]=fNRawClusters;
227 cnew.fNcluster[0]=fNPeaks;
230 cnew.fMultiplicity=2;
231 cnew.fIndexMap[0]=cluster->fIndexMap[0];
232 cnew.fIndexMap[1]=cluster->fIndexMap[i1];
234 cnew.fClusterType=cnew.PhysicsContribution();
239 cluster->fMultiplicity=1;
240 cluster->fIndexMap[0]=cluster->fIndexMap[i2];
241 cluster->fIndexMap[1]=0;
242 cluster->fIndexMap[2]=0;
243 FillCluster(cluster);
245 cluster->fNcluster[0]=fNPeaks;
246 cluster->fNcluster[1]=0;
248 cluster->fClusterType=cluster->PhysicsContribution();
249 AddRawCluster(*cluster);
253 printf("\n Completely screwed up %d !! \n",nd);
259 void AliRICHClusterFinder::SplitByLocalMaxima(AliRICHRawCluster *c)
263 // Split the cluster according to the number of maxima inside
266 AliRICHDigit* dig[100], *digt;
267 Int_t ix[100], iy[100], q[100];
268 Float_t x[100], y[100], zdum;
269 Int_t i; // loops over digits
270 Int_t j; // loops over local maxima
273 // Int_t threshold=500;
274 Int_t mul=c->fMultiplicity;
276 // dump digit information into arrays
278 for (i=0; i<mul; i++)
280 dig[i]= (AliRICHDigit*)fDigits->UncheckedAt(c->fIndexMap[i]);
281 ix[i]= dig[i]->PadX();
282 iy[i]= dig[i]->PadY();
283 q[i] = dig[i]->Signal();
284 fSegmentation->GetPadC(ix[i], iy[i], x[i], y[i], zdum);
291 Int_t associatePeak[100];
294 Int_t xNei[kMaxNeighbours], yNei[kMaxNeighbours];
295 for (i=0; i<mul; i++) {
296 fSegmentation->Neighbours(ix[i], iy[i], &nn, xNei, yNei);
298 for (j=0; j<nn; j++) {
299 if (fHitMap->TestHit(xNei[j], yNei[j])==kEmpty) continue;
300 digt=(AliRICHDigit*) fHitMap->GetHit(xNei[j], yNei[j]);
301 if (digt->Signal() > q[i]) {
305 // handle special case of neighbouring pads with equal signal
306 } else if (digt->Signal() == q[i]) {
308 for (Int_t k=0; k<nLocal; k++) {
309 if (xNei[j]==ix[indLocal[k]] && yNei[j]==iy[indLocal[k]]){
315 } // loop over next neighbours
316 // Maxima should not be on the edge
321 } // loop over all digits
322 // printf("Found %d local Maxima",nLocal);
324 // If only one local maximum found but multiplicity is high
325 // take global maximum from the list of digits.
326 if (nLocal==1 && mul>5) {
328 for (i=0; i<mul; i++) {
339 // If number of local maxima is 2 try to fit a double gaussian
342 // Initialise global variables for fit
344 gSegmentation=fSegmentation;
345 gResponse =fResponse;
348 for (i=0; i<mul; i++) {
351 gCharge[i]=Float_t(q[i]);
356 gMyMinuit = new TMinuit(5);
358 gMyMinuit->SetFCN(fcn);
359 gMyMinuit->mninit(5,10,7);
360 Double_t arglist[20];
363 // gMyMinuit->mnexcm("SET ERR",arglist,1,ierflag);
364 // Set starting values
365 static Double_t vstart[5];
366 vstart[0]=x[indLocal[0]];
367 vstart[1]=y[indLocal[0]];
368 vstart[2]=x[indLocal[1]];
369 vstart[3]=y[indLocal[1]];
370 vstart[4]=Float_t(q[indLocal[0]])/
371 Float_t(q[indLocal[0]]+q[indLocal[1]]);
372 // lower and upper limits
373 static Double_t lower[5], upper[5];
374 Int_t isec=fSegmentation->Sector(ix[indLocal[0]], iy[indLocal[0]]);
375 lower[0]=vstart[0]-fSegmentation->Dpx(isec)/2;
376 lower[1]=vstart[1]-fSegmentation->Dpy(isec)/2;
377 // lower[1]=vstart[1];
379 upper[0]=lower[0]+fSegmentation->Dpx(isec);
380 upper[1]=lower[1]+fSegmentation->Dpy(isec);
381 // upper[1]=vstart[1];
383 isec=fSegmentation->Sector(ix[indLocal[1]], iy[indLocal[1]]);
384 lower[2]=vstart[2]-fSegmentation->Dpx(isec)/2;
385 lower[3]=vstart[3]-fSegmentation->Dpy(isec)/2;
386 // lower[3]=vstart[3];
388 upper[2]=lower[2]+fSegmentation->Dpx(isec);
389 upper[3]=lower[3]+fSegmentation->Dpy(isec);
390 // upper[3]=vstart[3];
395 static Double_t step[5]={0.005, 0.03, 0.005, 0.03, 0.01};
397 gMyMinuit->mnparm(0,"x1",vstart[0],step[0],lower[0],upper[0],ierflag);
398 gMyMinuit->mnparm(1,"y1",vstart[1],step[1],lower[1],upper[1],ierflag);
399 gMyMinuit->mnparm(2,"x2",vstart[2],step[2],lower[2],upper[2],ierflag);
400 gMyMinuit->mnparm(3,"y2",vstart[3],step[3],lower[3],upper[3],ierflag);
401 gMyMinuit->mnparm(4,"a0",vstart[4],step[4],lower[4],upper[4],ierflag);
402 // ready for minimisation
403 gMyMinuit->SetPrintLevel(-1);
404 gMyMinuit->mnexcm("SET OUT", arglist, 0, ierflag);
408 gMyMinuit->mnexcm("SET NOGR", arglist, 0, ierflag);
409 gMyMinuit->mnexcm("SCAN", arglist, 0, ierflag);
410 gMyMinuit->mnexcm("EXIT" , arglist, 0, ierflag);
412 // Double_t amin,edm,errdef;
413 // Int_t nvpar,nparx,icstat;
414 // gMyMinuit->mnstat(amin,edm,errdef,nvpar,nparx,icstat);
415 // gMyMinuit->mnprin(3,amin);
416 // Get fitted parameters
418 Double_t xrec[2], yrec[2], qfrac;
420 Double_t epxz, b1, b2;
422 gMyMinuit->mnpout(0, chname, xrec[0], epxz, b1, b2, ierflg);
423 gMyMinuit->mnpout(1, chname, yrec[0], epxz, b1, b2, ierflg);
424 gMyMinuit->mnpout(2, chname, xrec[1], epxz, b1, b2, ierflg);
425 gMyMinuit->mnpout(3, chname, yrec[1], epxz, b1, b2, ierflg);
426 gMyMinuit->mnpout(4, chname, qfrac, epxz, b1, b2, ierflg);
427 //printf("\n %f %f %f %f %f\n", xrec[0], yrec[0], xrec[1], yrec[1],qfrac);
432 // One cluster for each maximum
434 for (j=0; j<2; j++) {
435 AliRICHRawCluster cnew;
437 cnew.fNcluster[0]=-1;
438 cnew.fNcluster[1]=fNRawClusters;
440 cnew.fNcluster[0]=fNPeaks;
443 cnew.fMultiplicity=0;
444 cnew.fX=Float_t(xrec[j]);
445 cnew.fY=Float_t(yrec[j]);
447 cnew.fQ=Int_t(gChargeTot*qfrac);
449 cnew.fQ=Int_t(gChargeTot*(1-qfrac));
451 gSegmentation->SetHit(xrec[j],yrec[j],0);
452 for (i=0; i<mul; i++) {
453 cnew.fIndexMap[cnew.fMultiplicity]=c->fIndexMap[i];
454 gSegmentation->SetPad(gix[i], giy[i]);
455 Float_t q1=gResponse->IntXY(gSegmentation);
456 cnew.fContMap[cnew.fMultiplicity]=Float_t(q[i])/(q1*cnew.fQ);
457 cnew.fMultiplicity++;
459 FillCluster(&cnew,0);
460 //printf("\n x,y %f %f ", cnew.fX, cnew.fY);
461 cnew.fClusterType=cnew.PhysicsContribution();
469 if (nLocal !=-100 || !fitted) {
470 // Check if enough local clusters have been found,
471 // if not add global maxima to the list
477 printf("\n Warning, no local maximum found \n");
481 if (nPerMax > fNperMax) {
482 Int_t nGlob=mul/fNperMax-nLocal+1;
485 for (i=0; i<mul; i++) {
492 if (nnew==nGlob) break;
497 // Associate hits to peaks
499 for (i=0; i<mul; i++) {
502 if (isLocal[i]) continue;
503 for (j=0; j<nLocal; j++) {
504 Int_t il=indLocal[j];
505 Float_t d=TMath::Sqrt((x[i]-x[il])*(x[i]-x[il])
506 +(y[i]-y[il])*(y[i]-y[il]));
509 // Select nearest peak
515 } else if (d==dmin) {
517 // If more than one take highest peak
530 // One cluster for each maximum
532 for (j=0; j<nLocal; j++) {
533 AliRICHRawCluster cnew;
535 cnew.fNcluster[0]=-1;
536 cnew.fNcluster[1]=fNRawClusters;
538 cnew.fNcluster[0]=fNPeaks;
541 cnew.fIndexMap[0]=c->fIndexMap[indLocal[j]];
542 cnew.fMultiplicity=1;
543 for (i=0; i<mul; i++) {
544 if (isLocal[i]) continue;
545 if (associatePeak[i]==j) {
546 cnew.fIndexMap[cnew.fMultiplicity]=c->fIndexMap[i];
547 cnew.fMultiplicity++;
551 cnew.fClusterType=cnew.PhysicsContribution();
559 void AliRICHClusterFinder::FillCluster(AliRICHRawCluster* c, Int_t flag)
562 // Completes cluster information starting from list of digits
578 for (Int_t i=0; i<c->fMultiplicity; i++)
580 dig= (AliRICHDigit*)fDigits->UncheckedAt(c->fIndexMap[i]);
581 ix=dig->PadX()+c->fOffsetMap[i];
583 Int_t q=dig->Signal();
584 if (dig->Physics() >= dig->Signal()) {
586 } else if (dig->Physics() == 0) {
588 } else c->fPhysicsMap[i]=1;
591 // peak signal and track list
593 if (q>c->fPeakSignal) {
596 c->fTracks[0]=dig->Track(0);
597 c->fTracks[1]=dig->Track(1);
598 c->fTracks[2]=dig->Track(2);
600 //c->fTracks[0]=dig->fTrack;
601 c->fTracks[0]=dig->Hit();
602 c->fTracks[1]=dig->Track(0);
603 c->fTracks[2]=dig->Track(1);
606 if (c->fContMap[i] > frac) {
610 c->fTracks[0]=dig->Track(0);
611 c->fTracks[1]=dig->Track(1);
612 c->fTracks[2]=dig->Track(2);
614 //c->fTracks[0]=dig->fTrack;
615 c->fTracks[0]=dig->Hit();
616 c->fTracks[1]=dig->Track(0);
617 c->fTracks[2]=dig->Track(1);
622 fSegmentation->GetPadC(ix, iy, x, y, z);
628 } // loop over digits
633 c->fX=fSegmentation->GetAnod(c->fX);
636 // apply correction to the coordinate along the anode wire
640 fSegmentation->GetPadI(x, y, 0, ix, iy);
641 fSegmentation->GetPadC(ix, iy, x, y, z);
642 Int_t isec=fSegmentation->Sector(ix,iy);
643 TF1* cogCorr = fSegmentation->CorrFunc(isec-1);
646 Float_t yOnPad=(c->fY-y)/fSegmentation->Dpy(isec);
647 c->fY=c->fY-cogCorr->Eval(yOnPad, 0, 0);
653 void AliRICHClusterFinder::FindCluster(Int_t i, Int_t j, AliRICHRawCluster &c){
658 // Add i,j as element of the cluster
661 Int_t idx = fHitMap->GetHitIndex(i,j);
662 AliRICHDigit* dig = (AliRICHDigit*) fHitMap->GetHit(i,j);
663 Int_t q=dig->Signal();
664 if (q > TMath::Abs(c.fPeakSignal)) {
667 c.fTracks[0]=dig->fTracks[0];
668 c.fTracks[1]=dig->fTracks[1];
669 c.fTracks[2]=dig->fTracks[2];
671 //c.fTracks[0]=dig->fTrack;
672 c.fTracks[0]=dig->Hit();
673 c.fTracks[1]=dig->Track(0);
674 c.fTracks[2]=dig->Track(1);
677 // Make sure that list of digits is ordered
679 Int_t mu=c.fMultiplicity;
682 if (dig->Physics() >= dig->Signal()) {
684 } else if (dig->Physics() == 0) {
686 } else c.fPhysicsMap[mu]=1;
689 for (Int_t ind=mu-1; ind>=0; ind--) {
690 Int_t ist=(c.fIndexMap)[ind];
691 Int_t ql=((AliRICHDigit*)fDigits
692 ->UncheckedAt(ist))->Signal();
694 c.fIndexMap[ind]=idx;
695 c.fIndexMap[ind+1]=ist;
704 if (c.fMultiplicity >= 50 ) {
705 printf("FindCluster - multiplicity >50 %d \n",c.fMultiplicity);
709 // Prepare center of gravity calculation
711 fSegmentation->GetPadC(i, j, x, y, z);
716 fHitMap->FlagHit(i,j);
718 // Now look recursively for all neighbours
721 Int_t xList[kMaxNeighbours], yList[kMaxNeighbours];
722 fSegmentation->Neighbours(i,j,&nn,xList,yList);
723 for (Int_t in=0; in<nn; in++) {
726 if (fHitMap->TestHit(ix,iy)==kUnused) FindCluster(ix, iy, c);
730 //_____________________________________________________________________________
732 void AliRICHClusterFinder::FindRawClusters()
735 // simple RICH cluster finder from digits -- finds neighbours and
736 // fill the tree with raw clusters
738 if (!fNdigits) return;
740 fHitMap = new AliRICHHitMapA1(fSegmentation, fDigits);
744 //printf ("Now I'm here");
750 for (ndig=0; ndig<fNdigits; ndig++) {
751 dig = (AliRICHDigit*)fDigits->UncheckedAt(ndig);
754 if (fHitMap->TestHit(i,j)==kUsed ||fHitMap->TestHit(i,j)==kEmpty) {
760 c.fPeakSignal=dig->Signal();
762 c.fTracks[0]=dig->fTracks[0];
763 c.fTracks[1]=dig->fTracks[1];
764 c.fTracks[2]=dig->fTracks[2];
766 //c.fTracks[0]=dig->fTrack;
767 c.fTracks[0]=dig->Hit();
768 c.fTracks[1]=dig->Track(0);
769 c.fTracks[2]=dig->Track(1);
770 // tag the beginning of cluster list in a raw cluster
775 c.fX=fSegmentation->GetAnod(c.fX);
778 // apply correction to the coordinate along the anode wire
785 fSegmentation->GetPadI(x, y, 0, ix, iy);
786 fSegmentation->GetPadC(ix, iy, x, y, z);
787 Int_t isec=fSegmentation->Sector(ix,iy);
788 TF1* cogCorr=fSegmentation->CorrFunc(isec-1);
790 Float_t yOnPad=(c.fY-y)/fSegmentation->Dpy(isec);
791 c.fY=c.fY-cogCorr->Eval(yOnPad,0,0);
795 // Analyse cluster and decluster if necessary
798 c.fNcluster[1]=fNRawClusters;
799 c.fClusterType=c.PhysicsContribution();
805 // reset Cluster object
806 for (int k=0;k<c.fMultiplicity;k++) {
814 void AliRICHClusterFinder::
825 fSegmentation->GiveTestPoints(n, x, y);
826 for (i=0; i<n; i++) {
830 SinoidalFit(xtest, ytest, func);
831 if (func) fSegmentation->SetCorrFunc(i, new TF1(*func));
837 void AliRICHClusterFinder::
838 SinoidalFit(Float_t x, Float_t y, TF1 *func)
843 static Int_t count=0;
848 sprintf(canvasname,"c%d",count);
851 Float_t xg[kNs], yg[kNs], xrg[kNs], yrg[kNs];
852 Float_t xsig[kNs], ysig[kNs];
854 AliSegmentation *segmentation=fSegmentation;
857 segmentation->GetPadI(x,y,0,ix,iy);
858 segmentation->GetPadC(ix,iy,x,y,z);
859 Int_t isec=segmentation->Sector(ix,iy);
861 Float_t xmin = x-segmentation->Dpx(isec)/2;
862 Float_t ymin = y-segmentation->Dpy(isec)/2;
864 // Integration Limits
865 Float_t dxI=fResponse->SigmaIntegration()*fResponse->ChargeSpreadX();
866 Float_t dyI=fResponse->SigmaIntegration()*fResponse->ChargeSpreadY();
876 Float_t dy=segmentation->Dpy(isec)/(kNs-1);
878 for (i=0; i<kNs; i++) {
884 segmentation->SigGenInit(x, yscan, 0);
886 for (segmentation->FirstPad(x, yscan,0, dxI, dyI);
887 segmentation->MorePads();
888 segmentation->NextPad())
890 qp=fResponse->IntXY(segmentation);
896 Int_t ixs=segmentation->Ix();
897 Int_t iys=segmentation->Iy();
899 segmentation->GetPadC(ixs,iys,xs,ys,zs);
903 Float_t ycog=sum/qcheck;
904 yg[i]=(yscan-y)/segmentation->Dpy(isec);
905 yrg[i]=(ycog-y)/segmentation->Dpy(isec);
912 Float_t dx=segmentation->Dpx(isec)/(kNs-1);
914 for (i=0; i<kNs; i++) {
920 segmentation->SigGenInit(xscan, y, 0);
922 for (segmentation->FirstPad(xscan, y, 0, dxI, dyI);
923 segmentation->MorePads();
924 segmentation->NextPad())
926 qp=fResponse->IntXY(segmentation);
932 Int_t ixs=segmentation->Ix();
933 Int_t iys=segmentation->Iy();
935 segmentation->GetPadC(ixs,iys,xs,ys,zs);
939 Float_t xcog=sum/qcheck;
940 xcog=segmentation->GetAnod(xcog);
942 xg[i]=(xscan-x)/segmentation->Dpx(isec);
943 xrg[i]=(xcog-x)/segmentation->Dpx(isec);
948 // Creates a Root function based on function sinoid above
949 // and perform the fit
951 // TGraph *graphx = new TGraph(kNs,xg ,xsig);
952 // TGraph *graphxr= new TGraph(kNs,xrg,xsig);
953 // TGraph *graphy = new TGraph(kNs,yg ,ysig);
954 TGraph *graphyr= new TGraph(kNs,yrg,ysig);
956 Double_t sinoid(Double_t *x, Double_t *par);
957 new TF1("sinoidf",sinoid,0.5,0.5,5);
958 graphyr->Fit("sinoidf","Q");
959 func = (TF1*)graphyr->GetListOfFunctions()->At(0);
962 TCanvas *c1=new TCanvas(canvasname,canvasname,400,10,600,700);
963 TPad* pad11 = new TPad("pad11"," ",0.01,0.51,0.49,0.99);
964 TPad* pad12 = new TPad("pad12"," ",0.51,0.51,0.99,0.99);
965 TPad* pad13 = new TPad("pad13"," ",0.01,0.01,0.49,0.49);
966 TPad* pad14 = new TPad("pad14"," ",0.51,0.01,0.99,0.49);
967 pad11->SetFillColor(11);
968 pad12->SetFillColor(11);
969 pad13->SetFillColor(11);
970 pad14->SetFillColor(11);
978 graphx->SetFillColor(42);
979 graphx->SetMarkerColor(4);
980 graphx->SetMarkerStyle(21);
982 graphx->GetHistogram()->SetXTitle("x on pad");
983 graphx->GetHistogram()->SetYTitle("xcog-x");
987 graphxr->SetFillColor(42);
988 graphxr->SetMarkerColor(4);
989 graphxr->SetMarkerStyle(21);
991 graphxr->GetHistogram()->SetXTitle("xcog on pad");
992 graphxr->GetHistogram()->SetYTitle("xcog-x");
996 graphy->SetFillColor(42);
997 graphy->SetMarkerColor(4);
998 graphy->SetMarkerStyle(21);
1000 graphy->GetHistogram()->SetXTitle("y on pad");
1001 graphy->GetHistogram()->SetYTitle("ycog-y");
1006 graphyr->SetFillColor(42);
1007 graphyr->SetMarkerColor(4);
1008 graphyr->SetMarkerStyle(21);
1009 graphyr->Draw("AF");
1010 graphyr->GetHistogram()->SetXTitle("ycog on pad");
1011 graphyr->GetHistogram()->SetYTitle("ycog-y");
1017 Double_t sinoid(Double_t *x, Double_t *par)
1022 Double_t arg = -2*TMath::Pi()*x[0];
1023 Double_t fitval= par[0]*TMath::Sin(arg)+
1024 par[1]*TMath::Sin(2*arg)+
1025 par[2]*TMath::Sin(3*arg)+
1026 par[3]*TMath::Sin(4*arg)+
1027 par[4]*TMath::Sin(5*arg);
1032 Double_t DoubleGauss(Double_t *x, Double_t *par)
1035 // Doublr gaussian function
1037 Double_t arg1 = (x[0]-par[1])/0.18;
1038 Double_t arg2 = (x[0]-par[3])/0.18;
1039 Double_t fitval= par[0]*TMath::Exp(-arg1*arg1/2)
1040 +par[2]*TMath::Exp(-arg2*arg2/2);
1044 Float_t DiscrCharge(Int_t i,Double_t *par)
1046 // par[0] x-position of first cluster
1047 // par[1] y-position of first cluster
1048 // par[2] x-position of second cluster
1049 // par[3] y-position of second cluster
1050 // par[4] charge fraction of first cluster
1051 // 1-par[4] charge fraction of second cluster
1053 static Float_t qtot;
1056 for (Int_t jbin=0; jbin<gNbins; jbin++) {
1057 qtot+=gCharge[jbin];
1060 //printf("\n sum of charge from DiscrCharge %f\n", qtot);
1061 gChargeTot=Int_t(qtot);
1064 gSegmentation->SetPad(gix[i], giy[i]);
1066 gSegmentation->SetHit(par[0],par[1],0);
1067 Float_t q1=gResponse->IntXY(gSegmentation);
1070 gSegmentation->SetHit(par[2],par[3],0);
1071 Float_t q2=gResponse->IntXY(gSegmentation);
1073 Float_t value = qtot*(par[4]*q1+(1.-par[4])*q2);
1078 // Minimisation function
1079 void fcn(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
1087 for (i=0; i<gNbins; i++) {
1088 Float_t q0=gCharge[i];
1089 Float_t q1=DiscrCharge(i,par);
1090 delta=(q0-q1)/TMath::Sqrt(q0);
1095 chisq=chisq+=(qtot-qcont)*(qtot-qcont)*0.5;
1100 void AliRICHClusterFinder::SetDigits(TClonesArray *RICHdigits)
1103 // Get all the digits
1106 fNdigits = fDigits->GetEntriesFast();
1109 AliRICHClusterFinder& AliRICHClusterFinder::operator=(const AliRICHClusterFinder& rhs)
1111 // Assignment operator