]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/UPGRADE/AliITSUClusterizer.h
to suppress compilation warnings
[u/mrichter/AliRoot.git] / ITS / UPGRADE / AliITSUClusterizer.h
CommitLineData
b69620f8 1#ifndef ALIITSUCLUSTERIZER_H\r
2#define ALIITSUCLUSTERIZER_H\r
3\r
b69620f8 4#include <TClonesArray.h>\r
5e375bb4 5class TTree;\r
6class TObjAray;\r
7class AliITSUSegmentationPix;\r
8class AliITSdigit;\r
9class AliCluster;\r
10class AliITSUClusterPix;\r
11class AliITSURecoParam;\r
b69620f8 12\r
13class AliITSUClusterizer : public TObject \r
14{\r
15 //\r
16 public:\r
4bac12be 17 enum {kDigitChunkSize=1024, kMaxLabels=20,kMaxLabInCluster=3};\r
b69620f8 18 //\r
19 AliITSUClusterizer(Int_t nrowInit=0);\r
20 virtual ~AliITSUClusterizer();\r
4bac12be 21 void SetRawData(Bool_t v=kTRUE) {fRawData = v;}\r
b69620f8 22 void Clusterize();\r
23 void SetSegmentation(const AliITSUSegmentationPix *segm);\r
5e375bb4 24 void SetRecoParam(const AliITSURecoParam* param) {fRecoParam = param;}\r
889b1493 25 void SetLayerID(Int_t id) {fLayerID = id;}\r
b69620f8 26 void SetVolID(Int_t id) {fVolID = id;}\r
27 void SetNRow(Int_t nrow);\r
ee58ce21 28 void SetAllowDiagonalClusterization(Bool_t v) {fAllowDiagonalClusterization = v;}\r
889b1493 29 void PrepareLorentzAngleCorrection(Double_t bz);\r
30 //\r
b69620f8 31 // interface methods\r
32 void MakeRecPointBranch(TTree */*treeR*/) {};\r
33 void SetRecPointTreeAddress(TTree */*treeR*/) {};\r
34 void DigitsToRecPoints(const TObjArray */*digList*/) {};\r
35 \r
5e375bb4 36 void SetDigits(const TClonesArray *digits) {fInputDigits=digits;fInputDigitsReadIndex=0;}\r
b69620f8 37 void SetClusters(TClonesArray *clusters) {fOutputClusters=clusters;}\r
4bac12be 38 //\r
39 // labeling methods\r
40 void AddLabel(int label);\r
41 void CheckLabels();\r
42 //\r
b69620f8 43 protected: // transient data types\r
44 struct AliITSUClusterizerClusterDigit {\r
45 AliITSUClusterizerClusterDigit *fNext;\r
46 AliITSdigit *fDigit;\r
b69620f8 47 };\r
48 \r
49 struct AliITSUClusterizerClusterCand;\r
50 struct AliITSUClusterizerClusterPart {\r
51 AliITSUClusterizerClusterPart *fNextInRow;\r
52 AliITSUClusterizerClusterPart *fPrevInCluster;\r
53 AliITSUClusterizerClusterPart *fNextInCluster;\r
54 AliITSUClusterizerClusterCand *fParent;\r
55 Int_t fUBegin;\r
56 Int_t fUEnd;\r
57 };\r
58 \r
59 struct AliITSUClusterizerClusterCand {\r
60 AliITSUClusterizerClusterCand *fNext; // only used for memory management\r
61 AliITSUClusterizerClusterPart *fFirstPart;\r
62 AliITSUClusterizerClusterDigit *fFirstDigit;\r
63 AliITSUClusterizerClusterDigit *fLastDigit ;\r
64 };\r
65\r
66 protected:\r
67 //\r
68 // allocation and deallocation\r
69 AliITSUClusterizerClusterDigit* AllocDigitFreelist();\r
70 AliITSUClusterizerClusterCand* AllocCand();\r
71 void DeallocCand(AliITSUClusterizerClusterCand *cand);\r
72 AliITSUClusterizerClusterPart* AllocPart();\r
73 void DeallocPart(AliITSUClusterizerClusterPart *part) {DeallocParts(part,part); }\r
74 void DeallocParts(AliITSUClusterizerClusterPart *first,AliITSUClusterizerClusterPart *last);\r
75 AliITSUClusterizerClusterDigit* AllocDigit();\r
76 void DeallocDigit(AliITSUClusterizerClusterDigit *digit) {DeallocDigits(digit,digit);}\r
77 void DeallocDigits(AliITSUClusterizerClusterDigit *first,AliITSUClusterizerClusterDigit *last);\r
78\r
79 // input "iterator"\r
80 AliITSUClusterizerClusterDigit* NextDigit();\r
81 // output "iterator"\r
5e375bb4 82 AliCluster* NextCluster() {return (AliCluster*)fOutputClusters->New(fOutputClusters->GetEntriesFast());}\r
b69620f8 83 \r
84 // modifiers\r
ee58ce21 85 void SetAllowDiagonalClusterization();\r
86\r
b69620f8 87 void AttachDigitToCand(AliITSUClusterizerClusterCand *cand,AliITSUClusterizerClusterDigit *digit);\r
88 void AttachPartToCand(AliITSUClusterizerClusterCand *cand,AliITSUClusterizerClusterPart *part);\r
89 void DetachPartFromCand(AliITSUClusterizerClusterCand *cand,AliITSUClusterizerClusterPart *part);\r
90 void MergeCands(AliITSUClusterizerClusterCand *a,AliITSUClusterizerClusterCand *b);\r
5e375bb4 91 void Transform(AliITSUClusterPix *cluster, AliITSUClusterizerClusterCand *cand);\r
b69620f8 92 void CloseCand(AliITSUClusterizerClusterCand *cand);\r
93 void ClosePart(AliITSUClusterizerClusterPart *part);\r
94\r
95 void CloseRemainingParts(AliITSUClusterizerClusterPart *part);\r
96 //\r
97 protected:\r
98 //\r
99 Int_t fVolID; // Volume id (module index)\r
ee58ce21 100 Bool_t fAllowDiagonalClusterization; // allow clusters with pixels having common corners only\r
b69620f8 101 const AliITSUSegmentationPix* fSegm; // Segmentation or local coord calc.\r
5e375bb4 102 const AliITSURecoParam* fRecoParam; // reco params\r
b69620f8 103 //\r
104 // Digit Input\r
5e375bb4 105 const TClonesArray *fInputDigits; // supplied digits\r
106 Int_t fInputDigitsReadIndex; // digits counter\r
889b1493 107 Int_t fLayerID; // current layer id\r
4bac12be 108 //\r
109 Int_t fCurrLabels[kMaxLabels]; // labels collected for current cluster\r
110 Int_t fNLabels; // number of collected labels\r
111 Bool_t fRawData; // is raw data processed?\r
112 //\r
889b1493 113 Double_t fLorAngCorrection; // Lorentz Angle correction for current layer\r
b69620f8 114 // Cluster Output\r
5e375bb4 115 TClonesArray *fOutputClusters; // external container to store clusters\r
116 //\r
b69620f8 117 // temporary variables\r
5e375bb4 118 AliITSUClusterizerClusterDigit *fDigitFreelist ; //! pool of local digits\r
119 AliITSUClusterizerClusterPart *fPartFreelist ; //! pool of unfinished clusters\r
120 AliITSUClusterizerClusterCand *fCandFreelist ; //! pool of clusters\r
121 AliITSUClusterizerClusterDigit *fDigitFreelistBptrFirst; //! pointer in the pool\r
122 AliITSUClusterizerClusterDigit *fDigitFreelistBptrLast ; //! pointer in the pool\r
123 AliITSUClusterizerClusterPart *fPartFreelistBptr ; //! pointer in the pool\r
124 AliITSUClusterizerClusterCand *fCandFreelistBptr ; //!pointer in the pool\r
b69620f8 125 //\r
126 private:\r
127 AliITSUClusterizer(const AliITSUClusterizer&); //Not implemented\r
128 AliITSUClusterizer& operator=(const AliITSUClusterizer&); //Not implemented\r
129 //\r
130 ClassDef(AliITSUClusterizer,0)\r
131};\r
132\r
133\r
134//_______________________________________________________________________________\r
135inline void AliITSUClusterizer::DeallocCand(AliITSUClusterizerClusterCand *cand)\r
136{\r
137 // free candidate\r
138 cand->fNext=fCandFreelist;\r
139 fCandFreelist=cand;\r
140}\r
141\r
142//_______________________________________________________________________________\r
143inline void AliITSUClusterizer::DeallocParts(AliITSUClusterizerClusterPart *first,AliITSUClusterizerClusterPart *last)\r
144{\r
145 // free cluster part\r
146 last->fNextInRow=fPartFreelist;\r
147 fPartFreelist=first;\r
148}\r
149\r
150//_______________________________________________________________________________\r
151inline AliITSUClusterizer::AliITSUClusterizerClusterDigit* AliITSUClusterizer::AllocDigit()\r
152{\r
153 // allocate digits\r
154 if (!fDigitFreelist) fDigitFreelist = AllocDigitFreelist();\r
155 AliITSUClusterizerClusterDigit *digit = fDigitFreelist;\r
156 fDigitFreelist = fDigitFreelist->fNext;\r
157 return digit;\r
158}\r
159\r
160//_______________________________________________________________________________\r
161inline AliITSUClusterizer::AliITSUClusterizerClusterPart* AliITSUClusterizer::AllocPart()\r
162{\r
163 // allocate cluster part\r
164 AliITSUClusterizerClusterPart *part=fPartFreelist;\r
165 fPartFreelist=fPartFreelist->fNextInRow;\r
166 return part;\r
167}\r
168\r
169//_______________________________________________________________________________\r
170inline AliITSUClusterizer::AliITSUClusterizerClusterCand* AliITSUClusterizer::AllocCand()\r
171{\r
172 // allocate cluster \r
173 AliITSUClusterizerClusterCand *cand=fCandFreelist;\r
174 fCandFreelist=fCandFreelist->fNext;\r
175 return cand;\r
176}\r
177\r
178//_______________________________________________________________________________\r
179inline void AliITSUClusterizer::DeallocDigits(AliITSUClusterizerClusterDigit *first, AliITSUClusterizerClusterDigit *last) \r
180{\r
181 // free digit\r
182 last->fNext = fDigitFreelist;\r
183 fDigitFreelist = first;\r
184}\r
185\r
186//_______________________________________________________________________________\r
187inline void AliITSUClusterizer::AttachDigitToCand(AliITSUClusterizerClusterCand *cand,AliITSUClusterizerClusterDigit *digit) \r
188{\r
189 // attach digit\r
190 digit->fNext = cand->fFirstDigit;\r
191 cand->fFirstDigit = digit;\r
192}\r
193\r
194//_______________________________________________________________________________\r
195inline void AliITSUClusterizer::DetachPartFromCand(AliITSUClusterizerClusterCand *cand,AliITSUClusterizerClusterPart *part) \r
196{\r
197 // remove cluster part \r
198 if (part->fPrevInCluster) part->fPrevInCluster->fNextInCluster=part->fNextInCluster;\r
199 else cand->fFirstPart=part->fNextInCluster;\r
200 if (part->fNextInCluster) part->fNextInCluster->fPrevInCluster=part->fPrevInCluster;\r
201}\r
202\r
4bac12be 203//______________________________________________________________________________\r
204inline void AliITSUClusterizer::AddLabel(int label)\r
205{\r
206 // add new label\r
207 if (fNLabels==kMaxLabels) return;\r
208 for (int i=fNLabels;i--;) if (fCurrLabels[i]==label) return;\r
209 fCurrLabels[fNLabels++] = label;\r
210}\r
211\r
b69620f8 212\r
213#endif\r
214\r