]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONClusterFinderAZ.h
Added class to read reconstruction parameters from OCDB (Yuri)
[u/mrichter/AliRoot.git] / MUON / AliMUONClusterFinderAZ.h
1 #ifndef ALIMUONCLUSTERFINDERAZ_H
2 #define ALIMUONCLUSTERFINDERAZ_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7
8 /// \ingroup rec
9 /// \class AliMUONClusterFinderAZ
10 /// \brief Cluster finder in MUON arm of ALICE
11 ///
12 /// \author Alexander Zinchenko, JINR Dubna
13
14 class TH2D;
15 class TClonesArray;
16 class TMinuit;
17
18 class AliMUONVGeometryDESegmentation;
19 class AliMUONPixel;
20 class AliMUONClusterDrawAZ;
21 #include "AliMUONClusterFinderVS.h"
22 #include "TMatrixDfwd.h"
23
24 class AliMUONClusterFinderAZ : public AliMUONClusterFinderVS 
25 {
26 public:
27   AliMUONClusterFinderAZ(Bool_t draw = 0); // Constructor
28   virtual ~AliMUONClusterFinderAZ(); // Destructor
29
30   void     FindRawClusters(); // the same interface as for old cluster finder
31   void     EventLoop(Int_t nev = 0, Int_t ch = 0); // first event 
32   Bool_t   TestTrack(Int_t t) const; // test if track was selected
33   
34   /// Return the number of pads in the cluster on the given cathode
35   Int_t    GetNPads(Int_t cath) const { return fnPads[cath]; }
36   /// Return pad information \todo add more details
37   Int_t    GetIJ(Int_t indx, Int_t iPad) const { return fPadIJ[indx][iPad]; }
38   /// Return pad information \todo add more details
39   Float_t  GetXyq(Int_t indx, Int_t iPad) const { return fXyq[indx][iPad]; }
40   /// Return the z-coordinate of the hit
41   Float_t  GetZpad() const { return fZpad; }
42   /// Return the flag for used pads
43   Bool_t GetUsed(Int_t cath, Int_t dig) const { return fUsed[cath][dig]; }
44
45   /// Mark used digits
46   void SetUsed(Int_t cath, Int_t dig) { fUsed[cath][dig] = kTRUE; } 
47   /// Unmark digits
48   void SetUnused(Int_t cath, Int_t dig) { fUsed[cath][dig] = kFALSE; } 
49   /// Set reco flag
50   void SetReco(Int_t iReco) { fReco = iReco; } 
51   /// Start  \todo add more details
52   void SetStart(Int_t iCath, Int_t iPad) { fCathBeg = iCath; fPadBeg[0] = fPadBeg[1] = 0; fPadBeg[fCathBeg] = iPad; } 
53
54 private:
55   // Some constants
56   static const Int_t fgkDim = 10000; ///< array size
57   static const Double_t fgkCouplMin; ///< threshold on coupling 
58   static const Double_t fgkZeroSuppression; ///< average zero suppression value
59   static const Double_t fgkSaturation; ///< average saturation level
60
61   static  AliMUONClusterFinderAZ* fgClusterFinder; ///< the ClusterFinderAZ instance
62
63   Int_t      fnPads[2];         //!< number of pads in the cluster on 2 cathodes
64   Float_t    fXyq[7][fgkDim];   //!< pad information \todo add more details
65   Int_t      fPadIJ[4][fgkDim]; //!< pad information \todo add more details
66   AliMUONVGeometryDESegmentation *fSegmentation[2]; //!< new segmentation
67   Float_t    fZpad;             //!< z-coordinate of the hit
68   Int_t      fNpar;             //!< number of fit parameters
69   Double_t   fQtot;             //!< total cluster charge
70   Int_t      fReco;             //!< !=0 if run reco with writing of reconstructed clusters 
71   Int_t fCathBeg;               //!< starting cathode (for combined cluster / track reco)
72   Int_t fPadBeg[2];             //!< starting pads (for combined cluster / track reco)
73
74   static     TMinuit* fgMinuit; //!< Fitter
75   Bool_t     fUsed[2][fgkDim]; //!< flags for used pads
76   AliMUONClusterDrawAZ *fDraw; //!< drawing object 
77   TObjArray* fPixArray; //!< collection of pixels
78   Int_t fnCoupled; //!< number of coupled clusters in precluster
79   Int_t fDebug; //!< debug level
80
81   // Functions
82
83   /// Not implemented
84   AliMUONClusterFinderAZ(const AliMUONClusterFinderAZ& rhs);
85   /// Not implemented
86   AliMUONClusterFinderAZ& operator=(const AliMUONClusterFinderAZ& rhs);
87
88   void   AddPad(Int_t cath, Int_t digit); // add a pad to the cluster
89   Bool_t Overlap(Int_t cath, AliMUONDigit *dig); // check if the pad from one cathode overlaps with a pad in the cluster on the other cathode
90   Bool_t Overlap(Float_t *xy1, Int_t iPad, Float_t *xy12, Int_t iSkip); // check if pads xy1 and iPad overlap and return overlap area
91   Bool_t CheckPrecluster(Int_t *nShown); // check precluster to simplify it (if possible)
92   void   BuildPixArray(); // build array of pixels
93   void   AdjustPixel(Float_t width, Int_t ixy); // adjust size of small pixels
94   void   AdjustPixel(Float_t wxmin, Float_t wymin); // adjust size of large pixels
95   Bool_t MainLoop(Int_t iSimple); // repeat MLEM algorithm until pixels become sufficiently small
96   void   Mlem(Double_t *coef, Double_t *probi, Int_t nIter); // use MLEM for cluster finding
97   void   FindCOG(TH2D *mlem, Double_t *xyc); // find COG position around maximum bin
98   Int_t  FindNearest(AliMUONPixel *pixPtr0); // find nearest neighbouring pixel to the given one
99   void   Split(TH2D *mlem, Double_t *coef); // steering function for pixels
100   void   AddBin(TH2D *mlem, Int_t ic, Int_t jc, Int_t mode, Bool_t* used, TObjArray *pix); // add a bin to the cluster
101   TObject* BinToPix(TH2D *mlem, Int_t jc, Int_t ic); // hist. bin-to-pixel
102   void   AddCluster(Int_t ic, Int_t nclust, TMatrixD *aijcluclu, Bool_t *used, Int_t *clustNumb, Int_t &nCoupled); // add a cluster to the group of coupled clusters
103   Double_t MinGroupCoupl(Int_t nCoupled, Int_t *clustNumb, TMatrixD *aijcluclu, Int_t *minGroup); // find group of cluster with min. coupling to others
104   Int_t  SelectPad(Int_t nCoupled, Int_t nForFit, Int_t *clustNumb, Int_t *clustFit, TMatrixD *aijcluclu); //select pads for fit
105   void   Merge(Int_t nForFit, Int_t nCoupled, Int_t *clustNumb, Int_t *clustFit, TObjArray **clusters, TMatrixD *aijcluclu, TMatrixD *aijclupad); // merge clusters
106   Int_t  Fit(Int_t iSimple, Int_t nfit, Int_t *clustFit, TObjArray **clusters, Double_t *parOk); // do the fitting 
107   void  UpdatePads(Int_t nfit, Double_t *par); // subtract fitted charges from pads
108   void  AddRawCluster(Double_t x, Double_t y, Double_t qTot, Double_t fmin, Int_t nfit, Int_t *tracks, Double_t sigx, Double_t sigy, Double_t dist); // add new reconstructed cluster
109   Int_t FindLocalMaxima(TObjArray *pixArray, Int_t *localMax, Double_t *maxVal); // find local maxima 
110   void  FlagLocalMax(TH2D *hist, Int_t i, Int_t j, Int_t *isLocalMax); // flag local max
111   void  FindCluster(Int_t *localMax, Int_t iMax); // find cluster around local max
112   void  AddVirtualPad(); // add virtual pads for some clusters (if necessary)
113   void  PadsInXandY(Int_t &nInX, Int_t &nInY); // get number of pads in X and Y
114   // This function is used for fitting
115   void  Fcn1(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag);
116   void Simple(); // process simple cluster
117
118   void Errors(AliMUONRawCluster *clus); // correct coordinates and eval. errors
119   void Errors(Int_t ny, Int_t nx, Int_t iby, Int_t ibx, Double_t fmin,
120               Double_t wy, Double_t wx, Int_t iover, 
121               Double_t dyc, Double_t dxc, Double_t qtot, 
122               Double_t &yrec, Double_t &xrec, Double_t &erry, Double_t &errx);
123
124   /// Dummy method for overloading warnings
125   void FindCluster(int, int, int, AliMUONRawCluster&) {return;}
126   /// Dummy method for overloading warnings
127   void FindLocalMaxima(AliMUONRawCluster*) {return;}
128   /// Dummy method for overloading warnings
129   void Split(AliMUONRawCluster*) {return;}
130   /// Dummy method for overloading warnings
131   void AddRawCluster(AliMUONRawCluster&) {return;}
132
133 ClassDef(AliMUONClusterFinderAZ,0) // cluster finder in MUON arm of ALICE
134 };
135
136 #endif