]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/UPGRADE/AliITSUpgradeClusterFinder.h
ITS-upgrade simulation/reconstruction code (C. Terrevoli, A. Mastroserio)
[u/mrichter/AliRoot.git] / ITS / UPGRADE / AliITSUpgradeClusterFinder.h
1 /* Copyright(c) 2004-2006, ALICE Experiment at CERN, All rights reserved. *
2  * See cxx source for full Copyright notice     */
3 /////////////////////////////////////////////////////////////////////
4 // Author: A.Mastroserio, C.Terrevoli                              //
5 //         annalisa.mastroserio@cern.ch                            //
6 //         cristina.terrevoli@ba.infn.it                           //
7 // Alternative cluster finder. Usage instructions below.           //
8 //                                                                 //
9 //  For each event:                                                //
10 //  1. Call StartEvent()                                           //
11 //  2. For each pixel hit:                                         //
12 //     Call ProcessHit(..) or ProcessHitOnline(..)                 //
13 //  3. Call FinishEvent()                                          //
14 //  4. Access cluster information for this event by methods:       //
15 //     GetClusterCount(layer)                                      //
16 //     GetClusterMeanCol(layer,index)                              //
17 //     GetClusterMeanRow(layer,index)                              //
18 //     GetClusterSize(layer,index)                                 //
19 //     GetClusterType(layer,index)                                 //
20 //                                                                 //
21 /////////////////////////////////////////////////////////////////////
22
23 /* $Id$ */
24
25 #ifndef ALIITSUPGRADECLUSTERFINDER_H
26 #define ALIITSUPGRADECLUSTERFINDER_H
27
28 #include <Rtypes.h>
29 #include "AliITSUpgradeClusterList.h"
30 #include <TObjArray.h>
31
32 class AliITSUpgradeClusterFinder :public TObject{
33
34  public:
35   AliITSUpgradeClusterFinder();
36   ~AliITSUpgradeClusterFinder();
37
38   void ActivateClusterTypeSearch(){fClusterTypeFlag=kTRUE;}
39   void DeActivateClusterTypeSearch(){fClusterTypeFlag=kFALSE;}
40
41   void  StartEvent();
42   Int_t ProcessHit(Int_t layer, UInt_t col, UInt_t row, UShort_t charge,Int_t label[3]);
43   Int_t ProcessHitOnline(Int_t layer, UInt_t col, UInt_t row, UShort_t charge, Int_t label[3]);
44   void  FinishEvent();
45
46   void AddLabelIndex(UInt_t col, UInt_t row);
47   void SetLabels(Int_t label[3]);
48
49   UInt_t  GetClusterCount(Int_t layer);
50   Float_t GetClusterMeanCol(Int_t layer, UInt_t index);
51   Float_t GetClusterMeanRow(Int_t layer, UInt_t index);
52   UInt_t  GetClusterSize(Int_t layer, UInt_t index);
53   UInt_t  GetClusterWidthZ(Int_t layer, UInt_t index);
54   UInt_t  GetClusterWidthPhi(Int_t layer, UInt_t index);
55   UInt_t  GetClusterType(Int_t layer, UInt_t index);
56   UShort_t GetCharge(Int_t layer, UInt_t index); 
57   UInt_t GetPixelCharge(UInt_t col, UInt_t row); 
58   Int_t* GetLabels(Int_t layer,UInt_t index) ;
59   void  PrintClusters(Int_t layer);
60   void  PrintAllClusters();
61
62  private:
63   
64   void   NewEvent();
65   void   NewModule();
66   Int_t  DoModuleClustering(Int_t Layer, UShort_t charge);
67   UInt_t FindClusterRecu(Int_t col, Int_t row, UShort_t charge);
68   void   ShiftClusterTypeArea(UInt_t direction);
69   UInt_t GetClusterType(UInt_t size);
70   UInt_t GetClusterWidthZ();
71   UInt_t GetClusterWidthPhi();
72
73   enum {kMAXCLUSTERTYPESIDEZ=3,kMAXCLUSTERTYPESIDEY=4}; // region of interest for cluster type pattern
74   enum {kSHIFTRIGHT,kSHIFTDOWN};  // used for shifting the region of interest for cluster type pattern
75   
76   UInt_t   fNhitsLeft;     // number of hits still left to process for this module
77   Bool_t   fHits[39530][39530];// hit map for this module
78   UShort_t fHitCol[999999]; // these two arrays remember which pixels are hit for this module
79   UShort_t fHitRow[999999]; // these two arrays remember which pixels are hit for this module
80   Short_t  fOldModule;     // remember previous module (-1 at start of event)
81   Bool_t   fClusterTypeFlag;   // should we classify the clusters at all
82   Bool_t   fFindClusterType;   // temporary, for classifying a cluster (pattern of pixels)
83   UShort_t fClusterTypeOrigCol;// temporary, for classifying a cluster (pattern of pixels)
84   UShort_t fClusterTypeOrigRow;// temporary, for classifying a cluster (pattern of pixels)
85   UInt_t   fColSum; // used to determine the center of a cluster
86   UInt_t   fRowSum; // used to determine the center of a cluster
87   UShort_t fCharge;        // cluster charge 
88   Int_t    fTmpLabel[3];   // label array to be kept temporarily during the clustering procedure
89   Int_t    fLabels[10];    // label array to be attached to the cluster
90
91   UShort_t fClusterWidthMaxCol;
92   UShort_t fClusterWidthMinCol;
93   UShort_t fClusterWidthMaxRow;
94   UShort_t fClusterWidthMinRow;
95   Bool_t   fClusterTypeArea[kMAXCLUSTERTYPESIDEZ][kMAXCLUSTERTYPESIDEY];// same as above comments
96   AliITSUpgradeClusterList fClusterList[8];
97   TObjArray *fChargeArray;
98
99   AliITSUpgradeClusterFinder(const AliITSUpgradeClusterFinder &source); // copy constructor
100   // assignment operator
101   AliITSUpgradeClusterFinder& operator=(const AliITSUpgradeClusterFinder &source);
102
103
104   ClassDef(AliITSUpgradeClusterFinder,1) 
105
106 };
107
108
109 #endif