]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONClusterFinderMLEM.h
Adding handling of Capacitances (Laurent)
[u/mrichter/AliRoot.git] / MUON / AliMUONClusterFinderMLEM.h
CommitLineData
c0a16418 1#ifndef ALIMUONCLUSTERFINDERMLEM_H
2#define ALIMUONCLUSTERFINDERMLEM_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 AliMUONClusterFinderMLEM
10/// \brief Cluster finder in MUON arm of ALICE
11///
12// Author Alexander Zinchenko, JINR Dubna; Laurent Aphecetche, SUBATECH
13//
14
15class TH2D;
16class TClonesArray;
17class TMinuit;
18class TStopwatch;
19
20#ifndef ROOT_TObjArray
21# include "TObjArray.h"
22#endif
23#ifndef ROOT_TVector2
24# include "TVector2.h"
25#endif
26
27class AliMUONPad;
28
29#include "AliMUONVClusterFinder.h"
30
31class AliMUONClusterSplitterMLEM;
32
33class AliMUONClusterFinderMLEM : public AliMUONVClusterFinder
34{
35public:
36 AliMUONClusterFinderMLEM(Bool_t plot=kFALSE); // Constructor
37 virtual ~AliMUONClusterFinderMLEM(); // Destructor
38
39 virtual Bool_t Prepare(const AliMpVSegmentation* segmentations[2],
40 TClonesArray* digits[2]);
41
42 virtual AliMUONCluster* NextCluster();
43
44 virtual void Print(Option_t* opt="") const;
45
46 virtual void Paint(Option_t* opt="");
47
48private:
71a2d3aa 49 /// Not implemented
c0a16418 50 AliMUONClusterFinderMLEM(const AliMUONClusterFinderMLEM& rhs);
71a2d3aa 51 /// Not implemented
c0a16418 52 AliMUONClusterFinderMLEM& operator=(const AliMUONClusterFinderMLEM& rhs);
53
54 Bool_t WorkOnPreCluster();
55
56 /// Check precluster to simplify it (if possible), and return the simplified cluster
57 AliMUONCluster* CheckPrecluster(const AliMUONCluster& cluster);
58 AliMUONCluster* CheckPreclusterTwoCathodes(AliMUONCluster* cluster);
59 AliMUONCluster* CheckPreclusterOneCathode(AliMUONCluster* cluster);
60
61 /// Checks whether a pad and a pixel have an overlapping area.
62 Bool_t Overlap(const AliMUONPad& pad, const AliMUONPad& pixel);
63
64 /// build array of pixels
65 void BuildPixArray(AliMUONCluster& cluster);
66 void BuildPixArrayOneCathode(AliMUONCluster& cluster);
67 void BuildPixArrayTwoCathodes(AliMUONCluster& cluster);
68
69 void RemovePixel(Int_t i);
70
71 AliMUONPad* Pixel(Int_t i) const;
72
73 void AdjustPixel(AliMUONCluster& cluster, Float_t width, Int_t ixy); // adjust size of small pixels
74 void AdjustPixel(Double_t wxmin, Double_t wymin); // adjust size of large pixels
75
76 Bool_t MainLoop(AliMUONCluster& cluster, Int_t iSimple); // repeat MLEM algorithm until pixels become sufficiently small
77
78 void Mlem(AliMUONCluster& cluster, Double_t *coef, Double_t *probi, Int_t nIter); // use MLEM for cluster finding
79
80 void FindCOG(TH2D *mlem, Double_t *xyc); // find COG position around maximum bin
81 Int_t FindNearest(AliMUONPad *pixPtr0); // find nearest neighbouring pixel to the given one
82
83 Int_t FindLocalMaxima(TObjArray *pixArray, Int_t *localMax, Double_t *maxVal); // find local maxima
84 void FlagLocalMax(TH2D *hist, Int_t i, Int_t j, Int_t *isLocalMax); // flag local max
85 void FindCluster(AliMUONCluster& cluster, Int_t *localMax, Int_t iMax); // find cluster around local max
86 void AddVirtualPad(AliMUONCluster& cluster); // add virtual pads for some clusters (if necessary)
87
88 void PadsInXandY(AliMUONCluster& cluster, Int_t &nInX, Int_t &nInY) const; // get number of pads in X and Y
89
90 /// Process simple cluster
91 void Simple(AliMUONCluster& cluster);
92
93 void Neighbours(Int_t cath, Int_t ix0, Int_t iy0,
94 Int_t& nn,
95 Int_t* xList, Int_t* yList);
96
97 void Plot(const char* outputfile);
98
99 void ComputeCoefficients(AliMUONCluster& cluster,
100 Double_t* coef, Double_t* probi);
101
102 void CheckOverlaps();
103
104 TStopwatch* Timer(Int_t i) const;
105
106private:
107
108 // Some constants
109 static const Int_t fgkDim = 10000; ///< array size
110 static const Double_t fgkZeroSuppression; ///< average zero suppression value
111 static const Double_t fgkSaturation; ///< average saturation level
112 static const Double_t fgkDistancePrecision; ///< used to check overlaps and so on
113 static const TVector2 fgkIncreaseSize; ///< idem
114 static const TVector2 fgkDecreaseSize; ///< idem
115
71a2d3aa 116 AliMUONVClusterFinder* fPreClusterFinder; //!< the pre-clustering worker
117 AliMUONCluster* fPreCluster; //!< current pre-cluster
118 TObjArray fClusterList; //!< clusters corresponding to the current pre-cluster
c0a16418 119
71a2d3aa 120 Int_t fEventNumber; //!< current event being processed
121 Int_t fDetElemId; //!< current DE being processed
122 Int_t fClusterNumber; //!< current cluster number
c0a16418 123
124 const AliMpVSegmentation *fSegmentation[2]; //!< new segmentation
125
126 Float_t fZpad; //!< z-coordinate of the hit
127 Int_t fReco; //!< !=0 if run reco with writing of reconstructed clusters
128 Int_t fCathBeg; //!< starting cathode (for combined cluster / track reco)
129 Int_t fPadBeg[2]; //!< starting pads (for combined cluster / track reco)
130
131 static TMinuit* fgMinuit; //!< Fitter
132
133 TObjArray* fPixArray; //!< collection of pixels
134 Int_t fDebug; //!< debug level
135 Bool_t fPlot; //!< whether we should plot thing (for debug only, quite slow!)
136
137 TObjArray* fTimers; //!< internal timers
71a2d3aa 138
139 /// \todo add comment
c0a16418 140 enum ETimer { kMainLoop, kCheckPreCluster, kLast };
141
142 AliMUONClusterSplitterMLEM* fSplitter; //!< helper class to go from pixel arrays to clusters
143 Int_t fNClusters; //!< total number of clusters
144 Int_t fNAddVirtualPads; //!< number of clusters for which we added virtual pads
145
146 ClassDef(AliMUONClusterFinderMLEM,0) // cluster finder in MUON arm of ALICE
147};
148
149#endif