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