]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONClusterFinderAZ.h
Code for MUON Station1 (I.Hrivnacova)
[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 #include <TROOT.h>
7 class TH2F;
8 class TH2D;
9 class TClonesArray;
10 class AliSegmentation;
11 class AliMUONResponse;
12 class TMinuit;
13 class TMatrixD;
14 class AliMUONPixel;
15 #include "AliMUONClusterFinderVS.h"
16
17 // Some constants
18  static const Int_t kDim = 2000; // array size
19  static const Double_t kCouplMin = 1.e-3; // threshold on coupling 
20
21 //class AliMUONClusterFinderAZ : public TObject {
22 class AliMUONClusterFinderAZ : public AliMUONClusterFinderVS {
23
24  public:
25
26   AliMUONClusterFinderAZ(Bool_t draw, Int_t iReco);// Constructor
27   virtual ~AliMUONClusterFinderAZ(); // Destructor
28
29   void FindRawClusters(); // the same interface as for old cluster finder
30   void EventLoop(Int_t nev, Int_t ch); // first event 
31   Bool_t TestTrack(Int_t t); // test if track was selected
32   static AliMUONClusterFinderAZ* fgClusterFinder;
33   Int_t fnPads[2]; // ! number of pads in the cluster on 2 cathodes
34   Float_t fXyq[6][kDim]; // ! pad information
35   Int_t fPadIJ[2][kDim]; // ! pad information
36   AliSegmentation *fSegmentation[2]; // ! segmentation
37   AliMUONResponse *fResponse; // ! response
38   Float_t fZpad; // ! z-coordinate of the hit
39   Int_t fNpar; // ! number of fit parameters
40   Double_t fQtot; // ! total cluster charge
41   Int_t fReco; // ! =1 if run reco with writing to TreeR
42
43  protected:
44
45  private:
46  
47   static TMinuit* fgMinuit; // ! Fitter
48   Bool_t fUsed[2][kDim]; // ! flags for used pads
49   TH2F *fHist[4]; // ! histograms
50   TClonesArray *fMuonDigits; // ! pointer to digits
51   Bool_t fDraw; // ! draw flag
52   Int_t fnMu; // number of muons passing thru the selected area
53   Double_t fxyMu[2][7]; // ! muon information
54   TObjArray *fPixArray; // collection of pixels
55
56   // Functions
57
58   void ModifyHistos(void); // modify histograms
59   void AddPad(Int_t cath, Int_t digit); // add a pad to the cluster
60   Bool_t Overlap(Int_t cath, TObject *dig); // check if the pad from one cathode overlaps with a pad in the cluster on the other cathode
61   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
62   Bool_t CheckPrecluster(Int_t *nShown); // check precluster to simplify it (if possible)
63   void BuildPixArray(); // build array of pixels
64   void AjustPixel(Float_t width, Int_t ixy); // ajust size of small pixels
65   void AjustPixel(Float_t wxmin, Float_t wymin); // ajust size of large pixels
66   Bool_t MainLoop(); // repeat MLEM algorithm until pixels become sufficiently small
67   void Mlem(Double_t *coef, Double_t *probi); // use MLEM for cluster finding
68   void FindCOG(TH2D *mlem, Double_t *xyc); // find COG position around maximum bin
69   Int_t FindNearest(AliMUONPixel *pixPtr0); // find nearest neighbouring pixel to the given one
70   void Split(TH2D *mlem, Double_t *coef); // steering function for pixels
71   void AddBin(TH2D *mlem, Int_t ic, Int_t jc, Int_t mode, Bool_t* used, TObjArray *pix); // add a bin to the cluster
72   TObject* BinToPix(TH2D *mlem, Int_t jc, Int_t ic); // hist. bin-to-pixel
73   void AddCluster(Int_t ic, Int_t nclust, TMatrixD *aij_clu_clu, Bool_t *used, Int_t *clustNumb, Int_t &nCoupled); // add a cluster to the group of coupled clusters
74   Double_t MinGroupCoupl(Int_t nCoupled, Int_t *clustNumb, TMatrixD *aij_clu_clu, Int_t *minGroup); // find group of cluster with min. coupling to others
75   Int_t SelectPad(Int_t nCoupled, Int_t nForFit, Int_t *clustNumb, Int_t *clustFit, TMatrixD *aij_clu_clu); //select pads for fit
76   void Merge(Int_t nForFit, Int_t nCoupled, Int_t *clustNumb, Int_t *clustFit, TObjArray **clusters, TMatrixD *aij_clu_clu, TMatrixD *aij_clu_pad); // merge clusters
77   Int_t Fit(Int_t nfit, Int_t *clustFit, TObjArray **clusters, Double_t *parOk); // do the fitting 
78   void UpdatePads(Int_t nfit, Double_t *par); // subtract fitted charges from pads
79   void AddRawCluster(Double_t x, Double_t y, Double_t fmin); // add new raw cluster
80   Int_t FindLocalMaxima(Int_t *localMax, Double_t *maxVal); // find local maxima 
81   void FlagLocalMax(TH2D *hist, Int_t i, Int_t j, Int_t *isLocalMax); // flag local max
82   void FindCluster(Int_t *localMax, Int_t iMax); // find cluster around local max
83
84   ClassDef(AliMUONClusterFinderAZ,0) // cluster finder in MUON arm of ALICE
85     };
86 #endif