1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 // **************************************************************************
17 // * The package was revised and changed by Boris Batiounia in the time *
18 // * period of March - June 2001 *
19 // **************************************************************************/
21 //#include <Riostream.h>
26 #include "AliITSClusterFinderSSD.h"
27 #include "AliITSDetTypeRec.h"
28 #include "AliITSMapA1.h"
29 #include "AliITSRawClusterSSD.h"
30 #include "AliITSRecPoint.h"
31 #include "AliITSdigitSSD.h"
32 #include "AliITSclusterSSD.h"
33 #include "AliITSpackageSSD.h"
34 #include "AliITSsegmentationSSD.h"
35 //#include "AliITSgeom.h"
36 #include "AliITSCalibrationSSD.h"
39 const Bool_t AliITSClusterFinderSSD::fgkSIDEP=kTRUE;
40 const Bool_t AliITSClusterFinderSSD::fgkSIDEN=kFALSE;
41 const Int_t AliITSClusterFinderSSD::fgkNoiseThreshold=5;
44 ClassImp(AliITSClusterFinderSSD)
46 //____________________________________________________________________
49 //______________________________________________________________________
50 AliITSClusterFinderSSD::AliITSClusterFinderSSD():
51 AliITSClusterFinder(),
71 //______________________________________________________________________
72 AliITSClusterFinderSSD::AliITSClusterFinderSSD(AliITSDetTypeRec* dettyp,
73 TClonesArray *digits):
74 AliITSClusterFinder(dettyp,digits),
91 //Standard constructor
94 SetMap(new AliITSMapA1(GetSeg(),Digits()));
95 fClusterP = new TClonesArray ("AliITSclusterSSD",200);
97 fClusterN = new TClonesArray ("AliITSclusterSSD",200);
99 fPackages = new TClonesArray ("AliITSpackageSSD",200); //packages
101 fDigitsIndexP = new TArrayI(800);
103 fDigitsIndexN = new TArrayI(800);
105 fPitch = GetSeg()->Dpx(0);
106 fPNsignalRatio= 7./8.; // warning: hard-wired number
109 //______________________________________________________________________
110 AliITSClusterFinderSSD::AliITSClusterFinderSSD(AliITSDetTypeRec* dettyp):
111 AliITSClusterFinder(dettyp),
128 //Standard constructor
130 fClusterP = new TClonesArray ("AliITSclusterSSD",200);
132 fClusterN = new TClonesArray ("AliITSclusterSSD",200);
134 fPackages = new TClonesArray ("AliITSpackageSSD",200); //packages
136 fDigitsIndexP = new TArrayI(800);
138 fDigitsIndexN = new TArrayI(800);
140 fPitch = GetSeg()->Dpx(0);
141 fPNsignalRatio= 7./8.; // warning: hard-wired number
144 //______________________________________________________________________
145 AliITSClusterFinderSSD::~AliITSClusterFinderSSD(){
146 // Default destructor
151 delete fDigitsIndexP;
152 delete fDigitsIndexN;
155 //______________________________________________________________________
156 void AliITSClusterFinderSSD::InitReconstruction(){
157 // initialization of the cluster finder
159 register Int_t i; //iterator
161 for (i=0;i<fNClusterP;i++) fClusterP->RemoveAt(i);
163 for (i=0;i<fNClusterN;i++) fClusterN->RemoveAt(i);
165 for (i=0;i<fNPackages;i++) fPackages->RemoveAt(i);
169 Float_t stereoP,stereoN;
170 //fSegmentation->Angles(stereoP,stereoN);
171 GetSeg()->Angles(stereoP,stereoN);
172 CalcStepFactor(stereoP,stereoN);
173 if (debug) cout<<"fSFF = "<<fSFF<<" fSFB = "<<fSFB<<"\n";
175 //______________________________________________________________________
176 void AliITSClusterFinderSSD::FindRawClusters(Int_t module){
177 // This function findes out all clusters belonging to one module
178 // 1. Zeroes all space after previous module reconstruction
179 // 2. Finds all neighbouring digits, create clusters
180 // 3. If necesery, resolves for each group of neighbouring digits
181 // how many clusters creates it.
182 // 4. Colculate the x and z coordinate
183 Int_t lay, lad, detect;
185 //cout<<"clusterfinder: this is module "<<module<<endl;
187 // AliITSgeom *geom = fITS->GetITSgeom();
189 if(!fDetTypeRec->GetITSgeom()) {
190 Error("FindRawClusters","ITS geom is null!");
195 fDetTypeRec->GetITSgeom()->GetModuleId(GetModule(),lay, lad, detect);
196 // geom->GetModuleId(module,lay, lad, detect);
198 //cout<<"layer = "<<lay<<endl;
200 if ( lay == 6 ) ((AliITSsegmentationSSD*)GetSeg())->SetLayer(6);
201 if ( lay == 5 ) ((AliITSsegmentationSSD*)GetSeg())->SetLayer(5);
204 InitReconstruction(); //ad. 1
208 if ( (fNDigitsP==0 ) || (fNDigitsN == 0 )) return;
211 FindNeighbouringDigits(module); //ad. 2
213 //SeparateOverlappedClusters(); //ad. 3
214 ClustersToPackages(); //ad. 4
219 //______________________________________________________________________
220 void AliITSClusterFinderSSD::FindNeighbouringDigits(Int_t module){
221 //If there are any digits on this side, create 1st Cluster,
222 // add to it this digit, and increment number of clusters
227 //if ( (fNDigitsP==0 ) || (fNDigitsN == 0 )) return;
229 Int_t currentstripNo;
230 Int_t *dbuffer = new Int_t [800]; //buffer for strip numbers
231 Int_t dnumber; //curent number of digits in buffer
233 TArrayI &lDigitsIndexP = *fDigitsIndexP;
234 TArrayI &lDigitsIndexN = *fDigitsIndexN;
236 TObjArray &lDigits = *(Digits());
238 TClonesArray &lClusterP = *fClusterP;
239 TClonesArray &lClusterN = *fClusterN;
243 dbuffer[0]=lDigitsIndexP[0];
245 //If next digit is a neigh. of previous, adds to last clust. this digit
246 for (i=1; i<fNDigitsP; i++) {
249 currentstripNo = ((AliITSdigitSSD*)lDigits[lDigitsIndexP[i]])->GetStripNumber();
251 if((((AliITSdigitSSD*)lDigits[lDigitsIndexP[i-1]])->GetStripNumber()) == (currentstripNo-1) )
252 dbuffer[dnumber++]=lDigitsIndexP[i];
257 for(j=0;j<dnumber;j++) {
259 if( (((AliITSdigitSSD*)lDigits[dbuffer[j]])->GetSignal())
260 > fgkNoiseThreshold* ((AliITSCalibrationSSD*)GetResp(module))->
261 GetNoiseP( ((AliITSdigitSSD*)lDigits[dbuffer[j]])->GetStripNumber()) )
266 //if(flag==dnumber) {
268 //create a new one side cluster
269 new(lClusterP[fNClusterP++]) AliITSclusterSSD(dnumber,dbuffer,
277 dbuffer[0]=lDigitsIndexP[i];
282 } // end loop over fNDigitsP
285 for(j=0;j<dnumber;j++) {
287 if( (((AliITSdigitSSD*)lDigits[dbuffer[j]])->GetSignal())
288 > fgkNoiseThreshold*((AliITSCalibrationSSD*)GetResp(module))->
289 GetNoiseP( ((AliITSdigitSSD*)lDigits[dbuffer[j]])->GetStripNumber()) )
294 //if(flag==dnumber) {
296 //create a new one side cluster
297 new(lClusterP[fNClusterP++]) AliITSclusterSSD(dnumber,dbuffer,
307 //for comments, see above
309 dbuffer[0]=lDigitsIndexN[0];
310 //If next digit is a neigh. of previous, adds to last clust. this digit
312 for (i=1; i<fNDigitsN; i++) {
313 currentstripNo = ((AliITSdigitSSD*)(lDigits[lDigitsIndexN[i]]))->GetStripNumber();
315 if ( (((AliITSdigitSSD*)lDigits[lDigitsIndexN[i-1]])->GetStripNumber()) == (currentstripNo-1) )
316 dbuffer[dnumber++]=lDigitsIndexN[i];
321 for(j=0;j<dnumber;j++) {
323 if( (((AliITSdigitSSD*)lDigits[dbuffer[j]])->GetSignal())
324 > fgkNoiseThreshold*((AliITSCalibrationSSD*)GetResp(module))->
325 GetNoiseN( ((AliITSdigitSSD*)lDigits[dbuffer[j]])->GetStripNumber()) )
330 //if(flag==dnumber) {
332 //create a new one side cluster
333 new(lClusterN[fNClusterN++]) AliITSclusterSSD(dnumber,dbuffer,
341 dbuffer[0]=lDigitsIndexN[i];
344 } // end loop over fNDigitsN
347 for(j=0;j<dnumber;j++) {
349 if( (((AliITSdigitSSD*)lDigits[dbuffer[j]])->GetSignal())
350 > fgkNoiseThreshold*((AliITSCalibrationSSD*)GetResp(module))->
351 GetNoiseN( ((AliITSdigitSSD*)lDigits[dbuffer[j]])->GetStripNumber()) )
356 //if(flag==dnumber) {
358 //create a new one side cluster
359 new(lClusterN[fNClusterN++]) AliITSclusterSSD(dnumber,dbuffer,
369 if (debug) cout<<"\n Found clusters: fNClusterP = "<<fNClusterP
370 <<" fNClusterN ="<<fNClusterN<<"\n";
372 //______________________________________________________________________
373 void AliITSClusterFinderSSD::SeparateOverlappedClusters(){
374 // overlapped clusters separation
375 register Int_t i; //iterator
376 Float_t factor=0.75; // How many percent must be lower signal
377 // on the middle one digit
378 // from its neighbours
379 Int_t signal0; //signal on the strip before the current one
380 Int_t signal1; //signal on the current one signal
381 Int_t signal2; //signal on the strip after the current one
382 TArrayI *splitlist; // List of splits
383 Int_t numerofsplits=0; // number of splits
384 Int_t initPsize = fNClusterP; //initial size of the arrays
385 Int_t initNsize = fNClusterN; //we have to keep it because it will grow
386 // in this function and it doasn't make
387 // sense to pass through it again
388 splitlist = new TArrayI(800);
390 for (i=0;i<initPsize;i++){
391 if (( ((AliITSclusterSSD*)(*fClusterP)[i])->
392 GetNumOfDigits())==1) continue;
393 if (( ((AliITSclusterSSD*)(*fClusterP)[i])->
394 GetNumOfDigits())==2) continue;
395 Int_t nj=(((AliITSclusterSSD*)(*fClusterP)[i])->GetNumOfDigits()-1);
396 for (Int_t j=1; j<nj; j++){
397 signal1=((AliITSclusterSSD*)(*fClusterP)[i])->GetDigitSignal(j);
398 signal0=((AliITSclusterSSD*)(*fClusterP)[i])->GetDigitSignal(j-1);
399 signal2=((AliITSclusterSSD*)(*fClusterP)[i])->GetDigitSignal(j+1);
400 //if signal is less then factor*signal of its neighbours
401 if ( (signal1<(factor*signal0)) && (signal1<(factor*signal2)) ){
402 (*splitlist)[numerofsplits++]=j;
404 } // end loop over number of digits
405 //split this cluster if necessary
406 if(numerofsplits>0) SplitCluster(splitlist,numerofsplits,i,fgkSIDEP);
408 //in signed places (splitlist)
409 } // end loop over clusters on Pside
411 for (i=0;i<initNsize;i++) {
412 if (( ((AliITSclusterSSD*)(*fClusterN)[i])->
413 GetNumOfDigits())==1) continue;
414 if (( ((AliITSclusterSSD*)(*fClusterN)[i])->
415 GetNumOfDigits())==2) continue;
416 Int_t nj=(((AliITSclusterSSD*)(*fClusterN)[i])->GetNumOfDigits()-1);
417 for (Int_t j=1; j<nj; j++){
418 signal1=((AliITSclusterSSD*)(*fClusterN)[i])->GetDigitSignal(j);
419 signal0=((AliITSclusterSSD*)(*fClusterN)[i])->GetDigitSignal(j-1);
420 signal2=((AliITSclusterSSD*)(*fClusterN)[i])->GetDigitSignal(j+1);
421 //if signal is less then factor*signal of its neighbours
422 if ( (signal1<(factor*signal0)) && (signal1<(factor*signal2)) )
423 (*splitlist)[numerofsplits++]=j;
424 } // end loop over number of digits
425 //split this cluster into more clusters
426 if(numerofsplits>0) SplitCluster(splitlist,numerofsplits,i,fgkSIDEN);
428 //in signed places (splitlist)
429 } // end loop over clusters on Nside
433 //______________________________________________________________________
434 void AliITSClusterFinderSSD::SplitCluster(TArrayI *list, Int_t nsplits,
435 Int_t index, Bool_t side){
436 //This function splits one side cluster into more clusters
437 //number of splits is defined by "nsplits"
438 //Place of splits are defined in the TArray "list"
439 // For further optimisation: Replace this function by two
440 // specialised ones (each for one side)
442 //For comlete comments see AliITSclusterSSD::SplitCluster
443 register Int_t i; //iterator
444 AliITSclusterSSD* curentcluster;
445 Int_t *tmpdigits = new Int_t[100];
448 // side true means P side
450 curentcluster =((AliITSclusterSSD*)((*fClusterP)[index])) ;
451 for (i = nsplits; i>0 ;i--) {
452 nn=curentcluster->SplitCluster((*list)[(i-1)],tmpdigits);
453 new ((*fClusterP)[fNClusterP]) AliITSclusterSSD(nn,tmpdigits,
455 ( (AliITSclusterSSD*)((*fClusterP)[fNClusterP]) )->
456 SetLeftNeighbour(kTRUE);
457 //if left cluster had neighbour on the right before split
458 //new should have it too
459 if ( curentcluster->GetRightNeighbour() )
460 ( (AliITSclusterSSD*)((*fClusterP)[fNClusterP]) )->
461 SetRightNeighbour(kTRUE);
462 else curentcluster->SetRightNeighbour(kTRUE);
464 } // end loop over nplits
466 curentcluster =((AliITSclusterSSD*)((*fClusterN)[index]));
467 for (i = nsplits; i>0 ;i--) {
468 nn=curentcluster->SplitCluster((*list)[(i-1)],tmpdigits);
469 new ((*fClusterN)[fNClusterN]) AliITSclusterSSD(nn,tmpdigits,
471 ((AliITSclusterSSD*)((*fClusterN)[fNClusterN]))->
472 SetRightNeighbour(kTRUE);
473 if (curentcluster->GetRightNeighbour())
474 ( (AliITSclusterSSD*)( (*fClusterN)[fNClusterN]) )->
475 SetRightNeighbour(kTRUE);
476 else curentcluster->SetRightNeighbour(kTRUE);
478 } // end loop over nplits
482 //______________________________________________________________________
483 Int_t AliITSClusterFinderSSD::SortDigitsP(Int_t start, Int_t end){
484 // sort digits on the P side
488 if (start != (end - 1) ){
489 left=this->SortDigitsP(start,(start+end)/2);
490 right=this->SortDigitsP((start+end)/2,end);
491 return (left || right);
493 left = ((AliITSdigitSSD*)((*(Digits()))[(*fDigitsIndexP)[start]]))->
495 right= ((AliITSdigitSSD*)((*(Digits()))[(*fDigitsIndexP)[end]]))->
498 Int_t tmp = (*fDigitsIndexP)[start];
499 (*fDigitsIndexP)[start]=(*fDigitsIndexP)[end];
500 (*fDigitsIndexP)[end]=tmp;
505 //______________________________________________________________________
506 Int_t AliITSClusterFinderSSD::SortDigitsN(Int_t start, Int_t end){
507 // sort digits on the N side
511 if (start != (end - 1)){
512 left=this->SortDigitsN(start,(start+end)/2);
513 right=this->SortDigitsN((start+end)/2,end);
514 return (left || right);
516 left =((AliITSdigitSSD*)((*(Digits()))[(*fDigitsIndexN)[start]]))->
518 right=((AliITSdigitSSD*)((*(Digits()))[(*fDigitsIndexN)[end]]))->
521 Int_t tmp = (*fDigitsIndexN)[start];
522 (*fDigitsIndexN)[start]=(*fDigitsIndexN)[end];
523 (*fDigitsIndexN)[end]=tmp;
528 //______________________________________________________________________
529 void AliITSClusterFinderSSD::FillDigitsIndex(){
530 //Fill the indexes of the clusters belonging to a given ITS module
537 noentries = fDigits->GetEntriesFast();
539 if (fDigitsIndexP==NULL) fDigitsIndexP = new TArrayI(noentries);
540 if (fDigitsIndexN==NULL) fDigitsIndexN = new TArrayI(noentries);
544 for ( i = 0 ; i< noentries; i++ ) {
546 dig = (AliITSdigitSSD*)GetDigit(i);
548 gain=(Int_t) ((AliITSCalibrationSSD*)GetResp(fModule))->GetGainP(dig->GetStripNumber());
549 signal=gain*dig->GetSignal();
550 dig->SetSignal(signal);
552 if(dig->IsSideP()) fDigitsIndexP->AddAt(i,fNDigitsP++);
553 else fDigitsIndexN->AddAt(i,fNDigitsN++);
560 if (debug) cout<<"Digits : P = "<<fNDigitsP<<" N = "<<fNDigitsN<<endl;
562 //______________________________________________________________________
563 void AliITSClusterFinderSSD::SortDigits(){
567 if(fNDigitsP>1) for (i=0;i<fNDigitsP-1;i++)
568 if (SortDigitsP(0,(fNDigitsP-1-i))==0) break;
569 if(fNDigitsN>1) for (i=0;i<fNDigitsN-1;i++)
570 if(SortDigitsN(0,(fNDigitsN-1-i))==0) break;
572 //______________________________________________________________________
573 void AliITSClusterFinderSSD::FillClIndexArrays(Int_t* arrayP, Int_t *arrayN) const{
574 // fill cluster index array
577 for (i=0; i<fNClusterP;i++) arrayP[i]=i;
578 for (i=0; i<fNClusterN;i++) arrayN[i]=i;
580 //______________________________________________________________________
581 void AliITSClusterFinderSSD::SortClusters(Int_t* arrayP, Int_t *arrayN){
585 if(fNClusterP>1) for (i=0;i<fNClusterP-1;i++)
586 if (SortClustersP(0,(fNClusterP-1),arrayP)==0) break;
587 if(fNClusterN>1) for (i=0;i<fNClusterN-1;i++)
588 if (SortClustersN(0,(fNClusterN-1),arrayN)==0) break;
590 //______________________________________________________________________
591 Int_t AliITSClusterFinderSSD::SortClustersP(Int_t start, Int_t end,
593 //Sort P side clusters
597 if (start != (end - 1) ) {
598 left=this->SortClustersP(start,(start+end)/2,array);
599 right=this->SortClustersP((start+end)/2,end,array);
600 return (left || right);
602 left =((AliITSclusterSSD*)((*fClusterP)[array[start]]))->
604 right=((AliITSclusterSSD*)((*fClusterP)[array[ end ]]))->
607 Int_t tmp = array[start];
608 array[start]=array[end];
614 //______________________________________________________________________
615 Int_t AliITSClusterFinderSSD::SortClustersN(Int_t start, Int_t end,
617 //Sort N side clusters
621 if (start != (end - 1) ) {
622 left=this->SortClustersN(start,(start+end)/2,array);
623 right=this->SortClustersN((start+end)/2,end,array);
624 return (left || right);
626 left =((AliITSclusterSSD*)((*fClusterN)[array[start]]))->
628 right=((AliITSclusterSSD*)((*fClusterN)[array[ end ]]))->
631 Int_t tmp = array[start];
632 array[start]=array[end];
638 //______________________________________________________________________
639 void AliITSClusterFinderSSD::ClustersToPackages(){
642 Int_t *oneSclP = new Int_t[fNClusterP];//I want to have sorted 1 S clusters
643 Int_t *oneSclN = new Int_t[fNClusterN];//I can not sort it in TClonesArray
644 //so, I create table of indexes and
646 //I do not use TArrayI on purpose
647 //MB: well, that's not true that one
648 //cannot sort objs in TClonesArray
649 AliITSclusterSSD *currentP;
650 AliITSclusterSSD *currentN;
653 //Fills in One Side Clusters Index Array
654 FillClIndexArrays(oneSclP,oneSclN);
655 //Sorts filled Arrays
656 //SortClusters(oneSclP,oneSclN);
659 new ((*fPackages)[0]) AliITSpackageSSD(fClusterP,fClusterN);
661 //This part was includede by Boris Batiounia in March 2001.
662 // Take all recpoint pairs (x coordinates) in both P and N sides
663 // to calculate z coordinates of the recpoints
665 for (j1=0;j1<fNClusterP;j1++) {
666 currentP = GetPSideCluster(oneSclP[j1]);
667 Double_t xP = currentP->GetPosition();
668 Float_t signalP = currentP->GetTotalSignal();
669 for (j2=0;j2<fNClusterN;j2++) {
670 currentN = GetNSideCluster(oneSclN[j2]);
671 Double_t xN = currentN->GetPosition();
672 Float_t signalN = currentN->GetTotalSignal();
673 CreateNewRecPoint(xP,1,xN,1,signalP,signalN,currentP,currentN,
681 //______________________________________________________________________
682 Bool_t AliITSClusterFinderSSD::CreateNewRecPoint(Float_t P,Float_t dP,
683 Float_t N, Float_t dN,
684 Float_t SigP,Float_t SigN,
685 AliITSclusterSSD *clusterP,
686 AliITSclusterSSD *clusterN,
688 // create the recpoints
689 const Float_t kADCtoKeV = 2.16;
690 // 50 ADC units -> 30000 e-h pairs; 1e-h pair -> 3.6e-3 KeV;
691 // 1 ADC unit -> (30000/50)*3.6e-3 = 2.16 KeV
692 const Float_t kconv = 1.0e-4;
693 const Float_t kRMSx = 20.0*kconv;
694 const Float_t kRMSz = 800.0*kconv;
700 fDetTypeRec->GetITSgeom()->GetModuleId(fModule,lay,lad,det);
701 Int_t ind=(lad-1)*fDetTypeRec->GetITSgeom()->GetNdetectors(lay)+(det-1);
704 if (GetCrossing(P,N)) {
705 //GetCrossingError(dP,dN);
706 dP = dN = prob = 0.0; // to remove unused variable warning.
707 AliITSRawClusterSSD cnew;
708 Int_t nstripsP=clusterP->GetNumOfDigits();
709 Int_t nstripsN=clusterN->GetNumOfDigits();
712 // Float_t meannoiseP=clusterP->GetMeanNoise();
713 //Float_t meannoiseN=clusterN->GetMeanNoise();
714 //cout<<meannoiseP<<" "<<meannoiseN<<endl;
717 dedx = SigP*kADCtoKeV;
720 dedx = SigN*kADCtoKeV;
721 } // end if SigP>SigN
722 tr = (Int_t*) clusterP->GetTracks(n);
723 ntracks = clusterP->GetNTracks();
725 //cnew.SetDigitsClusterP(clusterP);
726 //cnew.SetDigitsClusterN(clusterN);
728 cnew.SetSignalP(SigP);
729 cnew.SetSignalN(SigN);
730 cnew.SetMultiplicity(nstripsP);
731 cnew.SetMultN(nstripsN);
732 cnew.SetQErr(TMath::Abs(SigP-SigN));
733 cnew.SetNTrack(ntracks);
734 //cnew.SetMeanNoiseP(meannoiseP);
735 //cnew.SetMeanNoiseN(meannoiseN);
736 fDetTypeRec->AddCluster(2,&cnew);
737 //fITS->AddCluster(2,&cnew);
738 //AliITSRecPoint rnew;
739 AliITSRecPoint rnew(fDetTypeRec->GetITSgeom());
740 rnew.SetXZ(fModule,P*kconv,N*kconv);
741 //rnew.SetX(P*kconv);
742 //rnew.SetZ(N*kconv);
745 rnew.SetSigmaDetLocX2( kRMSx* kRMSx);
746 // rnew.SetSigmaX2( kRMSx* kRMSx);
747 rnew.SetSigmaZ2( kRMSz* kRMSz);
749 rnew.SetLabel(tr[0],0);
750 rnew.SetLabel(tr[1],1);
751 rnew.SetLabel(tr[2],2);
752 rnew.SetDetectorIndex(ind);
755 //rnew.fTracks[0]=tr[0];
756 // rnew.fTracks[1]=tr[1];
757 //rnew.fTracks[2]=tr[2];
758 //rnew.SetMultP(nstripsP);
759 //rnew.SetMultN(nstripsN);
760 fDetTypeRec->AddRecPoint(rnew);
761 // fITS->AddRecPoint(rnew);
766 //______________________________________________________________________
767 void AliITSClusterFinderSSD::CalcStepFactor(Float_t Psteo, Float_t Nsteo){
768 // calculate the step factor for matching clusters
769 // 95 is the pitch, 4000 - dimension along z ?
770 //Float_t dz=fSegmentation->Dz();
771 Float_t dz=GetSeg()->Dz();
773 fSFF = ( (Int_t) (Psteo*dz/fPitch ) );// +1;
774 fSFB = ( (Int_t) (Nsteo*dz/fPitch ) );// +1;
776 //______________________________________________________________________
777 AliITSclusterSSD* AliITSClusterFinderSSD::GetPSideCluster(Int_t idx){
778 // get P side clusters
780 if((idx<0)||(idx>=fNClusterP)){
781 printf("AliITSClusterFinderSSD::GetPSideCluster: index out of range\n");
784 return (AliITSclusterSSD*)((*fClusterP)[idx]);
787 //______________________________________________________________________
788 AliITSclusterSSD* AliITSClusterFinderSSD::GetNSideCluster(Int_t idx){
789 // get N side clusters
791 if((idx<0)||(idx>=fNClusterN)){
792 printf("AliITSClusterFinderSSD::GetNSideCluster: index out of range\n");
795 return (AliITSclusterSSD*)((*fClusterN)[idx]);
798 //______________________________________________________________________
799 AliITSclusterSSD* AliITSClusterFinderSSD::GetCluster(Int_t idx, Bool_t side){
802 return (side) ? GetPSideCluster(idx) : GetNSideCluster(idx);
804 //______________________________________________________________________
805 Bool_t AliITSClusterFinderSSD::GetCrossing (Float_t &P, Float_t &N){
807 // This function was rivised and changed by Boris Batiounia in March 2001
808 Float_t dx = GetSeg()->Dx(); // detector size in x direction, microns
809 Float_t dz = GetSeg()->Dz(); // detector size in z direction, microns
810 //Float_t dx = fSegmentation->Dx(); // detector size in x direction, microns
811 //Float_t dz = fSegmentation->Dz(); // detector size in z direction, microns
812 //cout<<dx<<" "<<dz<<endl;
813 Float_t xL; // x local coordinate
814 Float_t zL; // z local coordinate
815 Float_t x; // x = xL + dx/2
816 Float_t z; // z = zL + dz/2
817 Float_t xP; // x coordinate in the P side from the first P strip
818 Float_t xN; // x coordinate in the N side from the first N strip
819 Float_t stereoP,stereoN;
821 //fSegmentation->Angles(stereoP,stereoN);
822 GetSeg()->Angles(stereoP,stereoN);
824 //cout<<stereoP<<" "<<stereoN<<" "<<P<<" "<<N<<endl;
826 //cout<<" P="<<P<<", N="<<N<<endl;
828 fTanP=TMath::Tan(stereoP);
829 fTanN=TMath::Tan(stereoN);
830 Float_t kP = fTanP; // Tangent of 0.0075 mrad
831 Float_t kN = fTanN; // Tangent of 0.0275 mrad
837 // xP = N; // change the mistake for the P/N
838 //xN = P; // coordinates correspondence in this function
840 z=(xN-xP+dz*kN)/(kP+kN);
847 //cout<<"P= "<<P<<" , N= "<<N<<" , dx= "<<dx<<endl;
849 //cout<<"P="<<P<<", N="<<N<<endl;
851 if(TMath::Abs(xL) > dx/2 || TMath::Abs(zL) > dz/2) return kFALSE;
853 // Check that xL and zL are inside the detector for the
854 // correspondent xP and xN coordinates
858 //______________________________________________________________________
859 void AliITSClusterFinderSSD::GetCrossingError(Float_t& dP, Float_t& dN){
860 // get crossing error
863 dz = TMath::Abs(( dP + dN )*fPitch/(fTanP + fTanN) );
864 dx = fPitch*(TMath::Abs(dP*(1 - fTanP/(fTanP + fTanN))) +
865 TMath::Abs(dN *fTanP/(fTanP + fTanN) ));