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="");
47 // Status flags for pads
49 /// Return pad "basic" state flag
50 static Int_t GetZeroFlag() { return fgkZero; }
51 /// Return do not kill flag
52 static Int_t GetMustKeepFlag() { return fgkMustKeep; }
53 /// Return should be used for fit flag
54 static Int_t GetUseForFitFlag() { return fgkUseForFit; }
55 /// Return processing is over flag
56 static Int_t GetOverFlag() { return fgkOver; }
57 /// Return modified pad charge flag
58 static Int_t GetModifiedFlag() { return fgkModified; }
59 /// Return coupled pad flag
60 static Int_t GetCoupledFlag() { return fgkCoupled; }
64 AliMUONClusterFinderMLEM(const AliMUONClusterFinderMLEM& rhs);
66 AliMUONClusterFinderMLEM& operator=(const AliMUONClusterFinderMLEM& rhs);
68 Bool_t WorkOnPreCluster();
70 /// Check precluster to simplify it (if possible), and return the simplified cluster
71 AliMUONCluster* CheckPrecluster(const AliMUONCluster& cluster);
72 AliMUONCluster* CheckPreclusterTwoCathodes(AliMUONCluster* cluster);
74 /// Checks whether a pad and a pixel have an overlapping area.
75 Bool_t Overlap(const AliMUONPad& pad, const AliMUONPad& pixel);
77 /// build array of pixels
78 void BuildPixArray(AliMUONCluster& cluster);
79 void BuildPixArrayOneCathode(AliMUONCluster& cluster);
80 void PadOverHist(Int_t idir, Int_t ix0, Int_t iy0, AliMUONPad *pad);
82 void RemovePixel(Int_t i);
84 AliMUONPad* Pixel(Int_t i) const;
86 Bool_t MainLoop(AliMUONCluster& cluster, Int_t iSimple); // repeat MLEM algorithm until pixels become sufficiently small
88 void Mlem(AliMUONCluster& cluster, Double_t *coef, Double_t *probi, Int_t nIter); // use MLEM for cluster finding
90 void FindCOG(TH2D *mlem, Double_t *xyc); // find COG position around maximum bin
91 Int_t FindNearest(AliMUONPad *pixPtr0); // find nearest neighbouring pixel to the given one
93 Int_t FindLocalMaxima(TObjArray *pixArray, Int_t *localMax, Double_t *maxVal); // find local maxima
94 void FlagLocalMax(TH2D *hist, Int_t i, Int_t j, Int_t *isLocalMax); // flag local max
95 void FindCluster(AliMUONCluster& cluster, Int_t *localMax, Int_t iMax); // find cluster around local max
96 void AddVirtualPad(AliMUONCluster& cluster); // add virtual pads for some clusters (if necessary)
98 void PadsInXandY(AliMUONCluster& cluster, Int_t &nInX, Int_t &nInY) const; // get number of pads in X and Y
100 /// Process simple cluster
101 void Simple(AliMUONCluster& cluster);
103 void Plot(const char* outputfile);
105 void ComputeCoefficients(AliMUONCluster& cluster,
106 Double_t* coef, Double_t* probi);
108 void CheckOverlaps();
109 void AddBinSimple(TH2D *mlem, Int_t ic, Int_t jc);
110 void MaskPeaks(Int_t mask);
113 // Status flags for pads
114 static const Int_t fgkZero; ///< pad "basic" state
115 static const Int_t fgkMustKeep; ///< do not kill (for pixels)
116 static const Int_t fgkUseForFit; ///< should be used for fit
117 static const Int_t fgkOver; ///< processing is over
118 static const Int_t fgkModified; ///< modified pad charge
119 static const Int_t fgkCoupled; ///< coupled pad
122 static const Double_t fgkZeroSuppression; ///< average zero suppression value
123 static const Double_t fgkDistancePrecision; ///< used to check overlaps and so on
124 static const TVector2 fgkIncreaseSize; ///< idem
125 static const TVector2 fgkDecreaseSize; ///< idem
127 AliMUONVClusterFinder* fPreClusterFinder; //!< the pre-clustering worker
128 AliMUONCluster* fPreCluster; //!< current pre-cluster
129 TObjArray fClusterList; //!< clusters corresponding to the current pre-cluster
131 Int_t fEventNumber; //!< current event being processed
132 Int_t fDetElemId; //!< current DE being processed
133 Int_t fClusterNumber; //!< current cluster number
135 const AliMpVSegmentation *fSegmentation[2]; //!< new segmentation
137 Int_t fCathBeg; //!< starting cathode (for combined cluster / track reco)
138 Int_t fPadBeg[2]; //!< starting pads (for combined cluster / track reco)
140 static TMinuit* fgMinuit; //!< Fitter
142 TObjArray* fPixArray; //!< collection of pixels
143 Int_t fDebug; //!< debug level
144 Bool_t fPlot; //!< whether we should plot thing (for debug only, quite slow!)
146 AliMUONClusterSplitterMLEM* fSplitter; //!< helper class to go from pixel arrays to clusters
147 Int_t fNClusters; //!< total number of clusters
148 Int_t fNAddVirtualPads; //!< number of clusters for which we added virtual pads
150 ClassDef(AliMUONClusterFinderMLEM,0) // cluster finder in MUON arm of ALICE