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 **************************************************************************/
17 ////////////////////////////////////////////////////////////////////////////
18 //Piotr Krzysztof Skowronski //
19 //Warsaw University of Technology //
20 //skowron@if.pw.edu.pl //
22 // Describes set of neighbouring digits on one side of detector, //
23 // that are supposed to be generated by one particle. //
24 // includes information about clusters on other side that it crosses with //
25 ////////////////////////////////////////////////////////////////////////////
28 #include "TClonesArray.h"
29 #include "AliITSdigitSSD.h"
30 #include "AliITSclusterSSD.h"
32 ClassImp(AliITSclusterSSD)
34 //______________________________________________________________________
35 AliITSclusterSSD::AliITSclusterSSD(){
36 // default constructor
45 fLeftNeighbour = kFALSE;
46 fRightNeighbour = kFALSE;
47 fCrossedClusterIndexes = 0;
50 //______________________________________________________________________
51 AliITSclusterSSD::AliITSclusterSSD(Int_t ndigits, Int_t *DigitIndexes,
52 TObjArray *Digits, Bool_t side){
53 // non-default constructor
58 fDigitsIndex = new TArrayI(fNDigits,DigitIndexes );
60 fCrossedClusterIndexes = new TArrayI(300);
61 fLeftNeighbour = kFALSE;
62 fRightNeighbour = kFALSE;
67 //______________________________________________________________________
68 AliITSclusterSSD::~AliITSclusterSSD(){
72 delete fCrossedClusterIndexes;
74 //______________________________________________________________________
75 AliITSclusterSSD::AliITSclusterSSD(const AliITSclusterSSD &OneSCluster) :
79 if (this == &OneSCluster) return;
80 fNDigits = OneSCluster.fNDigits;
81 fSide=OneSCluster.fSide;
82 fDigits=OneSCluster.fDigits;
83 fDigitsIndex = new TArrayI(fNDigits);
84 fLeftNeighbour = OneSCluster.fLeftNeighbour;
85 fRightNeighbour = OneSCluster.fRightNeighbour;
88 fNCrosses = OneSCluster.fNCrosses;
89 fConsumed = OneSCluster.fConsumed;
91 for (i = 0; i< fNCrosses ; i++){
92 fCrossedClusterIndexes[i] = OneSCluster.fCrossedClusterIndexes[i];
94 for (i = 0; i< fNDigits ; i++){
95 fDigitsIndex[i]=OneSCluster.fDigitsIndex[i];
99 //______________________________________________________________________
100 AliITSclusterSSD& AliITSclusterSSD::operator=(const AliITSclusterSSD
102 // assignment operator
104 if (this == &OneSCluster) return *this;
105 fNDigits = OneSCluster.fNDigits;
106 fSide=OneSCluster.fSide;
107 fDigits=OneSCluster.fDigits;
108 fDigitsIndex = new TArrayI(fNDigits);
109 fLeftNeighbour = OneSCluster.fLeftNeighbour;
110 fRightNeighbour = OneSCluster.fRightNeighbour;
113 fNCrosses = OneSCluster.fNCrosses;
114 fConsumed = OneSCluster.fConsumed;
116 for (i = 0; i< fNCrosses ; i++){
117 fCrossedClusterIndexes[i] = OneSCluster.fCrossedClusterIndexes[i];
119 for (i = 0; i< fNDigits ; i++){
120 fDigitsIndex[i]=OneSCluster.fDigitsIndex[i];
124 //______________________________________________________________________
125 Int_t AliITSclusterSSD::SplitCluster(Int_t where, Int_t *outdigits){
126 //This methods generate data necessery to make new object of this class
127 //I choosen this way, because methods TClonesArray::Add* dont work
128 //so I have to use constraction: new (a[i]) Creator(params...);
129 //where 'a' is a TClonesArray
130 //This method generate params - see AliITSmoduleSSD::SplitCluster;
131 Int_t tmp = fNDigits;
134 outdigits[ind++]=(*fDigitsIndex)[where];
135 //coping border strip (it is shared by this two clusters)
136 for (Int_t i = (where+1); i < tmp; i++) {
137 outdigits[ind++]=(*fDigitsIndex)[i];
138 //"moving" strips from this to the new one
139 (*fDigitsIndex)[i]=-1;
140 fNDigits--; //deleting strips from this cluster
144 //______________________________________________________________________
145 Int_t AliITSclusterSSD::GetDigitStripNo(Int_t digit){
146 // return strip no of a digit
147 if (digit<0) return -1;
148 return (digit>(fNDigits-1)) ? -1 :
149 ((AliITSdigitSSD*)(fDigits->At((*fDigitsIndex)[digit])))->GetStripNumber();
151 //______________________________________________________________________
152 Int_t AliITSclusterSSD::GetDigitSignal(Int_t digit){
153 // returns digit signal
155 if (digit<0||digit>=fNDigits) return -1;
156 index = (*fDigitsIndex)[digit];
157 signal = ((AliITSdigitSSD*)(fDigits->At(index)))->GetSignal();
159 if(signal>1.e5) printf("GetDigitSignal: digit %d index %d signal %d\n",
160 digit,index, signal);
164 //______________________________________________________________________
165 void AliITSclusterSSD::AddCross(Int_t clIndex){
166 // add cluster cross to list of cluster crosses
168 (*fCrossedClusterIndexes)[fNCrosses++] = clIndex;
170 //______________________________________________________________________
171 Int_t AliITSclusterSSD::GetCross(Int_t crIndex) const {
172 // return crossing cluster
174 return ((crIndex>-1)&&(crIndex<fNCrosses))?(*fCrossedClusterIndexes)[crIndex]:-1;
176 //______________________________________________________________________
177 Double_t AliITSclusterSSD::CentrOfGravity(){
178 // return center of gravity of the cluster
181 if (fLeftNeighbour) ret+=(GetDigitStripNo(0)*0.5*GetDigitSignal(0));
182 else ret+=(GetDigitStripNo(0)*GetDigitSignal(0));
183 if (fRightNeighbour) ret+=(GetDigitStripNo(fNDigits -1)*0.5*GetDigitSignal(fNDigits -1));
184 else ret+=(GetDigitStripNo(fNDigits -1)*GetDigitSignal(fNDigits-1));
185 for (Int_t i=1;i<fNDigits-1;i++){
186 ret +=GetDigitStripNo(i)*GetDigitSignal(i);
189 if (fTotalSignal<0) GetTotalSignal();
191 return (ret/fTotalSignal);
193 //______________________________________________________________________
194 Float_t AliITSclusterSSD::GetTotalSignal(){
195 // return total signal
200 fTotalSignal = (Float_t)GetDigitSignal(0);
201 //printf("1 digit: signal %d \n",GetDigitSignal(0));
204 if (fLeftNeighbour) fTotalSignal += (Float_t)(0.5*GetDigitSignal(0));
205 else fTotalSignal += (Float_t) GetDigitSignal(0);
206 //printf("GetTotalSignal :i DigitSignal %d %d \n",0,GetDigitSignal(0));
207 if (fRightNeighbour) fTotalSignal += (Float_t)(0.5*GetDigitSignal(
209 else fTotalSignal += (Float_t)GetDigitSignal(fNDigits-1);
210 //printf("GetTotalSignal :i DigitSignal %d %d \n",fNDigits -1,GetDigitSignal(fNDigits -1));
211 for (Int_t i = 1;i<fNDigits -1;i++){
212 fTotalSignal += (Float_t)GetDigitSignal(i);
213 //printf("GetTotalSignal :i DigitSignal %d %d \n",i,GetDigitSignal(i));
215 //printf("GetTotalSignal: fNDigits %d fTotalSignal %.0f \n",fNDigits,fTotalSignal);
219 //______________________________________________________________________
220 Float_t AliITSclusterSSD::GetTotalSignalError(){
221 // return the error on the signal
223 for (Int_t i =1; i<fNDigits -1; i++){
224 err+=0.1*GetDigitSignal(i);
226 if (GetLeftNeighbour()){
227 err+=GetDigitSignal(0);
229 err+=0.1*GetDigitSignal(0);
231 if (GetRightNeighbour()){
232 err+=GetDigitSignal(fNDigits -1);
234 err+=0.1*GetDigitSignal(fNDigits -1);
238 //______________________________________________________________________
239 void AliITSclusterSSD::DelCross(Int_t index){
240 // remove cross clusters from the list of cross clusters
241 Int_t i,j; //iterators
243 for (i =0;i<fNCrosses;i++){
244 if ((*fCrossedClusterIndexes)[i] == index){
245 for (j=i;j<fNCrosses-1;j++){
246 (*fCrossedClusterIndexes)[j]=(*fCrossedClusterIndexes)[j+1];
253 //______________________________________________________________________
254 Int_t *AliITSclusterSSD::GetTracks(Int_t &nt){
255 // return the track number of the cluster
256 Int_t ntrk = GetDigit(0)->GetNTracks();
257 Int_t ndig = GetNumOfDigits();
258 Int_t *idig = new Int_t[ndig];
259 Int_t *sdig = new Int_t[ndig];
260 Int_t *itrk = new Int_t[ndig*ntrk];
264 for(i=0;i<ndig;i++){idig[i] = i;sdig[i] = GetDigit(i)->GetSignal();}
265 TMath::Sort(ndig,sdig,idig,kTRUE);
266 for(i=0;i<ndig*ntrk;i++) itrk[i] = -3;
268 for(i=0;i<ndig;i++){ // fill itrk with track numbers in order of digit size
270 for(k=0;k<ntrk;k++) if((trk = GetDigit(j)->GetTrack(k))>=0) {
275 for(i=0;i<10;i++) fTrack[i] = -3;
276 fTrack[0] = itrk[0]; // first element
280 for(j=0;j<k;j++) if(fTrack[j]==itrk[i]) b = kFALSE;
281 if(b){fTrack[k] = itrk[i]; k++;}
298 for (i=0;i<10;i++) fTrack[i] = -3;
300 //cout<<"GetTrack start -------: fNDigits ="<<fNDigits<<endl;
302 for (i = 0; i<fNDigits; i++) {
303 tidx = GetDigit(i)->GetTracks();
304 n = GetDigit(i)->GetNTracks();
305 for (j = 0; j<n && j<10;j++) {
308 fTrack[ntracks] = tidx[j];
310 }else if(tidx[j] != fTrack[ntracks-1]){
315 } // end if ntracks > 9
316 fTrack[ntracks-1] = tidx[j];
317 } // end if ntracke == 0
318 } // end if tidx[j] >=0
319 } // 3-tracks loop for the digit
328 //______________________________________________________________________
329 Double_t AliITSclusterSSD::GetPosition(){
330 // return position of the cluster
335 ret = GetDigitStripNo(0);
338 ret = EtaAlgorithm();
341 ret = CentrOfGravity();
345 //______________________________________________________________________
346 Double_t AliITSclusterSSD::EtaAlgorithm(){
347 // algorithm for determing cluster position
348 if (fNDigits != 2) return -1;
350 Int_t strip1 = GetDigit(0)->GetStripNumber();
351 Int_t strip2 = GetDigit(1)->GetStripNumber();
352 Int_t signal1 = GetDigit(0)->GetSignal();
353 Int_t signal2 = GetDigit(1)->GetSignal();
359 eta = ((Double_t)signal2)/((Double_t)(signal1+signal2));
360 if (eta<0.04) return strip1;
361 if (eta>0.96) return strip2;
362 return (strip1 + 0.43478261*eta + 0.2826087);
364 eta = ((Double_t)signal1)/((Double_t)(signal1+signal2));
365 if (eta<0.04) return strip2;
366 if (eta>0.96) return strip1;
367 return (strip2 + 0.43478261*eta + 0.2826087);
370 //______________________________________________________________________
371 Double_t AliITSclusterSSD::GetPositionError() const {
372 // return the position error
373 return (GetNumOfDigits()+1)/2;
375 //______________________________________________________________________
376 Bool_t AliITSclusterSSD::IsCrossingWith(Int_t idx) const{
377 // return the cluster to which he crosses
379 for (Int_t i =0; i< fNCrosses;i++){
380 if (GetCross(i) == idx) return kTRUE;