]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONClusterFinderVS.cxx
Correction of coding conventions: comments for all data members were added.
[u/mrichter/AliRoot.git] / MUON / AliMUONClusterFinderVS.cxx
index d196fd65616acc6a3c6247d95755e9d97daf2b52..6c600ae1ca11e941be79a1d36650b2d30e2da8b9 100644 (file)
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
-/*
-$Log$
-Revision 1.21  2001/05/18 08:54:59  morsch
-Bug in decision on splitting corrected.
-
-Revision 1.20  2001/04/12 12:22:26  morsch
-- some numerical problems caused by pad staggering cured.
-- treatment of 1-2 and 2-1 ghosts
-- debuglevel > 1 prints introduced
-
-Revision 1.19  2001/03/20 13:32:10  egangler
-Code introduced to remove ghosts with the charge correlation between the 2
-cathods. A chi2 is performed for the 2 possibilities.
-If one gets good chi2 (with respect to the fGhostChi2Cut parameter) and the
-other wrong chi2, the ambiguity is solved
-If both gets good or both bad chi2, no choice is made
-By default the fGhostChi2Cut parameter is set to solve about 70% of ghost
-problems with about 2% errors, with the current version of the code.
-
-Implementation :
-fGhostChi2Cut is in AliMUONClusterFinderVS, with setters and getters.
-a fDebugLevel was also introduced to switch off some of the output.
-When an ambiguity is detected and not solved, the fGhost word in
-AliMUONRawCluster is set to 1 or 2, depending whether both charge chi2 are
-good or bad.
-a DumpIndex method was also added in AliMUONRawCluster to produce a printout
-of digit indexes.
-
-User incidences :
-By default, the code makes ghost check. If you want previous behaviour,
-put in MUONrawclusters the value of SetGhostChi2Cut to infinity (1e.6) is
-sufficient.
-
-Revision 1.18  2001/01/26 21:37:53  morsch
-Use access functions to AliMUONDigit member data.
-
-Revision 1.17  2001/01/23 18:58:19  hristov
-Initialisation of some pointers
-
-Revision 1.16  2000/12/21 23:27:30  morsch
-Error in argument list of AddRawCluster corrected.
-
-Revision 1.15  2000/12/21 22:14:38  morsch
-Clean-up of coding rule violations.
-
-Revision 1.14  2000/10/23 16:03:45  morsch
-Correct z-position of all clusters created "on the flight".
-
-Revision 1.13  2000/10/23 13:38:23  morsch
-Set correct z-coordinate when cluster is split.
-
-Revision 1.12  2000/10/18 11:42:06  morsch
-- AliMUONRawCluster contains z-position.
-- Some clean-up of useless print statements during initialisations.
-
-Revision 1.11  2000/10/06 09:04:05  morsch
-- Dummy z-arguments in GetPadI, SetHit, FirstPad replaced by real z-coordinate
-       to make code work with slat chambers (AM)
-- Replace GetPadI calls with unchecked x,y coordinates by pad iterator calls wherever possible.
-
-Revision 1.10  2000/10/03 13:51:57  egangler
-Removal of useless dependencies via forward declarations
-
-Revision 1.9  2000/10/02 16:58:29  egangler
-Cleaning of the code :
--> coding conventions
--> void Streamers
--> some useless includes removed or replaced by "class" statement
-
-Revision 1.8  2000/07/03 11:54:57  morsch
-AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
-The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
-
-Revision 1.7  2000/06/28 15:16:35  morsch
-(1) Client code adapted to new method signatures in AliMUONSegmentation (see comments there)
-to allow development of slat-muon chamber simulation and reconstruction code in the MUON
-framework. The changes should have no side effects (mostly dummy arguments).
-(2) Hit disintegration uses 3-dim hit coordinates to allow simulation
-of chambers with overlapping modules (MakePadHits, Disintegration).
-
-Revision 1.6  2000/06/28 12:19:18  morsch
-More consequent seperation of global input data services (AliMUONClusterInput singleton) and the
-cluster and hit reconstruction algorithms in AliMUONClusterFinderVS.
-AliMUONClusterFinderVS becomes the base class for clustering and hit reconstruction.
-It requires two cathode planes. Small modifications in the code will make it usable for
-one cathode plane and, hence, more general (for test beam data).
-AliMUONClusterFinder is now obsolete.
-
-Revision 1.5  2000/06/28 08:06:10  morsch
-Avoid global variables in AliMUONClusterFinderVS by seperating the input data for the fit from the
-algorithmic part of the class. Input data resides inside the AliMUONClusterInput singleton.
-It also naturally takes care of the TMinuit instance.
-
-Revision 1.4  2000/06/27 16:18:47  gosset
-Finally correct implementation of xm, ym, ixm, iym sizes
-when at least three local maxima on cathode 1 or on cathode 2
-
-Revision 1.3  2000/06/22 14:02:45  morsch
-Parameterised size of xm[], ym[], ixm[], iym[] correctly implemented (PH)
-Some HP scope problems corrected (PH)
-
-Revision 1.2  2000/06/15 07:58:48  morsch
-Code from MUON-dev joined
-
-Revision 1.1.2.3  2000/06/09 21:58:33  morsch
-Most coding rule violations corrected.
-
-Revision 1.1.2.2  2000/02/15 08:33:52  morsch
-Error in calculation of contribution map for double clusters (Split method) corrected   (A.M.)
-Error in determination of track list for double cluster (FillCluster method) corrected  (A.M.)
-Revised and extended SplitByLocalMaxima method (Isabelle Chevrot):
-       - For clusters with more than 2 maxima on one of the cathode planes all valid
-       combinations of maxima on the two cathodes are preserved. The position of the maxima is
-       taken as the hit position.
-       - New FillCluster method with 2 arguments to find tracks associated to the clusters
-       defined above added. (Method destinction by argument list not very elegant in this case,
-       should be revides (A.M.)
-       - Bug in if-statement to handle maximum 1 maximum per plane corrected
-       - Two cluster per cathode but only 1 combination valid is handled.
-       - More rigerous treatment of 1-2 and 2-1 combinations of maxima.
 
-*/
+/* $Id$ */
+
+#include <TMinuit.h> 
+#include <TF1.h>
 
 #include "AliMUONClusterFinderVS.h"
 #include "AliMUONDigit.h"
@@ -142,20 +25,6 @@ Revised and extended SplitByLocalMaxima method (Isabelle Chevrot):
 #include "AliMUONResponse.h"
 #include "AliMUONClusterInput.h"
 #include "AliMUONHitMapA1.h"
-#include "AliRun.h"
-#include "AliMUON.h"
-
-#include <TTree.h>
-#include <TCanvas.h>
-#include <TH1.h>
-#include <TPad.h>
-#include <TGraph.h> 
-#include <TPostScript.h> 
-#include <TMinuit.h> 
-#include <TF1.h>
-
-#include <stdio.h>
-#include <Riostream.h>
 
 //_____________________________________________________________________
 // This function is minimized in the double-Mathieson fit
@@ -166,7 +35,8 @@ void fcnCombiS2(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t if
 
 ClassImp(AliMUONClusterFinderVS)
 
-    AliMUONClusterFinderVS::AliMUONClusterFinderVS()
+AliMUONClusterFinderVS::AliMUONClusterFinderVS()
+  : TObject()
 {
 // Default constructor
     fInput=AliMUONClusterInput::Instance();
@@ -181,22 +51,41 @@ ClassImp(AliMUONClusterFinderVS)
       for (Int_t j=0; j<2; j++) {
         fDig[i][j] = 0;
       }
-    }
+    } 
+    fRawClusters = new TClonesArray("AliMUONRawCluster",1000);
+    fNRawClusters = 0;
 }
-
-AliMUONClusterFinderVS::AliMUONClusterFinderVS(
-    const AliMUONClusterFinderVS & clusterFinder)
+ //____________________________________________________________________________
+AliMUONClusterFinderVS::~AliMUONClusterFinderVS()
 {
-// Dummy copy Constructor
-    ;
+  // Reset tracks information
+   fNRawClusters = 0;
+   if (fRawClusters) {
+     fRawClusters->Delete();
+     delete fRawClusters;
+   }
 }
 
+AliMUONClusterFinderVS::AliMUONClusterFinderVS(const AliMUONClusterFinderVS & clusterFinder):TObject(clusterFinder)
+{
+// Protected copy constructor
+
+  Fatal("AliMUONClusterFinderAZModule", "Not implemented.");
+}
+//____________________________________________________________________________
+void AliMUONClusterFinderVS::ResetRawClusters()
+{
+  // Reset tracks information
+  fNRawClusters = 0;
+  if (fRawClusters) fRawClusters->Clear();
+}
+//____________________________________________________________________________
 void AliMUONClusterFinderVS::Decluster(AliMUONRawCluster *cluster)
 {
 // Decluster by local maxima
     SplitByLocalMaxima(cluster);
 }
-
+//____________________________________________________________________________
 void AliMUONClusterFinderVS::SplitByLocalMaxima(AliMUONRawCluster *c)
 {
 // Split complex cluster by local maxima 
@@ -204,8 +93,8 @@ void AliMUONClusterFinderVS::SplitByLocalMaxima(AliMUONRawCluster *c)
 
     fInput->SetCluster(c);
 
-    fMul[0]=c->fMultiplicity[0];
-    fMul[1]=c->fMultiplicity[1];
+    fMul[0]=c->GetMultiplicity(0);
+    fMul[1]=c->GetMultiplicity(1);
 
 //
 //  dump digit information into arrays
@@ -218,7 +107,7 @@ void AliMUONClusterFinderVS::SplitByLocalMaxima(AliMUONRawCluster *c)
        for (i=0; i<fMul[cath]; i++)
        {
            // pointer to digit
-           fDig[i][cath]=fInput->Digit(cath, c->fIndexMap[i][cath]);
+           fDig[i][cath]=fInput->Digit(cath, c->GetIndex(i, cath));
            // pad coordinates
            fIx[i][cath]= fDig[i][cath]->PadX();
            fIy[i][cath]= fDig[i][cath]->PadY();
@@ -246,16 +135,16 @@ void AliMUONClusterFinderVS::SplitByLocalMaxima(AliMUONRawCluster *c)
 
        // One local maximum on cathodes 1 and 2 (X->cathode 2, Y->cathode 1)
        if (fNLocal[0]==1 &&  fNLocal[1]==1) {
-           fXInit[0]=c->fX[1];
-           fYInit[0]=c->fY[0];
+           fXInit[0]=c->GetX(1);
+           fYInit[0]=c->GetY(0);
            // One local maximum on cathode 1 (X,Y->cathode 1)
        } else if (fNLocal[0]==1) {
-           fXInit[0]=c->fX[0];
-           fYInit[0]=c->fY[0];
+           fXInit[0]=c->GetX(0);
+           fYInit[0]=c->GetY(0);
            // One local maximum on cathode 2  (X,Y->cathode 2)
        } else {
-           fXInit[0]=c->fX[1];
-           fYInit[0]=c->fY[1];
+           fXInit[0]=c->GetX(1);
+           fYInit[0]=c->GetY(1);
        }
        if (fDebugLevel)
            fprintf(stderr,"\n cas (1) CombiSingleMathiesonFit(c)\n");
@@ -268,22 +157,23 @@ void AliMUONClusterFinderVS::SplitByLocalMaxima(AliMUONRawCluster *c)
        if (fDebugLevel)
            fprintf(stderr," chi2 %f ",chi2);
 
-       c->fX[0]=fXFit[0];
-       c->fY[0]=fYFit[0];
+       c->SetX(0, fXFit[0]);
+       c->SetY(0, fYFit[0]);
 
-       c->fX[1]=fXFit[0];
-       c->fY[1]=fYFit[0];
-       c->fChi2[0]=chi2;
-       c->fChi2[1]=chi2;
+       c->SetX(1,fXFit[0]);
+       c->SetY(1,fYFit[0]);
+       c->SetChi2(0,chi2);
+       c->SetChi2(1,chi2);
         // Force on anod
-       c->fX[0]=fSeg[0]->GetAnod(c->fX[0]);
-       c->fX[1]=fSeg[1]->GetAnod(c->fX[1]);
+       c->SetX(0, fSeg[0]->GetAnod(c->GetX(0)));
+       c->SetX(1, fSeg[1]->GetAnod(c->GetX(1)));
        
 // If reasonable chi^2 add result to the list of rawclusters
        if (chi2 < 0.3) {
            AddRawCluster(*c);
 // If not try combined double Mathieson Fit
        } else {
+         if (fDebugLevel)
            fprintf(stderr," MAUVAIS CHI2 !!!\n");
            if (fNLocal[0]==1 &&  fNLocal[1]==1) {
                fXInit[0]=fX[fIndLocal[0][1]][1];
@@ -314,12 +204,15 @@ void AliMUONClusterFinderVS::SplitByLocalMaxima(AliMUONRawCluster *c)
 //         chi2_2->Fill(chi2);
            
 // Was this any better ??
-           fprintf(stderr," Old and new chi2 %f %f ", oldchi2, chi2);
+           if (fDebugLevel)
+             fprintf(stderr," Old and new chi2 %f %f ", oldchi2, chi2);
            if (fFitStat!=0 && chi2>0 && (2.*chi2 < oldchi2)) {
+             if (fDebugLevel)
                fprintf(stderr," Split\n");
                // Split cluster into two according to fit result
                Split(c);
            } else {
+             if (fDebugLevel)
                fprintf(stderr," Don't Split\n");
                // Don't split
                AddRawCluster(*c);
@@ -393,7 +286,8 @@ void AliMUONClusterFinderVS::SplitByLocalMaxima(AliMUONRawCluster *c)
                accepted[ico]=kFALSE;
            }
        }
-       printf("\n iacc= %d:\n", iacc);
+       if (fDebugLevel)
+         printf("\n iacc= %d:\n", iacc);
        if (iacc == 3) {
            if (accepted[0] && accepted[1]) {
                if (dr[0] >= dr[1]) {
@@ -428,8 +322,8 @@ void AliMUONClusterFinderVS::SplitByLocalMaxima(AliMUONRawCluster *c)
        }
        
        
-       printf("\n iacc= %d:\n", iacc);
        if (fDebugLevel) {
+         printf("\n iacc= %d:\n", iacc);
            if (iacc==2) {
                fprintf(stderr,"\n iacc=2: No problem ! \n");
            } else if (iacc==4) {
@@ -546,20 +440,20 @@ void AliMUONClusterFinderVS::SplitByLocalMaxima(AliMUONRawCluster *c)
                            AliMUONRawCluster cnew;
                            Int_t cath;    
                            for (cath=0; cath<2; cath++) {
-                               cnew.fX[cath]=Float_t(xm[ico][1]);
-                               cnew.fY[cath]=Float_t(ym[ico][0]);
-                               cnew.fZ[cath]=fZPlane;
+                               cnew.SetX(cath, Float_t(xm[ico][1]));
+                               cnew.SetY(cath, Float_t(ym[ico][0]));
+                               cnew.SetZ(cath, fZPlane);
                                
-                               cnew.fMultiplicity[cath]=c->fMultiplicity[cath];
+                               cnew.SetMultiplicity(cath,c->GetMultiplicity(cath));
                                for (i=0; i<fMul[cath]; i++) {
-                                   cnew.fIndexMap[i][cath]=c->fIndexMap[i][cath];
+                                   cnew.SetIndex(i, cath, c->GetIndex(i,cath));
                                    fSeg[cath]->SetPad(fIx[i][cath], fIy[i][cath]);
                                }
                                fprintf(stderr,"\nRawCluster %d cath %d\n",ico,cath);
-                               fprintf(stderr,"mult_av %d\n",c->fMultiplicity[cath]);
+                               fprintf(stderr,"mult_av %d\n",c->GetMultiplicity(cath));
                                FillCluster(&cnew,cath);
                            } 
-                           cnew.fClusterType=cnew.PhysicsContribution();
+                           cnew.SetClusterType(cnew.PhysicsContribution());
                            AddRawCluster(cnew);
                            fNPeaks++;
                        }
@@ -690,10 +584,10 @@ void AliMUONClusterFinderVS::SplitByLocalMaxima(AliMUONRawCluster *c)
            // fChi2[1]=sChi2[0]=chi2s;
 
            if (chi2f<=fGhostChi2Cut && chi2s<=fGhostChi2Cut)
-               c->fGhost=1;
+               c->SetGhost(1);
            if   (chi2f>fGhostChi2Cut && chi2s>fGhostChi2Cut) {
                // we keep the ghost
-               c->fGhost=2;
+               c->SetGhost(2);
                chi2s=-1;
                chi2f=-1;
            }
@@ -709,7 +603,7 @@ void AliMUONClusterFinderVS::SplitByLocalMaxima(AliMUONRawCluster *c)
                }
                Split(c);
            }
-           c->fGhost=0;
+           c->SetGhost(0);
        }
 
     } else if (fNLocal[0]==2 &&  fNLocal[1]==1) {
@@ -831,19 +725,19 @@ void AliMUONClusterFinderVS::SplitByLocalMaxima(AliMUONRawCluster *c)
                    AliMUONRawCluster cnew;
                    Int_t cath;    
                    for (cath=0; cath<2; cath++) {
-                       cnew.fX[cath]=Float_t(xm[ico][1]);
-                       cnew.fY[cath]=Float_t(ym[ico][0]);
-                       cnew.fZ[cath]=fZPlane;
-                       cnew.fMultiplicity[cath]=c->fMultiplicity[cath];
+                       cnew.SetX(cath, Float_t(xm[ico][1]));
+                       cnew.SetY(cath, Float_t(ym[ico][0]));
+                       cnew.SetZ(cath, fZPlane);
+                       cnew.SetMultiplicity(cath, c->GetMultiplicity(cath));
                        for (i=0; i<fMul[cath]; i++) {
-                           cnew.fIndexMap[i][cath]=c->fIndexMap[i][cath];
+                           cnew.SetIndex(i, cath, c->GetIndex(i, cath));
                            fSeg[cath]->SetPad(fIx[i][cath], fIy[i][cath]);
                        }
                        fprintf(stderr,"\nRawCluster %d cath %d\n",ico,cath);
-                       fprintf(stderr,"mult_av %d\n",c->fMultiplicity[cath]);
+                       fprintf(stderr,"mult_av %d\n",c->GetMultiplicity(cath));
                        FillCluster(&cnew,cath);
                    } 
-                   cnew.fClusterType=cnew.PhysicsContribution();
+                   cnew.SetClusterType(cnew.PhysicsContribution());
                    AddRawCluster(cnew);
                    fNPeaks++;
                }
@@ -969,19 +863,19 @@ void AliMUONClusterFinderVS::SplitByLocalMaxima(AliMUONRawCluster *c)
                    AliMUONRawCluster cnew;
                    Int_t cath;    
                    for (cath=0; cath<2; cath++) {
-                       cnew.fX[cath]=Float_t(xm[ico][1]);
-                       cnew.fY[cath]=Float_t(ym[ico][0]);
-                       cnew.fZ[cath]=fZPlane;
-                       cnew.fMultiplicity[cath]=c->fMultiplicity[cath];
+                       cnew.SetX(cath, Float_t(xm[ico][1]));
+                       cnew.SetY(cath, Float_t(ym[ico][0]));
+                       cnew.SetZ(cath, fZPlane);
+                       cnew.SetMultiplicity(cath, c->GetMultiplicity(cath));
                        for (i=0; i<fMul[cath]; i++) {
-                           cnew.fIndexMap[i][cath]=c->fIndexMap[i][cath];
+                           cnew.SetIndex(i, cath, c->GetIndex(i, cath));
                            fSeg[cath]->SetPad(fIx[i][cath], fIy[i][cath]);
                        }
                        fprintf(stderr,"\nRawCluster %d cath %d\n",ico,cath);
-                       fprintf(stderr,"mult_av %d\n",c->fMultiplicity[cath]);
+                       fprintf(stderr,"mult_av %d\n",c->GetMultiplicity(cath));
                        FillCluster(&cnew,cath);
                    } 
-                   cnew.fClusterType=cnew.PhysicsContribution();
+                   cnew.SetClusterType(cnew.PhysicsContribution());
                    AddRawCluster(cnew);
                    fNPeaks++;
                }
@@ -1045,17 +939,17 @@ void AliMUONClusterFinderVS::SplitByLocalMaxima(AliMUONRawCluster *c)
                Int_t cath;    
                AliMUONRawCluster cnew;
                for (cath=0; cath<2; cath++) {
-                   cnew.fX[cath]=Float_t(xm[ico][1]);
-                   cnew.fY[cath]=Float_t(ym[ico][0]);
-                   cnew.fZ[cath]=fZPlane;
-                   cnew.fMultiplicity[cath]=c->fMultiplicity[cath];
+                   cnew.SetX(cath, Float_t(xm[ico][1]));
+                   cnew.SetY(cath, Float_t(ym[ico][0]));
+                   cnew.SetZ(cath, fZPlane);
+                   cnew.SetMultiplicity(cath, c->GetMultiplicity(cath));
                    for (i=0; i<fMul[cath]; i++) {
-                       cnew.fIndexMap[i][cath]=c->fIndexMap[i][cath];
+                       cnew.SetIndex(i, cath, c->GetIndex(i, cath));
                        fSeg[cath]->SetPad(fIx[i][cath], fIy[i][cath]);
                    }
                    FillCluster(&cnew,cath);
                } 
-               cnew.fClusterType=cnew.PhysicsContribution();
+               cnew.SetClusterType(cnew.PhysicsContribution());
                AddRawCluster(cnew);
                fNPeaks++;
            }
@@ -1067,7 +961,7 @@ void AliMUONClusterFinderVS::SplitByLocalMaxima(AliMUONRawCluster *c)
     }
 }
 
-void AliMUONClusterFinderVS::FindLocalMaxima(AliMUONRawCluster* c)
+void AliMUONClusterFinderVS::FindLocalMaxima(AliMUONRawCluster* /*c*/)
 {
 // Find all local maxima of a cluster
     if (fDebugLevel)
@@ -1283,51 +1177,51 @@ void  AliMUONClusterFinderVS::FillCluster(AliMUONRawCluster* c, Int_t flag, Int_
     Int_t  ix, iy;
     
     if (cath==1) {
-       c->fPeakSignal[cath]=c->fPeakSignal[0]; 
+       c->SetPeakSignal(cath,c->GetPeakSignal(0));     
     } else {
-       c->fPeakSignal[cath]=0;
+       c->SetPeakSignal(cath,0);
     }
     
     
     if (flag) {
-       c->fX[cath]=0;
-       c->fY[cath]=0;
-       c->fQ[cath]=0;
+       c->SetX(cath,0.);
+       c->SetY(cath,0.);
+       c->SetCharge(cath,0);
     }
 
     if (fDebugLevel)
-       fprintf(stderr,"\n fPeakSignal %d\n",c->fPeakSignal[cath]);
-    for (Int_t i=0; i<c->fMultiplicity[cath]; i++)
+       fprintf(stderr,"\n fPeakSignal %d\n",c->GetPeakSignal(cath));
+    for (Int_t i=0; i<c->GetMultiplicity(cath); i++)
     {
-       dig= fInput->Digit(cath,c->fIndexMap[i][cath]);
-       ix=dig->PadX()+c->fOffsetMap[i][cath];
+       dig= fInput->Digit(cath,c->GetIndex(i,cath));
+       ix=dig->PadX()+c->GetOffset(i,cath);
        iy=dig->PadY();
        Int_t q=dig->Signal();
-       if (!flag) q=Int_t(q*c->fContMap[i][cath]);
+       if (!flag) q=Int_t(q*c->GetContrib(i,cath));
 //     fprintf(stderr,"q %d c->fPeakSignal[ %d ] %d\n",q,cath,c->fPeakSignal[cath]);
        if (dig->Physics() >= dig->Signal()) {
-           c->fPhysicsMap[i]=2;
+           c->SetPhysics(i,2);
        } else if (dig->Physics() == 0) {
-           c->fPhysicsMap[i]=0;
-       } else  c->fPhysicsMap[i]=1;
+           c->SetPhysics(i,0);
+       } else  c->SetPhysics(i,1);
 //
 // 
        if (fDebugLevel>1)
-           fprintf(stderr,"q %d c->fPeakSignal[cath] %d\n",q,c->fPeakSignal[cath]);
+           fprintf(stderr,"q %d c->fPeakSignal[cath] %d\n",q,c->GetPeakSignal(cath));
 // peak signal and track list
-       if (q>c->fPeakSignal[cath]) {
-           c->fPeakSignal[cath]=q;
-           c->fTracks[0]=dig->Hit();
-           c->fTracks[1]=dig->Track(0);
-           c->fTracks[2]=dig->Track(1);
+       if (q>c->GetPeakSignal(cath)) {
+           c->SetPeakSignal(cath, q);
+           c->SetTrack(0,dig->Hit());
+           c->SetTrack(1,dig->Track(0));
+           c->SetTrack(2,dig->Track(1));
 //         fprintf(stderr," c->fTracks[0] %d c->fTracks[1] %d\n",dig->fHit,dig->fTracks[0]);
        }
 //
        if (flag) {
            fSeg[cath]->GetPadC(ix, iy, x, y, z);
-           c->fX[cath] += q*x;
-           c->fY[cath] += q*y;
-           c->fQ[cath] += q;
+           c->AddX(cath, q*x);
+           c->AddY(cath, q*y);
+           c->AddCharge(cath, q);
        }
     } // loop over digits
     if (fDebugLevel)
@@ -1335,23 +1229,23 @@ void  AliMUONClusterFinderVS::FillCluster(AliMUONRawCluster* c, Int_t flag, Int_
 
 
     if (flag) {
-       c->fX[cath]/=c->fQ[cath];
+       c->SetX(cath, c->GetX(cath)/c->GetCharge(cath));
 // Force on anod
-       c->fX[cath]=fSeg[cath]->GetAnod(c->fX[cath]);
-       c->fY[cath]/=c->fQ[cath]
+       c->SetX(cath, fSeg[cath]->GetAnod(c->GetX(cath)));
+       c->SetY(cath, c->GetY(cath)/c->GetCharge(cath))
 //
 //  apply correction to the coordinate along the anode wire
 //
-       x=c->fX[cath];   
-       y=c->fY[cath];
+       x=c->GetX(cath);   
+       y=c->GetY(cath);
        fSeg[cath]->GetPadI(x, y, fZPlane, ix, iy);
        fSeg[cath]->GetPadC(ix, iy, x, y, z);
        Int_t isec=fSeg[cath]->Sector(ix,iy);
        TF1* cogCorr = fSeg[cath]->CorrFunc(isec-1);
        
        if (cogCorr) {
-           Float_t yOnPad=(c->fY[cath]-y)/fSeg[cath]->Dpy(isec);
-           c->fY[cath]=c->fY[cath]-cogCorr->Eval(yOnPad, 0, 0);
+           Float_t yOnPad=(c->GetY(cath)-y)/fSeg[cath]->Dpy(isec);
+           c->SetY(cath, c->GetY(cath)-cogCorr->Eval(yOnPad, 0, 0));
        }
     }
 }
@@ -1372,15 +1266,15 @@ void  AliMUONClusterFinderVS::FillCluster(AliMUONRawCluster* c, Int_t cath)
     Float_t xpad, ypad, zpad;
     Float_t dx, dy, dr;
 
-    for (Int_t i=0; i<c->fMultiplicity[cath]; i++)
+    for (Int_t i=0; i<c->GetMultiplicity(cath); i++)
     {
-       dig = fInput->Digit(cath,c->fIndexMap[i][cath]);
+       dig = fInput->Digit(cath,c->GetIndex(i,cath));
        fSeg[cath]->
        GetPadC(dig->PadX(),dig->PadY(),xpad,ypad, zpad);
        if (fDebugLevel)
-           fprintf(stderr,"x %f y %f cx %f cy %f\n",xpad,ypad,c->fX[0],c->fY[0]);
-       dx = xpad - c->fX[0];
-       dy = ypad - c->fY[0];
+           fprintf(stderr,"x %f y %f cx %f cy %f\n",xpad,ypad,c->GetX(0),c->GetY(0));
+       dx = xpad - c->GetX(0);
+       dy = ypad - c->GetY(0);
        dr = TMath::Sqrt(dx*dx+dy*dy);
 
        if (dr < dr0) {
@@ -1389,14 +1283,14 @@ void  AliMUONClusterFinderVS::FillCluster(AliMUONRawCluster* c, Int_t cath)
                fprintf(stderr," dr %f\n",dr);
            Int_t q=dig->Signal();
            if (dig->Physics() >= dig->Signal()) {
-               c->fPhysicsMap[i]=2;
+               c->SetPhysics(i,2);
            } else if (dig->Physics() == 0) {
-               c->fPhysicsMap[i]=0;
-           } else  c->fPhysicsMap[i]=1;
-           c->fPeakSignal[cath]=q;
-           c->fTracks[0]=dig->Hit();
-           c->fTracks[1]=dig->Track(0);
-           c->fTracks[2]=dig->Track(1);
+               c->SetPhysics(i,0);
+           } else  c->SetPhysics(i,1);
+           c->SetPeakSignal(cath,q);
+           c->SetTrack(0,dig->Hit());
+           c->SetTrack(1,dig->Track(0));
+           c->SetTrack(2,dig->Track(1));
            if (fDebugLevel)
                fprintf(stderr," c->fTracks[0] %d c->fTracks[1] %d\n",dig->Hit(),
                    dig->Track(0));
@@ -1406,7 +1300,7 @@ void  AliMUONClusterFinderVS::FillCluster(AliMUONRawCluster* c, Int_t cath)
 
 //  apply correction to the coordinate along the anode wire
 // Force on anod
-    c->fX[cath]=fSeg[cath]->GetAnod(c->fX[cath]);
+    c->SetX(cath,fSeg[cath]->GetAnod(c->GetX(cath)));
 }
 
 void  AliMUONClusterFinderVS::FindCluster(Int_t i, Int_t j, Int_t cath, AliMUONRawCluster &c){
@@ -1425,36 +1319,36 @@ void  AliMUONClusterFinderVS::FindCluster(Int_t i, Int_t j, Int_t cath, AliMUONR
     Int_t theX=dig->PadX();
     Int_t theY=dig->PadY(); 
    
-    if (q > TMath::Abs(c.fPeakSignal[0]) && q > TMath::Abs(c.fPeakSignal[1])) {
-       c.fPeakSignal[cath]=q;
-       c.fTracks[0]=dig->Hit();
-       c.fTracks[1]=dig->Track(0);
-       c.fTracks[2]=dig->Track(1);
+    if (q > TMath::Abs(c.GetPeakSignal(0)) && q > TMath::Abs(c.GetPeakSignal(1))) {
+       c.SetPeakSignal(cath,q);
+       c.SetTrack(0,dig->Hit());
+       c.SetTrack(1,dig->Track(0));
+       c.SetTrack(2,dig->Track(1));
     }
 
 //
 //  Make sure that list of digits is ordered 
 // 
-    Int_t mu=c.fMultiplicity[cath];
-    c.fIndexMap[mu][cath]=idx;
+    Int_t mu=c.GetMultiplicity(cath);
+    c.SetIndex(mu, cath, idx);
     
     if (dig->Physics() >= dig->Signal()) {
-        c.fPhysicsMap[mu]=2;
+        c.SetPhysics(mu,2);
     } else if (dig->Physics() == 0) {
-        c.fPhysicsMap[mu]=0;
-    } else  c.fPhysicsMap[mu]=1;
+        c.SetPhysics(mu,0);
+    } else  c.SetPhysics(mu,1);
 
     
     if (mu > 0) {
        for (Int_t ind = mu-1; ind >= 0; ind--) {
-           Int_t ist=(c.fIndexMap)[ind][cath];
+           Int_t ist=c.GetIndex(ind,cath);
            Int_t ql=fInput->Digit(cath, ist)->Signal();
            Int_t ix=fInput->Digit(cath, ist)->PadX();
            Int_t iy=fInput->Digit(cath, ist)->PadY();
            
            if (q>ql || (q==ql && theX > ix && theY < iy)) {
-               c.fIndexMap[ind][cath]=idx;
-               c.fIndexMap[ind+1][cath]=ist;
+               c.SetIndex(ind, cath, idx);
+               c.SetIndex(ind+1, cath, ist);
            } else {
                
                break;
@@ -1462,19 +1356,19 @@ void  AliMUONClusterFinderVS::FindCluster(Int_t i, Int_t j, Int_t cath, AliMUONR
        }
     }
 
-    c.fMultiplicity[cath]++;
-    if (c.fMultiplicity[cath] >= 50 ) {
-       printf("FindCluster - multiplicity >50  %d \n",c.fMultiplicity[0]);
-       c.fMultiplicity[cath]=49;
+    c.SetMultiplicity(cath, c.GetMultiplicity(cath)+1);
+    if (c.GetMultiplicity(cath) >= 50 ) {
+       printf("FindCluster - multiplicity >50  %d \n",c.GetMultiplicity(0));
+       c.SetMultiplicity(cath, 49);
     }
 
 // Prepare center of gravity calculation
     Float_t x, y, z;
     fSeg[cath]->GetPadC(i, j, x, y, z);
     
-    c.fX[cath] += q*x;
-    c.fY[cath] += q*y;
-    c.fQ[cath] += q;
+    c.AddX(cath,q*x);
+    c.AddY(cath,q*y);
+    c.AddCharge(cath,q);
 //
 // Flag hit as "taken"  
     fHitMap[cath]->FlagHit(i,j);
@@ -1551,6 +1445,7 @@ void AliMUONClusterFinderVS::FindRawClusters()
   // fills the tree with raw clusters
   //
 
+    ResetRawClusters();
 //  Return if no input datad available
     if (!fInput->NDigits(0) && !fInput->NDigits(1)) return;
 
@@ -1582,46 +1477,49 @@ void AliMUONClusterFinderVS::FindRawClusters()
            if (fDebugLevel)
                fprintf(stderr,"\n CATHODE %d CLUSTER %d\n",cath,ncls);
            AliMUONRawCluster c;
-           c.fMultiplicity[0]=0;
-           c.fMultiplicity[1]=0;
-           c.fPeakSignal[cath]=dig->Signal();
-           c.fTracks[0]=dig->Hit();
-           c.fTracks[1]=dig->Track(0);
-           c.fTracks[2]=dig->Track(1);
+           c.SetMultiplicity(0, 0);
+           c.SetMultiplicity(1, 0);
+           c.SetPeakSignal(cath,dig->Signal());
+           c.SetTrack(0, dig->Hit());
+           c.SetTrack(1, dig->Track(0));
+           c.SetTrack(2, dig->Track(1));
            // tag the beginning of cluster list in a raw cluster
-           c.fNcluster[0]=-1;
+           c.SetNcluster(0,-1);
            Float_t xcu, ycu;
            fSeg[cath]->GetPadC(i,j,xcu, ycu, fZPlane);
            fSector= fSeg[cath]->Sector(i,j)/100;
            if (fDebugLevel)
                printf("\n New Seed %d %d ", i,j);
-           
+       
+            
            FindCluster(i,j,cath,c);
 //          ^^^^^^^^^^^^^^^^^^^^^^^^
            // center of gravity
-           c.fX[0] /= c.fQ[0];
+           if (c.GetX(0)!=0.) c.SetX(0, c.GetX(0)/c.GetCharge(0)); // c.fX[0] /= c.fQ[0];
 // Force on anod
-           c.fX[0]=fSeg[0]->GetAnod(c.fX[0]);
-           c.fY[0] /= c.fQ[0];
-           c.fX[1] /= c.fQ[1];
-// Force on anod
-           c.fX[1]=fSeg[0]->GetAnod(c.fX[1]);
-           c.fY[1] /= c.fQ[1];
+           c.SetX(0,fSeg[0]->GetAnod(c.GetX(0)));
+           if (c.GetY(0)!=0.) c.SetY(0, c.GetY(0)/c.GetCharge(0)); // c.fY[0] /= c.fQ[0];
+           
+           if(c.GetCharge(1)!=0.) c.SetX(1, c.GetX(1)/c.GetCharge(1));  // c.fX[1] /= c.fQ[1];
+                                       
+          // Force on anod
+           c.SetX(1, fSeg[0]->GetAnod(c.GetX(1)));
+           if(c.GetCharge(1)!=0.) c.SetY(1, c.GetY(1)/c.GetCharge(1));// c.fY[1] /= c.fQ[1];
            
-           c.fZ[0] = fZPlane;
-           c.fZ[1] = fZPlane;      
+           c.SetZ(0, fZPlane);
+           c.SetZ(1, fZPlane);     
 
            if (fDebugLevel) {
                fprintf(stderr,"\n Cathode 1 multiplicite %d X(CG) %f Y(CG) %f\n",
-                       c.fMultiplicity[0],c.fX[0],c.fY[0]);
+                       c.GetMultiplicity(0),c.GetX(0),c.GetY(0));
                fprintf(stderr," Cathode 2 multiplicite %d X(CG) %f Y(CG) %f\n",
-                       c.fMultiplicity[1],c.fX[1],c.fY[1]);
+                       c.GetMultiplicity(1),c.GetX(1),c.GetY(1));
            }
 //      Analyse cluster and decluster if necessary
 //     
        ncls++;
-       c.fNcluster[1]=fNRawClusters;
-       c.fClusterType=c.PhysicsContribution();
+       c.SetNcluster(1,fNRawClusters);
+       c.SetClusterType(c.PhysicsContribution());
 
        fNPeaks=0;
 //
@@ -1630,14 +1528,15 @@ void AliMUONClusterFinderVS::FindRawClusters()
 //
 //      reset Cluster object
        { // begin local scope
-           for (int k=0;k<c.fMultiplicity[0];k++) c.fIndexMap[k][0]=0;
+           for (int k=0;k<c.GetMultiplicity(0);k++) c.SetIndex(k, 0, 0);
        } // end local scope
 
        { // begin local scope
-           for (int k=0;k<c.fMultiplicity[1];k++) c.fIndexMap[k][1]=0;
+           for (int k=0;k<c.GetMultiplicity(1);k++) c.SetIndex(k, 1, 0);
        } // end local scope
        
-       c.fMultiplicity[0]=c.fMultiplicity[0]=0;
+       c.SetMultiplicity(0,0);
+       c.SetMultiplicity(1,0);
 
        
        } // end loop ndig
@@ -1650,23 +1549,25 @@ Float_t AliMUONClusterFinderVS::SingleMathiesonFit(AliMUONRawCluster *c, Int_t c
 {
 // Performs a single Mathieson fit on one cathode
 // 
+    Double_t arglist[20];
+    Int_t ierflag=0;
     AliMUONClusterInput& clusterInput = *(AliMUONClusterInput::Instance());
     
     clusterInput.Fitter()->SetFCN(fcnS1);
     clusterInput.Fitter()->mninit(2,10,7);
-    Double_t arglist[20];
-    Int_t ierflag=0;
-    arglist[0]=1;
+    clusterInput.Fitter()->SetPrintLevel(-1+fDebugLevel);
+    arglist[0]=-1;
+    clusterInput.Fitter()->mnexcm("SET NOW", arglist, 0, ierflag);
 // Set starting values 
     static Double_t vstart[2];
-    vstart[0]=c->fX[1];
-    vstart[1]=c->fY[0];
+    vstart[0]=c->GetX(1);
+    vstart[1]=c->GetY(0);
     
     
 // lower and upper limits
     static Double_t lower[2], upper[2];
     Int_t ix,iy;
-    fSeg[cath]->GetPadI(c->fX[cath], c->fY[cath], fZPlane, ix, iy);
+    fSeg[cath]->GetPadI(c->GetX(cath), c->GetY(cath), fZPlane, ix, iy);
     Int_t isec=fSeg[cath]->Sector(ix, iy);
     lower[0]=vstart[0]-fSeg[cath]->Dpx(isec)/2;
     lower[1]=vstart[1]-fSeg[cath]->Dpy(isec)/2;
@@ -1680,16 +1581,12 @@ Float_t AliMUONClusterFinderVS::SingleMathiesonFit(AliMUONRawCluster *c, Int_t c
     clusterInput.Fitter()->mnparm(0,"x1",vstart[0],step[0],lower[0],upper[0],ierflag);
     clusterInput.Fitter()->mnparm(1,"y1",vstart[1],step[1],lower[1],upper[1],ierflag);
 // ready for minimisation      
-    clusterInput.Fitter()->SetPrintLevel(-1+fDebugLevel);
-    if (fDebugLevel==0)
-       clusterInput.Fitter()->mnexcm("SET NOW", arglist, 0, ierflag);
-    clusterInput.Fitter()->mnexcm("SET OUT", arglist, 0, ierflag);
     arglist[0]= -1;
     arglist[1]= 0;
     
     clusterInput.Fitter()->mnexcm("SET NOGR", arglist, 0, ierflag);
     clusterInput.Fitter()->mnexcm("MIGRAD", arglist, 0, ierflag);
-    clusterInput.Fitter()->mnexcm("EXIT" , arglist, 0, ierflag);
+    //    clusterInput.Fitter()->mnexcm("EXIT" , arglist, 0, ierflag);
     Double_t fmin, fedm, errdef;
     Int_t   npari, nparx, istat;
       
@@ -1709,16 +1606,18 @@ Float_t AliMUONClusterFinderVS::SingleMathiesonFit(AliMUONRawCluster *c, Int_t c
     return fmin;
 }
 
-Float_t AliMUONClusterFinderVS::CombiSingleMathiesonFit(AliMUONRawCluster *c)
+Float_t AliMUONClusterFinderVS::CombiSingleMathiesonFit(AliMUONRawCluster * /*c*/)
 {
 // Perform combined Mathieson fit on both cathode planes
 //
+    Double_t arglist[20];
+    Int_t ierflag=0;
     AliMUONClusterInput& clusterInput = *(AliMUONClusterInput::Instance());
     clusterInput.Fitter()->SetFCN(fcnCombiS1);
     clusterInput.Fitter()->mninit(2,10,7);
-    Double_t arglist[20];
-    Int_t ierflag=0;
-    arglist[0]=1;
+    clusterInput.Fitter()->SetPrintLevel(-1+fDebugLevel);
+    arglist[0]=-1;
+    clusterInput.Fitter()->mnexcm("SET NOW", arglist, 0, ierflag);
     static Double_t vstart[2];
     vstart[0]=fXInit[0];
     vstart[1]=fYInit[0];
@@ -1775,16 +1674,12 @@ Float_t AliMUONClusterFinderVS::CombiSingleMathiesonFit(AliMUONRawCluster *c)
     clusterInput.Fitter()->mnparm(0,"x1",vstart[0],step[0],lower[0],upper[0],ierflag);
     clusterInput.Fitter()->mnparm(1,"y1",vstart[1],step[1],lower[1],upper[1],ierflag);
 // ready for minimisation      
-    clusterInput.Fitter()->SetPrintLevel(-1+fDebugLevel);
-    if (fDebugLevel==0)
-       clusterInput.Fitter()->mnexcm("SET NOW", arglist, 0, ierflag);
-    clusterInput.Fitter()->mnexcm("SET OUT", arglist, 0, ierflag);
     arglist[0]= -1;
     arglist[1]= 0;
     
     clusterInput.Fitter()->mnexcm("SET NOGR", arglist, 0, ierflag);
     clusterInput.Fitter()->mnexcm("MIGRAD", arglist, 0, ierflag);
-    clusterInput.Fitter()->mnexcm("EXIT" , arglist, 0, ierflag);
+    //    clusterInput.Fitter()->mnexcm("EXIT" , arglist, 0, ierflag);
     Double_t fmin, fedm, errdef;
     Int_t   npari, nparx, istat;
       
@@ -1804,19 +1699,21 @@ Float_t AliMUONClusterFinderVS::CombiSingleMathiesonFit(AliMUONRawCluster *c)
     return fmin;
 }
 
-Bool_t AliMUONClusterFinderVS::DoubleMathiesonFit(AliMUONRawCluster *c, Int_t cath)
+Bool_t AliMUONClusterFinderVS::DoubleMathiesonFit(AliMUONRawCluster * /*c*/, Int_t cath)
 {
 // Performs a double Mathieson fit on one cathode
 // 
 
 //
 //  Initialise global variables for fit
+    Double_t arglist[20];
+    Int_t ierflag=0;
     AliMUONClusterInput& clusterInput = *(AliMUONClusterInput::Instance());
     clusterInput.Fitter()->SetFCN(fcnS2);
     clusterInput.Fitter()->mninit(5,10,7);
-    Double_t arglist[20];
-    Int_t ierflag=0;
-    arglist[0]=1;
+    clusterInput.Fitter()->SetPrintLevel(-1+fDebugLevel);
+    arglist[0]=-1;
+    clusterInput.Fitter()->mnexcm("SET NOW", arglist, 0, ierflag);
 // Set starting values 
     static Double_t vstart[5];
     vstart[0]=fX[fIndLocal[0][cath]][cath];
@@ -1852,16 +1749,12 @@ Bool_t AliMUONClusterFinderVS::DoubleMathiesonFit(AliMUONRawCluster *c, Int_t ca
     clusterInput.Fitter()->mnparm(3,"y2",vstart[3],step[3],lower[3],upper[3],ierflag);
     clusterInput.Fitter()->mnparm(4,"a0",vstart[4],step[4],lower[4],upper[4],ierflag);
 // ready for minimisation      
-    clusterInput.Fitter()->SetPrintLevel(-1+fDebugLevel);
-    if (fDebugLevel==0)
-       clusterInput.Fitter()->mnexcm("SET NOW", arglist, 0, ierflag);
-    clusterInput.Fitter()->mnexcm("SET OUT", arglist, 0, ierflag);
     arglist[0]= -1;
     arglist[1]= 0;
     
     clusterInput.Fitter()->mnexcm("SET NOGR", arglist, 0, ierflag);
     clusterInput.Fitter()->mnexcm("MIGRAD", arglist, 0, ierflag);
-    clusterInput.Fitter()->mnexcm("EXIT" , arglist, 0, ierflag);
+    //    clusterInput.Fitter()->mnexcm("EXIT" , arglist, 0, ierflag);
 // Get fitted parameters
     Double_t xrec[2], yrec[2], qfrac;
     TString chname;
@@ -1881,17 +1774,19 @@ Bool_t AliMUONClusterFinderVS::DoubleMathiesonFit(AliMUONRawCluster *c, Int_t ca
     return kTRUE;
 }
 
-Float_t AliMUONClusterFinderVS::CombiDoubleMathiesonFit(AliMUONRawCluster *c)
+Float_t AliMUONClusterFinderVS::CombiDoubleMathiesonFit(AliMUONRawCluster * /*c*/)
 {
 //
 // Perform combined double Mathieson fit on both cathode planes
 //
+    Double_t arglist[20];
+    Int_t ierflag=0;
     AliMUONClusterInput& clusterInput = *(AliMUONClusterInput::Instance());
     clusterInput.Fitter()->SetFCN(fcnCombiS2);
     clusterInput.Fitter()->mninit(6,10,7);
-    Double_t arglist[20];
-    Int_t ierflag=0;
-    arglist[0]=1;
+    clusterInput.Fitter()->SetPrintLevel(-1+fDebugLevel);
+    arglist[0]=-1;
+    clusterInput.Fitter()->mnexcm("SET NOW", arglist, 0, ierflag);
 // Set starting values 
     static Double_t vstart[6];
     vstart[0]=fXInit[0];
@@ -2006,16 +1901,12 @@ Float_t AliMUONClusterFinderVS::CombiDoubleMathiesonFit(AliMUONRawCluster *c)
     clusterInput.Fitter()->mnparm(4,"a0",vstart[4],step[4],lower[4],upper[4],ierflag);
     clusterInput.Fitter()->mnparm(5,"a1",vstart[5],step[5],lower[5],upper[5],ierflag);
 // ready for minimisation      
-    clusterInput.Fitter()->SetPrintLevel(-1+fDebugLevel);
-    if (fDebugLevel)
-       clusterInput.Fitter()->mnexcm("SET NOW", arglist, 0, ierflag);
-    clusterInput.Fitter()->mnexcm("SET OUT", arglist, 0, ierflag);
     arglist[0]= -1;
     arglist[1]= 0;
     
     clusterInput.Fitter()->mnexcm("SET NOGR", arglist, 0, ierflag);
     clusterInput.Fitter()->mnexcm("MIGRAD", arglist, 0, ierflag);
-    clusterInput.Fitter()->mnexcm("EXIT" , arglist, 0, ierflag);
+    //    clusterInput.Fitter()->mnexcm("EXIT" , arglist, 0, ierflag);
 // Get fitted parameters
     TString chname;
     Double_t epxz, b1, b2;
@@ -2047,42 +1938,40 @@ void AliMUONClusterFinderVS::Split(AliMUONRawCluster* c)
     AliMUONClusterInput& clusterInput = *(AliMUONClusterInput::Instance());
     for (j=0; j<2; j++) {
        AliMUONRawCluster cnew;
-       cnew.fGhost=c->fGhost;
+       cnew.SetGhost(c->GetGhost());
        for (cath=0; cath<2; cath++) {
-           cnew.fChi2[cath]=fChi2[0];
+           cnew.SetChi2(cath,fChi2[0]);
            // ?? why not cnew.fChi2[cath]=fChi2[cath];
            
            if (fNPeaks == 0) {
-               cnew.fNcluster[0]=-1;
-               cnew.fNcluster[1]=fNRawClusters;
+               cnew.SetNcluster(0,-1);
+               cnew.SetNcluster(1,fNRawClusters);
            } else {
-               cnew.fNcluster[0]=fNPeaks;
-               cnew.fNcluster[1]=0;
+               cnew.SetNcluster(0,fNPeaks);
+               cnew.SetNcluster(1,0);
            }
-           cnew.fMultiplicity[cath]=0;
-           cnew.fX[cath]=Float_t(fXFit[j]);
-           cnew.fY[cath]=Float_t(fYFit[j]);
-           cnew.fZ[cath]=fZPlane;
+           cnew.SetMultiplicity(cath,0);
+           cnew.SetX(cath, Float_t(fXFit[j]));
+           cnew.SetY(cath, Float_t(fYFit[j]));
+           cnew.SetZ(cath, fZPlane);
            if (j==0) {
-               cnew.fQ[cath]=Int_t(clusterInput.TotalCharge(cath)*fQrFit[cath]);
+               cnew.SetCharge(cath, Int_t(clusterInput.TotalCharge(cath)*fQrFit[cath]));
            } else {
-               cnew.fQ[cath]=Int_t(clusterInput.TotalCharge(cath)*(1-fQrFit[cath]));
+               cnew.SetCharge(cath, Int_t(clusterInput.TotalCharge(cath)*(1-fQrFit[cath])));
            }
            fSeg[cath]->SetHit(fXFit[j],fYFit[j],fZPlane);
            for (i=0; i<fMul[cath]; i++) {
-               cnew.fIndexMap[cnew.fMultiplicity[cath]][cath]=
-                   c->fIndexMap[i][cath];
+               cnew.SetIndex(cnew.GetMultiplicity(cath), cath, c->GetIndex(i,cath));
                fSeg[cath]->SetPad(fIx[i][cath], fIy[i][cath]);
                Float_t q1=fInput->Response()->IntXY(fSeg[cath]);
-               cnew.fContMap[i][cath]
-                   =(q1*Float_t(cnew.fQ[cath]))/Float_t(fQ[i][cath]);
-               cnew.fMultiplicity[cath]++;
+               cnew.SetContrib(i, cath, q1*Float_t(cnew.GetCharge(cath))/Float_t(fQ[i][cath]));
+               cnew.SetMultiplicity(cath, cnew.GetMultiplicity(cath)+1 );
            }
            FillCluster(&cnew,0,cath);
        } // cathode loop
        
-       cnew.fClusterType=cnew.PhysicsContribution();
-       if (cnew.fQ[0]>0 && cnew.fQ[1]>0) AddRawCluster(cnew);
+       cnew.SetClusterType(cnew.PhysicsContribution());
+       if (cnew.GetCharge(0)>0 && cnew.GetCharge(1)>0) AddRawCluster(cnew);
        fNPeaks++;
     }
 }
@@ -2091,7 +1980,7 @@ void AliMUONClusterFinderVS::Split(AliMUONRawCluster* c)
 //
 // Minimisation functions
 // Single Mathieson
-void fcnS1(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
+void fcnS1(Int_t & /*npar*/, Double_t * /*gin*/, Double_t &f, Double_t *par, Int_t /*iflag*/)
 {
     AliMUONClusterInput& clusterInput = *(AliMUONClusterInput::Instance());    
     Int_t i;
@@ -2111,7 +2000,7 @@ void fcnS1(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
     f=chisq;
 }
 
-void fcnCombiS1(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
+void fcnCombiS1(Int_t & /*npar*/, Double_t * /*gin*/, Double_t &f, Double_t *par, Int_t /*iflag*/)
 {
     AliMUONClusterInput& clusterInput = *(AliMUONClusterInput::Instance());    
     Int_t i, cath;
@@ -2134,7 +2023,7 @@ void fcnCombiS1(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t if
 }
 
 // Double Mathieson
-void fcnS2(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
+void fcnS2(Int_t & /*npar*/, Double_t * /*gin*/, Double_t &f, Double_t *par, Int_t /*iflag*/)
 {
     AliMUONClusterInput& clusterInput = *(AliMUONClusterInput::Instance());    
     Int_t i;
@@ -2156,7 +2045,7 @@ void fcnS2(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
 }
 
 // Double Mathieson
-void fcnCombiS2(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
+void fcnCombiS2(Int_t & /*npar*/, Double_t * /*gin*/, Double_t &f, Double_t *par, Int_t /*iflag*/)
 {
     AliMUONClusterInput& clusterInput = *(AliMUONClusterInput::Instance());    
     Int_t i, cath;
@@ -2177,19 +2066,24 @@ void fcnCombiS2(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t if
     f=chisq;
 }
 
-void AliMUONClusterFinderVS::AddRawCluster(const AliMUONRawCluster c)
+void AliMUONClusterFinderVS::AddRawCluster(const AliMUONRawCluster& c)
 {
   //
   // Add a raw cluster copy to the list
   //
-    AliMUON *pMUON=(AliMUON*)gAlice->GetModule("MUON");
-    pMUON->AddRawCluster(fInput->Chamber(),c); 
-    fNRawClusters++;
-//    if (fDebugLevel)
+
+//     AliMUON *pMUON=(AliMUON*)gAlice->GetModule("MUON");
+//     pMUON->GetMUONData()->AddRawCluster(fInput->Chamber(),c); 
+//     fNRawClusters++;
+
+  
+    TClonesArray &lrawcl = *fRawClusters;
+    new(lrawcl[fNRawClusters++]) AliMUONRawCluster(c);
+    if (fDebugLevel)
        fprintf(stderr,"\nfNRawClusters %d\n",fNRawClusters);
 }
 
-Bool_t AliMUONClusterFinderVS::TestTrack(Int_t t) {
+Bool_t AliMUONClusterFinderVS::TestTrack(Int_t t) const {
 // Test if track was user selected
     if (fTrack[0]==-1 || fTrack[1]==-1) {
        return kTRUE;
@@ -2203,8 +2097,13 @@ Bool_t AliMUONClusterFinderVS::TestTrack(Int_t t) {
 AliMUONClusterFinderVS& AliMUONClusterFinderVS
 ::operator = (const AliMUONClusterFinderVS& rhs)
 {
-// Dummy assignment operator
-    return *this;
+// Protected assignement operator
+
+  if (this == &rhs) return *this;
+
+  Fatal("operator=", "Not implemented.");
+    
+  return *this;  
 }