]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RICH/AliRICHClusterFinder.cxx
LL Weights Out Side Long Theoretical Functions and 2D Corr Fctns implemented
[u/mrichter/AliRoot.git] / RICH / AliRICHClusterFinder.cxx
index 1ef73c7581ead857b48f23c61d86b29351cc3b9b..f4cafb7fbede58488e80c9a02430998344a8a99f 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-  $Log$
-  Revision 1.8  2000/11/02 09:11:12  jbarbosa
-  Removed AliRICHRecHit.h from include.
-
-  Revision 1.7  2000/10/03 21:44:09  morsch
-  Use AliSegmentation and AliHit abstract base classes.
-
-  Revision 1.6  2000/10/02 21:28:12  fca
-  Removal of useless dependecies via forward declarations
-
-  Revision 1.5  2000/10/02 15:45:58  jbarbosa
-  Fixed forward declarations.
-
-  Revision 1.4  2000/06/12 19:01:29  morsch
-  Clean-up bug in Centered() corrected.
-
-  Revision 1.3  2000/06/12 15:49:44  jbarbosa
-  Removed verbose output.
-
-  Revision 1.2  2000/06/12 15:18:19  jbarbosa
-  Cleaned up version.
-
-  Revision 1.1  2000/04/19 13:01:48  morsch
-  A cluster finder and hit reconstruction class for RICH (adapted from MUON).
-  Cluster Finders for MUON and RICH should derive from the same class in the
-  future (JB, AM).
-
-*/
-
+/* $Id$ */
 
 #include "AliRICHClusterFinder.h"
 #include "AliRun.h"
 #include "AliRICH.h"
-#include "AliRICHHit.h"
 #include "AliRICHHitMapA1.h"
-#include "AliRICHCerenkov.h"
-#include "AliRICHPadHit.h"
+#include "AliRICHSDigit.h"
 #include "AliRICHDigit.h"
 #include "AliRICHRawCluster.h"
 
@@ -61,7 +30,7 @@
 #include <TPad.h>
 #include <TGraph.h> 
 #include <TPostScript.h> 
-#include <TMinuit.h> 
+#include <TMinuit.h>
 
 //----------------------------------------------------------
 static AliSegmentation* gSegmentation;
@@ -121,6 +90,7 @@ AliRICHClusterFinder::AliRICHClusterFinder()
 }
 
 AliRICHClusterFinder::AliRICHClusterFinder(const AliRICHClusterFinder& ClusterFinder)
+                     :TObject(ClusterFinder)
 {
 // Copy Constructor
 }
@@ -208,8 +178,8 @@ Bool_t AliRICHClusterFinder::Centered(AliRICHRawCluster *cluster)
 
     AliRICHDigit* dig;
     dig= (AliRICHDigit*)fDigits->UncheckedAt(cluster->fIndexMap[0]);
-    Int_t ix=dig->fPadX;
-    Int_t iy=dig->fPadY;
+    Int_t ix=dig->PadX();
+    Int_t iy=dig->PadY();
     Int_t nn;
     Int_t x[kMaxNeighbours], y[kMaxNeighbours], xN[kMaxNeighbours], yN[kMaxNeighbours];
     
@@ -307,9 +277,9 @@ void AliRICHClusterFinder::SplitByLocalMaxima(AliRICHRawCluster *c)
     for (i=0; i<mul; i++)
     {
        dig[i]= (AliRICHDigit*)fDigits->UncheckedAt(c->fIndexMap[i]);
-       ix[i]= dig[i]->fPadX;
-       iy[i]= dig[i]->fPadY;
-       q[i] = dig[i]->fSignal;
+       ix[i]= dig[i]->PadX();
+       iy[i]= dig[i]->PadY();
+       q[i] = dig[i]->Signal();
        fSegmentation->GetPadC(ix[i], iy[i], x[i], y[i], zdum);
     }
 //
@@ -327,12 +297,12 @@ void AliRICHClusterFinder::SplitByLocalMaxima(AliRICHRawCluster *c)
        for (j=0; j<nn; j++) {
            if (fHitMap->TestHit(xNei[j], yNei[j])==kEmpty) continue;
            digt=(AliRICHDigit*) fHitMap->GetHit(xNei[j], yNei[j]);
-           if (digt->fSignal > q[i]) {
+           if (digt->Signal() > q[i]) {
                isLocal[i]=kFALSE;
                break;
 //
 // handle special case of neighbouring pads with equal signal
-           } else if (digt->fSignal == q[i]) {
+           } else if (digt->Signal() == q[i]) {
                if (nLocal >0) {
                    for (Int_t k=0; k<nLocal; k++) {
                        if (xNei[j]==ix[indLocal[k]] && yNei[j]==iy[indLocal[k]]){
@@ -607,12 +577,12 @@ void  AliRICHClusterFinder::FillCluster(AliRICHRawCluster* c, Int_t flag)
     for (Int_t i=0; i<c->fMultiplicity; i++)
     {
        dig= (AliRICHDigit*)fDigits->UncheckedAt(c->fIndexMap[i]);
-       ix=dig->fPadX+c->fOffsetMap[i];
-       iy=dig->fPadY;
-       Int_t q=dig->fSignal;
-       if (dig->fPhysics >= dig->fSignal) {
+       ix=dig->PadX()+c->fOffsetMap[i];
+       iy=dig->PadY();
+       Int_t q=dig->Signal();
+       if (dig->Physics() >= dig->Signal()) {
          c->fPhysicsMap[i]=2;
-       } else if (dig->fPhysics == 0) {
+       } else if (dig->Physics() == 0) {
          c->fPhysicsMap[i]=0;
        } else  c->fPhysicsMap[i]=1;
 //
@@ -622,28 +592,28 @@ void  AliRICHClusterFinder::FillCluster(AliRICHRawCluster* c, Int_t flag)
           if (q>c->fPeakSignal) {
              c->fPeakSignal=q;
 /*
-           c->fTracks[0]=dig->fTracks[0];
-           c->fTracks[1]=dig->fTracks[1];
-           c->fTracks[2]=dig->fTracks[2];
+           c->fTracks[0]=dig->Track(0);
+           c->fTracks[1]=dig->Track(1);
+           c->fTracks[2]=dig->Track(2);
 */
              //c->fTracks[0]=dig->fTrack;
-           c->fTracks[0]=dig->fHit;
-           c->fTracks[1]=dig->fTracks[0];
-           c->fTracks[2]=dig->fTracks[1];
+           c->fTracks[0]=dig->Hit();
+           c->fTracks[1]=dig->Track(0);
+           c->fTracks[2]=dig->Track(1);
           }
        } else {
           if (c->fContMap[i] > frac) {
               frac=c->fContMap[i];
              c->fPeakSignal=q;
 /*
-           c->fTracks[0]=dig->fTracks[0];
-           c->fTracks[1]=dig->fTracks[1];
-           c->fTracks[2]=dig->fTracks[2];
+           c->fTracks[0]=dig->Track(0);
+           c->fTracks[1]=dig->Track(1);
+           c->fTracks[2]=dig->Track(2);
 */
              //c->fTracks[0]=dig->fTrack;
-           c->fTracks[0]=dig->fHit;
-           c->fTracks[1]=dig->fTracks[0];
-           c->fTracks[2]=dig->fTracks[1];
+           c->fTracks[0]=dig->Hit();
+           c->fTracks[1]=dig->Track(0);
+           c->fTracks[2]=dig->Track(1);
           }
        }
 //
@@ -689,7 +659,7 @@ void  AliRICHClusterFinder::FindCluster(Int_t i, Int_t j, AliRICHRawCluster &c){
     
     Int_t idx = fHitMap->GetHitIndex(i,j);
     AliRICHDigit* dig = (AliRICHDigit*) fHitMap->GetHit(i,j);
-    Int_t q=dig->fSignal;
+    Int_t q=dig->Signal();
     if (q > TMath::Abs(c.fPeakSignal)) {
        c.fPeakSignal=q;
 /*
@@ -698,9 +668,9 @@ void  AliRICHClusterFinder::FindCluster(Int_t i, Int_t j, AliRICHRawCluster &c){
        c.fTracks[2]=dig->fTracks[2];
 */
        //c.fTracks[0]=dig->fTrack;
-       c.fTracks[0]=dig->fHit;
-       c.fTracks[1]=dig->fTracks[0];
-       c.fTracks[2]=dig->fTracks[1];
+       c.fTracks[0]=dig->Hit();
+       c.fTracks[1]=dig->Track(0);
+       c.fTracks[2]=dig->Track(1);
     }
 //
 //  Make sure that list of digits is ordered 
@@ -708,9 +678,9 @@ void  AliRICHClusterFinder::FindCluster(Int_t i, Int_t j, AliRICHRawCluster &c){
     Int_t mu=c.fMultiplicity;
     c.fIndexMap[mu]=idx;
 
-    if (dig->fPhysics >= dig->fSignal) {
+    if (dig->Physics() >= dig->Signal()) {
         c.fPhysicsMap[mu]=2;
-    } else if (dig->fPhysics == 0) {
+    } else if (dig->Physics() == 0) {
         c.fPhysicsMap[mu]=0;
     } else  c.fPhysicsMap[mu]=1;
 
@@ -718,7 +688,7 @@ void  AliRICHClusterFinder::FindCluster(Int_t i, Int_t j, AliRICHRawCluster &c){
        for (Int_t ind=mu-1; ind>=0; ind--) {
            Int_t ist=(c.fIndexMap)[ind];
            Int_t ql=((AliRICHDigit*)fDigits
-                     ->UncheckedAt(ist))->fSignal;
+                     ->UncheckedAt(ist))->Signal();
            if (q>ql) {
                c.fIndexMap[ind]=idx;
                c.fIndexMap[ind+1]=ist;
@@ -778,24 +748,24 @@ void AliRICHClusterFinder::FindRawClusters()
     fHitMap->FillHits();
     for (ndig=0; ndig<fNdigits; ndig++) {
        dig = (AliRICHDigit*)fDigits->UncheckedAt(ndig);
-       Int_t i=dig->fPadX;
-       Int_t j=dig->fPadY;
+       Int_t i=dig->PadX();
+       Int_t j=dig->PadY();
        if (fHitMap->TestHit(i,j)==kUsed ||fHitMap->TestHit(i,j)==kEmpty) {
            nskip++;
            continue;
        }
        AliRICHRawCluster c;
        c.fMultiplicity=0;
-       c.fPeakSignal=dig->fSignal;
+       c.fPeakSignal=dig->Signal();
 /*
        c.fTracks[0]=dig->fTracks[0];
        c.fTracks[1]=dig->fTracks[1];
        c.fTracks[2]=dig->fTracks[2];
 */
        //c.fTracks[0]=dig->fTrack;
-       c.fTracks[0]=dig->fHit;
-       c.fTracks[1]=dig->fTracks[0];
-       c.fTracks[2]=dig->fTracks[1];
+       c.fTracks[0]=dig->Hit();
+       c.fTracks[1]=dig->Track(0);
+       c.fTracks[2]=dig->Track(1);
         // tag the beginning of cluster list in a raw cluster
         c.fNcluster[0]=-1;
        FindCluster(i,j, c);
@@ -849,21 +819,22 @@ CalibrateCOG()
     Float_t x[5];
     Float_t y[5];
     Int_t n, i;
-    TF1 func;
     if (fSegmentation) {
+        TF1 *func;
        fSegmentation->GiveTestPoints(n, x, y);
        for (i=0; i<n; i++) {
+            func = 0;
            Float_t xtest=x[i];
            Float_t ytest=y[i];     
            SinoidalFit(xtest, ytest, func);
-           fSegmentation->SetCorrFunc(i, new TF1(func));
+           if (func) fSegmentation->SetCorrFunc(i, new TF1(*func));
        }
     }
 }
 
 
 void AliRICHClusterFinder::
-SinoidalFit(Float_t x, Float_t y, TF1 &func)
+SinoidalFit(Float_t x, Float_t y, TF1 *func)
 {
 // Sinoidal fit
 
@@ -984,7 +955,7 @@ SinoidalFit(Float_t x, Float_t y, TF1 &func)
     Double_t sinoid(Double_t *x, Double_t *par);
     new TF1("sinoidf",sinoid,0.5,0.5,5);
     graphyr->Fit("sinoidf","Q");
-    func = *((TF1*)((graphyr->GetListOfFunctions())->At(0)));
+    func = (TF1*)graphyr->GetListOfFunctions()->At(0);
 /*
     
     TCanvas *c1=new TCanvas(canvasname,canvasname,400,10,600,700);
@@ -1104,8 +1075,9 @@ Float_t DiscrCharge(Int_t i,Double_t *par)
 
 //
 // Minimisation function
-void fcn(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
+void fcn(Int_t &npar, Double_t */*gin*/, Double_t &f, Double_t *par, Int_t /*iflag*/)
 {
+  npar=1;
     Int_t i;
     Float_t delta;
     Float_t chisq=0;
@@ -1134,7 +1106,7 @@ void AliRICHClusterFinder::SetDigits(TClonesArray *RICHdigits)
     fNdigits = fDigits->GetEntriesFast();
 }
 
-AliRICHClusterFinder& AliRICHClusterFinder::operator=(const AliRICHClusterFinder& rhs)
+AliRICHClusterFinder& AliRICHClusterFinder::operator=(const AliRICHClusterFinder& /*rhs*/)
 {
 // Assignment operator
     return *this;