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