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;
42 //const Int_t debug=0;
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
247 cout<<"----------------------------------------------------------------"<<endl;
248 cout<<"module="<<module<<" , # of Pdigits="<<fNDigitsP<<" , # of Ndigits="<<fNDigitsN<<endl;
250 cout<<" Pside"<<endl;
251 cout<<" "<<((AliITSdigitSSD*)lDigits[lDigitsIndexP[0]])->GetStripNumber()<<" "<<
252 ((AliITSdigitSSD*)lDigits[lDigitsIndexP[0]])->GetSignal()<<endl;
255 for (i=1; i<fNDigitsP; i++) {
258 currentstripNo = ((AliITSdigitSSD*)lDigits[lDigitsIndexP[i]])->GetStripNumber();
259 // cout<<" "<<currentstripNo<<" "<<((AliITSdigitSSD*)lDigits[lDigitsIndexP[i]])->GetSignal()<<endl;
261 if((((AliITSdigitSSD*)lDigits[lDigitsIndexP[i-1]])->GetStripNumber()) == (currentstripNo-1) )
262 dbuffer[dnumber++]=lDigitsIndexP[i];
267 for(j=0;j<dnumber;j++) {
269 if( (((AliITSdigitSSD*)lDigits[dbuffer[j]])->GetSignal())
270 > fgkNoiseThreshold* ((AliITSCalibrationSSD*)GetResp(module))->
271 GetNoiseP( ((AliITSdigitSSD*)lDigits[dbuffer[j]])->GetStripNumber()) )
276 //if(flag==dnumber) {
278 //create a new one side cluster
280 // cout<<" new cluster with "<<dnumber<<" digits"<<endl;
282 new(lClusterP[fNClusterP++]) AliITSclusterSSD(dnumber,dbuffer,
290 dbuffer[0]=lDigitsIndexP[i];
295 } // end loop over fNDigitsP
298 for(j=0;j<dnumber;j++) {
300 if( (((AliITSdigitSSD*)lDigits[dbuffer[j]])->GetSignal())
301 > fgkNoiseThreshold*((AliITSCalibrationSSD*)GetResp(module))->
302 GetNoiseP( ((AliITSdigitSSD*)lDigits[dbuffer[j]])->GetStripNumber()) )
307 //if(flag==dnumber) {
309 //create a new one side cluster
311 // cout<<" new cluster with "<<dnumber<<" digits"<<endl;
313 new(lClusterP[fNClusterP++]) AliITSclusterSSD(dnumber,dbuffer,
323 //for comments, see above
325 dbuffer[0]=lDigitsIndexN[0];
326 //If next digit is a neigh. of previous, adds to last clust. this digit
328 // cout<<" Nside"<<endl;
329 // cout<<" "<<((AliITSdigitSSD*)lDigits[lDigitsIndexN[0]])->GetStripNumber()<<" "<<
330 // ((AliITSdigitSSD*)lDigits[lDigitsIndexN[0]])->GetSignal()<<endl;
332 for (i=1; i<fNDigitsN; i++) {
333 currentstripNo = ((AliITSdigitSSD*)(lDigits[lDigitsIndexN[i]]))->GetStripNumber();
334 // cout<<" "<<currentstripNo<<" "<<((AliITSdigitSSD*)lDigits[lDigitsIndexN[i]])->GetSignal()<<endl;
336 if ( (((AliITSdigitSSD*)lDigits[lDigitsIndexN[i-1]])->GetStripNumber()) == (currentstripNo-1) )
337 dbuffer[dnumber++]=lDigitsIndexN[i];
342 for(j=0;j<dnumber;j++) {
344 if( (((AliITSdigitSSD*)lDigits[dbuffer[j]])->GetSignal())
345 > fgkNoiseThreshold*((AliITSCalibrationSSD*)GetResp(module))->
346 GetNoiseN( ((AliITSdigitSSD*)lDigits[dbuffer[j]])->GetStripNumber()) )
351 //if(flag==dnumber) {
353 //create a new one side cluster
355 // cout<<" new cluster with "<<dnumber<<" digits"<<endl;
357 new(lClusterN[fNClusterN++]) AliITSclusterSSD(dnumber,dbuffer,
365 dbuffer[0]=lDigitsIndexN[i];
368 } // end loop over fNDigitsN
371 for(j=0;j<dnumber;j++) {
373 if( (((AliITSdigitSSD*)lDigits[dbuffer[j]])->GetSignal())
374 > fgkNoiseThreshold*((AliITSCalibrationSSD*)GetResp(module))->
375 GetNoiseN( ((AliITSdigitSSD*)lDigits[dbuffer[j]])->GetStripNumber()) )
380 //if(flag==dnumber) {
382 //create a new one side cluster
384 // cout<<" new cluster with "<<dnumber<<" digits"<<endl;
386 new(lClusterN[fNClusterN++]) AliITSclusterSSD(dnumber,dbuffer,
396 // if (debug) cout<<"\n Found clusters: fNClusterP = "<<fNClusterP
397 // <<" fNClusterN ="<<fNClusterN<<"\n";
399 //______________________________________________________________________
400 void AliITSClusterFinderSSD::SeparateOverlappedClusters(){
401 // overlapped clusters separation
402 register Int_t i; //iterator
403 Float_t factor=0.75; // How many percent must be lower signal
404 // on the middle one digit
405 // from its neighbours
406 Int_t signal0; //signal on the strip before the current one
407 Int_t signal1; //signal on the current one signal
408 Int_t signal2; //signal on the strip after the current one
409 TArrayI *splitlist; // List of splits
410 Int_t numerofsplits=0; // number of splits
411 Int_t initPsize = fNClusterP; //initial size of the arrays
412 Int_t initNsize = fNClusterN; //we have to keep it because it will grow
413 // in this function and it doasn't make
414 // sense to pass through it again
415 splitlist = new TArrayI(800);
417 for (i=0;i<initPsize;i++){
418 if (( ((AliITSclusterSSD*)(*fClusterP)[i])->
419 GetNumOfDigits())==1) continue;
420 if (( ((AliITSclusterSSD*)(*fClusterP)[i])->
421 GetNumOfDigits())==2) continue;
422 Int_t nj=(((AliITSclusterSSD*)(*fClusterP)[i])->GetNumOfDigits()-1);
423 for (Int_t j=1; j<nj; j++){
424 signal1=((AliITSclusterSSD*)(*fClusterP)[i])->GetDigitSignal(j);
425 signal0=((AliITSclusterSSD*)(*fClusterP)[i])->GetDigitSignal(j-1);
426 signal2=((AliITSclusterSSD*)(*fClusterP)[i])->GetDigitSignal(j+1);
427 //if signal is less then factor*signal of its neighbours
428 if ( (signal1<(factor*signal0)) && (signal1<(factor*signal2)) ){
429 (*splitlist)[numerofsplits++]=j;
431 } // end loop over number of digits
432 //split this cluster if necessary
433 if(numerofsplits>0) SplitCluster(splitlist,numerofsplits,i,fgkSIDEP);
435 //in signed places (splitlist)
436 } // end loop over clusters on Pside
438 for (i=0;i<initNsize;i++) {
439 if (( ((AliITSclusterSSD*)(*fClusterN)[i])->
440 GetNumOfDigits())==1) continue;
441 if (( ((AliITSclusterSSD*)(*fClusterN)[i])->
442 GetNumOfDigits())==2) continue;
443 Int_t nj=(((AliITSclusterSSD*)(*fClusterN)[i])->GetNumOfDigits()-1);
444 for (Int_t j=1; j<nj; j++){
445 signal1=((AliITSclusterSSD*)(*fClusterN)[i])->GetDigitSignal(j);
446 signal0=((AliITSclusterSSD*)(*fClusterN)[i])->GetDigitSignal(j-1);
447 signal2=((AliITSclusterSSD*)(*fClusterN)[i])->GetDigitSignal(j+1);
448 //if signal is less then factor*signal of its neighbours
449 if ( (signal1<(factor*signal0)) && (signal1<(factor*signal2)) )
450 (*splitlist)[numerofsplits++]=j;
451 } // end loop over number of digits
452 //split this cluster into more clusters
453 if(numerofsplits>0) SplitCluster(splitlist,numerofsplits,i,fgkSIDEN);
455 //in signed places (splitlist)
456 } // end loop over clusters on Nside
460 //______________________________________________________________________
461 void AliITSClusterFinderSSD::SplitCluster(TArrayI *list, Int_t nsplits,
462 Int_t index, Bool_t side){
463 //This function splits one side cluster into more clusters
464 //number of splits is defined by "nsplits"
465 //Place of splits are defined in the TArray "list"
466 // For further optimisation: Replace this function by two
467 // specialised ones (each for one side)
469 //For comlete comments see AliITSclusterSSD::SplitCluster
470 register Int_t i; //iterator
471 AliITSclusterSSD* curentcluster;
472 Int_t *tmpdigits = new Int_t[100];
475 // side true means P side
477 curentcluster =((AliITSclusterSSD*)((*fClusterP)[index])) ;
478 for (i = nsplits; i>0 ;i--) {
479 nn=curentcluster->SplitCluster((*list)[(i-1)],tmpdigits);
480 new ((*fClusterP)[fNClusterP]) AliITSclusterSSD(nn,tmpdigits,
482 ( (AliITSclusterSSD*)((*fClusterP)[fNClusterP]) )->
483 SetLeftNeighbour(kTRUE);
484 //if left cluster had neighbour on the right before split
485 //new should have it too
486 if ( curentcluster->GetRightNeighbour() )
487 ( (AliITSclusterSSD*)((*fClusterP)[fNClusterP]) )->
488 SetRightNeighbour(kTRUE);
489 else curentcluster->SetRightNeighbour(kTRUE);
491 } // end loop over nplits
493 curentcluster =((AliITSclusterSSD*)((*fClusterN)[index]));
494 for (i = nsplits; i>0 ;i--) {
495 nn=curentcluster->SplitCluster((*list)[(i-1)],tmpdigits);
496 new ((*fClusterN)[fNClusterN]) AliITSclusterSSD(nn,tmpdigits,
498 ((AliITSclusterSSD*)((*fClusterN)[fNClusterN]))->
499 SetRightNeighbour(kTRUE);
500 if (curentcluster->GetRightNeighbour())
501 ( (AliITSclusterSSD*)( (*fClusterN)[fNClusterN]) )->
502 SetRightNeighbour(kTRUE);
503 else curentcluster->SetRightNeighbour(kTRUE);
505 } // end loop over nplits
509 //______________________________________________________________________
510 Int_t AliITSClusterFinderSSD::SortDigitsP(Int_t start, Int_t end){
511 // sort digits on the P side
515 if (start != (end - 1) ){
516 left=this->SortDigitsP(start,(start+end)/2);
517 right=this->SortDigitsP((start+end)/2,end);
518 return (left || right);
520 left = ((AliITSdigitSSD*)((*(Digits()))[(*fDigitsIndexP)[start]]))->
522 right= ((AliITSdigitSSD*)((*(Digits()))[(*fDigitsIndexP)[end]]))->
525 Int_t tmp = (*fDigitsIndexP)[start];
526 (*fDigitsIndexP)[start]=(*fDigitsIndexP)[end];
527 (*fDigitsIndexP)[end]=tmp;
532 //______________________________________________________________________
533 Int_t AliITSClusterFinderSSD::SortDigitsN(Int_t start, Int_t end){
534 // sort digits on the N side
538 if (start != (end - 1)){
539 left=this->SortDigitsN(start,(start+end)/2);
540 right=this->SortDigitsN((start+end)/2,end);
541 return (left || right);
543 left =((AliITSdigitSSD*)((*(Digits()))[(*fDigitsIndexN)[start]]))->
545 right=((AliITSdigitSSD*)((*(Digits()))[(*fDigitsIndexN)[end]]))->
548 Int_t tmp = (*fDigitsIndexN)[start];
549 (*fDigitsIndexN)[start]=(*fDigitsIndexN)[end];
550 (*fDigitsIndexN)[end]=tmp;
555 //______________________________________________________________________
556 void AliITSClusterFinderSSD::FillDigitsIndex(){
557 //Fill the indexes of the clusters belonging to a given ITS module
564 noentries = fDigits->GetEntriesFast();
566 if (fDigitsIndexP==NULL) fDigitsIndexP = new TArrayI(noentries);
567 if (fDigitsIndexN==NULL) fDigitsIndexN = new TArrayI(noentries);
571 for ( i = 0 ; i< noentries; i++ ) {
573 dig = (AliITSdigitSSD*)GetDigit(i);
575 gain=(Int_t) ((AliITSCalibrationSSD*)GetResp(fModule))->GetGainP(dig->GetStripNumber());
576 signal=gain*dig->GetSignal();
577 dig->SetSignal(signal);
579 if(dig->IsSideP()) fDigitsIndexP->AddAt(i,fNDigitsP++);
580 else fDigitsIndexN->AddAt(i,fNDigitsN++);
587 // if (debug) cout<<"Digits : P = "<<fNDigitsP<<" N = "<<fNDigitsN<<endl;
589 //______________________________________________________________________
590 void AliITSClusterFinderSSD::SortDigits(){
594 if(fNDigitsP>1) for (i=0;i<fNDigitsP-1;i++)
595 if (SortDigitsP(0,(fNDigitsP-1-i))==0) break;
596 if(fNDigitsN>1) for (i=0;i<fNDigitsN-1;i++)
597 if(SortDigitsN(0,(fNDigitsN-1-i))==0) break;
599 //______________________________________________________________________
600 void AliITSClusterFinderSSD::FillClIndexArrays(Int_t* arrayP, Int_t *arrayN) const{
601 // fill cluster index array
604 for (i=0; i<fNClusterP;i++) arrayP[i]=i;
605 for (i=0; i<fNClusterN;i++) arrayN[i]=i;
607 //______________________________________________________________________
608 void AliITSClusterFinderSSD::SortClusters(Int_t* arrayP, Int_t *arrayN){
612 if(fNClusterP>1) for (i=0;i<fNClusterP-1;i++)
613 if (SortClustersP(0,(fNClusterP-1),arrayP)==0) break;
614 if(fNClusterN>1) for (i=0;i<fNClusterN-1;i++)
615 if (SortClustersN(0,(fNClusterN-1),arrayN)==0) break;
617 //______________________________________________________________________
618 Int_t AliITSClusterFinderSSD::SortClustersP(Int_t start, Int_t end,
620 //Sort P side clusters
624 if (start != (end - 1) ) {
625 left=this->SortClustersP(start,(start+end)/2,array);
626 right=this->SortClustersP((start+end)/2,end,array);
627 return (left || right);
629 left =((AliITSclusterSSD*)((*fClusterP)[array[start]]))->
631 right=((AliITSclusterSSD*)((*fClusterP)[array[ end ]]))->
634 Int_t tmp = array[start];
635 array[start]=array[end];
641 //______________________________________________________________________
642 Int_t AliITSClusterFinderSSD::SortClustersN(Int_t start, Int_t end,
644 //Sort N side clusters
648 if (start != (end - 1) ) {
649 left=this->SortClustersN(start,(start+end)/2,array);
650 right=this->SortClustersN((start+end)/2,end,array);
651 return (left || right);
653 left =((AliITSclusterSSD*)((*fClusterN)[array[start]]))->
655 right=((AliITSclusterSSD*)((*fClusterN)[array[ end ]]))->
658 Int_t tmp = array[start];
659 array[start]=array[end];
665 //______________________________________________________________________
666 void AliITSClusterFinderSSD::ClustersToPackages(){
669 Int_t *oneSclP = new Int_t[fNClusterP];//I want to have sorted 1 S clusters
670 Int_t *oneSclN = new Int_t[fNClusterN];//I can not sort it in TClonesArray
671 //so, I create table of indexes and
673 //I do not use TArrayI on purpose
674 //MB: well, that's not true that one
675 //cannot sort objs in TClonesArray
676 AliITSclusterSSD *currentP;
677 AliITSclusterSSD *currentN;
680 //Fills in One Side Clusters Index Array
681 FillClIndexArrays(oneSclP,oneSclN);
682 //Sorts filled Arrays
683 //SortClusters(oneSclP,oneSclN);
686 new ((*fPackages)[0]) AliITSpackageSSD(fClusterP,fClusterN);
688 //This part was includede by Boris Batiounia in March 2001.
689 // Take all recpoint pairs (x coordinates) in both P and N sides
690 // to calculate z coordinates of the recpoints
692 for (j1=0;j1<fNClusterP;j1++) {
693 currentP = GetPSideCluster(oneSclP[j1]);
694 Double_t xP = currentP->GetPosition();
695 Float_t signalP = currentP->GetTotalSignal();
696 for (j2=0;j2<fNClusterN;j2++) {
697 currentN = GetNSideCluster(oneSclN[j2]);
698 Double_t xN = currentN->GetPosition();
699 Float_t signalN = currentN->GetTotalSignal();
700 CreateNewRecPoint(xP,1,xN,1,signalP,signalN,currentP,currentN,
708 //______________________________________________________________________
709 Bool_t AliITSClusterFinderSSD::CreateNewRecPoint(Float_t P,Float_t dP,
710 Float_t N, Float_t dN,
711 Float_t SigP,Float_t SigN,
712 AliITSclusterSSD *clusterP,
713 AliITSclusterSSD *clusterN,
715 // create the recpoints
716 const Float_t kADCtoKeV = 2.16;
717 // 50 ADC units -> 30000 e-h pairs; 1e-h pair -> 3.6e-3 KeV;
718 // 1 ADC unit -> (30000/50)*3.6e-3 = 2.16 KeV
719 const Float_t kconv = 1.0e-4;
720 const Float_t kRMSx = 20.0*kconv;
721 const Float_t kRMSz = 800.0*kconv;
727 fDetTypeRec->GetITSgeom()->GetModuleId(fModule,lay,lad,det);
728 Int_t ind=(lad-1)*fDetTypeRec->GetITSgeom()->GetNdetectors(lay)+(det-1);
731 if (GetCrossing(P,N)) {
732 //GetCrossingError(dP,dN);
733 dP = dN = prob = 0.0; // to remove unused variable warning.
734 AliITSRawClusterSSD cnew;
735 Int_t nstripsP=clusterP->GetNumOfDigits();
736 Int_t nstripsN=clusterN->GetNumOfDigits();
739 // Float_t meannoiseP=clusterP->GetMeanNoise();
740 //Float_t meannoiseN=clusterN->GetMeanNoise();
741 //cout<<meannoiseP<<" "<<meannoiseN<<endl;
744 dedx = SigP*kADCtoKeV;
747 dedx = SigN*kADCtoKeV;
748 } // end if SigP>SigN
749 tr = (Int_t*) clusterP->GetTracks(n);
750 ntracks = clusterP->GetNTracks();
752 //cnew.SetDigitsClusterP(clusterP);
753 //cnew.SetDigitsClusterN(clusterN);
755 cnew.SetSignalP(SigP);
756 cnew.SetSignalN(SigN);
757 cnew.SetMultiplicity(nstripsP);
758 cnew.SetMultN(nstripsN);
759 cnew.SetQErr(TMath::Abs(SigP-SigN));
760 cnew.SetNTrack(ntracks);
761 //cnew.SetMeanNoiseP(meannoiseP);
762 //cnew.SetMeanNoiseN(meannoiseN);
763 fDetTypeRec->AddCluster(2,&cnew);
764 //fITS->AddCluster(2,&cnew);
765 //AliITSRecPoint rnew;
766 Int_t lab[4] = {tr[0],tr[1],tr[2],ind};
767 Float_t hit[5] = {P*kconv,N*kconv,kRMSx*kRMSx,kRMSz*kRMSz,signal};
768 Int_t info[3] = {nstripsP,nstripsN,lyr};
770 AliITSRecPoint rnew(lab,hit,info,kTRUE);
773 fDetTypeRec->AddRecPoint(rnew);
774 // fITS->AddRecPoint(rnew);
779 //______________________________________________________________________
780 void AliITSClusterFinderSSD::CalcStepFactor(Float_t Psteo, Float_t Nsteo){
781 // calculate the step factor for matching clusters
782 // 95 is the pitch, 4000 - dimension along z ?
783 //Float_t dz=fSegmentation->Dz();
784 Float_t dz=GetSeg()->Dz();
786 fSFF = ( (Int_t) (Psteo*dz/fPitch ) );// +1;
787 fSFB = ( (Int_t) (Nsteo*dz/fPitch ) );// +1;
789 //______________________________________________________________________
790 AliITSclusterSSD* AliITSClusterFinderSSD::GetPSideCluster(Int_t idx){
791 // get P side clusters
793 if((idx<0)||(idx>=fNClusterP)){
794 printf("AliITSClusterFinderSSD::GetPSideCluster: index out of range\n");
797 return (AliITSclusterSSD*)((*fClusterP)[idx]);
800 //______________________________________________________________________
801 AliITSclusterSSD* AliITSClusterFinderSSD::GetNSideCluster(Int_t idx){
802 // get N side clusters
804 if((idx<0)||(idx>=fNClusterN)){
805 printf("AliITSClusterFinderSSD::GetNSideCluster: index out of range\n");
808 return (AliITSclusterSSD*)((*fClusterN)[idx]);
811 //______________________________________________________________________
812 AliITSclusterSSD* AliITSClusterFinderSSD::GetCluster(Int_t idx, Bool_t side){
815 return (side) ? GetPSideCluster(idx) : GetNSideCluster(idx);
817 //______________________________________________________________________
818 Bool_t AliITSClusterFinderSSD::GetCrossing (Float_t &P, Float_t &N){
820 // This function was rivised and changed by Boris Batiounia in March 2001
821 Float_t dx = GetSeg()->Dx(); // detector size in x direction, microns
822 Float_t dz = GetSeg()->Dz(); // detector size in z direction, microns
823 //Float_t dx = fSegmentation->Dx(); // detector size in x direction, microns
824 //Float_t dz = fSegmentation->Dz(); // detector size in z direction, microns
825 //cout<<dx<<" "<<dz<<endl;
826 Float_t xL; // x local coordinate
827 Float_t zL; // z local coordinate
828 Float_t x; // x = xL + dx/2
829 Float_t z; // z = zL + dz/2
830 Float_t xP; // x coordinate in the P side from the first P strip
831 Float_t xN; // x coordinate in the N side from the first N strip
832 Float_t stereoP,stereoN;
834 //fSegmentation->Angles(stereoP,stereoN);
835 GetSeg()->Angles(stereoP,stereoN);
837 //cout<<stereoP<<" "<<stereoN<<" "<<P<<" "<<N<<endl;
839 //cout<<" P="<<P<<", N="<<N<<endl;
841 fTanP=TMath::Tan(stereoP);
842 fTanN=TMath::Tan(stereoN);
843 Float_t kP = fTanP; // Tangent of 0.0075 mrad
844 Float_t kN = fTanN; // Tangent of 0.0275 mrad
850 // xP = N; // change the mistake for the P/N
851 //xN = P; // coordinates correspondence in this function
853 z=(xN-xP+dz*kN)/(kP+kN);
860 //cout<<"P= "<<P<<" , N= "<<N<<" , dx= "<<dx<<endl;
862 //cout<<"P="<<P<<", N="<<N<<endl;
864 if(TMath::Abs(xL) > dx/2 || TMath::Abs(zL) > dz/2) return kFALSE;
866 // Check that xL and zL are inside the detector for the
867 // correspondent xP and xN coordinates
871 //______________________________________________________________________
872 void AliITSClusterFinderSSD::GetCrossingError(Float_t& dP, Float_t& dN){
873 // get crossing error
876 dz = TMath::Abs(( dP + dN )*fPitch/(fTanP + fTanN) );
877 dx = fPitch*(TMath::Abs(dP*(1 - fTanP/(fTanP + fTanN))) +
878 TMath::Abs(dN *fTanP/(fTanP + fTanN) ));