Ideal calibration coefficients for PHOS EMC and CPV (Yu.Kharlov)
[u/mrichter/AliRoot.git] / MUON / AliMUONClusterFinderAZ.h
CommitLineData
0df3ca52 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
30178c30 6/* $Id$ */
30178c30 7
692de412 8/// \ingroup rec
9/// \class AliMUONClusterFinderAZ
10/// \brief Cluster finder in MUON arm of ALICE
11
0df3ca52 12class TH2D;
13class TClonesArray;
0df3ca52 14class TMinuit;
0df3ca52 15
0627f609 16class AliMUONVGeometryDESegmentation;
30178c30 17class AliMUONPixel;
1af223d7 18class AliMUONClusterDrawAZ;
243b68c3 19#include "AliMUONClusterFinderVS.h"
e785d2ac 20#include "TMatrixDfwd.h"
0df3ca52 21
30178c30 22class AliMUONClusterFinderAZ : public AliMUONClusterFinderVS
23{
24public:
1af223d7 25 AliMUONClusterFinderAZ(Bool_t draw = 0); // Constructor
0df3ca52 26 virtual ~AliMUONClusterFinderAZ(); // Destructor
27
9e993f2a 28 void FindRawClusters(); // the same interface as for old cluster finder
1af223d7 29 void EventLoop(Int_t nev = 0, Int_t ch = 0); // first event
30178c30 30 Bool_t TestTrack(Int_t t) const; // test if track was selected
1af223d7 31 Int_t GetNPads(Int_t cath) const { return fnPads[cath]; }
32 Int_t GetIJ(Int_t indx, Int_t iPad) const { return fPadIJ[indx][iPad]; }
33 Float_t GetXyq(Int_t indx, Int_t iPad) const { return fXyq[indx][iPad]; }
34 Float_t GetZpad() { return fZpad; }
cc87ebcd 35 Bool_t GetUsed(Int_t cath, Int_t dig) const { return fUsed[cath][dig]; }
36 void SetUsed(Int_t cath, Int_t dig) { fUsed[cath][dig] = kTRUE; } // mark used digits
37 void SetUnused(Int_t cath, Int_t dig) { fUsed[cath][dig] = kFALSE; } // unmark digits
38 void SetReco(Int_t iReco) { fReco = iReco; } // set reco flag
39 void SetStart(Int_t iCath, Int_t iPad) { fCathBeg = iCath; fPadBeg[0] = fPadBeg[1] = 0; fPadBeg[fCathBeg] = iPad; } // start
9e993f2a 40
41protected:
74f7bbc5 42 AliMUONClusterFinderAZ(const AliMUONClusterFinderAZ& rhs);
43 AliMUONClusterFinderAZ& operator=(const AliMUONClusterFinderAZ& rhs);
0df3ca52 44
45 private:
343146bf 46 // Some constants
2b1e4f0e 47 static const Int_t fgkDim = 10000; // array size
343146bf 48 static const Double_t fgkCouplMin; // threshold on coupling
0627f609 49 static const Double_t fgkZeroSuppression; // average zero suppression value
50 static const Double_t fgkSaturation; // average saturation level
343146bf 51
74f7bbc5 52 static AliMUONClusterFinderAZ* fgClusterFinder; // the ClusterFinderAZ instance
9e993f2a 53
cc87ebcd 54 Int_t fnPads[2]; // ! number of pads in the cluster on 2 cathodes
55 Float_t fXyq[7][fgkDim]; // ! pad information
0627f609 56 Int_t fPadIJ[4][fgkDim]; // ! pad information
57 AliMUONVGeometryDESegmentation *fSegmentation[2]; // ! new segmentation
cc87ebcd 58 Float_t fZpad; // ! z-coordinate of the hit
59 Int_t fNpar; // ! number of fit parameters
60 Double_t fQtot; // ! total cluster charge
61 Int_t fReco; // ! !=0 if run reco with writing of reconstructed clusters
62 Int_t fCathBeg; // ! starting cathode (for combined cluster / track reco)
63 Int_t fPadBeg[2]; // ! starting pads (for combined cluster / track reco)
9e993f2a 64
65 static TMinuit* fgMinuit; // ! Fitter
343146bf 66 Bool_t fUsed[2][fgkDim]; // ! flags for used pads
1af223d7 67 AliMUONClusterDrawAZ *fDraw; // ! drawing object
2b1e4f0e 68 TObjArray* fPixArray; // ! collection of pixels
69 Int_t fnCoupled; // ! number of coupled clusters in precluster
70 Int_t fDebug; // ! debug level
0df3ca52 71
72 // Functions
73
9e993f2a 74 void AddPad(Int_t cath, Int_t digit); // add a pad to the cluster
2b1e4f0e 75 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
0df3ca52 76 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
77 Bool_t CheckPrecluster(Int_t *nShown); // check precluster to simplify it (if possible)
9e993f2a 78 void BuildPixArray(); // build array of pixels
2b1e4f0e 79 void AdjustPixel(Float_t width, Int_t ixy); // adjust size of small pixels
80 void AdjustPixel(Float_t wxmin, Float_t wymin); // adjust size of large pixels
81 Bool_t MainLoop(Int_t iSimple); // repeat MLEM algorithm until pixels become sufficiently small
82 void Mlem(Double_t *coef, Double_t *probi, Int_t nIter); // use MLEM for cluster finding
9e993f2a 83 void FindCOG(TH2D *mlem, Double_t *xyc); // find COG position around maximum bin
84 Int_t FindNearest(AliMUONPixel *pixPtr0); // find nearest neighbouring pixel to the given one
85 void Split(TH2D *mlem, Double_t *coef); // steering function for pixels
86 void AddBin(TH2D *mlem, Int_t ic, Int_t jc, Int_t mode, Bool_t* used, TObjArray *pix); // add a bin to the cluster
0df3ca52 87 TObject* BinToPix(TH2D *mlem, Int_t jc, Int_t ic); // hist. bin-to-pixel
9e993f2a 88 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
c1aed84f 89 Double_t MinGroupCoupl(Int_t nCoupled, Int_t *clustNumb, TMatrixD *aijcluclu, Int_t *minGroup); // find group of cluster with min. coupling to others
9e993f2a 90 Int_t SelectPad(Int_t nCoupled, Int_t nForFit, Int_t *clustNumb, Int_t *clustFit, TMatrixD *aijcluclu); //select pads for fit
91 void Merge(Int_t nForFit, Int_t nCoupled, Int_t *clustNumb, Int_t *clustFit, TObjArray **clusters, TMatrixD *aijcluclu, TMatrixD *aijclupad); // merge clusters
0627f609 92 Int_t Fit(Int_t iSimple, Int_t nfit, Int_t *clustFit, TObjArray **clusters, Double_t *parOk); // do the fitting
9e993f2a 93 void UpdatePads(Int_t nfit, Double_t *par); // subtract fitted charges from pads
2b1e4f0e 94 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
0627f609 95 Int_t FindLocalMaxima(TObjArray *pixArray, Int_t *localMax, Double_t *maxVal); // find local maxima
9e993f2a 96 void FlagLocalMax(TH2D *hist, Int_t i, Int_t j, Int_t *isLocalMax); // flag local max
97 void FindCluster(Int_t *localMax, Int_t iMax); // find cluster around local max
2b1e4f0e 98 void AddVirtualPad(); // add virtual pads for some clusters (if necessary)
99 void PadsInXandY(Int_t &nInX, Int_t &nInY); // get number of pads in X and Y
100 // This function is used for fitting
101 void Fcn1(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag);
102 void Simple(); // process simple cluster
103
104 void Errors(AliMUONRawCluster *clus); // correct coordinates and eval. errors
105 void Errors(Int_t ny, Int_t nx, Int_t iby, Int_t ibx, Double_t fmin,
106 Double_t wy, Double_t wx, Int_t iover,
107 Double_t dyc, Double_t dxc, Double_t qtot,
108 Double_t &yrec, Double_t &xrec, Double_t &erry, Double_t &errx);
f161a467 109
2b1e4f0e 110 // Dummy methods for overloading warnings
f161a467 111 void FindCluster(int, int, int, AliMUONRawCluster&) {return;}
112 void FindLocalMaxima(AliMUONRawCluster*) {return;}
113 void Split(AliMUONRawCluster*) {return;}
9a8c01b2 114 void AddRawCluster(AliMUONRawCluster&) {return;}
f161a467 115
2b1e4f0e 116ClassDef(AliMUONClusterFinderAZ,0) // cluster finder in MUON arm of ALICE
74f7bbc5 117};
118
0df3ca52 119#endif