]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSRawCluster.cxx
Bugfix in AliPoints2Memory
[u/mrichter/AliRoot.git] / ITS / AliITSRawCluster.cxx
CommitLineData
b48af428 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$
9e1e0cd7 18Revision 1.7 2001/10/19 21:32:35 nilsen
19Minor changes to remove compliation warning on gcc 2.92.2 compiler, and
20cleanded up a little bit of code.
21
b48af428 22*/
b0f5e3fc 23#include <iostream.h>
24#include <TMath.h>
25
26#include "AliITSRawCluster.h"
27
28ClassImp(AliITSRawCluster)
b0f5e3fc 29ClassImp(AliITSRawClusterSDD)
b48af428 30
31//______________________________________________________________________
32AliITSRawClusterSDD::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.;
b0f5e3fc 67}
b48af428 68//______________________________________________________________________
69AliITSRawClusterSDD::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;
44d4400c 92}
b48af428 93//______________________________________________________________________
b0f5e3fc 94void AliITSRawClusterSDD::Add(AliITSRawClusterSDD* clJ) {
b48af428 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//______________________________________________________________________
131Bool_t AliITSRawClusterSDD::Brother(AliITSRawClusterSDD* cluster,
132 Float_t danode,Float_t dtime) {
44d4400c 133
b48af428 134 Bool_t brother = kFALSE;
b48af428 135 Bool_t test2 = kFALSE;
136 Bool_t test3 = kFALSE;
137 Bool_t test4 = kFALSE;
138 Bool_t test5 = kFALSE;
44d4400c 139
b48af428 140 if(fWing != cluster->W()) return brother;
44d4400c 141
b48af428 142 if(fTstopf >= cluster->Tstart() &&
143 fTstartf <= cluster->Tstop()) test2 = kTRUE;
144 if(cluster->Astop() == (fAstop+1)) test3 = kTRUE;
44d4400c 145
b48af428 146 if(TMath::Abs(fTime-cluster->T()) < dtime) test4 = kTRUE;
147 if(TMath::Abs(fAnode-cluster->A()) < danode) test5 = kTRUE;
44d4400c 148
b48af428 149 if((test2 && test3) || (test4 && test5) ) {
150 return brother = kTRUE;
151 } // end if
44d4400c 152
b48af428 153 return brother;
b0f5e3fc 154}
b48af428 155//______________________________________________________________________
e8189707 156void AliITSRawClusterSDD::PrintInfo() {
b48af428 157 // print
b0f5e3fc 158
b48af428 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//======================================================================
b0f5e3fc 165ClassImp(AliITSRawClusterSPD)
b48af428 166//______________________________________________________________________
167AliITSRawClusterSPD::AliITSRawClusterSPD(Float_t clz,Float_t clx,
168 Float_t Charge,Int_t ClusterSizeZ,
169 Int_t ClusterSizeX,Int_t xstart,
9e1e0cd7 170 Int_t xstop,
b48af428 171 Float_t zstart,Float_t zstop,
9e1e0cd7 172 Int_t zend,Int_t module) {
b48af428 173 // constructor
174
175 fZ = clz;
176 fX = clx;
177 fQ = Charge;
178 fNClZ = ClusterSizeZ;
179 fNClX = ClusterSizeX;
180 fXStart = xstart;
181 fXStop = xstop;
b48af428 182 fZStart = zstart;
183 fZStop = zstop;
184 fZend = zend;
9e1e0cd7 185 fModule = module;
b0f5e3fc 186}
b48af428 187//______________________________________________________________________
b0f5e3fc 188void AliITSRawClusterSPD::Add(AliITSRawClusterSPD* clJ) {
b48af428 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
b48af428 198 if(this->fZend < clJ->Zend()) this->fZend = clJ->Zend();
9e1e0cd7 199 this->fNClX = this->fXStop - this->fXStart + 1;
b48af428 200 (this->fNClZ)++;
201
202 return;
b0f5e3fc 203}
b48af428 204//______________________________________________________________________
205Bool_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;
b0f5e3fc 227}
b48af428 228//______________________________________________________________________
229void 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;
9e1e0cd7 234 cout <<" XStart, XStop,Zend, Module ="<<fXStart<<","
235 <<fXStop<<","<<fZend << "," << fModule<<endl;
b48af428 236}
237//======================================================================
b0f5e3fc 238ClassImp(AliITSRawClusterSSD)
b48af428 239//______________________________________________________________________
240AliITSRawClusterSSD::AliITSRawClusterSSD(Float_t Prob,Int_t Sp,Int_t Sn) {
241 // constructor
242
243 //fProbability = Prob;
244 fMultiplicity = Sp;
245 fMultiplicityN = Sn;
b0f5e3fc 246}