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