]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCclusterer.h
Log replaced by Id
[u/mrichter/AliRoot.git] / TPC / AliTPCclusterer.h
1 #ifndef ALITPCCLUSTERER_H
2 #define ALITPCCLUSTERER_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 //-------------------------------------------------------
9 //                       TPC clusterer
10 //
11 //   Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch 
12 //-------------------------------------------------------
13 #include <Rtypes.h>
14
15 #define kMAXCLUSTER 2500
16
17 class TFile;
18 class AliTPCParam;
19 class AliTPCcluster;
20 class AliLoader;
21
22 class AliTPCclusterer {
23 public:
24    static void Digits2Clusters(const AliTPCParam *par, AliLoader *of, Int_t eventn=1);
25
26 private:
27    class AliBin {
28    public:
29      UShort_t GetQ()    const   {return fQ;}
30      UInt_t   GetMask() const   {return fMask;}
31      void     SetQ(UShort_t q)  {fQ=q;}
32      void     SetMask(UInt_t m) {fMask=m;}
33    private:
34      UShort_t fQ;  //signal
35      UInt_t fMask; //peak mask
36    };
37
38 private:
39    static Bool_t IsMaximum(Int_t k, Int_t max, const AliBin *bins); 
40   static void FindPeaks(Int_t k,Int_t m,AliBin*b,Int_t*idx,UInt_t*msk,Int_t&n);
41    static void MarkPeak(Int_t k, Int_t max, AliBin *bins, UInt_t m);
42    static void MakeCluster(Int_t k,Int_t max,AliBin *bins,UInt_t m,
43    AliTPCcluster &c);
44 };
45
46
47 inline Bool_t AliTPCclusterer::IsMaximum(Int_t k,Int_t max,const AliBin *bins){
48   //is this a local maximum ?
49   UShort_t q=bins[k].GetQ();
50   if (q==1023) return kFALSE;
51   if (bins[k-max].GetQ() > q) return kFALSE;
52   if (bins[k-1  ].GetQ() > q) return kFALSE; 
53   if (bins[k+max].GetQ() > q) return kFALSE; 
54   if (bins[k+1  ].GetQ() > q) return kFALSE; 
55   if (bins[k-max-1].GetQ() > q) return kFALSE;
56   if (bins[k+max-1].GetQ() > q) return kFALSE; 
57   if (bins[k+max+1].GetQ() > q) return kFALSE; 
58   if (bins[k-max+1].GetQ() > q) return kFALSE;
59   return kTRUE; 
60 }
61
62 //-----------------------------------------------------------------
63
64 #endif
65
66