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