Line data Source code
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 :
17 :
18 : ////////////////////////////////////////////////////////////////////////////
19 : // Implementation of the ITS SDD fast clusterer class //
20 : // //
21 : // Origin: Simone Capodicasa, Universita e INFN, capodica@to.infn.it //
22 : // //
23 : ////////////////////////////////////////////////////////////////////////////
24 :
25 : #include <vector>
26 : #include <TClonesArray.h>
27 : #include <TBits.h>
28 : #include <TMath.h>
29 : #include <TH2F.h>
30 : #include <TFile.h>
31 : #include "AliITSClusterFinderSDDfast.h"
32 : #include "AliITSRecPoint.h"
33 : #include "AliITSRecPointContainer.h"
34 : #include "AliITSDetTypeRec.h"
35 : #include "AliRawReader.h"
36 : #include "AliITSRawStreamSDD.h"
37 : #include "AliITSRawStreamSDDCompressed.h"
38 : #include "AliITSCalibrationSDD.h"
39 : #include "AliITSresponseSDD.h"
40 : #include "AliITSDetTypeRec.h"
41 : #include "AliITSReconstructor.h"
42 : #include "AliITSsegmentationSDD.h"
43 : #include "AliITSdigitSDD.h"
44 : #include "AliITSgeomTGeo.h"
45 :
46 118 : ClassImp(AliITSClusterFinderSDDfast)
47 :
48 2 : AliITSClusterFinderSDDfast::AliITSClusterFinderSDDfast(AliITSDetTypeRec* dettyp):AliITSClusterFinder(dettyp),
49 2 : fNAnodes(0),
50 2 : fNTimeBins(0),
51 2 : fNZbins(0),
52 2 : fNXbins(0),
53 2 : fDDLBins(),
54 2 : fCutOnPeakLoose(0.),
55 2 : fCutOnPeakTight(0.),
56 2 : fMaxDrTimeForTightCut(0.)
57 10 : {
58 : //Default constructor
59 6 : fNAnodes = GetSeg()->NpzHalf();
60 2 : fNZbins = fNAnodes+2;
61 6 : fNTimeBins = GetSeg()->Npx();
62 2 : fNXbins = fNTimeBins+2;
63 10 : AliDebug(2,Form("Cells in SDD cluster finder: Andoes=%d TimeBins=%d",fNAnodes,fNTimeBins));
64 2 : SetPeakSelection(15.,30.,2000.);
65 2 : fDDLBins.resize(kHybridsPerDDL);
66 4 : }
67 :
68 :
69 : //______________________________________________________________________
70 : AliITSClusterFinderSDDfast::~AliITSClusterFinderSDDfast()
71 12 : {
72 : //Default destructor
73 6 : }
74 :
75 : //______________________________________________________________________
76 : void AliITSClusterFinderSDDfast::FindRawClusters(Int_t mod){
77 :
78 : //Find clusters
79 196 : SetModule(mod);
80 98 : FindClustersSDD(fDigits);
81 :
82 98 : }
83 :
84 : //______________________________________________________________________
85 : void AliITSClusterFinderSDDfast::FindClustersSDD(TClonesArray *digits){
86 :
87 196 : std::vector<int> bins0;
88 98 : std::vector<int> bins1;
89 98 : const Int_t kMapDim=fNZbins*fNXbins/32;
90 98 : Int_t map0[kMapDim];
91 98 : Int_t map1[kMapDim];
92 205604 : for(Int_t j=0;j<kMapDim;++j){
93 102704 : map0[j]=map1[j]=0;
94 : }
95 98 : AliITSCalibrationSDD* cal = (AliITSCalibrationSDD*)GetResp(fModule);
96 98 : if(cal==0){
97 0 : AliError(Form("Calibration object not present for SDD module %d\n",fModule));
98 0 : return;
99 : }
100 :
101 : AliITSdigitSDD *d=0;
102 98 : Int_t i, ndigits=digits->GetEntriesFast();
103 1482 : for (i=0; i<ndigits; i++){
104 643 : d=(AliITSdigitSDD*)digits->UncheckedAt(i);
105 643 : Int_t ian=d->GetCoord1();
106 643 : Int_t itb=d->GetCoord2();
107 1286 : Float_t gain=cal->GetChannelGain(ian)/fDetTypeRec->GetAverageGainSDD();
108 1286 : Float_t charge=d->GetSignal(); // returns expanded signal
109 : // (10 bit, low threshold already added)
110 643 : Float_t baseline = cal->GetBaseline(ian);
111 1286 : if(charge>baseline) charge-=baseline;
112 : else charge=0;
113 :
114 643 : if(gain>0.){ // Bad channels have gain=0.
115 643 : charge/=gain;
116 1286 : if(charge<cal->GetThresholdAnode(ian)) continue;
117 643 : Int_t q=(Int_t)(charge+0.5);
118 643 : Int_t y=itb+1;
119 643 : Int_t z=ian+1;
120 643 : Int_t iindex=y*fNZbins+z;
121 643 : Float_t noise=cal->GetNoiseAfterElectronics(ian)*2.2; // applies zero suppression using the measured noise of each anode. Threshold values from ALICE-INT-1999-28 V10
122 643 : if (z<=fNAnodes){
123 336 : if(q>noise){
124 336 : bins0.push_back(iindex);
125 336 : bins0.push_back(q);
126 336 : bins0.push_back(0);
127 336 : bins0.push_back(i);
128 336 : map0[iindex/32]|=(1<<(iindex%32));
129 336 : }
130 : }
131 : else{
132 307 : z-=fNAnodes;
133 307 : if(q>noise){
134 307 : iindex=y*fNZbins+z;
135 307 : bins1.push_back(iindex);
136 307 : bins1.push_back(q);
137 307 : bins1.push_back(0);
138 307 : bins1.push_back(i);
139 307 : map1[iindex/32]|=(1<<(iindex%32));
140 307 : }
141 : }
142 643 : }
143 643 : }
144 98 : FindClustersSDD(bins0, bins1, map0, map1, digits);
145 196 : }
146 :
147 : //______________________________________________________________________
148 : void AliITSClusterFinderSDDfast::FindClustersSDD(std::vector<int>& bins0, std::vector<int>& bins1, const Int_t map0[], const Int_t map1[], TClonesArray *digits, TClonesArray *clusters, Int_t jitter){
149 :
150 : static AliITSRecoParam *repa = NULL;
151 2276 : if(!repa){
152 2 : repa = (AliITSRecoParam*) AliITSReconstructor::GetRecoParam();
153 2 : if(!repa){
154 0 : repa = AliITSRecoParam::GetHighFluxParam();
155 0 : AliWarning("Using default AliITSRecoParam class");
156 0 : }
157 : }
158 1138 : const TGeoHMatrix *mT2L=AliITSgeomTGeo::GetTracking2LocalMatrix(fModule);
159 1138 : AliITSCalibrationSDD* cal = (AliITSCalibrationSDD*)GetResp(fModule);
160 1138 : if(cal==0){
161 0 : AliError(Form("Calibration object not present for SDD module %d\n",fModule));
162 0 : return;
163 : }
164 :
165 : TClonesArray &cl=*clusters;
166 : Int_t nrp=0;
167 6828 : for (Int_t s=0; s<2; s++){
168 : Int_t *bins;
169 : unsigned int binssize;
170 : const Int_t* map;
171 2276 : if(s==0){
172 1138 : binssize=bins0.size();
173 1138 : bins = &bins0[0];
174 : map=map0;
175 1138 : }
176 2276 : if(s==1){
177 1138 : binssize=bins1.size();
178 1138 : bins=&bins1[0];
179 : map=map1;
180 1138 : }
181 :
182 2276 : const Int_t rresto=fNZbins-1;
183 : Int_t cid=0;
184 7124 : for(std::vector<int>::size_type i=0;i<binssize;i+=4){
185 1286 : if(!bins[i+2])
186 258 : bins[i+2]=++cid;
187 1286 : Int_t me=bins[i];
188 1286 : Int_t resto=me%fNZbins;
189 1286 : if(resto==rresto){
190 0 : Int_t idxs[1]={me+fNZbins};
191 0 : for(Int_t k=0;k<1;++k)
192 0 : if(map[idxs[k]/32]&(1<<(idxs[k]%32)))
193 0 : for(std::vector<int>::size_type j=i+4;j<binssize;j+=4)
194 0 : if(bins[j]==idxs[k]){
195 0 : bins[j+2]=bins[i+2];
196 0 : break;
197 0 : }
198 0 : }
199 : else{
200 1286 : Int_t idxs[2]={me+1,me+fNZbins};
201 7716 : for(int k=0;k<2;++k)
202 2572 : if(map[idxs[k]/32]&(1<<(idxs[k]%32)))
203 5024 : for(std::vector<int>::size_type j=i+4;j<binssize;j+=4)
204 2512 : if(bins[j]==idxs[k]){
205 1384 : bins[j+2]=bins[i+2];
206 1384 : break;
207 1384 : }
208 1286 : }
209 : }
210 7124 : for(std::vector<int>::size_type i=0;i<binssize;i+=4){
211 1286 : Int_t me=bins[i];
212 1286 : Int_t resto=me%fNZbins;
213 1286 : if(resto==fNZbins-1){
214 0 : Int_t idxs[1]={me+fNZbins};
215 0 : Int_t myid=bins[i+2];
216 0 : for(Int_t l=0;l<1;++l){
217 0 : if(map[idxs[l]/32]&(1<<(idxs[l]%32)))
218 0 : for(std::vector<int>::size_type j=i+4;j<binssize;j+=4){
219 0 : if(bins[j]==idxs[l]){
220 0 : Int_t hisid=bins[j+2];
221 0 : if(myid!=hisid){
222 0 : for(std::vector<int>::size_type k=2;k<binssize;k+=4)
223 0 : if(bins[k]==hisid)
224 0 : bins[k]=myid;
225 0 : }
226 : break;
227 : }
228 0 : }
229 : }
230 0 : }
231 : else{
232 1286 : Int_t idxs[2]={me+1,me+fNZbins};
233 1286 : Int_t myid=bins[i+2];
234 7716 : for(Int_t l=0;l<2;++l){
235 2572 : if(map[idxs[l]/32]&(1<<(idxs[l]%32)))
236 5024 : for(std::vector<int>::size_type j=i+4;j<binssize;j+=4){
237 2512 : if(bins[j]==idxs[l]){
238 1384 : Int_t hisid=bins[j+2];
239 1384 : if(myid!=hisid){
240 536 : for(std::vector<int>::size_type k=2;k<binssize;k+=4)
241 240 : if(bins[k]==hisid)
242 154 : bins[k]=myid;
243 28 : }
244 : break;
245 : }
246 1384 : }
247 : }
248 1286 : }
249 : }
250 :
251 2276 : Int_t recp[cid][12];
252 5068 : for(Int_t i=0;i<cid;++i)
253 6708 : for(Int_t j=0;j<12;++j)
254 3096 : recp[i][j]=0;
255 :
256 2276 : Int_t kplab[cid][10];
257 5068 : for(Int_t i=0;i<cid;++i)
258 5676 : for(Int_t j=0;j<10;++j)
259 2580 : kplab[i][j]=-2;
260 :
261 7124 : for(std::vector<int>::size_type i=0;i<binssize;i+=4){
262 1286 : Int_t q=bins[i+1];
263 1286 : Int_t me=bins[i+2]-1;
264 1286 : Int_t z=bins[i]%fNZbins;
265 1286 : Int_t x=bins[i]/fNZbins;
266 1286 : recp[me][0]+=q; //sumq
267 1286 : recp[me][1]+=z*q; //sumz
268 1286 : recp[me][2]+=x*q; //sumx
269 :
270 : #ifdef CSBASEDERROR
271 : recp[me][3]+=z*z*q; //sigmaZ2
272 : recp[me][4]+=x*x*q; //sigmaX2
273 : #endif
274 :
275 1286 : if(recp[me][5]==0){
276 230 : recp[me][6]=z;
277 230 : recp[me][7]=z;
278 230 : recp[me][8]=x;
279 230 : recp[me][9]=x;
280 230 : recp[me][10]=q;
281 230 : recp[me][11]=bins[i];
282 230 : }
283 : else{
284 1294 : if(recp[me][6]<z) recp[me][6]=z;
285 1056 : if(recp[me][7]>z) recp[me][7]=z;
286 1518 : if(recp[me][8]<x) recp[me][8]=x;
287 1084 : if(recp[me][9]>x) recp[me][9]=x;
288 1056 : if(recp[me][10]<q){
289 308 : recp[me][10]=q;
290 308 : recp[me][11]=bins[i];
291 308 : }
292 : }
293 :
294 1286 : if(digits){
295 643 : Int_t kplab2[10];
296 14146 : for(Int_t ilab=0;ilab<10;++ilab)
297 6430 : kplab2[ilab]=kplab[me][ilab];
298 643 : AliITSdigitSDD* d=(AliITSdigitSDD*)digits->UncheckedAt(bins[i+3]);
299 14146 : for (Int_t itrack=0;itrack<10;itrack++){
300 6430 : Int_t track = (d->GetTracks())[itrack];
301 6430 : if (track>=0) {
302 620 : AddLabel(kplab2, track);
303 620 : }
304 : }
305 14146 : for(Int_t ilab=0;ilab<10;++ilab)
306 6430 : kplab[me][ilab]=kplab2[ilab];
307 643 : }
308 1286 : ++recp[me][5]; //nPiInClu
309 : }
310 :
311 5068 : for(Int_t i=0;i<cid;++i){
312 258 : if(recp[i][5]==0) continue;
313 230 : if(recp[i][5]==1) continue;
314 :
315 230 : Float_t q=recp[i][0];
316 :
317 230 : Int_t clSizAnode=recp[i][6]-recp[i][7]+1;
318 230 : Int_t clSizTb=recp[i][8]-recp[i][9]+1;
319 230 : if(repa->GetUseSDDClusterSizeSelection()){
320 0 : if(clSizTb==1) continue; // cut common mode noise spikes
321 0 : if(clSizAnode>5) continue; // cut common mode noise spikes
322 0 : if(clSizTb>10) continue; // cut clusters on noisy anodes
323 0 : if(cal->IsAMAt20MHz() && clSizTb>8) continue; // cut clusters on noisy anodes
324 : }
325 :
326 230 : Float_t zz=(Float_t)recp[i][1]/q;
327 230 : Float_t xx=(Float_t)recp[i][2]/q;
328 :
329 230 : AliITSresponseSDD* rsdd = fDetTypeRec->GetResponseSDD();
330 :
331 230 : Float_t zAnode=zz-0.5; // to have anode in range 0.-255. and centered on the mid of the pitch
332 230 : Float_t timebin=xx-0.5; // to have time bin in range 0.-255. amd centered on the mid of the bin
333 :
334 338 : if(s==1) zAnode+=fNAnodes; // right side has anodes from 256. to 511.
335 :
336 230 : Float_t zdet=GetSeg()->GetLocalZFromAnode(zAnode);
337 230 : Float_t driftTimeUncorr=GetSeg()->GetDriftTimeFromTb(timebin)+jitter*rsdd->GetCarlosRXClockPeriod();
338 230 : Float_t driftTime=driftTimeUncorr-rsdd->GetTimeZero(fModule);
339 :
340 308 : if(driftTime<fMaxDrTimeForTightCut && recp[i][10]<fCutOnPeakTight) continue;
341 228 : if(recp[i][10]<fCutOnPeakLoose) continue;
342 :
343 228 : Float_t driftSpeed=cal->GetDriftSpeedAtAnode(zAnode) + rsdd->GetDeltaVDrift(fModule,zAnode>255);
344 228 : Float_t driftPathMicron=driftTime*driftSpeed;
345 : const Double_t kMicronTocm=1.0e-4;
346 228 : Float_t xdet=(driftPathMicron-GetSeg()->Dx())*kMicronTocm; // xdet is negative
347 348 : if(s==0) xdet=-xdet; // left side has positive local x
348 :
349 228 : if(repa->GetUseSDDCorrectionMaps()){
350 228 : Float_t corrx=0, corrz=0;
351 228 : cal->GetCorrections(zdet,xdet,corrz,corrx,GetSeg());
352 228 : zdet+=corrz;
353 228 : xdet+=corrx;
354 228 : }
355 :
356 228 : Double_t loc[3]={xdet,0.,zdet},trk[3]={0.,0.,0.};
357 228 : mT2L->MasterToLocal(loc,trk);
358 228 : xx=trk[1];
359 228 : zz=trk[2];
360 :
361 : Double_t dEdxslope;
362 342 : if(digits) dEdxslope=rsdd->GetADCvsDriftTime(fModule,kTRUE);
363 114 : else dEdxslope=rsdd->GetADCvsDriftTime(fModule);
364 228 : q+=(driftTime*dEdxslope); // correction for zero supp.
365 228 : q/=rsdd->GetADCtokeV(fModule);
366 456 : if(cal-> IsAMAt20MHz()) q*=2.; // account for 1/2 sampling freq.
367 228 : if(q<repa->GetMinClusterChargeSDD()) continue; // remove noise clusters
368 :
369 : #ifdef CSBASEDERROR
370 : Float_t hit[6]={xx,zz,recp[i][3],recp[i][4],q,0.};
371 : #else
372 228 : Float_t hit[6]={xx, zz, 0.0030*0.0030, 0.0020*0.0020, q, 0.};
373 : #endif
374 :
375 228 : Int_t info[3]={clSizTb, clSizAnode, fNlayer[fModule]};
376 :
377 228 : Int_t kplab2[10];
378 228 : if(digits){
379 2508 : for(Int_t ilab=0;ilab<10;++ilab)
380 1140 : if(kplab[i][ilab]!=-2)
381 156 : kplab2[ilab]=kplab[i][ilab];
382 : else
383 984 : kplab2[ilab]=-2;
384 114 : }
385 : else{
386 114 : if(fRawID2ClusID) kplab2[0]=fNClusters+1; // RS: store clID+1 as a reference to the cluster
387 2280 : for(Int_t ilab=1;ilab<10;++ilab)
388 1026 : kplab2[ilab]=-2;
389 : }
390 342 : if(digits) CheckLabels2(kplab2);
391 228 : kplab2[3]=fNdet[fModule];
392 228 : AliITSRecPoint cc(kplab2,hit,info);
393 228 : cc.SetType(101);
394 228 : cc.SetDriftTime(driftTimeUncorr);
395 228 : cc.SetDriftSide(s);
396 228 : cc.SetChargeRatio(recp[i][10]);
397 570 : if(clusters) new (cl[nrp]) AliITSRecPoint(cc);
398 : else {
399 114 : fDetTypeRec->AddRecPoint(cc);
400 : }
401 228 : ++nrp;
402 228 : ++fNClusters;
403 456 : }
404 2276 : }
405 3414 : AliDebug(2,Form("Clusters found on SDD module %d (unfolding %d) = %d\n",fModule,repa->GetUseUnfoldingInClusterFinderSDD(),nrp));
406 2276 : }
407 :
408 : //______________________________________________________________________
409 : void AliITSClusterFinderSDDfast::RawdataToClusters(AliRawReader* rawReader){
410 : //------------------------------------------------------------
411 : // This function creates ITS clusters from raw data
412 : //------------------------------------------------------------
413 8 : fNClusters = 0; //RS
414 4 : AliITSRawStream* inputSDD=AliITSRawStreamSDD::CreateRawStreamSDD(rawReader);
415 12 : AliDebug(1,Form("%s is used",inputSDD->ClassName()));
416 :
417 4 : AliITSDDLModuleMapSDD *ddlmap=(AliITSDDLModuleMapSDD*)fDetTypeRec->GetDDLModuleMapSDD();
418 4 : inputSDD->SetDDLModuleMap(ddlmap);
419 200 : for(Int_t iddl=0; iddl<AliITSDDLModuleMapSDD::GetNDDLs(); iddl++){
420 2496 : for(Int_t icar=0; icar<AliITSDDLModuleMapSDD::GetNModPerDDL();icar++){
421 1152 : Int_t iMod=ddlmap->GetModuleNumber(iddl,icar);
422 1264 : if(iMod==-1) continue;
423 1040 : AliITSCalibrationSDD* cal = (AliITSCalibrationSDD*)GetResp(iMod);
424 1040 : if(cal==0){
425 0 : AliError(Form("Calibration object not present for SDD module %d\n",iMod));
426 0 : continue;
427 : }
428 1040 : Bool_t isZeroSupp=cal->GetZeroSupp();
429 1040 : if(isZeroSupp){
430 6240 : for(Int_t iSid=0; iSid<2; iSid++) inputSDD->SetZeroSuppLowThreshold(iMod-240,iSid,cal->GetZSLowThreshold(iSid));
431 1040 : }else{
432 0 : for(Int_t iSid=0; iSid<2; iSid++) inputSDD->SetZeroSuppLowThreshold(iMod-240,iSid,0);
433 : }
434 1040 : }
435 : }
436 4 : FindClustersSDD(inputSDD);
437 8 : delete inputSDD;
438 4 : }
439 :
440 : void AliITSClusterFinderSDDfast::FindClustersSDD(AliITSRawStream* input){
441 :
442 8 : AliITSRecPointContainer* rpc = AliITSRecPointContainer::Instance();
443 : Int_t nClustersSDD=0;
444 :
445 4 : const Int_t kMapDim=fNZbins*fNXbins/32;
446 4 : Int_t mapsDDL[kHybridsPerDDL][kMapDim];
447 200 : for(Int_t i=0;i<kHybridsPerDDL;++i)
448 201408 : for(Int_t j=0;j<kMapDim;++j)
449 100608 : mapsDDL[i][j]=0;
450 :
451 4 : Int_t vectModId[kModulesPerDDL];
452 104 : for(Int_t iMod=0; iMod<kModulesPerDDL; iMod++) vectModId[iMod]=-1;
453 : // read raw data input stream
454 4 : int countRW = 0; //RS
455 4 : if (fRawID2ClusID) fRawID2ClusID->Reset(); //RS if array was provided, we shall store the rawID -> ClusterID
456 :
457 1783 : while (input->Next()) {
458 1779 : Int_t iModule = input->GetModuleID();
459 1779 : if(iModule<0){
460 0 : AliWarning(Form("Invalid SDD module number %d\n", iModule));
461 0 : continue;
462 : }
463 1779 : Int_t iCarlos=input->GetCarlosId();
464 1779 : Int_t iSide=input->GetChannel();
465 1779 : Int_t iHybrid=iCarlos*2+iSide;
466 :
467 1779 : if(input->IsCompletedModule()){
468 1040 : vectModId[iCarlos]=iModule; // store the module number
469 1040 : }
470 739 : else if(input->IsCompletedDDL()){
471 : // when all data from a DDL was read, search for clusters
472 96 : Int_t jitter=input->GetJitter();
473 2496 : for(Int_t iMod=0;iMod<kModulesPerDDL;iMod++){
474 1152 : if(vectModId[iMod]>=0){
475 1040 : fModule = vectModId[iMod];
476 1040 : TClonesArray* clusters=rpc->UncheckedGetClusters(fModule);
477 1040 : std::vector<int> bins0;
478 1040 : std::vector<int> bins1;
479 1040 : bins0=fDDLBins[iMod*2];
480 1040 : bins1=fDDLBins[iMod*2+1];
481 1040 : Int_t map0[kMapDim];
482 1040 : Int_t map1[kMapDim];
483 2181920 : for(Int_t j=0;j<kMapDim;++j){
484 1089920 : map0[j]=map1[j]=0;
485 : }
486 2181920 : for(Int_t i=0;i<kMapDim;++i){
487 1089920 : map0[i]=mapsDDL[iMod*2][i];
488 1089920 : map1[i]=mapsDDL[iMod*2+1][i];
489 : }
490 :
491 1040 : FindClustersSDD(bins0, bins1, map0, map1, NULL, clusters,jitter);
492 :
493 1040 : Int_t nClusters = clusters->GetEntriesFast();
494 1040 : nClustersSDD += nClusters;
495 1040 : vectModId[iMod]=-1;
496 1040 : }
497 6912 : for (Int_t s=0; s<2; s++){
498 2304 : Int_t indexHyb=iMod*2+s;
499 4814 : for(std::vector<int>::size_type i=0;i<fDDLBins[indexHyb].size();++i)
500 103 : fDDLBins[indexHyb].erase(fDDLBins[indexHyb].begin(),fDDLBins[indexHyb].end());
501 4833792 : for(Int_t j=0;j<kMapDim;++j)
502 2414592 : mapsDDL[indexHyb][j]=0;
503 : }
504 : }
505 96 : }
506 : else{ // fill the current digit into the bins array
507 643 : if(iHybrid<0 || iHybrid>=kHybridsPerDDL){
508 0 : AliWarning(Form("Invalid SDD hybrid number %d on module %d\n", iHybrid,iModule));
509 0 : continue;
510 : }
511 643 : AliITSCalibrationSDD* cal=(AliITSCalibrationSDD*)GetResp(iModule);
512 643 : if(cal==0){
513 0 : AliError(Form("Calibration object not present for SDD module %d\n",iModule));
514 0 : continue;
515 : }
516 643 : Float_t charge=input->GetSignal();
517 643 : Int_t chan=input->GetCoord1()+fNAnodes*iSide;
518 643 : Float_t gain=cal->GetChannelGain(chan)/fDetTypeRec->GetAverageGainSDD();;
519 643 : Float_t baseline=cal->GetBaseline(chan);
520 1286 : if(charge>baseline) charge-=baseline;
521 : else charge=0;
522 643 : if(gain>0.){ // Bad channels have gain=0
523 643 : charge/=gain;
524 643 : if(charge>=cal->GetThresholdAnode(chan)){
525 643 : Int_t q=(Int_t)(charge+0.5);
526 643 : Int_t iz = input->GetCoord1();
527 643 : Int_t itb = input->GetCoord2();
528 : Int_t ian=iz;
529 643 : if(iSide==1)
530 307 : ian+=256;
531 643 : Float_t noise=cal->GetNoiseAfterElectronics(ian)*2.2; // applies zero suppression using the measured noise of each anode. Threshold values from ALICE-INT-1999-28 V10
532 643 : Int_t index=(itb+1)*fNZbins+(iz+1);
533 1286 : if((itb<fNTimeBins) && (iz<fNAnodes)){
534 643 : if(q<noise) continue;
535 643 : fDDLBins[iHybrid].push_back(index);
536 643 : fDDLBins[iHybrid].push_back(q);
537 643 : fDDLBins[iHybrid].push_back(0);
538 643 : fDDLBins[iHybrid].push_back(countRW);
539 643 : mapsDDL[iHybrid][index/32]|=(1<<(index%32));
540 643 : }
541 : else{
542 0 : static bool show_info = !(getenv("HLT_ONLINE_MODE") && strcmp(getenv("HLT_ONLINE_MODE"), "on") == 0);
543 : static int nErrors = 0;
544 0 : if (show_info || nErrors++ < 10)
545 : {
546 0 : AliWarning(Form("Invalid SDD cell: Carlos=%d,Module=%d,Anode=%d,TimeBin=%d",iCarlos,iModule,iz,itb));
547 0 : }
548 : }
549 1286 : }
550 : }
551 643 : }
552 1779 : countRW++; //RS
553 1779 : }
554 12 : AliDebug(1,Form("found clusters in ITS SDD: %d", nClustersSDD));
555 4 : }
|