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