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