Old style include needed on HP
[u/mrichter/AliRoot.git] / RICH / AliRICHClusterFinder.cxx
index 9400670..098ede5 100644 (file)
 
 /*
   $Log$
+  Revision 1.10  2001/02/27 15:21:58  jbarbosa
+  Transition to SDigits.
+
+  Revision 1.9  2001/01/26 20:00:27  hristov
+  Major upgrade of AliRoot code
+
+  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.
 
 #include "AliRICHHit.h"
 #include "AliRICHHitMapA1.h"
 #include "AliRICHCerenkov.h"
-#include "AliRICHPadHit.h"
+#include "AliRICHSDigit.h"
 #include "AliRICHDigit.h"
 #include "AliRICHRawCluster.h"
-#include "AliRICHRecHit.h"
 
 #include <TTree.h>
 #include <TCanvas.h>
 #include <TH1.h>
+#include <TF1.h>
 #include <TPad.h>
 #include <TGraph.h> 
 #include <TPostScript.h> 
 #include <TMinuit.h> 
 
 //----------------------------------------------------------
-static AliRICHSegmentation* gSegmentation;
+static AliSegmentation* gSegmentation;
 static AliRICHResponse*     gResponse;
 static Int_t                gix[500];
 static Int_t                giy[500];
@@ -60,7 +84,7 @@ static Int_t                gChargeTot;
 ClassImp(AliRICHClusterFinder)
 
 AliRICHClusterFinder::AliRICHClusterFinder
-(AliRICHSegmentation *segmentation, AliRICHResponse *response, 
+(AliSegmentation *segmentation, AliRICHResponse *response, 
  TClonesArray *digits, Int_t chamber)   
 {
 
@@ -190,8 +214,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];
     
@@ -199,7 +223,7 @@ Bool_t AliRICHClusterFinder::Centered(AliRICHRawCluster *cluster)
     Int_t nd=0;
     for (Int_t i=0; i<nn; i++) {
        if (fHitMap->TestHit(x[i],y[i]) == kUsed) {
-           yN[nd]=x[i];
+           xN[nd]=x[i];
            yN[nd]=y[i];
            nd++;
            
@@ -276,7 +300,7 @@ void AliRICHClusterFinder::SplitByLocalMaxima(AliRICHRawCluster *c)
 
     AliRICHDigit* dig[100], *digt;
     Int_t ix[100], iy[100], q[100];
-    Float_t x[100], y[100];
+    Float_t x[100], y[100], zdum;
     Int_t i; // loops over digits
     Int_t j; // loops over local maxima
     //    Float_t xPeak[2];
@@ -289,10 +313,10 @@ 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;
-       fSegmentation->GetPadCxy(ix[i], iy[i], x[i], y[i]);
+       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);
     }
 //
 //  Find local maxima
@@ -309,12 +333,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]]){
@@ -459,7 +483,7 @@ void AliRICHClusterFinder::SplitByLocalMaxima(AliRICHRawCluster *c)
            } else {
                cnew.fQ=Int_t(gChargeTot*(1-qfrac));
            }
-           gSegmentation->SetHit(xrec[j],yrec[j]);
+           gSegmentation->SetHit(xrec[j],yrec[j],0);
            for (i=0; i<mul; i++) {
                cnew.fIndexMap[cnew.fMultiplicity]=c->fIndexMap[i];
                gSegmentation->SetPad(gix[i], giy[i]);
@@ -573,7 +597,7 @@ void  AliRICHClusterFinder::FillCluster(AliRICHRawCluster* c, Int_t flag)
 //  Completes cluster information starting from list of digits
 //
     AliRICHDigit* dig;
-    Float_t x, y;
+    Float_t x, y, z;
     Int_t  ix, iy;
     Float_t frac=0;
     
@@ -589,12 +613,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;
 //
@@ -604,33 +628,33 @@ 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);
           }
        }
 //
        if (flag) {
-           fSegmentation->GetPadCxy(ix, iy, x, y);
+           fSegmentation->GetPadC(ix, iy, x, y, z);
            c->fX += q*x;
            c->fY += q*y;
            c->fQ += q;
@@ -648,8 +672,8 @@ void  AliRICHClusterFinder::FillCluster(AliRICHRawCluster* c, Int_t flag)
 //
      x=c->fX;   
      y=c->fY;
-     fSegmentation->GetPadIxy(x, y, ix, iy);
-     fSegmentation->GetPadCxy(ix, iy, x, y);
+     fSegmentation->GetPadI(x, y, 0, ix, iy);
+     fSegmentation->GetPadC(ix, iy, x, y, z);
      Int_t isec=fSegmentation->Sector(ix,iy);
      TF1* cogCorr = fSegmentation->CorrFunc(isec-1);
      
@@ -671,7 +695,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;
 /*
@@ -680,9 +704,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 
@@ -690,9 +714,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;
 
@@ -700,7 +724,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;
@@ -718,8 +742,8 @@ void  AliRICHClusterFinder::FindCluster(Int_t i, Int_t j, AliRICHRawCluster &c){
     }
 
 // Prepare center of gravity calculation
-    Float_t x, y;
-    fSegmentation->GetPadCxy(i, j, x, y);
+    Float_t x, y, z;
+    fSegmentation->GetPadC(i, j, x, y, z);
     c.fX += q*x;
     c.fY += q*y;
     c.fQ += q;
@@ -760,24 +784,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);
@@ -791,8 +815,10 @@ void AliRICHClusterFinder::FindRawClusters()
        Int_t ix,iy;
        Float_t x=c.fX;   
        Float_t y=c.fY;
-       fSegmentation->GetPadIxy(x, y, ix, iy);
-       fSegmentation->GetPadCxy(ix, iy, x, y);
+       Float_t z;
+       
+       fSegmentation->GetPadI(x, y, 0, ix, iy);
+       fSegmentation->GetPadC(ix, iy, x, y, z);
        Int_t isec=fSegmentation->Sector(ix,iy);
        TF1* cogCorr=fSegmentation->CorrFunc(isec-1);
        if (cogCorr) {
@@ -850,6 +876,8 @@ SinoidalFit(Float_t x, Float_t y, TF1 &func)
 
     static Int_t count=0;
     char canvasname[3];
+    Float_t z;
+    
     count++;
     sprintf(canvasname,"c%d",count);
 
@@ -857,11 +885,11 @@ SinoidalFit(Float_t x, Float_t y, TF1 &func)
     Float_t xg[kNs], yg[kNs], xrg[kNs], yrg[kNs];
     Float_t xsig[kNs], ysig[kNs];
    
-    AliRICHSegmentation *segmentation=fSegmentation;
+    AliSegmentation *segmentation=fSegmentation;
 
     Int_t ix,iy;
-    segmentation->GetPadIxy(x,y,ix,iy);   
-    segmentation->GetPadCxy(ix,iy,x,y);   
+    segmentation->GetPadI(x,y,0,ix,iy);   
+    segmentation->GetPadC(ix,iy,x,y,z);   
     Int_t isec=segmentation->Sector(ix,iy);
 // Pad Limits    
     Float_t xmin = x-segmentation->Dpx(isec)/2;
@@ -889,7 +917,7 @@ SinoidalFit(Float_t x, Float_t y, TF1 &func)
        Float_t qcheck=0;
        segmentation->SigGenInit(x, yscan, 0);
        
-       for (segmentation->FirstPad(x, yscan, dxI, dyI); 
+       for (segmentation->FirstPad(x, yscan,0, dxI, dyI); 
             segmentation->MorePads(); 
             segmentation->NextPad()) 
        {
@@ -901,8 +929,8 @@ SinoidalFit(Float_t x, Float_t y, TF1 &func)
                qcheck+=qp;
                Int_t ixs=segmentation->Ix();
                Int_t iys=segmentation->Iy();
-               Float_t xs,ys;
-               segmentation->GetPadCxy(ixs,iys,xs,ys);
+               Float_t xs,ys,zs;
+               segmentation->GetPadC(ixs,iys,xs,ys,zs);
                sum+=qp*ys;
            }
        } // Pad loop
@@ -925,7 +953,7 @@ SinoidalFit(Float_t x, Float_t y, TF1 &func)
        Float_t qcheck=0;
        segmentation->SigGenInit(xscan, y, 0);
        
-       for (segmentation->FirstPad(xscan, y, dxI, dyI); 
+       for (segmentation->FirstPad(xscan, y, 0, dxI, dyI); 
             segmentation->MorePads(); 
             segmentation->NextPad()) 
        {
@@ -937,8 +965,8 @@ SinoidalFit(Float_t x, Float_t y, TF1 &func)
                qcheck+=qp;
                Int_t ixs=segmentation->Ix();
                Int_t iys=segmentation->Iy();
-               Float_t xs,ys;
-               segmentation->GetPadCxy(ixs,iys,xs,ys);
+               Float_t xs,ys,zs;
+               segmentation->GetPadC(ixs,iys,xs,ys,zs);
                sum+=qp*xs;
            }
        } // Pad loop
@@ -1069,11 +1097,11 @@ Float_t DiscrCharge(Int_t i,Double_t *par)
     }
     gSegmentation->SetPad(gix[i], giy[i]);
 //  First Cluster
-    gSegmentation->SetHit(par[0],par[1]);
+    gSegmentation->SetHit(par[0],par[1],0);
     Float_t q1=gResponse->IntXY(gSegmentation);
     
 //  Second Cluster
-    gSegmentation->SetHit(par[2],par[3]);
+    gSegmentation->SetHit(par[2],par[3],0);
     Float_t q2=gResponse->IntXY(gSegmentation);
     
     Float_t value = qtot*(par[4]*q1+(1.-par[4])*q2);
@@ -1118,13 +1146,3 @@ AliRICHClusterFinder& AliRICHClusterFinder::operator=(const AliRICHClusterFinder
     return *this;
     
 }
-
-
-
-
-
-
-
-
-
-