]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RICH/AliRICHCluster.h
Raw data reconstruction (K.Shileev)
[u/mrichter/AliRoot.git] / RICH / AliRICHCluster.h
index f4b339b12f75d39e093c77fffc37081051446d8c..74117ebe8c98a95bf4221df692325ff96b5abfcf 100644 (file)
@@ -3,25 +3,27 @@
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 
-#include <TObject.h>
-#include <TVector.h>
-#include <TVector2.h>
+#include <TObject.h>         //base class
+#include <TVector2.h>        //DistTo
 #include "AliRICHDigit.h"
+class TMinuit;
 
 class AliRICHCluster :public TObject
 {
 public:
-  enum ClusterStatus {kEdge,kShape,kSize,kRaw,kResolved,kEmpty}; 
-                    AliRICHCluster():TObject(),fCFM(0),fSize(0),fShape(0),fQdc(0),fChamber(0),fX(0),fY(0),fStatus(kEmpty),fDigits(0) {}  //default ctor  
-  virtual          ~AliRICHCluster()                 {AliDebug(1,"Start");/*Reset();*/}                                                  //dtor
+  enum EClusterStatus {kFormed,kCoG,kUnfolded,kEmpty}; 
+  AliRICHCluster()                                               :TObject(),fCFM(-1),fSize(-1),fShape(-1),fQdc(-1),fChamber(-1),fX(-1),fY(-1),fStatus(kEmpty),fDigits(0) {}  //default ctor  
+  AliRICHCluster(Int_t cs,Double_t x,Double_t y,Int_t q,Int_t sm):TObject(),fCFM(-1),fSize(sm),fShape(-1),fQdc(q ),fChamber(cs),fX(x ),fY(y ),fStatus(kEmpty),fDigits(0) {}  //default ctor  
+  virtual          ~AliRICHCluster()                 {}                                                  //dtor
                    // AliRICHcluster(const AliRICHcluster& clus):TObject(clus)                                                         {}  //copy ctor 
-   AliRICHCluster&  operator=(const AliRICHCluster&)                 {return *this;}                                                     //copy operator
+  AliRICHCluster&  operator=(const AliRICHCluster&)                 {return *this;}                                                     //copy operator
                    
+         void      Print(Option_t *option="")const;                                                       //
   
   
-         void       Reset()                          {DeleteDigits();fCFM=fSize=fShape=fQdc=fChamber=0;fX=fY=0;fStatus=kEmpty;} //cleans the cluster
+         void       Reset()                          {DeleteDigits();fCFM=fSize=fShape=fQdc=fChamber=-1;fX=fY=-1;fStatus=kEmpty;} //cleans the cluster
          void       DeleteDigits()                   {if(fDigits) {delete fDigits;} fDigits=0;}           //deletes the list of digits  
-         Int_t      Nlocals()                   const{return fSize-10000*(fSize/10000);}                //number of local maximums
+         Int_t      Nlocmax()                   const{return fSize-10000*(fSize/10000);}                //number of local maximums
          Int_t      Size()                      const{return fSize/10000;}                              //number of digits in cluster
          Int_t      Fsize()                     const{return fSize;}                                    //
          Int_t      Shape()                     const{return fShape;}                                   //cluster shape rectangulare
@@ -47,21 +49,28 @@ public:
          Bool_t     IsFeedback()                const{return Nfeedbacks()!=0;}                             //
          Int_t      CombiPid()                  const{return fCFM;}                                        //
          void       CFM(Int_t c,Int_t f,Int_t m)     {fCFM=1000000*c+1000*f+m;}                            //cluster contributors
-         TObjArray* Digits()                    const{return fDigits;}                                     //  
-  virtual void      Print(Option_t *option="")const;                                                   //
-  inline  void      AddDigit(AliRICHDigit *pDig);                                                      //
-  inline  void      CoG(Int_t nLocals);                                                                //calculates center of gravity
+         TObjArray*    Digits()                    const{return fDigits;}                                     //  
+         
+  inline void          AddDigit(AliRICHDigit *pDig);                                                          //add new digit ot the cluster
+         AliRICHDigit* Digit  (Int_t i                      )const{return (AliRICHDigit*)fDigits->At(i); }//get pointer to i-th digit without existence check 
+         TMinuit*      Solve  (                             );                                            //calculates cluster position
+         TMinuit*      Unfold (                             );                                            //decompose cluster n. loc max clusters
+         void          Set    (Double_t x,Double_t y,Int_t q)     {fX=x;fY=y,fQdc=q;                     }//set some cluster properties
+  static void          FitFunc(Int_t &iNpars, Double_t *, Double_t &chi2, Double_t *aPar, Int_t);         //fit function to be used by MINUIT
+          
+         void      CoG(Int_t iNlocmax);                                                                   //calculates center of gravity
           void      Fill(AliRICHCluster *pRaw,Double_t x,Double_t y,Double_t q,Int_t cfm)              //form new resolved cluster from raw one
-                    {fCFM=cfm;fChamber=pRaw->Fchamber();fSize=pRaw->Fsize();fQdc=(Int_t)(q*pRaw->Q());fX=x;fY=y;fStatus=kResolved;} 
+                    {fCFM=cfm;fChamber=pRaw->Fchamber();fSize=pRaw->Fsize();fQdc=(Int_t)(q*pRaw->Q());fX=x;fY=y;fStatus=kUnfolded;} 
          Double_t   DistTo(TVector2 x)          const{return TMath::Sqrt((x.X()-fX)*(x.X()-fX)+(x.Y()-fY)*(x.Y()-fY));} //distance to given point 
          Double_t   DistX(TVector2 x)           const{return (x.X()-fX);} //distance in x to given point 
          Double_t   DistY(TVector2 x)           const{return (x.Y()-fY);} //distance to given point 
+         void       Test(const TVector2 &x,Double_t dEloss=0);            //test cluster fuctionality by provided hit with energy in eV
 protected:
   Int_t         fCFM;         //1000000*Ncerenkovs+1000*Nfeedbacks+Nmips  
-  Int_t         fSize;        //10000*(how many digits belong to this cluster) + nLocalMaxima     
+  Int_t         fSize;        //10000*(N digits) + N maxima     
   Int_t         fShape;       //100*xdim+ydim box containing the cluster
   Int_t         fQdc;         //QDC value
-  Int_t         fChamber;     //10*module number+sector number 
+  Int_t         fChamber;     //10*chamber number+sector number 
   Double_t      fX;           //local x postion 
   Double_t      fY;           //local y postion  
   Int_t         fStatus;      //flag to mark the quality of the cluster   
@@ -72,33 +81,12 @@ protected:
 void AliRICHCluster::AddDigit(AliRICHDigit *pDig)
 {
 // Adds a given digit to the list of digits belonging to this cluster    
-  if(!fDigits) {fQdc=fSize=fCFM=0;fDigits = new TObjArray;}
-  fQdc+=(Int_t)pDig->Q(); fDigits->Add(pDig);
-  fChamber=10*pDig->C()+pDig->S();
+  if(!fDigits) {fQdc=fSize=0;fDigits = new TObjArray;}
+  fDigits->Add(pDig);
+  fQdc+=(Int_t)pDig->Qdc(); 
+  fChamber=10*pDig->Chamber()+pDig->Sector();
   fSize+=10000;
-  fStatus=kRaw;
+  fStatus=kFormed;
 }
 //__________________________________________________________________________________________________
-void AliRICHCluster::CoG(Int_t nLocals)
-{
-// Calculates naive cluster position as a center of gravity of its digits.
-  Float_t xmin=999,ymin=999,xmax=0,ymax=0;   
-  fX=fY=0;
-  for(Int_t iDig=0;iDig<Size();iDig++) {
-    AliRICHDigit *pDig=(AliRICHDigit*)fDigits->At(iDig);
-    TVector pad=pDig->Pad(); Double_t q=pDig->Q();
-    TVector2 x2=AliRICHParam::Pad2Loc(pad);
-    fX += x2.X()*q;fY +=x2.Y()*q;
-    if(pad[0]<xmin)xmin=pad[0];if(pad[0]>xmax)xmax=pad[0];if(pad[1]<ymin)ymin=pad[1];if(pad[1]>ymax)ymax=pad[1];
-   }
-   fX/=fQdc;fY/=fQdc;//Center of Gravity
-
-   TVector2 center = AliRICHParam::Pad2Loc(AliRICHParam::Loc2Pad(TVector2(fX,fY)));
-   fX += AliRICHParam::CogCorr(fX-center.X());
-
-   fShape=Int_t(100*(xmax-xmin+1)+ymax-ymin+1);//find box containing cluster
-   fSize+=nLocals;
-   fStatus=kRaw;
-}//CoG()
-//__________________________________________________________________________________________________
 #endif