]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSRawCluster.cxx
new classes for raw data processing (T. Kuhr)
[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$
4ae5bbc4 18Revision 1.9 2002/10/14 14:57:00 hristov
19Merging the VirtualMC branch to the main development branch (HEAD)
20
b9d0a01d 21Revision 1.7.6.1 2002/08/28 15:06:50 alibrary
22Updating to v3-09-01
23
24Revision 1.8 2002/08/21 22:04:27 nilsen
25Added data member to SPD cluters and made related modifications to the
26SPD Cluster finders. Generaly cleanded up some of the code.
27
9e1e0cd7 28Revision 1.7 2001/10/19 21:32:35 nilsen
29Minor changes to remove compliation warning on gcc 2.92.2 compiler, and
30cleanded up a little bit of code.
31
b48af428 32*/
4ae5bbc4 33#include <Riostream.h>
b0f5e3fc 34#include <TMath.h>
35
36#include "AliITSRawCluster.h"
37
38ClassImp(AliITSRawCluster)
b0f5e3fc 39ClassImp(AliITSRawClusterSDD)
b48af428 40
41//______________________________________________________________________
42AliITSRawClusterSDD::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.;
b0f5e3fc 77}
b48af428 78//______________________________________________________________________
79AliITSRawClusterSDD::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;
44d4400c 102}
b48af428 103//______________________________________________________________________
b0f5e3fc 104void AliITSRawClusterSDD::Add(AliITSRawClusterSDD* clJ) {
b48af428 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//______________________________________________________________________
141Bool_t AliITSRawClusterSDD::Brother(AliITSRawClusterSDD* cluster,
142 Float_t danode,Float_t dtime) {
44d4400c 143
b48af428 144 Bool_t brother = kFALSE;
b48af428 145 Bool_t test2 = kFALSE;
146 Bool_t test3 = kFALSE;
147 Bool_t test4 = kFALSE;
148 Bool_t test5 = kFALSE;
44d4400c 149
b48af428 150 if(fWing != cluster->W()) return brother;
44d4400c 151
b48af428 152 if(fTstopf >= cluster->Tstart() &&
153 fTstartf <= cluster->Tstop()) test2 = kTRUE;
154 if(cluster->Astop() == (fAstop+1)) test3 = kTRUE;
44d4400c 155
b48af428 156 if(TMath::Abs(fTime-cluster->T()) < dtime) test4 = kTRUE;
157 if(TMath::Abs(fAnode-cluster->A()) < danode) test5 = kTRUE;
44d4400c 158
b48af428 159 if((test2 && test3) || (test4 && test5) ) {
160 return brother = kTRUE;
161 } // end if
44d4400c 162
b48af428 163 return brother;
b0f5e3fc 164}
b48af428 165//______________________________________________________________________
e8189707 166void AliITSRawClusterSDD::PrintInfo() {
b48af428 167 // print
b0f5e3fc 168
b48af428 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//======================================================================
b0f5e3fc 175ClassImp(AliITSRawClusterSPD)
b48af428 176//______________________________________________________________________
177AliITSRawClusterSPD::AliITSRawClusterSPD(Float_t clz,Float_t clx,
178 Float_t Charge,Int_t ClusterSizeZ,
179 Int_t ClusterSizeX,Int_t xstart,
9e1e0cd7 180 Int_t xstop,
b48af428 181 Float_t zstart,Float_t zstop,
9e1e0cd7 182 Int_t zend,Int_t module) {
b48af428 183 // constructor
184
185 fZ = clz;
186 fX = clx;
187 fQ = Charge;
188 fNClZ = ClusterSizeZ;
189 fNClX = ClusterSizeX;
190 fXStart = xstart;
191 fXStop = xstop;
b48af428 192 fZStart = zstart;
193 fZStop = zstop;
194 fZend = zend;
9e1e0cd7 195 fModule = module;
b0f5e3fc 196}
b48af428 197//______________________________________________________________________
b0f5e3fc 198void AliITSRawClusterSPD::Add(AliITSRawClusterSPD* clJ) {
b48af428 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
b48af428 208 if(this->fZend < clJ->Zend()) this->fZend = clJ->Zend();
9e1e0cd7 209 this->fNClX = this->fXStop - this->fXStart + 1;
b48af428 210 (this->fNClZ)++;
211
212 return;
b0f5e3fc 213}
b48af428 214//______________________________________________________________________
215Bool_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;
b0f5e3fc 237}
b48af428 238//______________________________________________________________________
239void 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;
9e1e0cd7 244 cout <<" XStart, XStop,Zend, Module ="<<fXStart<<","
245 <<fXStop<<","<<fZend << "," << fModule<<endl;
b48af428 246}
247//======================================================================
b0f5e3fc 248ClassImp(AliITSRawClusterSSD)
b48af428 249//______________________________________________________________________
250AliITSRawClusterSSD::AliITSRawClusterSSD(Float_t Prob,Int_t Sp,Int_t Sn) {
251 // constructor
252
253 //fProbability = Prob;
254 fMultiplicity = Sp;
255 fMultiplicityN = Sn;
b0f5e3fc 256}