Line data Source code
1 : #ifndef ALIITSCLUSTERFINDER_H
2 : #define ALIITSCLUSTERFINDER_H
3 :
4 : /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 : * See cxx source for full Copyright notice */
6 :
7 : /* $Id$ */
8 :
9 : ////////////////////////////////////////////////
10 : // ITS Cluster Finder Class //
11 : // //
12 : // //
13 : ////////////////////////////////////////////////
14 :
15 : #include <TObject.h>
16 : #include <TClonesArray.h>
17 : #include "AliLog.h"
18 :
19 : class AliITSMap;
20 : class AliITSresponse;
21 : class AliITSsegmentation;
22 : class AliITSdigit;
23 : class AliITSRecPoint;
24 : class AliITSDetTypeRec;
25 : class AliRawReader;
26 : class TArrayI;
27 :
28 : using std::istream;
29 :
30 : //----------------------------------------------------------------------
31 : class AliITSClusterFinder :public TObject{
32 : public:
33 : AliITSClusterFinder(); // Default constructor
34 : // Standard Constructor
35 : AliITSClusterFinder(AliITSDetTypeRec* dettyp);
36 : AliITSClusterFinder(AliITSDetTypeRec* dettyp,TClonesArray *digits);// Standard+ Constructor
37 : virtual ~AliITSClusterFinder(); // Destructor
38 : //
39 : // Do the Reconstruction.
40 : virtual void FindRawClusters(Int_t /*mod*/)=0; // Finds cluster of digits.
41 : virtual void RawdataToClusters(AliRawReader* /*rawReader*/) {
42 0 : AliError("Method not implemented in this class ");
43 0 : }
44 :
45 : // Digit
46 : virtual void SetDigits(TClonesArray *itsDigits) {// set digits
47 13170 : fDigits=itsDigits;fNdigits = fDigits->GetEntriesFast();}
48 : virtual AliITSdigit* GetDigit(Int_t i){ // Returns ith digit
49 0 : return (AliITSdigit*) fDigits->UncheckedAt(i);}
50 0 : virtual TClonesArray* Digits(){return fDigits;}// Gets fDigits
51 0 : virtual Int_t NDigits() const {return fNdigits;}// Get Number of Digits
52 :
53 : // Set fClusters up
54 : virtual void SetClusters(TClonesArray *itsClusters){// set clusters
55 0 : fClusters = itsClusters;}
56 : // Get fCluters
57 0 : virtual TClonesArray* Clusters(){return fClusters;}
58 : // Returns the present number of enteries
59 0 : virtual Int_t NClusters()const {return fClusters->GetEntriesFast();}
60 :
61 13164 : virtual void SetModule(Int_t module){fModule = module;}// Set module number
62 0 : virtual Int_t GetModule()const {return fModule;}// Returns module number
63 :
64 0 : void SetEvent(Int_t event) { fEvent=event; }
65 :
66 : // Others
67 0 : virtual void SetMap(AliITSMap *m) {fMap=m;}// map
68 0 : AliITSMap* Map(){return fMap;}// map
69 0 : virtual Int_t GetNPeaks() const {return fNPeaks;}// returns fNPeaks
70 : //
71 : virtual Bool_t IsNeighbor(TObjArray *digs,Int_t i,Int_t j[]) const;
72 : // Set max. cluster size ; bigger clusters will be rejected
73 :
74 : // IO functions
75 : void Print(ostream *os) const; // Class ascii print function
76 : void Read(istream *os); // Class ascii read function
77 0 : virtual void Print(Option_t *option="") const {TObject::Print(option);}
78 0 : virtual Int_t Read(const char *name) {return TObject::Read(name);}
79 :
80 13188 : virtual void SetDetTypeRec(AliITSDetTypeRec* dtr) {fDetTypeRec=dtr;}
81 13108 : AliITSDetTypeRec* GetDetTypeRec() const {return fDetTypeRec;}
82 :
83 : void InitGeometry();
84 : //
85 24 : void ResetNClusters() {fNClusters = 0;}
86 13172 : Int_t GetNClusters() const {return fNClusters;}
87 0 : void SetRawID2ClusID(TArrayI *arr) {fRawID2ClusID = arr;}
88 0 : TArrayI* GetRawID2ClusID() const {return fRawID2ClusID;}
89 : //
90 : protected:
91 : class Ali1Dcluster {
92 : public:
93 1264 : void SetY(Float_t y) {fY=y;}
94 1264 : void SetQ(Float_t q) {fQ=q;}
95 1264 : void SetNd(Int_t n) {fNd=n;}
96 1264 : void SetLabels(Int_t *lab) {fLab[0]=lab[0];fLab[1]=lab[1];fLab[2]=lab[2];}
97 3038 : Float_t GetY() const {return fY;}
98 12574 : Float_t GetQ() const {return fQ;}
99 2300 : Int_t GetNd()const {return fNd;}
100 3504 : Int_t GetLabel(Int_t lab) const { return fLab[lab]; }
101 : protected:
102 : Float_t fY; //cluster position
103 : Float_t fQ; //cluster charge
104 : Int_t fNd; //number of digits
105 : Int_t fLab[3]; //track label
106 : };
107 : class AliBin {
108 : public:
109 161834112 : AliBin():fIndex(0),fMask(0xFFFFFFFE),fRawID(-1),fQ(0){}
110 592 : void SetIndex(UInt_t idx) {fIndex=idx;}
111 848304 : void SetQ(UShort_t q) {fQ=q;}
112 848304 : void SetMask(UInt_t m) {fMask=m;}
113 296 : void SetRawID(Int_t id) {fRawID=id;}
114 0 : void Reset() {fIndex=0; fMask=0xFFFFFFFE; fQ=0; fRawID=-1;}
115 :
116 548 : void Use() {fMask&=0xFFFFFFFE;}
117 77659160 : Bool_t IsNotUsed() const {return (fMask&1);}
118 77656968 : Bool_t IsUsed() const {return !(IsNotUsed());}
119 :
120 548 : UInt_t GetIndex() const {return fIndex;}
121 274 : UShort_t GetQ() const {return fQ;}
122 0 : UInt_t GetMask() const {return fMask;}
123 0 : Int_t GetRawID() const {return fRawID;}
124 : protected:
125 : UInt_t fIndex; //digit index
126 : UInt_t fMask; //peak mask
127 : Int_t fRawID; // ID of raw word (used for embedding)
128 : UShort_t fQ; //signal
129 : };
130 : void MakeCluster(Int_t k,Int_t max,AliBin *bins,UInt_t m,AliITSRecPoint &c);
131 : static Bool_t IsMaximum(Int_t k, Int_t max, const AliBin *bins);
132 : static void FindPeaks(Int_t k,Int_t m,AliBin*b,Int_t*idx,UInt_t*msk,Int_t&n);
133 : static void MarkPeak(Int_t k, Int_t max, AliBin *bins, UInt_t m);
134 : static void FindCluster(Int_t k,Int_t maxz,AliBin *bins,Int_t &n,Int_t *idx);
135 :
136 : static void CheckLabels2(Int_t lab[10]);
137 : static void AddLabel(Int_t lab[10], Int_t label);
138 :
139 : // data members
140 :
141 : Int_t fModule; //! Module number to be reconstuctted
142 : TClonesArray *fDigits; //! digits
143 : Int_t fNdigits; //! num of digits
144 :
145 : AliITSDetTypeRec* fDetTypeRec; //ITS object for reconstruction
146 : TClonesArray *fClusters; //! Array of clusters
147 : AliITSMap *fMap; //! map
148 : Int_t fNPeaks; //! NPeaks
149 : // Data members needed to fill AliCluster objects
150 : Int_t fNdet[2200]; // detector index
151 : Int_t fNlayer[2200]; // detector layer
152 :
153 : Int_t fNModules; // total number of modules
154 : Int_t fEvent; //event number
155 : Int_t fZmin; // minimum channel in Zloc
156 : Int_t fZmax; // maximum channel in Zloc
157 : Int_t fXmin; // minimum channel in Xloc
158 : Int_t fXmax; // maximum channel in Xloc
159 : //
160 : UInt_t fNClusters; // total number of clusters found
161 : //
162 : TArrayI* fRawID2ClusID; //! optional array to store raw word ID -> ClusID for embedding (not owned)
163 :
164 : AliITSClusterFinder(const AliITSClusterFinder &source); // copy constructor
165 : // assignment operator
166 : AliITSClusterFinder& operator=(const AliITSClusterFinder &source);
167 :
168 :
169 118 : ClassDef(AliITSClusterFinder,11) //Class for clustering and reconstruction of space points
170 : };
171 : // Input and output functions for standard C++ input/output.
172 : ostream &operator<<(ostream &os,AliITSClusterFinder &source);
173 : istream &operator>>(istream &os,AliITSClusterFinder &source);
174 : #endif
|