Removing leftover return
[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;
c0a16418 16class TMinuit;
c0a16418 17
18#ifndef ROOT_TObjArray
19# include "TObjArray.h"
20#endif
21#ifndef ROOT_TVector2
22# include "TVector2.h"
23#endif
24
25class AliMUONPad;
26
27#include "AliMUONVClusterFinder.h"
28
29class AliMUONClusterSplitterMLEM;
30
31class AliMUONClusterFinderMLEM : public AliMUONVClusterFinder
32{
33public:
b1a19e07 34 AliMUONClusterFinderMLEM(Bool_t plot, AliMUONVClusterFinder* clusterFinder); // Constructor
c0a16418 35 virtual ~AliMUONClusterFinderMLEM(); // Destructor
36
24935e58 37 virtual Bool_t NeedSegmentation() const { return kTRUE; }
38
39 using AliMUONVClusterFinder::Prepare;
40
41 virtual Bool_t Prepare(Int_t detElemId,
9e41a340 42 TObjArray* pads[2],
24935e58 43 const AliMpArea& area,
44 const AliMpVSegmentation* segmentations[2]);
c0a16418 45
46 virtual AliMUONCluster* NextCluster();
47
110edb51 48 virtual void SetChargeHints(Double_t lowestPadCharge, Double_t lowestClusterCharge);
49
c0a16418 50 virtual void Print(Option_t* opt="") const;
51
52 virtual void Paint(Option_t* opt="");
53
8c718ff8 54 // Status flags for pads
05542040 55
56 /// Return pad "basic" state flag
57 static Int_t GetZeroFlag() { return fgkZero; }
58 /// Return do not kill flag
59 static Int_t GetMustKeepFlag() { return fgkMustKeep; }
60 /// Return should be used for fit flag
61 static Int_t GetUseForFitFlag() { return fgkUseForFit; }
62 /// Return processing is over flag
63 static Int_t GetOverFlag() { return fgkOver; }
64 /// Return modified pad charge flag
65 static Int_t GetModifiedFlag() { return fgkModified; }
66 /// Return coupled pad flag
67 static Int_t GetCoupledFlag() { return fgkCoupled; }
8c718ff8 68
c0a16418 69private:
71a2d3aa 70 /// Not implemented
c0a16418 71 AliMUONClusterFinderMLEM(const AliMUONClusterFinderMLEM& rhs);
71a2d3aa 72 /// Not implemented
c0a16418 73 AliMUONClusterFinderMLEM& operator=(const AliMUONClusterFinderMLEM& rhs);
74
75 Bool_t WorkOnPreCluster();
76
77 /// Check precluster to simplify it (if possible), and return the simplified cluster
78 AliMUONCluster* CheckPrecluster(const AliMUONCluster& cluster);
79 AliMUONCluster* CheckPreclusterTwoCathodes(AliMUONCluster* cluster);
c0a16418 80
81 /// Checks whether a pad and a pixel have an overlapping area.
82 Bool_t Overlap(const AliMUONPad& pad, const AliMUONPad& pixel);
83
84 /// build array of pixels
85 void BuildPixArray(AliMUONCluster& cluster);
86 void BuildPixArrayOneCathode(AliMUONCluster& cluster);
c80b29a4 87 void PadOverHist(Int_t idir, Int_t ix0, Int_t iy0, AliMUONPad *pad,
88 TH2D *hist1, TH2D *hist2);
c0a16418 89
90 void RemovePixel(Int_t i);
91
92 AliMUONPad* Pixel(Int_t i) const;
93
c0a16418 94 Bool_t MainLoop(AliMUONCluster& cluster, Int_t iSimple); // repeat MLEM algorithm until pixels become sufficiently small
95
72dae9ff 96 void Mlem(AliMUONCluster& cluster, const Double_t *coef, Double_t *probi, Int_t nIter); // use MLEM for cluster finding
c0a16418 97
c80b29a4 98 void FindCOG(Double_t *xyc); // find COG position around maximum bin
72dae9ff 99 Int_t FindNearest(const AliMUONPad *pixPtr0); // find nearest neighbouring pixel to the given one
c0a16418 100
101 Int_t FindLocalMaxima(TObjArray *pixArray, Int_t *localMax, Double_t *maxVal); // find local maxima
102 void FlagLocalMax(TH2D *hist, Int_t i, Int_t j, Int_t *isLocalMax); // flag local max
72dae9ff 103 void FindCluster(AliMUONCluster& cluster, const Int_t *localMax, Int_t iMax); // find cluster around local max
c0a16418 104 void AddVirtualPad(AliMUONCluster& cluster); // add virtual pads for some clusters (if necessary)
105
106 void PadsInXandY(AliMUONCluster& cluster, Int_t &nInX, Int_t &nInY) const; // get number of pads in X and Y
107
108 /// Process simple cluster
109 void Simple(AliMUONCluster& cluster);
110
c0a16418 111 void Plot(const char* outputfile);
112
113 void ComputeCoefficients(AliMUONCluster& cluster,
114 Double_t* coef, Double_t* probi);
115
116 void CheckOverlaps();
2abdae6e 117 void AddBinSimple(TH2D *mlem, Int_t ic, Int_t jc);
8c718ff8 118 void MaskPeaks(Int_t mask);
2abdae6e 119
c0a16418 120private:
05542040 121 // Status flags for pads
122 static const Int_t fgkZero; ///< pad "basic" state
123 static const Int_t fgkMustKeep; ///< do not kill (for pixels)
124 static const Int_t fgkUseForFit; ///< should be used for fit
125 static const Int_t fgkOver; ///< processing is over
126 static const Int_t fgkModified; ///< modified pad charge
127 static const Int_t fgkCoupled; ///< coupled pad
128
c0a16418 129 // Some constants
c0a16418 130 static const Double_t fgkDistancePrecision; ///< used to check overlaps and so on
131 static const TVector2 fgkIncreaseSize; ///< idem
132 static const TVector2 fgkDecreaseSize; ///< idem
133
71a2d3aa 134 AliMUONVClusterFinder* fPreClusterFinder; //!< the pre-clustering worker
135 AliMUONCluster* fPreCluster; //!< current pre-cluster
136 TObjArray fClusterList; //!< clusters corresponding to the current pre-cluster
c0a16418 137
71a2d3aa 138 Int_t fEventNumber; //!< current event being processed
139 Int_t fDetElemId; //!< current DE being processed
140 Int_t fClusterNumber; //!< current cluster number
c0a16418 141
72dae9ff 142 const AliMpVSegmentation *fkSegmentation[2]; //!< new segmentation
c0a16418 143
c80b29a4 144 //Int_t fCathBeg; //!< starting cathode (for combined cluster / track reco)
145 //Int_t fPadBeg[2]; //!< starting pads (for combined cluster / track reco)
c0a16418 146
c80b29a4 147 //static TMinuit* fgMinuit; //!< Fitter
148 TH2D *fHistMlem; //!< histogram for MLEM procedure
149 TH2D *fHistAnode; //!< histogram for local maxima search
c0a16418 150
151 TObjArray* fPixArray; //!< collection of pixels
152 Int_t fDebug; //!< debug level
153 Bool_t fPlot; //!< whether we should plot thing (for debug only, quite slow!)
154
c0a16418 155 AliMUONClusterSplitterMLEM* fSplitter; //!< helper class to go from pixel arrays to clusters
156 Int_t fNClusters; //!< total number of clusters
157 Int_t fNAddVirtualPads; //!< number of clusters for which we added virtual pads
158
110edb51 159 Double_t fLowestPixelCharge; //!< see AliMUONRecoParam
160 Double_t fLowestPadCharge; //!< see AliMUONRecoParam
161 Double_t fLowestClusterCharge; //!< see AliMUONRecoParam
162
c0a16418 163 ClassDef(AliMUONClusterFinderMLEM,0) // cluster finder in MUON arm of ALICE
164};
165
166#endif