]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONClusterFinderPeakFit.h
In AliMUONTrackReconstructorK:
[u/mrichter/AliRoot.git] / MUON / AliMUONClusterFinderPeakFit.h
1 #ifndef ALIMUONCLUSTERFINDERPEAKFIT_H
2 #define ALIMUONCLUSTERFINDERPEAKFIT_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 AliMUONClusterFinderPeakFit
10 /// \brief Cluster finder in MUON arm of ALICE
11 ///
12 //  Author Alexander Zinchenko, JINR Dubna; Laurent Aphecetche, SUBATECH
13 //
14
15 #include "AliMUONVClusterFinder.h"
16
17 #ifndef ROOT_TObjArray
18 #  include "TObjArray.h"
19 #endif
20 #ifndef ROOT_TVector2
21 #  include "TVector2.h"
22 #endif
23
24 class AliMUONMathieson;
25 //class AliMUONPad;
26
27 class TH2D;
28 //class TClonesArray;
29
30 class AliMUONClusterFinderPeakFit : public AliMUONVClusterFinder
31 {
32 public:
33   AliMUONClusterFinderPeakFit(Bool_t plot, AliMUONVClusterFinder* clusterFinder); // Constructor
34   virtual ~AliMUONClusterFinderPeakFit(); // Destructor
35
36   /// It needs segmentation
37   virtual Bool_t NeedSegmentation() const { return kTRUE; }
38
39   using AliMUONVClusterFinder::Prepare;
40
41   virtual Bool_t Prepare(Int_t detElemId, TClonesArray* pads[2],
42                          const AliMpArea& area, const AliMpVSegmentation* seg[2]);
43
44   virtual AliMUONCluster* NextCluster();
45   
46   /// Return the number of local maxima
47   Int_t GetNMax() const { return fNMax; }
48   
49   virtual void Print(Option_t* opt="") const;
50
51 private:
52   /// Not implemented
53   AliMUONClusterFinderPeakFit(const AliMUONClusterFinderPeakFit& rhs);
54   /// Not implemented
55   AliMUONClusterFinderPeakFit& operator=(const AliMUONClusterFinderPeakFit& rhs);
56
57   Bool_t WorkOnPreCluster();
58
59   /// Check precluster to simplify it (if possible), and return the simplified cluster
60   AliMUONCluster* CheckPrecluster(const AliMUONCluster& cluster); 
61   AliMUONCluster* CheckPreclusterTwoCathodes(AliMUONCluster* cluster); 
62   
63   /// Checks whether a pad and a pixel have an overlapping area.
64   Bool_t Overlap(const AliMUONPad& pad, const AliMUONPad& pixel); 
65   
66   /// build array of pixels
67   void BuildPixArray(AliMUONCluster& cluster); 
68   void BuildPixArrayOneCathode(AliMUONCluster& cluster); 
69   void PadOverHist(Int_t idir, Int_t ix0, Int_t iy0, AliMUONPad *pad, TH2D *h1, TH2D *h2);
70
71   void RemovePixel(Int_t i);
72   
73   AliMUONPad* Pixel(Int_t i) const;
74   
75   Int_t FindLocalMaxima(TObjArray *pixArray, Int_t *localMax, Double_t *maxVal); // find local maxima 
76   void  FlagLocalMax(TH2D *hist, Int_t i, Int_t j, Int_t *isLocalMax); // flag local max
77   void  FindClusterCOG(AliMUONCluster& cluster, const Int_t *localMax, Int_t iMax); // find cluster around local max with COG
78   void  FindClusterFit(AliMUONCluster& cluster, const Int_t *localMax, const Int_t *maxPos, Int_t nMax); // find cluster around local max with fitting
79   void  PadsInXandY(AliMUONCluster& cluster, Int_t &nInX, Int_t &nInY) const; // get number of pads in X and Y
80
81   void CheckOverlaps();
82
83 private:
84   // Status flags for pads
85   static const Int_t fgkZero; ///< pad "basic" state
86   static const Int_t fgkMustKeep; ///< do not kill (for pixels)
87   static const Int_t fgkUseForFit; ///< should be used for fit
88   static const Int_t fgkOver; ///< processing is over
89   static const Int_t fgkModified; ///< modified pad charge 
90   static const Int_t fgkCoupled; ///< coupled pad    
91     
92   // Some constants
93   static const Double_t fgkZeroSuppression; ///< average zero suppression value
94   static const Double_t fgkDistancePrecision; ///< used to check overlaps and so on
95   static const TVector2 fgkIncreaseSize; ///< idem
96   static const TVector2 fgkDecreaseSize; ///< idem
97   
98   AliMUONVClusterFinder* fPreClusterFinder; //!< the pre-clustering worker
99   AliMUONCluster* fPreCluster; //!< current pre-cluster
100   TObjArray fClusterList; //!< clusters corresponding to the current pre-cluster
101   AliMUONMathieson* fMathieson; //!< Mathieson to compute the charge repartition
102   
103   Int_t fEventNumber; //!< current event being processed
104   Int_t fDetElemId; //!< current DE being processed
105   Int_t fClusterNumber; //!< current cluster number
106   Int_t fNMax; //!< number of local maxima
107   TH2D *fHistAnode; //!< histo for local maxima search
108   
109   const AliMpVSegmentation *fkSegmentation[2]; //!< new segmentation
110   
111   TObjArray* fPixArray; //!< collection of pixels
112   Int_t fDebug; //!< debug level
113   Bool_t fPlot; //!< whether we should plot thing (for debug only, quite slow!)
114   
115   Int_t fNClusters; //!< total number of clusters
116   Int_t fNAddVirtualPads; //!< number of clusters for which we added virtual pads
117   
118   ClassDef(AliMUONClusterFinderPeakFit,0) // cluster finder in MUON arm of ALICE
119 };
120
121 #endif