]>
Commit | Line | Data |
---|---|---|
04366a57 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | //////////////////////////////////////////////////////////////////////////// | |
16 | // Implementation of the ITS clusterer V2 class // | |
17 | // // | |
18 | // Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch // | |
19 | // // | |
20 | /////////////////////////////////////////////////////////////////////////// | |
21 | ||
22 | ||
04366a57 | 23 | |
24 | #include "AliITSClusterFinderV2SDD.h" | |
00a7cc50 | 25 | #include "AliITSRecPoint.h" |
7d62fb64 | 26 | #include "AliITSDetTypeRec.h" |
04366a57 | 27 | #include "AliRawReader.h" |
0599a018 | 28 | #include "AliITSRawStreamSDD.h" |
5bfe44ce | 29 | #include "AliITSCalibrationSDD.h" |
30 | #include "AliITSDetTypeRec.h" | |
31 | #include "AliITSsegmentationSDD.h" | |
04366a57 | 32 | #include <TClonesArray.h> |
04366a57 | 33 | #include "AliITSdigitSDD.h" |
b4704be3 | 34 | #include "AliITSgeomTGeo.h" |
04366a57 | 35 | ClassImp(AliITSClusterFinderV2SDD) |
36 | ||
e56160b8 | 37 | AliITSClusterFinderV2SDD::AliITSClusterFinderV2SDD(AliITSDetTypeRec* dettyp):AliITSClusterFinderV2(dettyp), |
38 | fNySDD(256), | |
39 | fNzSDD(256), | |
40 | fYpitchSDD(0.01825), | |
41 | fZpitchSDD(0.02940), | |
42 | fHwSDD(3.5085), | |
43 | fHlSDD(3.7632), | |
44 | fYoffSDD(0.0425){ | |
04366a57 | 45 | |
46 | //Default constructor | |
47 | ||
04366a57 | 48 | |
49 | } | |
50 | ||
51 | ||
52 | void AliITSClusterFinderV2SDD::FindRawClusters(Int_t mod){ | |
53 | ||
54 | //Find clusters V2 | |
55 | SetModule(mod); | |
56 | FindClustersSDD(fDigits); | |
57 | ||
58 | } | |
59 | ||
60 | void AliITSClusterFinderV2SDD::FindClustersSDD(TClonesArray *digits) { | |
61 | //------------------------------------------------------------ | |
62 | // Actual SDD cluster finder | |
63 | //------------------------------------------------------------ | |
64 | Int_t kNzBins = fNzSDD + 2; | |
65 | const Int_t kMAXBIN=kNzBins*(fNySDD+2); | |
66 | ||
67 | AliBin *bins[2]; | |
68 | bins[0]=new AliBin[kMAXBIN]; | |
69 | bins[1]=new AliBin[kMAXBIN]; | |
404c1c29 | 70 | AliITSCalibrationSDD* cal = (AliITSCalibrationSDD*)GetResp(fModule); |
0599a018 | 71 | AliITSresponseSDD* res = (AliITSresponseSDD*)cal->GetResponse(); |
72 | const char *option=res->ZeroSuppOption(); | |
04366a57 | 73 | AliITSdigitSDD *d=0; |
74 | Int_t i, ndigits=digits->GetEntriesFast(); | |
75 | for (i=0; i<ndigits; i++) { | |
76 | d=(AliITSdigitSDD*)digits->UncheckedAt(i); | |
77 | Int_t y=d->GetCoord2()+1; //y | |
78 | Int_t z=d->GetCoord1()+1; //z | |
79 | Int_t q=d->GetSignal(); | |
0599a018 | 80 | if(!((strstr(option,"1D")) || (strstr(option,"2D")))){ |
81 | Float_t baseline = cal->GetBaseline(d->GetCoord1()); | |
82 | if(q>baseline) q-=(Int_t)baseline; | |
83 | else q=0; | |
84 | } | |
9e4d7193 | 85 | if(q<cal->GetThresholdAnode(d->GetCoord1())) continue; |
0599a018 | 86 | |
404c1c29 | 87 | //if (q<3) continue; |
04366a57 | 88 | |
89 | if (z <= fNzSDD) { | |
90 | bins[0][y*kNzBins+z].SetQ(q); | |
91 | bins[0][y*kNzBins+z].SetMask(1); | |
92 | bins[0][y*kNzBins+z].SetIndex(i); | |
93 | } else { | |
94 | z-=fNzSDD; | |
95 | bins[1][y*kNzBins+z].SetQ(q); | |
96 | bins[1][y*kNzBins+z].SetMask(1); | |
97 | bins[1][y*kNzBins+z].SetIndex(i); | |
98 | } | |
99 | } | |
100 | ||
101 | FindClustersSDD(bins, kMAXBIN, kNzBins, digits); | |
102 | ||
103 | delete[] bins[0]; | |
104 | delete[] bins[1]; | |
105 | ||
106 | } | |
107 | ||
108 | void AliITSClusterFinderV2SDD:: | |
109 | FindClustersSDD(AliBin* bins[2], Int_t nMaxBin, Int_t nzBins, | |
110 | TClonesArray *digits, TClonesArray *clusters) { | |
111 | //------------------------------------------------------------ | |
112 | // Actual SDD cluster finder | |
113 | //------------------------------------------------------------ | |
b4704be3 | 114 | |
115 | const TGeoHMatrix *mT2L=AliITSgeomTGeo::GetTracking2LocalMatrix(fModule); | |
404c1c29 | 116 | AliITSCalibrationSDD* cal = (AliITSCalibrationSDD*)GetResp(fModule); |
04366a57 | 117 | Int_t ncl=0; |
118 | TClonesArray &cl=*clusters; | |
119 | for (Int_t s=0; s<2; s++) | |
120 | for (Int_t i=0; i<nMaxBin; i++) { | |
121 | if (bins[s][i].IsUsed()) continue; | |
122 | Int_t idx[32]; UInt_t msk[32]; Int_t npeaks=0; | |
123 | FindPeaks(i, nzBins, bins[s], idx, msk, npeaks); | |
124 | ||
125 | if (npeaks>30) continue; | |
126 | if (npeaks==0) continue; | |
127 | ||
128 | Int_t k,l; | |
129 | for (k=0; k<npeaks-1; k++){//mark adjacent peaks | |
130 | if (idx[k] < 0) continue; //this peak is already removed | |
131 | for (l=k+1; l<npeaks; l++) { | |
132 | if (idx[l] < 0) continue; //this peak is already removed | |
133 | Int_t ki=idx[k]/nzBins, kj=idx[k] - ki*nzBins; | |
134 | Int_t li=idx[l]/nzBins, lj=idx[l] - li*nzBins; | |
135 | Int_t di=TMath::Abs(ki - li); | |
136 | Int_t dj=TMath::Abs(kj - lj); | |
137 | if (di>1 || dj>1) continue; | |
138 | if (bins[s][idx[k]].GetQ() > bins[s][idx[l]].GetQ()) { | |
139 | msk[l]=msk[k]; | |
140 | idx[l]*=-1; | |
141 | } else { | |
142 | msk[k]=msk[l]; | |
143 | idx[k]*=-1; | |
144 | break; | |
145 | } | |
146 | } | |
147 | } | |
148 | ||
149 | for (k=0; k<npeaks; k++) { | |
150 | MarkPeak(TMath::Abs(idx[k]), nzBins, bins[s], msk[k]); | |
151 | } | |
152 | ||
153 | for (k=0; k<npeaks; k++) { | |
154 | if (idx[k] < 0) continue; //removed peak | |
75fb37cc | 155 | AliITSRecPoint c; |
04366a57 | 156 | MakeCluster(idx[k], nzBins, bins[s], msk[k], c); |
157 | //mi change | |
158 | Int_t milab[10]; | |
159 | for (Int_t ilab=0;ilab<10;ilab++){ | |
160 | milab[ilab]=-2; | |
161 | } | |
162 | Int_t maxi=0,mini=0,maxj=0,minj=0; | |
163 | //AliBin *bmax=&bins[s][idx[k]]; | |
164 | //Float_t max = TMath::Max(TMath::Abs(bmax->GetQ())/5.,3.); | |
24c98369 | 165 | |
04366a57 | 166 | for (Int_t di=-2; di<=2;di++) |
167 | for (Int_t dj=-3;dj<=3;dj++){ | |
168 | Int_t index = idx[k]+di+dj*nzBins; | |
169 | if (index<0) continue; | |
170 | if (index>=nMaxBin) continue; | |
171 | AliBin *b=&bins[s][index]; | |
24c98369 | 172 | if (di>maxi) maxi=di; |
173 | if (di<mini) mini=di; | |
174 | if (dj>maxj) maxj=dj; | |
175 | if (dj<minj) minj=dj; | |
176 | // | |
177 | if(digits) { | |
178 | if (TMath::Abs(di)<2&&TMath::Abs(dj)<2){ | |
179 | AliITSdigitSDD* d=(AliITSdigitSDD*)digits->UncheckedAt(b->GetIndex()); | |
180 | for (Int_t itrack=0;itrack<10;itrack++){ | |
181 | Int_t track = (d->GetTracks())[itrack]; | |
182 | if (track>=0) { | |
183 | AddLabel(milab, track); | |
04366a57 | 184 | } |
185 | } | |
186 | } | |
24c98369 | 187 | } |
04366a57 | 188 | } |
189 | ||
190 | /* | |
191 | Float_t s2 = c.GetSigmaY2()/c.GetQ() - c.GetY()*c.GetY(); | |
192 | Float_t w=par->GetPadPitchWidth(sec); | |
193 | c.SetSigmaY2(s2); | |
194 | if (s2 != 0.) { | |
195 | c.SetSigmaY2(c.GetSigmaY2()*0.108); | |
196 | if (sec<par->GetNInnerSector()) c.SetSigmaY2(c.GetSigmaY2()*2.07); | |
197 | } | |
198 | s2 = c.GetSigmaZ2()/c.GetQ() - c.GetZ()*c.GetZ(); | |
199 | w=par->GetZWidth(); | |
200 | c.SetSigmaZ2(s2); | |
201 | ||
202 | if (s2 != 0.) { | |
203 | c.SetSigmaZ2(c.GetSigmaZ2()*0.169); | |
204 | if (sec<par->GetNInnerSector()) c.SetSigmaZ2(c.GetSigmaZ2()*1.77); | |
205 | } | |
206 | */ | |
207 | ||
04366a57 | 208 | Float_t y=c.GetY(),z=c.GetZ(), q=c.GetQ(); |
209 | y/=q; z/=q; | |
210 | // | |
211 | //Float_t s2 = c.GetSigmaY2()/c.GetQ() - y*y; | |
212 | // c.SetSigmaY2(s2); | |
213 | //s2 = c.GetSigmaZ2()/c.GetQ() - z*z; | |
214 | //c.SetSigmaZ2(s2); | |
215 | // | |
404c1c29 | 216 | |
217 | Float_t yyyy = y; | |
218 | //y=(y-0.5)*fYpitchSDD; | |
219 | //y-=fHwSDD; | |
220 | //y-=fYoffSDD; //delay ? | |
221 | //if (s) y=-y; | |
04366a57 | 222 | |
223 | z=(z-0.5)*fZpitchSDD; | |
224 | z-=fHlSDD; | |
404c1c29 | 225 | Float_t zdet = z; |
226 | // y=-(-y+fYshift[fModule]); | |
227 | // z= -z+fZshift[fModule]; | |
00a7cc50 | 228 | // c.SetY(y); |
229 | // c.SetZ(z); | |
9e4d7193 | 230 | Float_t timebin = GetSeg()->Dpx(0); |
231 | Float_t xdet = cal->GetDriftPath((yyyy-0.5)*timebin,0); | |
404c1c29 | 232 | xdet=xdet/10000.-fHwSDD-fYoffSDD; |
233 | if (s) xdet=-xdet; | |
234 | ||
235 | CorrectPosition(zdet,xdet); | |
236 | ||
b4704be3 | 237 | { |
238 | Double_t loc[3]={xdet,0.,zdet},trk[3]={0.,0.,0.}; | |
239 | mT2L->MasterToLocal(loc,trk); | |
240 | y=trk[1]; | |
241 | z=trk[2]; | |
242 | } | |
3a4139a2 | 243 | q/=5.243; //to have MPV 1 MIP = 86.4 KeV --> this must go to calibr. |
ecb9da3c | 244 | Float_t hit[5] = {y, z, 0.0030*0.0030, 0.0020*0.0020, q}; |
245 | Int_t info[3] = {maxj-minj+1, maxi-mini+1, fNlayer[fModule]}; | |
04366a57 | 246 | |
247 | if (digits) { | |
248 | // AliBin *b=&bins[s][idx[k]]; | |
249 | // AliITSdigitSDD* d=(AliITSdigitSDD*)digits->UncheckedAt(b->GetIndex()); | |
250 | { | |
251 | //Int_t lab[3]; | |
252 | //lab[0]=(d->GetTracks())[0]; | |
253 | //lab[1]=(d->GetTracks())[1]; | |
254 | //lab[2]=(d->GetTracks())[2]; | |
255 | //CheckLabels(lab); | |
256 | CheckLabels2(milab); | |
04366a57 | 257 | } |
258 | } | |
ecb9da3c | 259 | milab[3]=fNdet[fModule]; |
260 | ||
261 | AliITSRecPoint cc(milab,hit,info); | |
262 | cc.SetType(npeaks); | |
263 | ||
264 | if(clusters) new (cl[ncl]) AliITSRecPoint(cc); | |
04366a57 | 265 | else { |
ecb9da3c | 266 | fDetTypeRec->AddRecPoint(cc); |
04366a57 | 267 | } |
268 | ncl++; | |
269 | } | |
270 | } | |
24c98369 | 271 | |
04366a57 | 272 | } |
273 | ||
274 | ||
275 | ||
276 | void AliITSClusterFinderV2SDD::RawdataToClusters(AliRawReader* rawReader,TClonesArray** clusters){ | |
277 | //------------------------------------------------------------ | |
278 | // This function creates ITS clusters from raw data | |
279 | //------------------------------------------------------------ | |
280 | rawReader->Reset(); | |
0599a018 | 281 | AliITSRawStreamSDD inputSDD(rawReader); |
04366a57 | 282 | FindClustersSDD(&inputSDD,clusters); |
283 | ||
284 | } | |
285 | ||
286 | void AliITSClusterFinderV2SDD::FindClustersSDD(AliITSRawStream* input, | |
287 | TClonesArray** clusters) | |
288 | { | |
289 | //------------------------------------------------------------ | |
290 | // Actual SDD cluster finder for raw data | |
291 | //------------------------------------------------------------ | |
292 | Int_t nClustersSDD = 0; | |
293 | Int_t kNzBins = fNzSDD + 2; | |
294 | Int_t kMaxBin = kNzBins * (fNySDD+2); | |
d7d9347b | 295 | AliBin *binsSDDInit = new AliBin[kMaxBin]; |
296 | AliBin *binsSDD1 = new AliBin[kMaxBin]; | |
297 | AliBin *binsSDD2 = new AliBin[kMaxBin]; | |
04366a57 | 298 | AliBin* bins[2] = {NULL, NULL}; |
299 | ||
300 | // read raw data input stream | |
301 | while (kTRUE) { | |
302 | Bool_t next = input->Next(); | |
303 | if (!next || input->IsNewModule()) { | |
304 | Int_t iModule = input->GetPrevModuleID(); | |
305 | ||
306 | // when all data from a module was read, search for clusters | |
307 | if (bins[0]) { | |
00a7cc50 | 308 | clusters[iModule] = new TClonesArray("AliITSRecPoint"); |
04366a57 | 309 | fModule = iModule; |
310 | FindClustersSDD(bins, kMaxBin, kNzBins, NULL, clusters[iModule]); | |
311 | Int_t nClusters = clusters[iModule]->GetEntriesFast(); | |
312 | nClustersSDD += nClusters; | |
a97b3678 | 313 | bins[0] = bins[1] = NULL; |
04366a57 | 314 | } |
315 | ||
316 | if (!next) break; | |
d7d9347b | 317 | bins[0]=binsSDD1; |
318 | bins[1]=binsSDD2; | |
319 | memcpy(binsSDD1,binsSDDInit,sizeof(AliBin)*kMaxBin); | |
320 | memcpy(binsSDD2,binsSDDInit,sizeof(AliBin)*kMaxBin); | |
321 | ||
04366a57 | 322 | } |
323 | ||
324 | // fill the current digit into the bins array | |
a97b3678 | 325 | AliITSCalibrationSDD* cal = (AliITSCalibrationSDD*)GetResp(input->GetModuleID()); |
326 | AliITSresponseSDD* res = (AliITSresponseSDD*)cal->GetResponse(); | |
327 | const char *option=res->ZeroSuppOption(); | |
328 | Int_t q=input->GetSignal(); | |
329 | if(!((strstr(option,"1D")) || (strstr(option,"2D")))){ | |
330 | Float_t baseline = cal->GetBaseline(input->GetCoord1()); | |
331 | if(q>baseline) q-=(Int_t)baseline; | |
332 | else q=0; | |
333 | } | |
334 | if(q>=cal->GetThresholdAnode(input->GetCoord1())) { | |
04366a57 | 335 | Int_t iz = input->GetCoord1()+1; |
a97b3678 | 336 | //Int_t side = ((iz <= fNzSDD) ? 0 : 1); |
337 | Int_t side = ((AliITSRawStreamSDD*)input)->GetChannel(); | |
338 | // iz -= side*fNzSDD; | |
04366a57 | 339 | Int_t index = (input->GetCoord2()+1) * kNzBins + iz; |
a97b3678 | 340 | bins[side][index].SetQ(q); |
04366a57 | 341 | bins[side][index].SetMask(1); |
342 | bins[side][index].SetIndex(index); | |
343 | } | |
344 | } | |
d7d9347b | 345 | delete[] binsSDD1; |
346 | delete[] binsSDD2; | |
347 | delete[] binsSDDInit; | |
04366a57 | 348 | |
349 | Info("FindClustersSDD", "found clusters in ITS SDD: %d", nClustersSDD); | |
04366a57 | 350 | } |
351 | ||
352 | ||
5bfe44ce | 353 | //_________________________________________________________________________ |
354 | void AliITSClusterFinderV2SDD::CorrectPosition(Float_t &z, Float_t&y){ | |
355 | ||
356 | //correction of coordinates using the maps stored in the DB | |
357 | ||
358 | AliITSCalibrationSDD* cal = (AliITSCalibrationSDD*)GetResp(fModule); | |
a97b3678 | 359 | static const Int_t knbint = cal->GetMapTimeNBin(); |
360 | static const Int_t knbina = cal->Chips()*cal->Channels(); | |
5bfe44ce | 361 | Float_t stepa = (GetSeg()->Dpz(0))/10000.; //anode pitch in cm |
362 | Float_t stept = (GetSeg()->Dx()/cal->GetMapTimeNBin()/2.)/10.; | |
404c1c29 | 363 | |
364 | Int_t bint = TMath::Abs((Int_t)(y/stept)); | |
a97b3678 | 365 | if(y>=0) bint+=(Int_t)(knbint/2.); |
366 | if(bint>knbint) AliError("Wrong bin number!"); | |
5bfe44ce | 367 | |
404c1c29 | 368 | Int_t bina = TMath::Abs((Int_t)(z/stepa)); |
a97b3678 | 369 | if(z>=0) bina+=(Int_t)(knbina/2.); |
370 | if(bina>knbina) AliError("Wrong bin number!"); | |
5bfe44ce | 371 | |
372 | Float_t devz = cal->GetMapACell(bina,bint)/10000.; | |
373 | Float_t devx = cal->GetMapTCell(bina,bint)/10000.; | |
404c1c29 | 374 | z+=devz; |
375 | y+=devx; | |
5bfe44ce | 376 | |
377 | ||
378 | } |