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 Revision 1.3 2000/06/12 15:49:44 jbarbosa
19 Removed verbose output.
21 Revision 1.2 2000/06/12 15:18:19 jbarbosa
24 Revision 1.1 2000/04/19 13:01:48 morsch
25 A cluster finder and hit reconstruction class for RICH (adapted from MUON).
26 Cluster Finders for MUON and RICH should derive from the same class in the
32 #include "AliRICHClusterFinder.h"
35 #include "AliRICHHit.h"
36 #include "AliRICHHitMapA1.h"
37 #include "AliRICHCerenkov.h"
38 #include "AliRICHPadHit.h"
39 #include "AliRICHDigit.h"
40 #include "AliRICHRawCluster.h"
41 #include "AliRICHRecHit.h"
48 #include <TPostScript.h>
51 //----------------------------------------------------------
52 static AliRICHSegmentation* gSegmentation;
53 static AliRICHResponse* gResponse;
54 static Int_t gix[500];
55 static Int_t giy[500];
56 static Float_t gCharge[500];
58 static Int_t gFirst=kTRUE;
59 static TMinuit *gMyMinuit ;
60 void fcn(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag);
61 static Int_t gChargeTot;
63 ClassImp(AliRICHClusterFinder)
65 AliRICHClusterFinder::AliRICHClusterFinder
66 (AliRICHSegmentation *segmentation, AliRICHResponse *response,
67 TClonesArray *digits, Int_t chamber)
70 // Constructor for Cluster Finder object
72 fSegmentation=segmentation;
76 fNdigits = fDigits->GetEntriesFast();
78 fRawClusters=new TClonesArray("AliRICHRawCluster",10000);
87 AliRICHClusterFinder::AliRICHClusterFinder()
90 // Default constructor
98 fRawClusters=new TClonesArray("AliRICHRawCluster",10000);
108 AliRICHClusterFinder::AliRICHClusterFinder(const AliRICHClusterFinder& ClusterFinder)
113 AliRICHClusterFinder::~AliRICHClusterFinder()
121 void AliRICHClusterFinder::AddRawCluster(const AliRICHRawCluster c)
124 // Add a raw cluster copy to the list
126 AliRICH *pRICH=(AliRICH*)gAlice->GetModule("RICH");
127 pRICH->AddRawCluster(fChamber,c);
133 void AliRICHClusterFinder::Decluster(AliRICHRawCluster *cluster)
137 // Decluster algorithm
139 Int_t mul = cluster->fMultiplicity;
140 // printf("Decluster - multiplicity %d \n",mul);
142 if (mul == 1 || mul ==2) {
144 // Nothing special for 1- and 2-clusters
146 cluster->fNcluster[0]=fNPeaks;
147 cluster->fNcluster[1]=0;
149 AddRawCluster(*cluster);
151 } else if (mul ==3) {
153 // 3-cluster, check topology
154 // printf("\n 3-cluster, check topology \n");
155 if (fDeclusterFlag) {
156 if (Centered(cluster)) {
157 // ok, cluster is centered
159 // cluster is not centered, split into 2+1
163 cluster->fNcluster[0]=fNPeaks;
164 cluster->fNcluster[1]=0;
166 AddRawCluster(*cluster);
171 // 4-and more-pad clusters
173 if (mul <= fClusterSize) {
174 if (fDeclusterFlag) {
175 SplitByLocalMaxima(cluster);
178 cluster->fNcluster[0]=fNPeaks;
179 cluster->fNcluster[1]=0;
181 AddRawCluster(*cluster);
189 Bool_t AliRICHClusterFinder::Centered(AliRICHRawCluster *cluster)
192 // Is the cluster centered?
195 dig= (AliRICHDigit*)fDigits->UncheckedAt(cluster->fIndexMap[0]);
199 Int_t x[kMaxNeighbours], y[kMaxNeighbours], xN[kMaxNeighbours], yN[kMaxNeighbours];
201 fSegmentation->Neighbours(ix,iy,&nn,x,y);
203 for (Int_t i=0; i<nn; i++) {
204 if (fHitMap->TestHit(x[i],y[i]) == kUsed) {
209 //printf("Getting: %d %d %d\n",i,x[i],y[i]);
214 // cluster is centered !
216 cluster->fNcluster[0]=fNPeaks;
217 cluster->fNcluster[1]=0;
220 AddRawCluster(*cluster);
225 // Highest signal on an edge, split cluster into 2+1
227 // who is the neighbour ?
229 //printf("Calling GetIndex with x:%d y:%d\n",xN[0], yN[0]);
231 Int_t nind=fHitMap->GetHitIndex(xN[0], yN[0]);
232 Int_t i1= (nind==cluster->fIndexMap[1]) ? 1:2;
233 Int_t i2= (nind==cluster->fIndexMap[1]) ? 2:1;
236 AliRICHRawCluster cnew;
238 cnew.fNcluster[0]=-1;
239 cnew.fNcluster[1]=fNRawClusters;
241 cnew.fNcluster[0]=fNPeaks;
244 cnew.fMultiplicity=2;
245 cnew.fIndexMap[0]=cluster->fIndexMap[0];
246 cnew.fIndexMap[1]=cluster->fIndexMap[i1];
248 cnew.fClusterType=cnew.PhysicsContribution();
253 cluster->fMultiplicity=1;
254 cluster->fIndexMap[0]=cluster->fIndexMap[i2];
255 cluster->fIndexMap[1]=0;
256 cluster->fIndexMap[2]=0;
257 FillCluster(cluster);
259 cluster->fNcluster[0]=fNPeaks;
260 cluster->fNcluster[1]=0;
262 cluster->fClusterType=cluster->PhysicsContribution();
263 AddRawCluster(*cluster);
267 printf("\n Completely screwed up %d !! \n",nd);
273 void AliRICHClusterFinder::SplitByLocalMaxima(AliRICHRawCluster *c)
277 // Split the cluster according to the number of maxima inside
280 AliRICHDigit* dig[100], *digt;
281 Int_t ix[100], iy[100], q[100];
282 Float_t x[100], y[100];
283 Int_t i; // loops over digits
284 Int_t j; // loops over local maxima
287 // Int_t threshold=500;
288 Int_t mul=c->fMultiplicity;
290 // dump digit information into arrays
292 for (i=0; i<mul; i++)
294 dig[i]= (AliRICHDigit*)fDigits->UncheckedAt(c->fIndexMap[i]);
295 ix[i]= dig[i]->fPadX;
296 iy[i]= dig[i]->fPadY;
297 q[i] = dig[i]->fSignal;
298 fSegmentation->GetPadCxy(ix[i], iy[i], x[i], y[i]);
305 Int_t associatePeak[100];
308 Int_t xNei[kMaxNeighbours], yNei[kMaxNeighbours];
309 for (i=0; i<mul; i++) {
310 fSegmentation->Neighbours(ix[i], iy[i], &nn, xNei, yNei);
312 for (j=0; j<nn; j++) {
313 if (fHitMap->TestHit(xNei[j], yNei[j])==kEmpty) continue;
314 digt=(AliRICHDigit*) fHitMap->GetHit(xNei[j], yNei[j]);
315 if (digt->fSignal > q[i]) {
319 // handle special case of neighbouring pads with equal signal
320 } else if (digt->fSignal == q[i]) {
322 for (Int_t k=0; k<nLocal; k++) {
323 if (xNei[j]==ix[indLocal[k]] && yNei[j]==iy[indLocal[k]]){
329 } // loop over next neighbours
330 // Maxima should not be on the edge
335 } // loop over all digits
336 // printf("Found %d local Maxima",nLocal);
338 // If only one local maximum found but multiplicity is high
339 // take global maximum from the list of digits.
340 if (nLocal==1 && mul>5) {
342 for (i=0; i<mul; i++) {
353 // If number of local maxima is 2 try to fit a double gaussian
356 // Initialise global variables for fit
358 gSegmentation=fSegmentation;
359 gResponse =fResponse;
362 for (i=0; i<mul; i++) {
365 gCharge[i]=Float_t(q[i]);
370 gMyMinuit = new TMinuit(5);
372 gMyMinuit->SetFCN(fcn);
373 gMyMinuit->mninit(5,10,7);
374 Double_t arglist[20];
377 // gMyMinuit->mnexcm("SET ERR",arglist,1,ierflag);
378 // Set starting values
379 static Double_t vstart[5];
380 vstart[0]=x[indLocal[0]];
381 vstart[1]=y[indLocal[0]];
382 vstart[2]=x[indLocal[1]];
383 vstart[3]=y[indLocal[1]];
384 vstart[4]=Float_t(q[indLocal[0]])/
385 Float_t(q[indLocal[0]]+q[indLocal[1]]);
386 // lower and upper limits
387 static Double_t lower[5], upper[5];
388 Int_t isec=fSegmentation->Sector(ix[indLocal[0]], iy[indLocal[0]]);
389 lower[0]=vstart[0]-fSegmentation->Dpx(isec)/2;
390 lower[1]=vstart[1]-fSegmentation->Dpy(isec)/2;
391 // lower[1]=vstart[1];
393 upper[0]=lower[0]+fSegmentation->Dpx(isec);
394 upper[1]=lower[1]+fSegmentation->Dpy(isec);
395 // upper[1]=vstart[1];
397 isec=fSegmentation->Sector(ix[indLocal[1]], iy[indLocal[1]]);
398 lower[2]=vstart[2]-fSegmentation->Dpx(isec)/2;
399 lower[3]=vstart[3]-fSegmentation->Dpy(isec)/2;
400 // lower[3]=vstart[3];
402 upper[2]=lower[2]+fSegmentation->Dpx(isec);
403 upper[3]=lower[3]+fSegmentation->Dpy(isec);
404 // upper[3]=vstart[3];
409 static Double_t step[5]={0.005, 0.03, 0.005, 0.03, 0.01};
411 gMyMinuit->mnparm(0,"x1",vstart[0],step[0],lower[0],upper[0],ierflag);
412 gMyMinuit->mnparm(1,"y1",vstart[1],step[1],lower[1],upper[1],ierflag);
413 gMyMinuit->mnparm(2,"x2",vstart[2],step[2],lower[2],upper[2],ierflag);
414 gMyMinuit->mnparm(3,"y2",vstart[3],step[3],lower[3],upper[3],ierflag);
415 gMyMinuit->mnparm(4,"a0",vstart[4],step[4],lower[4],upper[4],ierflag);
416 // ready for minimisation
417 gMyMinuit->SetPrintLevel(-1);
418 gMyMinuit->mnexcm("SET OUT", arglist, 0, ierflag);
422 gMyMinuit->mnexcm("SET NOGR", arglist, 0, ierflag);
423 gMyMinuit->mnexcm("SCAN", arglist, 0, ierflag);
424 gMyMinuit->mnexcm("EXIT" , arglist, 0, ierflag);
426 // Double_t amin,edm,errdef;
427 // Int_t nvpar,nparx,icstat;
428 // gMyMinuit->mnstat(amin,edm,errdef,nvpar,nparx,icstat);
429 // gMyMinuit->mnprin(3,amin);
430 // Get fitted parameters
432 Double_t xrec[2], yrec[2], qfrac;
434 Double_t epxz, b1, b2;
436 gMyMinuit->mnpout(0, chname, xrec[0], epxz, b1, b2, ierflg);
437 gMyMinuit->mnpout(1, chname, yrec[0], epxz, b1, b2, ierflg);
438 gMyMinuit->mnpout(2, chname, xrec[1], epxz, b1, b2, ierflg);
439 gMyMinuit->mnpout(3, chname, yrec[1], epxz, b1, b2, ierflg);
440 gMyMinuit->mnpout(4, chname, qfrac, epxz, b1, b2, ierflg);
441 //printf("\n %f %f %f %f %f\n", xrec[0], yrec[0], xrec[1], yrec[1],qfrac);
446 // One cluster for each maximum
448 for (j=0; j<2; j++) {
449 AliRICHRawCluster cnew;
451 cnew.fNcluster[0]=-1;
452 cnew.fNcluster[1]=fNRawClusters;
454 cnew.fNcluster[0]=fNPeaks;
457 cnew.fMultiplicity=0;
458 cnew.fX=Float_t(xrec[j]);
459 cnew.fY=Float_t(yrec[j]);
461 cnew.fQ=Int_t(gChargeTot*qfrac);
463 cnew.fQ=Int_t(gChargeTot*(1-qfrac));
465 gSegmentation->SetHit(xrec[j],yrec[j]);
466 for (i=0; i<mul; i++) {
467 cnew.fIndexMap[cnew.fMultiplicity]=c->fIndexMap[i];
468 gSegmentation->SetPad(gix[i], giy[i]);
469 Float_t q1=gResponse->IntXY(gSegmentation);
470 cnew.fContMap[cnew.fMultiplicity]=Float_t(q[i])/(q1*cnew.fQ);
471 cnew.fMultiplicity++;
473 FillCluster(&cnew,0);
474 //printf("\n x,y %f %f ", cnew.fX, cnew.fY);
475 cnew.fClusterType=cnew.PhysicsContribution();
483 if (nLocal !=-100 || !fitted) {
484 // Check if enough local clusters have been found,
485 // if not add global maxima to the list
491 printf("\n Warning, no local maximum found \n");
495 if (nPerMax > fNperMax) {
496 Int_t nGlob=mul/fNperMax-nLocal+1;
499 for (i=0; i<mul; i++) {
506 if (nnew==nGlob) break;
511 // Associate hits to peaks
513 for (i=0; i<mul; i++) {
516 if (isLocal[i]) continue;
517 for (j=0; j<nLocal; j++) {
518 Int_t il=indLocal[j];
519 Float_t d=TMath::Sqrt((x[i]-x[il])*(x[i]-x[il])
520 +(y[i]-y[il])*(y[i]-y[il]));
523 // Select nearest peak
529 } else if (d==dmin) {
531 // If more than one take highest peak
544 // One cluster for each maximum
546 for (j=0; j<nLocal; j++) {
547 AliRICHRawCluster cnew;
549 cnew.fNcluster[0]=-1;
550 cnew.fNcluster[1]=fNRawClusters;
552 cnew.fNcluster[0]=fNPeaks;
555 cnew.fIndexMap[0]=c->fIndexMap[indLocal[j]];
556 cnew.fMultiplicity=1;
557 for (i=0; i<mul; i++) {
558 if (isLocal[i]) continue;
559 if (associatePeak[i]==j) {
560 cnew.fIndexMap[cnew.fMultiplicity]=c->fIndexMap[i];
561 cnew.fMultiplicity++;
565 cnew.fClusterType=cnew.PhysicsContribution();
573 void AliRICHClusterFinder::FillCluster(AliRICHRawCluster* c, Int_t flag)
576 // Completes cluster information starting from list of digits
592 for (Int_t i=0; i<c->fMultiplicity; i++)
594 dig= (AliRICHDigit*)fDigits->UncheckedAt(c->fIndexMap[i]);
595 ix=dig->fPadX+c->fOffsetMap[i];
597 Int_t q=dig->fSignal;
598 if (dig->fPhysics >= dig->fSignal) {
600 } else if (dig->fPhysics == 0) {
602 } else c->fPhysicsMap[i]=1;
605 // peak signal and track list
607 if (q>c->fPeakSignal) {
610 c->fTracks[0]=dig->fTracks[0];
611 c->fTracks[1]=dig->fTracks[1];
612 c->fTracks[2]=dig->fTracks[2];
614 //c->fTracks[0]=dig->fTrack;
615 c->fTracks[0]=dig->fHit;
616 c->fTracks[1]=dig->fTracks[0];
617 c->fTracks[2]=dig->fTracks[1];
620 if (c->fContMap[i] > frac) {
624 c->fTracks[0]=dig->fTracks[0];
625 c->fTracks[1]=dig->fTracks[1];
626 c->fTracks[2]=dig->fTracks[2];
628 //c->fTracks[0]=dig->fTrack;
629 c->fTracks[0]=dig->fHit;
630 c->fTracks[1]=dig->fTracks[0];
631 c->fTracks[2]=dig->fTracks[1];
636 fSegmentation->GetPadCxy(ix, iy, x, y);
642 } // loop over digits
647 c->fX=fSegmentation->GetAnod(c->fX);
650 // apply correction to the coordinate along the anode wire
654 fSegmentation->GetPadIxy(x, y, ix, iy);
655 fSegmentation->GetPadCxy(ix, iy, x, y);
656 Int_t isec=fSegmentation->Sector(ix,iy);
657 TF1* cogCorr = fSegmentation->CorrFunc(isec-1);
660 Float_t yOnPad=(c->fY-y)/fSegmentation->Dpy(isec);
661 c->fY=c->fY-cogCorr->Eval(yOnPad, 0, 0);
667 void AliRICHClusterFinder::FindCluster(Int_t i, Int_t j, AliRICHRawCluster &c){
672 // Add i,j as element of the cluster
675 Int_t idx = fHitMap->GetHitIndex(i,j);
676 AliRICHDigit* dig = (AliRICHDigit*) fHitMap->GetHit(i,j);
677 Int_t q=dig->fSignal;
678 if (q > TMath::Abs(c.fPeakSignal)) {
681 c.fTracks[0]=dig->fTracks[0];
682 c.fTracks[1]=dig->fTracks[1];
683 c.fTracks[2]=dig->fTracks[2];
685 //c.fTracks[0]=dig->fTrack;
686 c.fTracks[0]=dig->fHit;
687 c.fTracks[1]=dig->fTracks[0];
688 c.fTracks[2]=dig->fTracks[1];
691 // Make sure that list of digits is ordered
693 Int_t mu=c.fMultiplicity;
696 if (dig->fPhysics >= dig->fSignal) {
698 } else if (dig->fPhysics == 0) {
700 } else c.fPhysicsMap[mu]=1;
703 for (Int_t ind=mu-1; ind>=0; ind--) {
704 Int_t ist=(c.fIndexMap)[ind];
705 Int_t ql=((AliRICHDigit*)fDigits
706 ->UncheckedAt(ist))->fSignal;
708 c.fIndexMap[ind]=idx;
709 c.fIndexMap[ind+1]=ist;
718 if (c.fMultiplicity >= 50 ) {
719 printf("FindCluster - multiplicity >50 %d \n",c.fMultiplicity);
723 // Prepare center of gravity calculation
725 fSegmentation->GetPadCxy(i, j, x, y);
730 fHitMap->FlagHit(i,j);
732 // Now look recursively for all neighbours
735 Int_t xList[kMaxNeighbours], yList[kMaxNeighbours];
736 fSegmentation->Neighbours(i,j,&nn,xList,yList);
737 for (Int_t in=0; in<nn; in++) {
740 if (fHitMap->TestHit(ix,iy)==kUnused) FindCluster(ix, iy, c);
744 //_____________________________________________________________________________
746 void AliRICHClusterFinder::FindRawClusters()
749 // simple RICH cluster finder from digits -- finds neighbours and
750 // fill the tree with raw clusters
752 if (!fNdigits) return;
754 fHitMap = new AliRICHHitMapA1(fSegmentation, fDigits);
758 //printf ("Now I'm here");
764 for (ndig=0; ndig<fNdigits; ndig++) {
765 dig = (AliRICHDigit*)fDigits->UncheckedAt(ndig);
768 if (fHitMap->TestHit(i,j)==kUsed ||fHitMap->TestHit(i,j)==kEmpty) {
774 c.fPeakSignal=dig->fSignal;
776 c.fTracks[0]=dig->fTracks[0];
777 c.fTracks[1]=dig->fTracks[1];
778 c.fTracks[2]=dig->fTracks[2];
780 //c.fTracks[0]=dig->fTrack;
781 c.fTracks[0]=dig->fHit;
782 c.fTracks[1]=dig->fTracks[0];
783 c.fTracks[2]=dig->fTracks[1];
784 // tag the beginning of cluster list in a raw cluster
789 c.fX=fSegmentation->GetAnod(c.fX);
792 // apply correction to the coordinate along the anode wire
797 fSegmentation->GetPadIxy(x, y, ix, iy);
798 fSegmentation->GetPadCxy(ix, iy, x, y);
799 Int_t isec=fSegmentation->Sector(ix,iy);
800 TF1* cogCorr=fSegmentation->CorrFunc(isec-1);
802 Float_t yOnPad=(c.fY-y)/fSegmentation->Dpy(isec);
803 c.fY=c.fY-cogCorr->Eval(yOnPad,0,0);
807 // Analyse cluster and decluster if necessary
810 c.fNcluster[1]=fNRawClusters;
811 c.fClusterType=c.PhysicsContribution();
817 // reset Cluster object
818 for (int k=0;k<c.fMultiplicity;k++) {
826 void AliRICHClusterFinder::
837 fSegmentation->GiveTestPoints(n, x, y);
838 for (i=0; i<n; i++) {
841 SinoidalFit(xtest, ytest, func);
842 fSegmentation->SetCorrFunc(i, new TF1(func));
848 void AliRICHClusterFinder::
849 SinoidalFit(Float_t x, Float_t y, TF1 &func)
854 static Int_t count=0;
857 sprintf(canvasname,"c%d",count);
860 Float_t xg[kNs], yg[kNs], xrg[kNs], yrg[kNs];
861 Float_t xsig[kNs], ysig[kNs];
863 AliRICHSegmentation *segmentation=fSegmentation;
866 segmentation->GetPadIxy(x,y,ix,iy);
867 segmentation->GetPadCxy(ix,iy,x,y);
868 Int_t isec=segmentation->Sector(ix,iy);
870 Float_t xmin = x-segmentation->Dpx(isec)/2;
871 Float_t ymin = y-segmentation->Dpy(isec)/2;
873 // Integration Limits
874 Float_t dxI=fResponse->SigmaIntegration()*fResponse->ChargeSpreadX();
875 Float_t dyI=fResponse->SigmaIntegration()*fResponse->ChargeSpreadY();
885 Float_t dy=segmentation->Dpy(isec)/(kNs-1);
887 for (i=0; i<kNs; i++) {
893 segmentation->SigGenInit(x, yscan, 0);
895 for (segmentation->FirstPad(x, yscan, dxI, dyI);
896 segmentation->MorePads();
897 segmentation->NextPad())
899 qp=fResponse->IntXY(segmentation);
905 Int_t ixs=segmentation->Ix();
906 Int_t iys=segmentation->Iy();
908 segmentation->GetPadCxy(ixs,iys,xs,ys);
912 Float_t ycog=sum/qcheck;
913 yg[i]=(yscan-y)/segmentation->Dpy(isec);
914 yrg[i]=(ycog-y)/segmentation->Dpy(isec);
921 Float_t dx=segmentation->Dpx(isec)/(kNs-1);
923 for (i=0; i<kNs; i++) {
929 segmentation->SigGenInit(xscan, y, 0);
931 for (segmentation->FirstPad(xscan, y, dxI, dyI);
932 segmentation->MorePads();
933 segmentation->NextPad())
935 qp=fResponse->IntXY(segmentation);
941 Int_t ixs=segmentation->Ix();
942 Int_t iys=segmentation->Iy();
944 segmentation->GetPadCxy(ixs,iys,xs,ys);
948 Float_t xcog=sum/qcheck;
949 xcog=segmentation->GetAnod(xcog);
951 xg[i]=(xscan-x)/segmentation->Dpx(isec);
952 xrg[i]=(xcog-x)/segmentation->Dpx(isec);
957 // Creates a Root function based on function sinoid above
958 // and perform the fit
960 // TGraph *graphx = new TGraph(kNs,xg ,xsig);
961 // TGraph *graphxr= new TGraph(kNs,xrg,xsig);
962 // TGraph *graphy = new TGraph(kNs,yg ,ysig);
963 TGraph *graphyr= new TGraph(kNs,yrg,ysig);
965 Double_t sinoid(Double_t *x, Double_t *par);
966 new TF1("sinoidf",sinoid,0.5,0.5,5);
967 graphyr->Fit("sinoidf","Q");
968 func = *((TF1*)((graphyr->GetListOfFunctions())->At(0)));
971 TCanvas *c1=new TCanvas(canvasname,canvasname,400,10,600,700);
972 TPad* pad11 = new TPad("pad11"," ",0.01,0.51,0.49,0.99);
973 TPad* pad12 = new TPad("pad12"," ",0.51,0.51,0.99,0.99);
974 TPad* pad13 = new TPad("pad13"," ",0.01,0.01,0.49,0.49);
975 TPad* pad14 = new TPad("pad14"," ",0.51,0.01,0.99,0.49);
976 pad11->SetFillColor(11);
977 pad12->SetFillColor(11);
978 pad13->SetFillColor(11);
979 pad14->SetFillColor(11);
987 graphx->SetFillColor(42);
988 graphx->SetMarkerColor(4);
989 graphx->SetMarkerStyle(21);
991 graphx->GetHistogram()->SetXTitle("x on pad");
992 graphx->GetHistogram()->SetYTitle("xcog-x");
996 graphxr->SetFillColor(42);
997 graphxr->SetMarkerColor(4);
998 graphxr->SetMarkerStyle(21);
1000 graphxr->GetHistogram()->SetXTitle("xcog on pad");
1001 graphxr->GetHistogram()->SetYTitle("xcog-x");
1005 graphy->SetFillColor(42);
1006 graphy->SetMarkerColor(4);
1007 graphy->SetMarkerStyle(21);
1009 graphy->GetHistogram()->SetXTitle("y on pad");
1010 graphy->GetHistogram()->SetYTitle("ycog-y");
1015 graphyr->SetFillColor(42);
1016 graphyr->SetMarkerColor(4);
1017 graphyr->SetMarkerStyle(21);
1018 graphyr->Draw("AF");
1019 graphyr->GetHistogram()->SetXTitle("ycog on pad");
1020 graphyr->GetHistogram()->SetYTitle("ycog-y");
1026 Double_t sinoid(Double_t *x, Double_t *par)
1031 Double_t arg = -2*TMath::Pi()*x[0];
1032 Double_t fitval= par[0]*TMath::Sin(arg)+
1033 par[1]*TMath::Sin(2*arg)+
1034 par[2]*TMath::Sin(3*arg)+
1035 par[3]*TMath::Sin(4*arg)+
1036 par[4]*TMath::Sin(5*arg);
1041 Double_t DoubleGauss(Double_t *x, Double_t *par)
1044 // Doublr gaussian function
1046 Double_t arg1 = (x[0]-par[1])/0.18;
1047 Double_t arg2 = (x[0]-par[3])/0.18;
1048 Double_t fitval= par[0]*TMath::Exp(-arg1*arg1/2)
1049 +par[2]*TMath::Exp(-arg2*arg2/2);
1053 Float_t DiscrCharge(Int_t i,Double_t *par)
1055 // par[0] x-position of first cluster
1056 // par[1] y-position of first cluster
1057 // par[2] x-position of second cluster
1058 // par[3] y-position of second cluster
1059 // par[4] charge fraction of first cluster
1060 // 1-par[4] charge fraction of second cluster
1062 static Float_t qtot;
1065 for (Int_t jbin=0; jbin<gNbins; jbin++) {
1066 qtot+=gCharge[jbin];
1069 //printf("\n sum of charge from DiscrCharge %f\n", qtot);
1070 gChargeTot=Int_t(qtot);
1073 gSegmentation->SetPad(gix[i], giy[i]);
1075 gSegmentation->SetHit(par[0],par[1]);
1076 Float_t q1=gResponse->IntXY(gSegmentation);
1079 gSegmentation->SetHit(par[2],par[3]);
1080 Float_t q2=gResponse->IntXY(gSegmentation);
1082 Float_t value = qtot*(par[4]*q1+(1.-par[4])*q2);
1087 // Minimisation function
1088 void fcn(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
1096 for (i=0; i<gNbins; i++) {
1097 Float_t q0=gCharge[i];
1098 Float_t q1=DiscrCharge(i,par);
1099 delta=(q0-q1)/TMath::Sqrt(q0);
1104 chisq=chisq+=(qtot-qcont)*(qtot-qcont)*0.5;
1109 void AliRICHClusterFinder::SetDigits(TClonesArray *RICHdigits)
1112 // Get all the digits
1115 fNdigits = fDigits->GetEntriesFast();
1118 AliRICHClusterFinder& AliRICHClusterFinder::operator=(const AliRICHClusterFinder& rhs)
1120 // Assignment operator