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 */
9 /// \class AliMUONClusterFinderMLEM
10 /// \brief Cluster finder in MUON arm of ALICE
12 // Author Alexander Zinchenko, JINR Dubna; Laurent Aphecetche, SUBATECH
19 #ifndef ROOT_TObjArray
20 # include "TObjArray.h"
23 # include "TVector2.h"
28 #include "AliMUONVClusterFinder.h"
30 class AliMUONClusterSplitterMLEM;
32 class AliMUONClusterFinderMLEM : public AliMUONVClusterFinder
35 AliMUONClusterFinderMLEM(Bool_t plot, AliMUONVClusterFinder* clusterFinder); // Constructor
36 virtual ~AliMUONClusterFinderMLEM(); // Destructor
38 virtual Bool_t Prepare(const AliMpVSegmentation* segmentations[2],
39 const AliMUONVDigitStore& digitStore);
41 virtual AliMUONCluster* NextCluster();
43 virtual void Print(Option_t* opt="") const;
45 virtual void Paint(Option_t* opt="");
49 AliMUONClusterFinderMLEM(const AliMUONClusterFinderMLEM& rhs);
51 AliMUONClusterFinderMLEM& operator=(const AliMUONClusterFinderMLEM& rhs);
53 Bool_t WorkOnPreCluster();
55 /// Check precluster to simplify it (if possible), and return the simplified cluster
56 AliMUONCluster* CheckPrecluster(const AliMUONCluster& cluster);
57 AliMUONCluster* CheckPreclusterTwoCathodes(AliMUONCluster* cluster);
59 /// Checks whether a pad and a pixel have an overlapping area.
60 Bool_t Overlap(const AliMUONPad& pad, const AliMUONPad& pixel);
62 /// build array of pixels
63 void BuildPixArray(AliMUONCluster& cluster);
64 void BuildPixArrayOneCathode(AliMUONCluster& cluster);
65 void BuildPixArrayTwoCathodes(AliMUONCluster& cluster);
66 void PadOverHist(Int_t idir, Int_t ix0, Int_t iy0, AliMUONPad *pad);
68 void RemovePixel(Int_t i);
70 AliMUONPad* Pixel(Int_t i) const;
72 void AdjustPixel(AliMUONCluster& cluster, Float_t width, Int_t ixy); // adjust size of small pixels
73 void AdjustPixel(Double_t wxmin, Double_t wymin); // adjust size of large pixels
75 Bool_t MainLoop(AliMUONCluster& cluster, Int_t iSimple); // repeat MLEM algorithm until pixels become sufficiently small
77 void Mlem(AliMUONCluster& cluster, Double_t *coef, Double_t *probi, Int_t nIter); // use MLEM for cluster finding
79 void FindCOG(TH2D *mlem, Double_t *xyc); // find COG position around maximum bin
80 Int_t FindNearest(AliMUONPad *pixPtr0); // find nearest neighbouring pixel to the given one
82 Int_t FindLocalMaxima(TObjArray *pixArray, Int_t *localMax, Double_t *maxVal); // find local maxima
83 void FlagLocalMax(TH2D *hist, Int_t i, Int_t j, Int_t *isLocalMax); // flag local max
84 void FindCluster(AliMUONCluster& cluster, Int_t *localMax, Int_t iMax); // find cluster around local max
85 void AddVirtualPad(AliMUONCluster& cluster); // add virtual pads for some clusters (if necessary)
87 void PadsInXandY(AliMUONCluster& cluster, Int_t &nInX, Int_t &nInY) const; // get number of pads in X and Y
89 /// Process simple cluster
90 void Simple(AliMUONCluster& cluster);
92 void Neighbours(Int_t cath, Int_t ix0, Int_t iy0,
94 Int_t* xList, Int_t* yList);
96 void Plot(const char* outputfile);
98 void ComputeCoefficients(AliMUONCluster& cluster,
99 Double_t* coef, Double_t* probi);
101 void CheckOverlaps();
102 void AddBinSimple(TH2D *mlem, Int_t ic, Int_t jc);
107 static const Int_t fgkDim = 10000; ///< array size
108 static const Double_t fgkZeroSuppression; ///< average zero suppression value
109 static const Double_t fgkSaturation; ///< average saturation level
110 static const Double_t fgkDistancePrecision; ///< used to check overlaps and so on
111 static const TVector2 fgkIncreaseSize; ///< idem
112 static const TVector2 fgkDecreaseSize; ///< idem
114 AliMUONVClusterFinder* fPreClusterFinder; //!< the pre-clustering worker
115 AliMUONCluster* fPreCluster; //!< current pre-cluster
116 TObjArray fClusterList; //!< clusters corresponding to the current pre-cluster
118 Int_t fEventNumber; //!< current event being processed
119 Int_t fDetElemId; //!< current DE being processed
120 Int_t fClusterNumber; //!< current cluster number
122 const AliMpVSegmentation *fSegmentation[2]; //!< new segmentation
124 Float_t fZpad; //!< z-coordinate of the hit
125 Int_t fReco; //!< !=0 if run reco with writing of reconstructed clusters
126 Int_t fCathBeg; //!< starting cathode (for combined cluster / track reco)
127 Int_t fPadBeg[2]; //!< starting pads (for combined cluster / track reco)
129 static TMinuit* fgMinuit; //!< Fitter
131 TObjArray* fPixArray; //!< collection of pixels
132 Int_t fDebug; //!< debug level
133 Bool_t fPlot; //!< whether we should plot thing (for debug only, quite slow!)
135 AliMUONClusterSplitterMLEM* fSplitter; //!< helper class to go from pixel arrays to clusters
136 Int_t fNClusters; //!< total number of clusters
137 Int_t fNAddVirtualPads; //!< number of clusters for which we added virtual pads
139 ClassDef(AliMUONClusterFinderMLEM,0) // cluster finder in MUON arm of ALICE