adding map include file to solve compilation issue (bug https://savannah.cern.ch...
[u/mrichter/AliRoot.git] / HLT / ITS / clusterfinders / AliHLTITSClusterFinderSSD.cxx
CommitLineData
b2bac0a3 1/**************************************************************************
2 * Copyright(c) 2007-2009, 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/* $Id: AliHLTITSClusterFinderSSD.cxx 34920 2009-09-22 07:48:53Z masera $ */
17
18////////////////////////////////////////////////////////////////////////////
19// Implementation of the ITS clusterer V2 class //
20// //
21// Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch //
22// Last revision: 13-05-09 Enrico Fragiacomo //
23// enrico.fragiacomo@ts.infn.it //
24// //
25///////////////////////////////////////////////////////////////////////////
26
27#include <Riostream.h>
28#include "AliLog.h"
29
30#include "AliHLTITSClusterFinderSSD.h"
31#include "AliITSRecPoint.h"
32#include "AliITSgeomTGeo.h"
33#include "AliITSDetTypeRec.h"
34#include "AliRawReader.h"
35#include "AliITSRawStreamSSD.h"
36#include <TClonesArray.h>
37#include "AliITSdigitSSD.h"
38#include "AliITSReconstructor.h"
39#include "AliITSCalibrationSSD.h"
40#include "AliITSsegmentationSSD.h"
41
42Short_t *AliHLTITSClusterFinderSSD::fgPairs = 0x0;
43Int_t AliHLTITSClusterFinderSSD::fgPairsSize = 0;
44const Float_t AliHLTITSClusterFinderSSD::fgkThreshold = 5.;
45
46const Float_t AliHLTITSClusterFinderSSD::fgkCosmic2008StripShifts[16][9] =
47 {{-0.35,-0.35,-0.35,-0.35,-0.35,-0.35,-0.35,-0.35,-0.35}, // DDL 512
48 {-0.35,-0.35,-0.35,-0.35,-0.35,-0.35,-0.35,-0.35,-0.35}, // DDL 513
49 {-0.15,-0.15,-0.15,-0.15,-0.15,-0.15,-0.15,-0.15,-0.15}, // DDL 514
50 {-0.15,-0.15,-0.15,-0.15,-0.15,-0.15,-0.15,-0.15,-0.15}, // DDL 515
51 { 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00}, // DDL 516
52 { 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00}, // DDL 517
53 {-0.15,-0.15,-0.15,-0.15,-0.15,-0.15,-0.15,-0.15,-0.15}, // DDL 518
54 {-0.15,-0.15,-0.15,-0.15,-0.15,-0.15,-0.15,-0.15,-0.15}, // DDL 519
55 {-0.15,-0.15,-0.15,-0.15,-0.15,-0.15,-0.15,-0.25,-0.15}, // DDL 520
56 {-0.15,-0.15,-0.15,-0.15,-0.15,-0.15,-0.15,-0.15,-0.15}, // DDL 521
57 {-0.10,-0.10,-0.10,-0.40,-0.40,-0.40,-0.10,-0.10,-0.45}, // DDL 522
58 {-0.10,-0.10,-0.10,-0.35,-0.35,-0.35,-0.10,-0.35,-0.50}, // DDL 523
59 { 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00}, // DDL 524
60 { 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00}, // DDL 525
61 { 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35}, // DDL 526
62 { 0.45, 0.45, 0.45, 0.45, 0.45, 0.45, 0.45, 0.45, 0.45}}; // DDL 527
63
64ClassImp(AliHLTITSClusterFinderSSD)
65
66
67 AliHLTITSClusterFinderSSD::AliHLTITSClusterFinderSSD(AliITSDetTypeRec* dettyp, AliRawReader *reader)
68 :
69 AliITSClusterFinder(dettyp),
70 fRecoParam(0),
71 fRawReader( reader ),
72 fRawStream( 0 ),
73 fLastSSD1(AliITSgeomTGeo::GetModuleIndex(6,1,1)-1)
74{
75//Default constructor
76 //
77 // Initialisation of ITS geometry
78 //
79 Int_t mmax=AliITSgeomTGeo::GetNModules();
80 for (Int_t m=0; m<mmax; m++) {
81 Int_t lay,lad,det; AliITSgeomTGeo::GetModuleId(m,lay,lad,det);
82 fNdet[m] = (lad-1)*AliITSgeomTGeo::GetNDetectors(lay) + (det-1);
83 fNlayer[m] = lay-1;
84 }
85
86 fRecoParam = (AliITSRecoParam*) AliITSReconstructor::GetRecoParam();
87 if( !fRecoParam ){
88 fRecoParam = AliITSRecoParam::GetHighFluxParam();
726155fd 89 // AliWarning("Using default AliITSRecoParam class");
b2bac0a3 90 }
91 fRawStream = new AliITSRawStreamSSD( fRawReader);
92}
93
94//______________________________________________________________________
95AliHLTITSClusterFinderSSD::AliHLTITSClusterFinderSSD(const AliHLTITSClusterFinderSSD &cf) : AliITSClusterFinder(cf), fRecoParam(cf.fRecoParam), fRawReader(cf.fRawReader), fRawStream(0), fLastSSD1(cf.fLastSSD1)
96{
97 // Dummy
98}
99
100//______________________________________________________________________
101AliHLTITSClusterFinderSSD& AliHLTITSClusterFinderSSD::operator=(const AliHLTITSClusterFinderSSD& ){
102 // Dummy
103 return *this;
104}
105
106AliHLTITSClusterFinderSSD::~AliHLTITSClusterFinderSSD()
107{
108 // destructor
109 delete fRawStream;
110}
111
112void AliHLTITSClusterFinderSSD::RawdataToClusters( std::vector<AliITSRecPoint> &clusters )
113{
114 //------------------------------------------------------------
115 // Actual SSD cluster finder for raw data
116 //------------------------------------------------------------
1710656f 117
b2bac0a3 118 fRawReader->Reset();
119
814be89c 120 const Int_t kNADC = 12;
121 const Int_t kMaxADCClusters = 1000;
122
123 Int_t strips[kNADC][2][kMaxADCClusters][2]; // [ADC],[side],[istrip], [0]=istrip [1]=signal
124 Int_t nStrips[kNADC][2];
125
126 for( int i=0; i<kNADC; i++ ){
127 nStrips[i][0] = 0;
128 nStrips[i][1] = 0;
129 }
130
131 Int_t ddl = -1;
132 Int_t ad = -1;
133
134 //*
135 //* Loop over modules DDL+AD
136 //*
137
b2bac0a3 138 while (kTRUE) {
814be89c 139
b2bac0a3 140 bool next = fRawStream->Next();
141
814be89c 142 //*
143 //* Continue if corrupted input
144 //*
b2bac0a3 145
814be89c 146 if( (!next)&&(fRawStream->flag) ){
147 AliWarning(Form("HLT ClustersFinderSSD: Corrupted data: warning from RawReader"));
148 continue;
149 }
b2bac0a3 150
814be89c 151 Int_t newDDL = fRawStream->GetDDL();
152 Int_t newAD = fRawStream->GetAD();
b2bac0a3 153
814be89c 154 if( next ){
155 if( newDDL<0 || newDDL>15 ){
726155fd 156 // AliWarning(Form("HLT ClustersFinderSSD: Corrupted data: wrong DDL number (%d)",newDDL));
814be89c 157 continue;
158 }
159
160 if( newAD<1 || newAD>9 ){
726155fd 161 // AliWarning(Form("HLT ClustersFinderSSD: Corrupted data: wrong AD number (%d)",newAD));
814be89c 162 continue;
b2bac0a3 163 }
b2bac0a3 164 }
165
814be89c 166 bool newModule = ( !next || ddl!= newDDL || ad!=newAD );
167
168 if( newModule && ddl>=0 && ad>=0 ){
169
170 //*
171 //* Reconstruct the previous module --- actual clusterfinder
172 //*
173 //cout<<endl;
174 for( int adc = 0; adc<kNADC; adc++ ){
175
176 //* 1D clusterfinder
177
178 Ali1Dcluster clusters1D[2][kMaxADCClusters]; // per ADC, per side
179 Int_t nClusters1D[2] = {0,0};
180 //int nstat[2] = {0,0};
181 fModule = AliITSRawStreamSSD::GetModuleNumber(ddl, (ad - 1) * 12 + adc );
182
183 if( fModule<0 ){
726155fd 184 // AliWarning(Form("HLT ClustersFinderSSD: Corrupted data: module (ddl %d ad %d adc %d) not found in the map",ddl,ad,adc));
814be89c 185 continue;
186 }
187
188 AliITSCalibrationSSD* cal = (AliITSCalibrationSSD*)fDetTypeRec->GetCalibrationModel(fModule);
189 if( !cal ){
726155fd 190 AliWarning(Form("HLT ClustersFinderSSD: No calibration found for module (ddl %d ad %d adc %d)",ddl,ad,adc));
814be89c 191 continue;
192 }
193
194 Float_t dStrip = 0;
195
196 if( fRecoParam->GetUseCosmicRunShiftsSSD()) { // Special condition for 2007/2008 cosmic data
197 dStrip = fgkCosmic2008StripShifts[ddl][ad-1];
198 if (TMath::Abs(dStrip) > 1.5){
199 AliWarning(Form("Indexing error in Cosmic calibration: ddl = %d, dStrip %f\n",ddl,dStrip));
200 dStrip = 0;
201 }
202 }
203
204 for( int side=0; side<=1; side++ ){
205
206 Int_t lab[3]={-2,-2,-2};
207 Float_t q = 0.;
208 Float_t y = 0.;
209 Int_t nDigits = 0;
1710656f 210 Int_t ostrip = -2;
814be89c 211 Bool_t snFlag = 0;
212
213 Int_t n = nStrips[adc][side];
214 for( int istr = 0; istr<n+1; istr++ ){
215
216 bool stripOK = 1;
217 Int_t strip=0, signal=0;
218 Float_t noise=1, gain=0;
219
220 if( istr<n ){
221 strip = strips[adc][side][istr][0];
222 signal = strips[adc][side][istr][1];
223
224 //cout<<"strip "<<adc<<" / "<<side<<": "<<strip<<endl;
225
226 if( cal ){
227 noise = side ?cal->GetNoiseN(strip) :cal->GetNoiseP(strip);
228 gain = side ?cal->GetGainN(strip) :cal->GetGainP(strip);
229 stripOK = ( noise>=1. && signal>=3*noise
230 //&& !cal->IsPChannelBad(strip)
231 );
232 }
233 } else stripOK = 0; // end of data
234
1710656f 235 bool newCluster = ( TMath::Abs(strip-ostrip)>1 || !stripOK );
814be89c 236
237 if( newCluster ){
238
239 //* Store the previous cluster
240
241 if( nDigits>0 && q>0 && snFlag ){
242
243 if (nClusters1D[side] >= kMaxADCClusters-1 ) {
244 AliWarning("HLT ClustersFinderSSD: Too many 1D clusters !");
245 }else {
246
247 Ali1Dcluster &cluster = clusters1D[side][nClusters1D[side]++];
248 cluster.SetY( y / q + dStrip);
249 cluster.SetQ(q);
250 cluster.SetNd(nDigits);
251 cluster.SetLabels(lab);
252 //cout<<"cluster 1D side "<<side<<": y= "<<y<<" q= "<<q<<" d="<<dStrip<<" Y="<<cluster.GetY()<<endl;
253 //Split suspiciously big cluster
254
255 if( fRecoParam->GetUseUnfoldingInClusterFinderSSD()
256 && nDigits > 4 && nDigits < 25
257 ){
258 cluster.SetY(y/q + dStrip - 0.25*nDigits);
259 cluster.SetQ(0.5*q);
260 Ali1Dcluster& cluster2 = clusters1D[side][nClusters1D[side]++];
261 cluster2.SetY(y/q + dStrip + 0.25*nDigits);
262 cluster2.SetQ(0.5*q);
263 cluster2.SetNd(nDigits);
264 cluster2.SetLabels(lab);
265 } // unfolding is on
266 }
267 }
268 y = q = 0.;
269 nDigits = 0;
270 snFlag = 0;
271
272 } //* End store the previous cluster
273
274 if( stripOK ){ // add new signal to the cluster
275 signal = (Int_t) ( signal * gain ); // signal is corrected for gain
276 if( signal>fgkThreshold*noise) snFlag = 1;
277 if( cal ) signal = (Int_t) cal->ADCToKeV( signal ); // signal is converted in KeV
278 q += signal; // add digit to current cluster
279 y += strip * signal;
280 nDigits++;
281 //nstat[side]++;
282 ostrip = strip;
283 //cout<<"strip "<<adc<<" / "<<side<<": "<<strip<<" / "<<signal<<" stored"<<endl;
284
285 }
286 } //* end loop over strips
287
288 } //* end loop over ADC sides
289
290
291 //* 2D clusterfinder
292
293 if( nClusters1D[0] && nClusters1D[1] && fModule>=0 ){
294 FindClustersSSD( clusters1D[0], nClusters1D[0], clusters1D[1], nClusters1D[1], clusters);
295 }
296 //cout<<"SG: "<<ddl<<" "<<ad<<" "<<adc<<": strips "<<nstat[0]<<"+"<<nstat[1]<<", clusters 1D= "<<nClusters1D[0]<<" + "<<nClusters1D[1]<<", 2D= "<<clusters.size()<<endl;
297
298 }//* end loop over adc
299
300 }//* end of reconstruction of previous module
b2bac0a3 301
814be89c 302 if( newModule ){
303
304 //*
305 //* Clean up arrays and set new module
306 //*
307
308 for( int i=0; i<kNADC; i++ ){
309 nStrips[i][0] = 0;
310 nStrips[i][1] = 0;
311 }
312 ddl = newDDL;
313 ad = newAD;
314 }
b2bac0a3 315
b2bac0a3 316
814be89c 317 //*
318 //* Exit main loop when there is no more input
319 //*
320
321 if( !next ) break;
b2bac0a3 322
814be89c 323 //*
324 //* Fill the current strip information
325 //*
326
327 Int_t adc = fRawStream->GetADC();
328 if( adc<0 || adc>=kNADC+2 || (adc>5&&adc<8) ){
329 AliWarning(Form("HLT ClustersFinderSSD: Corrupted data: wrong adc number (%d)", adc));
330 continue;
b2bac0a3 331 }
814be89c 332
333 if( adc>7 ) adc-= 2; // shift ADC numbers 8-13 to 6-11
b2bac0a3 334
814be89c 335 Bool_t side = fRawStream->GetSideFlag();
336 Int_t strip = fRawStream->GetStrip();
337 Int_t signal = fRawStream->GetSignal();
338
339 //cout<<"SSD: "<<ddl<<" "<<ad<<" "<<adc<<" "<<side<<" "<<strip<<" : "<<signal<<endl;
b2bac0a3 340
814be89c 341 if( strip<0 || strip>767 ){
814be89c 342 continue;
343 }
b2bac0a3 344
814be89c 345 int &n = nStrips[adc][side];
346 if( n >0 ){
347 Int_t oldStrip = strips[adc][side][n-1][0];
814be89c 348 if( strip==oldStrip ){
349 AliWarning(Form("HLT ClustersFinderSSD: Corrupted data: duplicated signal: ddl %d ad %d adc %d, side %d, strip %d",
350 ddl, ad, adc, side, strip ));
351 continue;
352 }
b2bac0a3 353 }
814be89c 354 strips[adc][side][n][0] = strip;
355 strips[adc][side][n][1] = signal;
356 n++;
357
358 //cout<<"SSD: "<<fRawStream->GetDDL()<<" "<<fRawStream->GetAD()<<" "
359 //<<fRawStream->GetADC()<<" "<<fRawStream->GetSideFlag()<<" "<<((int)fRawStream->GetStrip())<<" "<<strip<<" : "<<fRawStream->GetSignal()<<endl;
360
361 } //* End main loop over the input
362
b2bac0a3 363}
364
365
366void AliHLTITSClusterFinderSSD::
367FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
368 Ali1Dcluster* pos, Int_t np,
369 std::vector<AliITSRecPoint> &clusters) {
370 //------------------------------------------------------------
371 // Actual SSD cluster finder
372 //------------------------------------------------------------
373
374 const TGeoHMatrix *mT2L=AliITSgeomTGeo::GetTracking2LocalMatrix(fModule);
375
376 AliITSsegmentationSSD *seg = dynamic_cast<AliITSsegmentationSSD*>(fDetTypeRec->GetSegmentationModel(2));
377 if (fModule>fLastSSD1)
378 seg->SetLayer(6);
379 else
380 seg->SetLayer(5);
381
382 Float_t hwSSD = seg->Dx()*1e-4/2;
383 Float_t hlSSD = seg->Dz()*1e-4/2;
384
385 Int_t idet=fNdet[fModule];
386 Int_t ncl=0;
387
388 //
389 Int_t *cnegative = new Int_t[np];
390 Int_t *cused1 = new Int_t[np];
391 Int_t *negativepair = new Int_t[10*np];
392 Int_t *cpositive = new Int_t[nn];
393 Int_t *cused2 = new Int_t[nn];
394 Int_t *positivepair = new Int_t[10*nn];
395 for (Int_t i=0;i<np;i++) {cnegative[i]=0; cused1[i]=0;}
396 for (Int_t i=0;i<nn;i++) {cpositive[i]=0; cused2[i]=0;}
397 for (Int_t i=0;i<10*np;i++) {negativepair[i]=0;}
398 for (Int_t i=0;i<10*nn;i++) {positivepair[i]=0;}
399
400 if ((np*nn) > fgPairsSize) {
401
402 if (fgPairs) delete [] fgPairs;
403 fgPairsSize = 4*np*nn;
404 fgPairs = new Short_t[fgPairsSize];
405 }
406 memset(fgPairs,0,sizeof(Short_t)*np*nn);
407
408 //
409 // find available pairs
410 //
411 for (Int_t i=0; i<np; i++) {
412 Float_t yp=pos[i].GetY();
413 if ( (pos[i].GetQ()>0) && (pos[i].GetQ()<3) ) continue;
414 for (Int_t j=0; j<nn; j++) {
415 if ( (neg[j].GetQ()>0) && (neg[j].GetQ()<3) ) continue;
416 Float_t yn=neg[j].GetY();
417
418 Float_t xt, zt;
419 seg->GetPadCxz(yn, yp, xt, zt);
420 //cout<<yn<<" "<<yp<<" "<<xt<<" "<<zt<<endl;
421
422 if (TMath::Abs(xt)<hwSSD)
423 if (TMath::Abs(zt)<hlSSD) {
424 Int_t in = i*10+cnegative[i];
425 Int_t ip = j*10+cpositive[j];
426 if ((in < 10*np) && (ip < 10*nn)) {
427 negativepair[in] =j; //index
428 positivepair[ip] =i;
429 cnegative[i]++; //counters
430 cpositive[j]++;
431 fgPairs[i*nn+j]=100;
432 }
433 else
434 AliError(Form("Index out of range: ip=%d, in=%d",ip,in));
435 }
436 }
437 }
438
439
440 //
441 Float_t lp[6];
442 Int_t milab[10];
443 Double_t ratio;
444
445
446 if(fRecoParam->GetUseChargeMatchingInClusterFinderSSD()==kTRUE) {
447
448
449 //
450 // sign gold tracks
451 //
452 for (Int_t ip=0;ip<np;ip++){
453
454 Float_t xbest=1000,zbest=1000,qbest=0;
455 //
456 // select gold clusters
457 if ( (cnegative[ip]==1) && cpositive[negativepair[10*ip]]==1){
458
459 Float_t yp=pos[ip].GetY();
460 Int_t j = negativepair[10*ip];
461
462 if( (pos[ip].GetQ()==0) && (neg[j].GetQ() ==0) ) {
463 // both bad, hence continue;
464 // mark both as used (to avoid recover at the end)
465 cused1[ip]++;
466 cused2[j]++;
467 continue;
468 }
469
470 ratio = (pos[ip].GetQ()-neg[j].GetQ())/(pos[ip].GetQ()+neg[j].GetQ());
471 //cout<<"ratio="<<ratio<<endl;
472
473 // charge matching (note that if posQ or negQ is 0 -> ratio=1 and the following condition is met
474 if (TMath::Abs(ratio)>0.2) continue; // note: 0.2=3xsigma_ratio calculated in cosmics tests
475
476 //
477 Float_t yn=neg[j].GetY();
478
479 Float_t xt, zt;
480 seg->GetPadCxz(yn, yp, xt, zt);
481
482 xbest=xt; zbest=zt;
483
484
485 qbest=0.5*(pos[ip].GetQ()+neg[j].GetQ());
486 if( (pos[ip].GetQ()==0)||(neg[j].GetQ()==0)) qbest*=2; // in case of bad strips on one side keep all charge from the other one
487
488 {
489 Double_t loc[3]={xbest,0.,zbest},trk[3]={0.,0.,0.};
490 mT2L->MasterToLocal(loc,trk);
491 lp[0]=trk[1];
492 lp[1]=trk[2];
493 }
494 lp[4]=qbest; //Q
495 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
496 for (Int_t ilab=0;ilab<3;ilab++){
497 milab[ilab] = pos[ip].GetLabel(ilab);
498 milab[ilab+3] = neg[j].GetLabel(ilab);
499 }
500 //
501 CheckLabels2(milab);
502 milab[3]=(((ip<<10) + j)<<10) + idet; // pos|neg|det
503 Int_t info[3] = {pos[ip].GetNd(),neg[j].GetNd(),fNlayer[fModule]};
504
505 lp[2]=0.0022*0.0022; //SigmaY2
506 lp[3]=0.110*0.110; //SigmaZ2
507 // out-of-diagonal element of covariance matrix
508 if( (info[0]==1) && (info[1]==1) ) lp[5]=-0.00012;
509 else if ( (info[0]>1) && (info[1]>1) ) {
510 lp[2]=0.0016*0.0016; //SigmaY2
511 lp[3]=0.08*0.08; //SigmaZ2
512 lp[5]=-0.00006;
513 }
514 else {
515 lp[3]=0.093*0.093;
516 if (info[0]==1) { lp[5]=-0.00014;}
517 else { lp[2]=0.0017*0.0017; lp[5]=-0.00004;}
518 }
519 AliITSRecPoint cl2(milab,lp,info);
520 cl2.SetChargeRatio(ratio);
521 cl2.SetType(1);
522
523 fgPairs[ip*nn+j]=1;
524 if ((pos[ip].GetNd()+neg[j].GetNd())>6){ //multi cluster
525 cl2.SetType(2);
526 fgPairs[ip*nn+j]=2;
527 }
528
529 if(pos[ip].GetQ()==0) cl2.SetType(3);
530 if(neg[j].GetQ()==0) cl2.SetType(4);
531
532 cused1[ip]++;
533 cused2[j]++;
534
535 clusters.push_back(cl2);
536
537 ncl++;
538 }
539 }
540
541 for (Int_t ip=0;ip<np;ip++){
542 Float_t xbest=1000,zbest=1000,qbest=0;
543 //
544 //
545 // select "silber" cluster
546 if ( cnegative[ip]==1 && cpositive[negativepair[10*ip]]==2){
547 Int_t in = negativepair[10*ip];
548 Int_t ip2 = positivepair[10*in];
549 if (ip2==ip) ip2 = positivepair[10*in+1];
550 Float_t pcharge = pos[ip].GetQ()+pos[ip2].GetQ();
551
552
553
554 ratio = (pcharge-neg[in].GetQ())/(pcharge+neg[in].GetQ());
555 if ( (TMath::Abs(ratio)<0.2) && (pcharge!=0) ) {
556 //if ( (TMath::Abs(pcharge-neg[in].GetQ())<30) && (pcharge!=0) ) { //
557
558 //
559 // add first pair
560 if ( (fgPairs[ip*nn+in]==100)&&(pos[ip].GetQ() ) ) { //
561
562 Float_t yp=pos[ip].GetY();
563 Float_t yn=neg[in].GetY();
564
565 Float_t xt, zt;
566 seg->GetPadCxz(yn, yp, xt, zt);
567
568 xbest=xt; zbest=zt;
569
570 qbest =pos[ip].GetQ();
571 Double_t loc[3]={xbest,0.,zbest},trk[3]={0.,0.,0.};
572 mT2L->MasterToLocal(loc,trk);
573 lp[0]=trk[1];
574 lp[1]=trk[2];
575
576 lp[4]=qbest; //Q
577 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
578 for (Int_t ilab=0;ilab<3;ilab++){
579 milab[ilab] = pos[ip].GetLabel(ilab);
580 milab[ilab+3] = neg[in].GetLabel(ilab);
581 }
582 //
583 CheckLabels2(milab);
584 ratio = (pos[ip].GetQ()-neg[in].GetQ())/(pos[ip].GetQ()+neg[in].GetQ());
585 milab[3]=(((ip<<10) + in)<<10) + idet; // pos|neg|det
586 Int_t info[3] = {pos[ip].GetNd(),neg[in].GetNd(),fNlayer[fModule]};
587
588 lp[2]=0.0022*0.0022; //SigmaY2
589 lp[3]=0.110*0.110; //SigmaZ2
590 // out-of-diagonal element of covariance matrix
591 if( (info[0]==1) && (info[1]==1) ) lp[5]=-0.00012;
592 else if ( (info[0]>1) && (info[1]>1) ) {
593 lp[2]=0.0016*0.0016; //SigmaY2
594 lp[3]=0.08*0.08; //SigmaZ2
595 lp[5]=-0.00006;
596 }
597 else {
598 lp[3]=0.093*0.093;
599 if (info[0]==1) { lp[5]=-0.00014;}
600 else { lp[2]=0.0017*0.0017; lp[5]=-0.00004;}
601 }
602
603 AliITSRecPoint cl2(milab,lp,info);
604 cl2.SetChargeRatio(ratio);
605 cl2.SetType(5);
606 fgPairs[ip*nn+in] = 5;
607 if ((pos[ip].GetNd()+neg[in].GetNd())>6){ //multi cluster
608 cl2.SetType(6);
609 fgPairs[ip*nn+in] = 6;
610 }
611 clusters.push_back(cl2);
612 ncl++;
613 }
614
615
616 //
617 // add second pair
618
619 // if (!(cused1[ip2] || cused2[in])){ //
620 if ( (fgPairs[ip2*nn+in]==100) && (pos[ip2].GetQ()) ) {
621
622 Float_t yp=pos[ip2].GetY();
623 Float_t yn=neg[in].GetY();
624
625 Float_t xt, zt;
626 seg->GetPadCxz(yn, yp, xt, zt);
627
628 xbest=xt; zbest=zt;
629
630 qbest =pos[ip2].GetQ();
631
632 Double_t loc[3]={xbest,0.,zbest},trk[3]={0.,0.,0.};
633 mT2L->MasterToLocal(loc,trk);
634 lp[0]=trk[1];
635 lp[1]=trk[2];
636
637 lp[4]=qbest; //Q
638 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
639 for (Int_t ilab=0;ilab<3;ilab++){
640 milab[ilab] = pos[ip2].GetLabel(ilab);
641 milab[ilab+3] = neg[in].GetLabel(ilab);
642 }
643 //
644 CheckLabels2(milab);
645 ratio = (pos[ip2].GetQ()-neg[in].GetQ())/(pos[ip2].GetQ()+neg[in].GetQ());
646 milab[3]=(((ip2<<10) + in)<<10) + idet; // pos|neg|det
647 Int_t info[3] = {pos[ip2].GetNd(),neg[in].GetNd(),fNlayer[fModule]};
648
649 lp[2]=0.0022*0.0022; //SigmaY2
650 lp[3]=0.110*0.110; //SigmaZ2
651 // out-of-diagonal element of covariance matrix
652 if( (info[0]==1) && (info[1]==1) ) lp[5]=-0.00012;
653 else if ( (info[0]>1) && (info[1]>1) ) {
654 lp[2]=0.0016*0.0016; //SigmaY2
655 lp[3]=0.08*0.08; //SigmaZ2
656 lp[5]=-0.00006;
657 }
658 else {
659 lp[3]=0.093*0.093;
660 if (info[0]==1) { lp[5]=-0.00014;}
661 else { lp[2]=0.0017*0.0017; lp[5]=-0.00004;}
662 }
663
664 AliITSRecPoint cl2(milab,lp,info);
665 cl2.SetChargeRatio(ratio);
666 cl2.SetType(5);
667 fgPairs[ip2*nn+in] =5;
668 if ((pos[ip2].GetNd()+neg[in].GetNd())>6){ //multi cluster
669 cl2.SetType(6);
670 fgPairs[ip2*nn+in] =6;
671 }
672 clusters.push_back(cl2);
673 ncl++;
674 }
675
676 cused1[ip]++;
677 cused1[ip2]++;
678 cused2[in]++;
679
680 } // charge matching condition
681
682 } // 2 Pside cross 1 Nside
683 } // loop over Pside clusters
684
685
686 //
687 for (Int_t jn=0;jn<nn;jn++){
688 if (cused2[jn]) continue;
689 Float_t xbest=1000,zbest=1000,qbest=0;
690 // select "silber" cluster
691 if ( cpositive[jn]==1 && cnegative[positivepair[10*jn]]==2){
692 Int_t ip = positivepair[10*jn];
693 Int_t jn2 = negativepair[10*ip];
694 if (jn2==jn) jn2 = negativepair[10*ip+1];
695 Float_t pcharge = neg[jn].GetQ()+neg[jn2].GetQ();
696 //
697
698
699 ratio = (pcharge-pos[ip].GetQ())/(pcharge+pos[ip].GetQ());
700 if ( (TMath::Abs(ratio)<0.2) && (pcharge!=0) ) {
701
702 /*
703 if ( (TMath::Abs(pcharge-pos[ip].GetQ())<30) && // charge matching
704 (pcharge!=0) ) { // reject combinations of bad strips
705 */
706
707
708 //
709 // add first pair
710 // if (!(cused1[ip]||cused2[jn])){
711 if ( (fgPairs[ip*nn+jn]==100) && (neg[jn].GetQ()) ) { //
712
713 Float_t yn=neg[jn].GetY();
714 Float_t yp=pos[ip].GetY();
715
716 Float_t xt, zt;
717 seg->GetPadCxz(yn, yp, xt, zt);
718
719 xbest=xt; zbest=zt;
720
721 qbest =neg[jn].GetQ();
722
723 {
724 Double_t loc[3]={xbest,0.,zbest},trk[3]={0.,0.,0.};
725 mT2L->MasterToLocal(loc,trk);
726 lp[0]=trk[1];
727 lp[1]=trk[2];
728 }
729
730 lp[4]=qbest; //Q
731 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
732 for (Int_t ilab=0;ilab<3;ilab++){
733 milab[ilab] = pos[ip].GetLabel(ilab);
734 milab[ilab+3] = neg[jn].GetLabel(ilab);
735 }
736 //
737 CheckLabels2(milab);
738 ratio = (pos[ip].GetQ()-neg[jn].GetQ())/(pos[ip].GetQ()+neg[jn].GetQ());
739 milab[3]=(((ip<<10) + jn)<<10) + idet; // pos|neg|det
740 Int_t info[3] = {pos[ip].GetNd(),neg[jn].GetNd(),fNlayer[fModule]};
741
742 lp[2]=0.0022*0.0022; //SigmaY2
743 lp[3]=0.110*0.110; //SigmaZ2
744 // out-of-diagonal element of covariance matrix
745 if( (info[0]==1) && (info[1]==1) ) lp[5]=-0.00012;
746 else if ( (info[0]>1) && (info[1]>1) ) {
747 lp[2]=0.0016*0.0016; //SigmaY2
748 lp[3]=0.08*0.08; //SigmaZ2
749 lp[5]=-0.00006;
750 }
751 else {
752 lp[3]=0.093*0.093;
753 if (info[0]==1) { lp[5]=-0.00014;}
754 else { lp[2]=0.0017*0.0017; lp[5]=-0.00004;}
755 }
756
757 AliITSRecPoint cl2(milab,lp,info);
758 cl2.SetChargeRatio(ratio);
759 cl2.SetType(7);
760 fgPairs[ip*nn+jn] =7;
761 if ((pos[ip].GetNd()+neg[jn].GetNd())>6){ //multi cluster
762 cl2.SetType(8);
763 fgPairs[ip*nn+jn]=8;
764 }
765 clusters.push_back(cl2);
766
767 ncl++;
768 }
769 //
770 // add second pair
771 // if (!(cused1[ip]||cused2[jn2])){
772 if ( (fgPairs[ip*nn+jn2]==100)&&(neg[jn2].GetQ() ) ) { //
773
774 Float_t yn=neg[jn2].GetY();
775 Double_t yp=pos[ip].GetY();
776
777 Float_t xt, zt;
778 seg->GetPadCxz(yn, yp, xt, zt);
779
780 xbest=xt; zbest=zt;
781
782 qbest =neg[jn2].GetQ();
783
784 {
785 Double_t loc[3]={xbest,0.,zbest},trk[3]={0.,0.,0.};
786 mT2L->MasterToLocal(loc,trk);
787 lp[0]=trk[1];
788 lp[1]=trk[2];
789 }
790
791 lp[4]=qbest; //Q
792 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
793 for (Int_t ilab=0;ilab<3;ilab++){
794 milab[ilab] = pos[ip].GetLabel(ilab);
795 milab[ilab+3] = neg[jn2].GetLabel(ilab);
796 }
797 //
798 CheckLabels2(milab);
799 ratio = (pos[ip].GetQ()-neg[jn2].GetQ())/(pos[ip].GetQ()+neg[jn2].GetQ());
800 milab[3]=(((ip<<10) + jn2)<<10) + idet; // pos|neg|det
801 Int_t info[3] = {pos[ip].GetNd(),neg[jn2].GetNd(),fNlayer[fModule]};
802
803 lp[2]=0.0022*0.0022; //SigmaY2
804 lp[3]=0.110*0.110; //SigmaZ2
805 // out-of-diagonal element of covariance matrix
806 if( (info[0]==1) && (info[1]==1) ) lp[5]=-0.00012;
807 else if ( (info[0]>1) && (info[1]>1) ) {
808 lp[2]=0.0016*0.0016; //SigmaY2
809 lp[3]=0.08*0.08; //SigmaZ2
810 lp[5]=-0.00006;
811 }
812 else {
813 lp[3]=0.093*0.093;
814 if (info[0]==1) { lp[5]=-0.00014;}
815 else { lp[2]=0.0017*0.0017; lp[5]=-0.00004;}
816 }
817
818 AliITSRecPoint cl2(milab,lp,info);
819 cl2.SetChargeRatio(ratio);
820 fgPairs[ip*nn+jn2]=7;
821 cl2.SetType(7);
822 if ((pos[ip].GetNd()+neg[jn2].GetNd())>6){ //multi cluster
823 cl2.SetType(8);
824 fgPairs[ip*nn+jn2]=8;
825 }
826 clusters.push_back( cl2 );
827 ncl++;
828 }
829 cused1[ip]++;
830 cused2[jn]++;
831 cused2[jn2]++;
832
833 } // charge matching condition
834
835 } // 2 Nside cross 1 Pside
836 } // loop over Pside clusters
837
838
839
840 for (Int_t ip=0;ip<np;ip++){
841
842 if(cused1[ip]) continue;
843
844
845 Float_t xbest=1000,zbest=1000,qbest=0;
846 //
847 // 2x2 clusters
848 //
849 if ( (cnegative[ip]==2) && cpositive[negativepair[10*ip]]==2){
850 Float_t minchargediff =4.;
851 Float_t minchargeratio =0.2;
852
853 Int_t j=-1;
854 for (Int_t di=0;di<cnegative[ip];di++){
855 Int_t jc = negativepair[ip*10+di];
856 Float_t chargedif = pos[ip].GetQ()-neg[jc].GetQ();
857 ratio = (pos[ip].GetQ()-neg[jc].GetQ())/(pos[ip].GetQ()+neg[jc].GetQ());
858 //if (TMath::Abs(chargedif)<minchargediff){
859 if (TMath::Abs(ratio)<0.2){
860 j =jc;
861 minchargediff = TMath::Abs(chargedif);
862 minchargeratio = TMath::Abs(ratio);
863 }
864 }
865 if (j<0) continue; // not proper cluster
866
867
868 Int_t count =0;
869 for (Int_t di=0;di<cnegative[ip];di++){
870 Int_t jc = negativepair[ip*10+di];
871 Float_t chargedif = pos[ip].GetQ()-neg[jc].GetQ();
872 if (TMath::Abs(chargedif)<minchargediff+3.) count++;
873 }
874 if (count>1) continue; // more than one "proper" cluster for positive
875 //
876
877 count =0;
878 for (Int_t dj=0;dj<cpositive[j];dj++){
879 Int_t ic = positivepair[j*10+dj];
880 Float_t chargedif = pos[ic].GetQ()-neg[j].GetQ();
881 if (TMath::Abs(chargedif)<minchargediff+3.) count++;
882 }
883 if (count>1) continue; // more than one "proper" cluster for negative
884
885 Int_t jp = 0;
886
887 count =0;
888 for (Int_t dj=0;dj<cnegative[jp];dj++){
889 Int_t ic = positivepair[jp*10+dj];
890 Float_t chargedif = pos[ic].GetQ()-neg[jp].GetQ();
891 if (TMath::Abs(chargedif)<minchargediff+4.) count++;
892 }
893 if (count>1) continue;
894 if (fgPairs[ip*nn+j]<100) continue;
895 //
896
897
898
899 //almost gold clusters
900 Float_t yp=pos[ip].GetY();
901 Float_t yn=neg[j].GetY();
902 Float_t xt, zt;
903 seg->GetPadCxz(yn, yp, xt, zt);
904 xbest=xt; zbest=zt;
905 qbest=0.5*(pos[ip].GetQ()+neg[j].GetQ());
906 {
907 Double_t loc[3]={xbest,0.,zbest},trk[3]={0.,0.,0.};
908 mT2L->MasterToLocal(loc,trk);
909 lp[0]=trk[1];
910 lp[1]=trk[2];
911 }
912 lp[4]=qbest; //Q
913 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
914 for (Int_t ilab=0;ilab<3;ilab++){
915 milab[ilab] = pos[ip].GetLabel(ilab);
916 milab[ilab+3] = neg[j].GetLabel(ilab);
917 }
918 //
919 CheckLabels2(milab);
920 if ((neg[j].GetQ()==0)&&(pos[ip].GetQ()==0)) continue; // reject crosses of bad strips!!
921 ratio = (pos[ip].GetQ()-neg[j].GetQ())/(pos[ip].GetQ()+neg[j].GetQ());
922 milab[3]=(((ip<<10) + j)<<10) + idet; // pos|neg|det
923 Int_t info[3] = {pos[ip].GetNd(),neg[j].GetNd(),fNlayer[fModule]};
924
925 lp[2]=0.0022*0.0022; //SigmaY2
926 lp[3]=0.110*0.110; //SigmaZ2
927 // out-of-diagonal element of covariance matrix
928 if( (info[0]==1) && (info[1]==1) ) lp[5]=-0.00012;
929 else if ( (info[0]>1) && (info[1]>1) ) {
930 lp[2]=0.0016*0.0016; //SigmaY2
931 lp[3]=0.08*0.08; //SigmaZ2
932 lp[5]=-0.00006;
933 }
934 else {
935 lp[3]=0.093*0.093;
936 if (info[0]==1) { lp[5]=-0.00014;}
937 else { lp[2]=0.0017*0.0017; lp[5]=-0.00004;}
938 }
939
940 AliITSRecPoint cl2(milab,lp,info);
941 cl2.SetChargeRatio(ratio);
942 cl2.SetType(10);
943 fgPairs[ip*nn+j]=10;
944 if ((pos[ip].GetNd()+neg[j].GetNd())>6){ //multi cluster
945 cl2.SetType(11);
946 fgPairs[ip*nn+j]=11;
947 }
948 cused1[ip]++;
949 cused2[j]++;
950
951 clusters.push_back(cl2);
952 ncl++;
953
954 } // 2X2
955 } // loop over Pside 1Dclusters
956
957
958 for (Int_t ip=0;ip<np;ip++){
959
960 if(cused1[ip]) continue;
961
962
963 Float_t xbest=1000,zbest=1000,qbest=0;
964 //
965 // manyxmany clusters
966 //
967 if ( (cnegative[ip]<5) && cpositive[negativepair[10*ip]]<5){
968 Float_t minchargediff =4.;
969 Int_t j=-1;
970 for (Int_t di=0;di<cnegative[ip];di++){
971 Int_t jc = negativepair[ip*10+di];
972 Float_t chargedif = pos[ip].GetQ()-neg[jc].GetQ();
973 if (TMath::Abs(chargedif)<minchargediff){
974 j =jc;
975 minchargediff = TMath::Abs(chargedif);
976 }
977 }
978 if (j<0) continue; // not proper cluster
979
980 Int_t count =0;
981 for (Int_t di=0;di<cnegative[ip];di++){
982 Int_t jc = negativepair[ip*10+di];
983 Float_t chargedif = pos[ip].GetQ()-neg[jc].GetQ();
984 if (TMath::Abs(chargedif)<minchargediff+3.) count++;
985 }
986 if (count>1) continue; // more than one "proper" cluster for positive
987 //
988
989 count =0;
990 for (Int_t dj=0;dj<cpositive[j];dj++){
991 Int_t ic = positivepair[j*10+dj];
992 Float_t chargedif = pos[ic].GetQ()-neg[j].GetQ();
993 if (TMath::Abs(chargedif)<minchargediff+3.) count++;
994 }
995 if (count>1) continue; // more than one "proper" cluster for negative
996
997 Int_t jp = 0;
998
999 count =0;
1000 for (Int_t dj=0;dj<cnegative[jp];dj++){
1001 Int_t ic = positivepair[jp*10+dj];
1002 Float_t chargedif = pos[ic].GetQ()-neg[jp].GetQ();
1003 if (TMath::Abs(chargedif)<minchargediff+4.) count++;
1004 }
1005 if (count>1) continue;
1006 if (fgPairs[ip*nn+j]<100) continue;
1007 //
1008
1009 //almost gold clusters
1010 Float_t yp=pos[ip].GetY();
1011 Float_t yn=neg[j].GetY();
1012
1013
1014 Float_t xt, zt;
1015 seg->GetPadCxz(yn, yp, xt, zt);
1016
1017 xbest=xt; zbest=zt;
1018
1019 qbest=0.5*(pos[ip].GetQ()+neg[j].GetQ());
1020
1021 {
1022 Double_t loc[3]={xbest,0.,zbest},trk[3]={0.,0.,0.};
1023 mT2L->MasterToLocal(loc,trk);
1024 lp[0]=trk[1];
1025 lp[1]=trk[2];
1026 }
1027 lp[4]=qbest; //Q
1028 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
1029 for (Int_t ilab=0;ilab<3;ilab++){
1030 milab[ilab] = pos[ip].GetLabel(ilab);
1031 milab[ilab+3] = neg[j].GetLabel(ilab);
1032 }
1033 //
1034 CheckLabels2(milab);
1035 if ((neg[j].GetQ()==0)&&(pos[ip].GetQ()==0)) continue; // reject crosses of bad strips!!
1036 ratio = (pos[ip].GetQ()-neg[j].GetQ())/(pos[ip].GetQ()+neg[j].GetQ());
1037 milab[3]=(((ip<<10) + j)<<10) + idet; // pos|neg|det
1038 Int_t info[3] = {pos[ip].GetNd(),neg[j].GetNd(),fNlayer[fModule]};
1039
1040 lp[2]=0.0022*0.0022; //SigmaY2
1041 lp[3]=0.110*0.110; //SigmaZ2
1042 // out-of-diagonal element of covariance matrix
1043 if( (info[0]==1) && (info[1]==1) ) lp[5]=-0.00012;
1044 else if ( (info[0]>1) && (info[1]>1) ) {
1045 lp[2]=0.0016*0.0016; //SigmaY2
1046 lp[3]=0.08*0.08; //SigmaZ2
1047 lp[5]=-0.00006;
1048 }
1049 else {
1050 lp[3]=0.093*0.093;
1051 if (info[0]==1) { lp[5]=-0.00014;}
1052 else { lp[2]=0.0017*0.0017; lp[5]=-0.00004;}
1053 }
1054
1055 AliITSRecPoint cl2(milab,lp,info);
1056 cl2.SetChargeRatio(ratio);
1057 cl2.SetType(12);
1058 fgPairs[ip*nn+j]=12;
1059 if ((pos[ip].GetNd()+neg[j].GetNd())>6){ //multi cluster
1060 cl2.SetType(13);
1061 fgPairs[ip*nn+j]=13;
1062 }
1063 cused1[ip]++;
1064 cused2[j]++;
1065 clusters.push_back( cl2 );
1066 ncl++;
1067
1068 } // manyXmany
1069 } // loop over Pside 1Dclusters
1070
1071 } // use charge matching
1072
1073 // recover all the other crosses
1074 //
1075 for (Int_t i=0; i<np; i++) {
1076 Float_t xbest=1000,zbest=1000,qbest=0;
1077 Float_t yp=pos[i].GetY();
1078 if ((pos[i].GetQ()>0)&&(pos[i].GetQ()<3)) continue;
1079 for (Int_t j=0; j<nn; j++) {
1080 // for (Int_t di = 0;di<cpositive[i];di++){
1081 // Int_t j = negativepair[10*i+di];
1082 if ((neg[j].GetQ()>0)&&(neg[j].GetQ()<3)) continue;
1083
1084 if ((neg[j].GetQ()==0)&&(pos[i].GetQ()==0)) continue; // reject crosses of bad strips!!
1085
1086 if (cused2[j]||cused1[i]) continue;
1087 if (fgPairs[i*nn+j]>0 &&fgPairs[i*nn+j]<100) continue;
1088 ratio = (pos[i].GetQ()-neg[j].GetQ())/(pos[i].GetQ()+neg[j].GetQ());
1089 Float_t yn=neg[j].GetY();
1090
1091 Float_t xt, zt;
1092 seg->GetPadCxz(yn, yp, xt, zt);
1093
1094 if (TMath::Abs(xt)<hwSSD)
1095 if (TMath::Abs(zt)<hlSSD) {
1096 xbest=xt; zbest=zt;
1097
1098 qbest=0.5*(pos[i].GetQ()+neg[j].GetQ());
1099
1100 {
1101 Double_t loc[3]={xbest,0.,zbest},trk[3]={0.,0.,0.};
1102 mT2L->MasterToLocal(loc,trk);
1103 lp[0]=trk[1];
1104 lp[1]=trk[2];
1105 }
1106 lp[4]=qbest; //Q
1107 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
1108 for (Int_t ilab=0;ilab<3;ilab++){
1109 milab[ilab] = pos[i].GetLabel(ilab);
1110 milab[ilab+3] = neg[j].GetLabel(ilab);
1111 }
1112 //
1113 CheckLabels2(milab);
1114 milab[3]=(((i<<10) + j)<<10) + idet; // pos|neg|det
1115 Int_t info[3] = {pos[i].GetNd(),neg[j].GetNd(),fNlayer[fModule]};
1116
1117 lp[2]=0.0022*0.0022; //SigmaY2
1118 lp[3]=0.110*0.110; //SigmaZ2
1119 // out-of-diagonal element of covariance matrix
1120 if( (info[0]==1) && (info[1]==1) ) lp[5]=-0.00012;
1121 else if ( (info[0]>1) && (info[1]>1) ) {
1122 lp[2]=0.0016*0.0016; //SigmaY2
1123 lp[3]=0.08*0.08; //SigmaZ2
1124 lp[5]=-0.00006;
1125 }
1126 else {
1127 lp[3]=0.093*0.093;
1128 if (info[0]==1) { lp[5]=-0.00014;}
1129 else { lp[2]=0.0017*0.0017; lp[5]=-0.00004;}
1130 }
1131
1132 AliITSRecPoint cl2(milab,lp,info);
1133 cl2.SetChargeRatio(ratio);
1134 cl2.SetType(100+cpositive[j]+cnegative[i]);
1135
1136 if(pos[i].GetQ()==0) cl2.SetType(200+cpositive[j]+cnegative[i]);
1137 if(neg[j].GetQ()==0) cl2.SetType(300+cpositive[j]+cnegative[i]);
1138 clusters.push_back( cl2 );
1139 ncl++;
1140 }
1141 }
1142 }
1143
1144
1145 if(fRecoParam->GetUseBadChannelsInClusterFinderSSD()==kTRUE) {
1146
1147 //---------------------------------------------------------
1148 // recover crosses of good 1D clusters with bad strips on the other side
1149 // Note1: at first iteration skip modules with a bad side (or almost), (would produce too many fake!)
1150 // Note2: for modules with a bad side see below
1151
1152 AliITSCalibrationSSD* cal = (AliITSCalibrationSSD*) fDetTypeRec->GetCalibrationModel(fModule);
1153 Int_t countPbad=0, countNbad=0;
1154 for(Int_t ib=0; ib<768; ib++) {
1155 if(cal->IsPChannelBad(ib)) countPbad++;
1156 if(cal->IsNChannelBad(ib)) countNbad++;
1157 }
1158 // AliInfo(Form("module %d has %d P- and %d N-bad strips",fModule,countPbad,countNbad));
1159
1160 if( (countPbad<100) && (countNbad<100) ) { // no bad side!!
1161
1162 for (Int_t i=0; i<np; i++) { // loop over Nside 1Dclusters with no crosses
1163 if(cnegative[i]) continue; // if intersecting Pside clusters continue;
1164
1165 // for(Int_t ib=0; ib<768; ib++) { // loop over all Pstrips
1166 for(Int_t ib=15; ib<753; ib++) { // loop over all Pstrips
1167
1168 if(cal->IsPChannelBad(ib)) { // check if strips is bad
1169 Float_t yN=pos[i].GetY();
1170 Float_t xt, zt;
1171 seg->GetPadCxz(1.*ib, yN, xt, zt);
1172
1173 //----------
1174 // bad Pstrip is crossing the Nside 1Dcluster -> create recpoint
1175 //
1176 if ( (TMath::Abs(xt)<hwSSD) && (TMath::Abs(zt)<hlSSD) ) {
1177 Double_t loc[3]={xt,0.,zt},trk[3]={0.,0.,0.};
1178 mT2L->MasterToLocal(loc,trk);
1179 lp[0]=trk[1];
1180 lp[1]=trk[2];
1181 lp[4]=pos[i].GetQ(); //Q
1182 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
1183 for (Int_t ilab=0;ilab<3;ilab++) milab[ilab] = pos[i].GetLabel(ilab);
1184 CheckLabels2(milab);
1185 milab[3]=( (i<<10) << 10 ) + idet; // pos|neg|det
1186 Int_t info[3] = {pos[i].GetNd(),0,fNlayer[fModule]};
1187
1188 // out-of-diagonal element of covariance matrix
1189 if (info[0]==1) lp[5]=0.0065;
1190 else lp[5]=0.0093;
1191
1192 lp[2]=0.0022*0.0022; //SigmaY2
1193 lp[3]=0.110*0.110; //SigmaZ2
1194 lp[5]=-0.00012; // out-of-diagonal element of covariance matrix
1195
1196 AliITSRecPoint cl2(milab,lp,info);
1197 cl2.SetChargeRatio(1.);
1198 cl2.SetType(50);
1199 clusters.push_back( cl2 );
1200 ncl++;
1201 } // cross is within the detector
1202 //
1203 //--------------
1204
1205 } // bad Pstrip
1206
1207 } // end loop over Pstrips
1208
1209 } // end loop over Nside 1D clusters
1210
1211 for (Int_t j=0; j<nn; j++) { // loop over Pside 1D clusters with no crosses
1212 if(cpositive[j]) continue;
1213
1214 // for(Int_t ib=0; ib<768; ib++) { // loop over all Nside strips
1215 for(Int_t ib=15; ib<753; ib++) { // loop over all Nside strips
1216
1217 if(cal->IsNChannelBad(ib)) { // check if strip is bad
1218 Float_t yP=neg[j].GetY();
1219 Float_t xt, zt;
1220 seg->GetPadCxz(yP, 1.*ib, xt, zt);
1221
1222 //----------
1223 // bad Nstrip is crossing the Pside 1Dcluster -> create recpoint
1224 //
1225 if ( (TMath::Abs(xt)<hwSSD) && (TMath::Abs(zt)<hlSSD) ) {
1226 Double_t loc[3]={xt,0.,zt},trk[3]={0.,0.,0.};
1227 mT2L->MasterToLocal(loc,trk);
1228 lp[0]=trk[1];
1229 lp[1]=trk[2];
1230 lp[4]=neg[j].GetQ(); //Q
1231 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
1232 for (Int_t ilab=0;ilab<3;ilab++) milab[ilab] = neg[j].GetLabel(ilab);
1233 CheckLabels2(milab);
1234 milab[3]=( j << 10 ) + idet; // pos|neg|det
1235 Int_t info[3]={0,(Int_t)neg[j].GetNd(),fNlayer[fModule]};
1236
1237 lp[2]=0.0022*0.0022; //SigmaY2
1238 lp[3]=0.110*0.110; //SigmaZ2
1239 lp[5]=-0.00012; // out-of-diagonal element of covariance matrix
1240
1241 AliITSRecPoint cl2(milab,lp,info);
1242 cl2.SetChargeRatio(1.);
1243 cl2.SetType(60);
1244 clusters.push_back( cl2 );
1245 ncl++;
1246 } // cross is within the detector
1247 //
1248 //--------------
1249
1250 } // bad Nstrip
1251 } // end loop over Nstrips
1252 } // end loop over Pside 1D clusters
1253
1254 } // no bad sides
1255
1256 //---------------------------------------------------------
1257
1258 else if( (countPbad>700) && (countNbad<100) ) { // bad Pside!!
1259
1260 for (Int_t i=0; i<np; i++) { // loop over Nside 1Dclusters with no crosses
1261 if(cnegative[i]) continue; // if intersecting Pside clusters continue;
1262
1263 Float_t xt, zt;
1264 Float_t yN=pos[i].GetY();
1265 Float_t yP=0.;
1266 if (seg->GetLayer()==5) yP = yN + (7.6/1.9);
1267 else yP = yN - (7.6/1.9);
1268 seg->GetPadCxz(yP, yN, xt, zt);
1269
1270 if ( (TMath::Abs(xt)<hwSSD) && (TMath::Abs(zt)<hlSSD) ) {
1271 Double_t loc[3]={xt,0.,zt},trk[3]={0.,0.,0.};
1272 mT2L->MasterToLocal(loc,trk);
1273 lp[0]=trk[1];
1274 lp[1]=trk[2];
1275 lp[4]=pos[i].GetQ(); //Q
1276 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
1277 for (Int_t ilab=0;ilab<3;ilab++) milab[ilab] = pos[i].GetLabel(ilab);
1278 CheckLabels2(milab);
1279 milab[3]=( (i<<10) << 10 ) + idet; // pos|neg|det
1280 Int_t info[3] = {(Int_t)pos[i].GetNd(),0,fNlayer[fModule]};
1281
1282 lp[2]=0.031*0.031; //SigmaY2
1283 lp[3]=1.15*1.15; //SigmaZ2
1284 lp[5]=-0.036;
1285
1286 AliITSRecPoint cl2(milab,lp,info);
1287 cl2.SetChargeRatio(1.);
1288 cl2.SetType(70);
1289 clusters.push_back( cl2 );
1290 ncl++;
1291 } // cross is within the detector
1292 //
1293 //--------------
1294
1295 } // end loop over Nside 1D clusters
1296
1297 } // bad Pside module
1298
1299 else if( (countNbad>700) && (countPbad<100) ) { // bad Nside!!
1300
1301 for (Int_t j=0; j<nn; j++) { // loop over Pside 1D clusters with no crosses
1302 if(cpositive[j]) continue;
1303
1304 Float_t xt, zt;
1305 Float_t yP=neg[j].GetY();
1306 Float_t yN=0.;
1307 if (seg->GetLayer()==5) yN = yP - (7.6/1.9);
1308 else yN = yP + (7.6/1.9);
1309 seg->GetPadCxz(yP, yN, xt, zt);
1310
1311 if ( (TMath::Abs(xt)<hwSSD) && (TMath::Abs(zt)<hlSSD) ) {
1312 Double_t loc[3]={xt,0.,zt},trk[3]={0.,0.,0.};
1313 mT2L->MasterToLocal(loc,trk);
1314 lp[0]=trk[1];
1315 lp[1]=trk[2];
1316 lp[4]=neg[j].GetQ(); //Q
1317 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
1318 for (Int_t ilab=0;ilab<3;ilab++) milab[ilab] = neg[j].GetLabel(ilab);
1319 CheckLabels2(milab);
1320 milab[3]=( j << 10 ) + idet; // pos|neg|det
1321 Int_t info[3] = {0,(Int_t)neg[j].GetNd(),fNlayer[fModule]};
1322
1323 lp[2]=0.0085*0.0085; //SigmaY2
1324 lp[3]=1.15*1.15; //SigmaZ2
1325 lp[5]=0.0093;
1326
1327 AliITSRecPoint cl2(milab,lp,info);
1328 cl2.SetChargeRatio(1.);
1329 cl2.SetType(80);
1330 clusters.push_back( cl2 );
1331 ncl++;
1332 } // cross is within the detector
1333 //
1334 //--------------
1335
1336 } // end loop over Pside 1D clusters
1337
1338 } // bad Nside module
1339
1340 //---------------------------------------------------------
1341
1342 } // use bad channels
1343
1344 //cout<<ncl<<" clusters for this module"<<endl;
1345
1346 delete [] cnegative;
1347 delete [] cused1;
1348 delete [] negativepair;
1349 delete [] cpositive;
1350 delete [] cused2;
1351 delete [] positivepair;
1352
1353}