]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSRawCluster.cxx
Added data member to SPD cluters and made related modifications to the
[u/mrichter/AliRoot.git] / ITS / AliITSRawCluster.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15  
16 /*
17 $Log$
18 Revision 1.7  2001/10/19 21:32:35  nilsen
19 Minor changes to remove compliation warning on gcc 2.92.2 compiler, and
20 cleanded up a little bit of code.
21
22 */
23 #include <iostream.h>
24 #include <TMath.h>
25  
26 #include "AliITSRawCluster.h"
27
28 ClassImp(AliITSRawCluster)
29 ClassImp(AliITSRawClusterSDD)
30
31 //______________________________________________________________________
32 AliITSRawClusterSDD::AliITSRawClusterSDD(Int_t wing,
33                                          Float_t Anode,Float_t Time,
34                                          Float_t Charge,Float_t PeakAmplitude,
35                                          Int_t PeakPosition,
36                                          Float_t Asigma,Float_t Tsigma,
37                                          Float_t DriftPath,
38                                          Float_t AnodeOffset,
39                                          Int_t Samples,Int_t Tstart,
40                                          Int_t Tstop,Int_t Tstartf,
41                                          Int_t Tstopf,Int_t Anodes, 
42                                          Int_t Astart, Int_t Astop){
43     // constructor
44
45     fWing          = wing;
46     fAnode         = Anode;
47     fTime          = Time;
48     fQ             = Charge;
49     fPeakAmplitude = PeakAmplitude;
50     fPeakPosition  = PeakPosition;
51     fAsigma        = Asigma;
52     fTsigma        = Tsigma;
53     fNanodes       = Anodes;
54     fTstart        = Tstart;
55     fTstop         = Tstop;
56     fTstartf       = Tstartf;
57     fTstopf        = Tstopf;
58     fAstart        = Astart;
59     fAstop         = Astop;
60     fMultiplicity  = Samples;
61     fSumAmplitude  = 0;
62
63     Int_t sign = 1;
64     for(Int_t i=0;i<fWing; i++) sign *= (-1);
65     fX = DriftPath*sign/10000.;
66     fZ = AnodeOffset/10000.;
67 }
68 //______________________________________________________________________
69 AliITSRawClusterSDD::AliITSRawClusterSDD( const AliITSRawClusterSDD & source){
70     // copy constructor
71
72     fWing          = source.fWing;
73     fAnode         = source.fAnode;
74     fTime          = source.fTime;
75     fQ             = source.fQ;
76     fPeakAmplitude = source.fPeakAmplitude;
77     fPeakPosition  = source.fPeakPosition;
78     fAsigma        = source.fAsigma;
79     fTsigma        = source.fTsigma;
80     fNanodes       = source.fNanodes;
81     fTstart        = source.fTstart;
82     fTstop         = source.fTstop;
83     fTstartf       = source.fTstartf;
84     fTstopf        = source.fTstopf;
85     fAstart        = source.fAstart;
86     fAstop         = source.fAstop;
87
88     fMultiplicity  = source.fMultiplicity;
89     fSumAmplitude  = source.fSumAmplitude;
90     fX             = source.fX;
91     fZ             = source.fZ;
92 }
93 //______________________________________________________________________
94 void AliITSRawClusterSDD::Add(AliITSRawClusterSDD* clJ) {
95     // add
96
97     fAnode = (fAnode*fQ + clJ->A()*clJ->Q())/(fQ+clJ->Q());
98     fTime  = ( fTime*fQ + clJ->T()*clJ->Q())/(fQ+clJ->Q());
99     fX     = (    fX*fQ + clJ->X()*clJ->Q())/(fQ+clJ->Q());
100     fZ     = (    fZ*fQ + clJ->Z()*clJ->Q())/(fQ+clJ->Q());
101     fQ += clJ->Q();
102     if(fSumAmplitude == 0) fSumAmplitude += fPeakAmplitude;
103     /*
104       fAnode = (fAnode*fSumAmplitude+clJ->A()*clJ->PeakAmpl())/
105                (fSumAmplitude+clJ->PeakAmpl());
106       fTime = (fTime*fSumAmplitude +clJ->T()*clJ->PeakAmpl())/
107               (fSumAmplitude+clJ->PeakAmpl());
108       fX = (fX*fSumAmplitude +clJ->X()*clJ->PeakAmpl())/
109            (fSumAmplitude+clJ->PeakAmpl());
110       fZ = (fZ*fSumAmplitude +clJ->Z()*clJ->PeakAmpl())/
111            (fSumAmplitude+clJ->PeakAmpl());
112     */
113     fSumAmplitude += clJ->PeakAmpl();
114
115     fTstart = clJ->Tstart();
116     fTstop  = clJ->Tstop();
117     if(fTstartf > clJ->Tstartf()) fTstartf = clJ->Tstartf();
118     if( fTstopf < clJ->Tstopf() ) fTstopf  = clJ->Tstopf();
119     if(  fAstop < clJ->Astop()  ) fAstop   = clJ->Astop();
120
121     fMultiplicity += (Int_t) (clJ->Samples());
122     (fNanodes)++;
123     if(clJ->PeakAmpl() > fPeakAmplitude) {
124         fPeakAmplitude = clJ->PeakAmpl();
125         fPeakPosition = clJ->PeakPos();
126     } // end if
127
128     return;
129 }
130 //______________________________________________________________________
131 Bool_t AliITSRawClusterSDD::Brother(AliITSRawClusterSDD* cluster,
132                                     Float_t danode,Float_t dtime) {
133
134     Bool_t brother = kFALSE;
135     Bool_t test2 = kFALSE;
136     Bool_t test3 = kFALSE;
137     Bool_t test4 = kFALSE;
138     Bool_t test5 = kFALSE;
139   
140     if(fWing != cluster->W()) return brother;
141
142     if(fTstopf >= cluster->Tstart() &&
143        fTstartf <= cluster->Tstop()) test2 = kTRUE;
144     if(cluster->Astop() == (fAstop+1)) test3 = kTRUE;
145
146     if(TMath::Abs(fTime-cluster->T()) < dtime) test4 = kTRUE;
147     if(TMath::Abs(fAnode-cluster->A()) < danode) test5 = kTRUE;
148
149     if((test2 && test3) || (test4 && test5) ) {
150         return brother = kTRUE;
151     } // end if
152   
153     return brother;
154 }
155 //______________________________________________________________________
156 void AliITSRawClusterSDD::PrintInfo() {
157     // print
158
159     cout << ", Anode " << fAnode << ", Time: " << fTime << ", Charge: " << fQ;
160     cout << ", Samples: " << fMultiplicity;
161     cout << ", X: " << fX << ", Z: " << fZ << "tstart " << fTstart 
162          << "tstop "<< fTstop <<endl;
163 }
164 //======================================================================
165 ClassImp(AliITSRawClusterSPD)
166 //______________________________________________________________________
167 AliITSRawClusterSPD::AliITSRawClusterSPD(Float_t clz,Float_t clx,
168                                          Float_t Charge,Int_t ClusterSizeZ,
169                                          Int_t ClusterSizeX,Int_t xstart,
170                                          Int_t xstop,
171                                          Float_t zstart,Float_t zstop,
172                                          Int_t zend,Int_t module) {
173     // constructor
174
175     fZ       = clz;
176     fX       = clx;
177     fQ       = Charge;
178     fNClZ    = ClusterSizeZ;
179     fNClX    = ClusterSizeX;
180     fXStart  = xstart;
181     fXStop   = xstop;
182     fZStart  = zstart;
183     fZStop   = zstop;
184     fZend    = zend;
185     fModule  = module;
186 }
187 //______________________________________________________________________
188 void AliITSRawClusterSPD::Add(AliITSRawClusterSPD* clJ) {
189     // Recolculate the new center of gravity coordinate and cluster sizes
190     // in both directions after grouping of clusters
191
192     if(this->fZStop < clJ->ZStop()) this->fZStop = clJ->ZStop();
193     this->fZ      = this->fZ + clJ->Z();
194     this->fX      = (this->fX + clJ->X())/2.;
195     this->fQ      = this->fQ + clJ->Q();
196     this->fXStart = clJ->XStart(); // for a comparison with the next
197     this->fXStop  = clJ->XStop();  // z column
198     if(this->fZend < clJ->Zend())       this->fZend    = clJ->Zend();
199     this->fNClX   = this->fXStop - this->fXStart + 1; 
200     (this->fNClZ)++;
201
202     return;
203 }
204 //______________________________________________________________________
205 Bool_t AliITSRawClusterSPD::Brother(AliITSRawClusterSPD* cluster,
206                                     Float_t dz,Float_t dx) {
207     // fXStart, fXstop and fZend information is used now instead of dz and dx
208     // to check an absent (or a present) of the gap between two pixels in 
209     // both x and z directions. The increasing order of fZend is used.
210     Bool_t brother = kFALSE;  
211     Bool_t test2 = kFALSE;  
212     Bool_t test3 = kFALSE;
213
214     // Diagonal clusters are included:
215     if(fXStop >= (cluster->XStart() -1) && 
216        fXStart <= (cluster->XStop()+1)) test2 = kTRUE;
217
218     // Diagonal clusters are excluded:   
219     // if(fXStop >= cluster->XStart() &&
220     //    fXStart <= cluster->XStop()) test2 = kTRUE;
221     if(cluster->Zend() == (fZend + 1)) test3 = kTRUE; 
222     if(test2 && test3) {
223         // cout<<"test 2,3 0k, brother = true "<<endl;
224         return brother = kTRUE;
225     } // end if
226     return brother;
227 }
228 //______________________________________________________________________
229 void AliITSRawClusterSPD::PrintInfo(){
230     // print
231
232     cout << ", Z: " << fZ << ", X: " << fX << ", Charge: " << fQ<<endl;
233     cout << " Z cluster size: " << fNClZ <<", X cluster size "<< fNClX <<endl;
234     cout <<" XStart, XStop,Zend, Module ="<<fXStart<<","
235          <<fXStop<<","<<fZend << "," << fModule<<endl;
236 }
237 //======================================================================
238 ClassImp(AliITSRawClusterSSD)
239 //______________________________________________________________________
240 AliITSRawClusterSSD::AliITSRawClusterSSD(Float_t Prob,Int_t Sp,Int_t Sn) {  
241     // constructor
242
243     //fProbability   = Prob;
244     fMultiplicity  = Sp;
245     fMultiplicityN = Sn;
246 }