]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSRawCluster.cxx
Bug fix in the creation of the AliITSgeom::fShape entry for SPD. Now there is both...
[u/mrichter/AliRoot.git] / ITS / AliITSRawCluster.cxx
CommitLineData
b0f5e3fc 1#include <iostream.h>
2#include <TMath.h>
3
4#include "AliITSRawCluster.h"
5
6ClassImp(AliITSRawCluster)
7
8ClassImp(AliITSRawClusterSDD)
9//--------------------------------------
44d4400c 10AliITSRawClusterSDD::AliITSRawClusterSDD(Int_t wing, Float_t Anode,Float_t Time, Float_t Charge,
11 Float_t PeakAmplitude,Int_t PeakPosition, Float_t Asigma, Float_t Tsigma, Float_t DriftPath, Float_t AnodeOffset, Int_t Samples,
12 Int_t Tstart, Int_t Tstop, Int_t Tstartf, Int_t Tstopf, Int_t Anodes, Int_t Astart, Int_t Astop)
13{
b0f5e3fc 14 // constructor
15 fWing = wing;
16 fAnode = Anode;
17 fTime = Time;
18 fQ = Charge;
19 fPeakAmplitude = PeakAmplitude;
313ba434 20 fPeakPosition = PeakPosition;
44d4400c 21 fAsigma = Asigma;
22 fTsigma = Tsigma;
23 fNanodes = Anodes;
24 fTstart = Tstart;
25 fTstop = Tstop;
26 fTstartf = Tstartf;
27 fTstopf = Tstopf;
28 fAstart = Astart;
29 fAstop = Astop;
30 fMultiplicity = Samples;
31 fSumAmplitude = 0;
b0f5e3fc 32 Int_t sign = 1;
e8189707 33 for(Int_t i=0;i<fWing; i++) sign*=(-1);
b0f5e3fc 34 fX = DriftPath*sign/10000.;
35 fZ = AnodeOffset/10000.;
36}
44d4400c 37AliITSRawClusterSDD::AliITSRawClusterSDD( const AliITSRawClusterSDD & source)
38{
39 // copy constructor
40 fWing = source.fWing;
41 fAnode = source.fAnode;
42 fTime = source.fTime;
43 fQ = source.fQ;
44 fPeakAmplitude = source.fPeakAmplitude;
45 fPeakPosition = source.fPeakPosition;
46 fAsigma = source.fAsigma;
47 fTsigma = source.fTsigma;
48 fNanodes = source.fNanodes;
49 fTstart = source.fTstart;
50 fTstop = source.fTstop;
51 fTstartf = source.fTstartf;
52 fTstopf = source.fTstopf;
53 fAstart = source.fAstart;
54 fAstop = source.fAstop;
b0f5e3fc 55
44d4400c 56 fMultiplicity = source.fMultiplicity;
57 fSumAmplitude = source.fSumAmplitude;
58 fX = source.fX;
59 fZ = source.fZ;
60}
b0f5e3fc 61//----------------------------------------
62void AliITSRawClusterSDD::Add(AliITSRawClusterSDD* clJ) {
63 // add
64 fAnode = (fAnode*fQ + clJ->A()*clJ->Q())/(fQ+clJ->Q());
65 fTime = (fTime*fQ + clJ->T()*clJ->Q())/(fQ+clJ->Q());
66 fX = (fX*fQ + clJ->X()*clJ->Q())/(fQ+clJ->Q());
67 fZ = (fZ*fQ + clJ->Z()*clJ->Q())/(fQ+clJ->Q());
68 fQ += clJ->Q();
44d4400c 69 if(fSumAmplitude == 0) fSumAmplitude += fPeakAmplitude;
70 /*
71 fAnode = (fAnode*fSumAmplitude+clJ->A()*clJ->PeakAmpl())/(fSumAmplitude+clJ->PeakAmpl());
72 fTime = (fTime*fSumAmplitude +clJ->T()*clJ->PeakAmpl())/(fSumAmplitude+clJ->PeakAmpl());
73 fX = (fX*fSumAmplitude +clJ->X()*clJ->PeakAmpl())/(fSumAmplitude+clJ->PeakAmpl());
74 fZ = (fZ*fSumAmplitude +clJ->Z()*clJ->PeakAmpl())/(fSumAmplitude+clJ->PeakAmpl());
75 */
76 fSumAmplitude += clJ->PeakAmpl();
77
78 fTstart = clJ->Tstart();
79 fTstop = clJ->Tstop();
80 if(fTstartf > clJ->Tstartf()) fTstartf = clJ->Tstartf();
81 if(fTstopf < clJ->Tstopf()) fTstopf = clJ->Tstopf();
82 if(fAstop < clJ->Astop()) fAstop = clJ->Astop();
83
84 fMultiplicity += (Int_t) (clJ->Samples());
b0f5e3fc 85 (fNanodes)++;
313ba434 86 if(clJ->PeakAmpl() > fPeakAmplitude) {
87 fPeakAmplitude = clJ->PeakAmpl();
88 fPeakPosition = clJ->PeakPos();
89 }
b0f5e3fc 90
91 return;
92}
44d4400c 93
b0f5e3fc 94//--------------------------------------
95Bool_t AliITSRawClusterSDD::Brother(AliITSRawClusterSDD* cluster,Float_t danode,Float_t dtime) {
44d4400c 96
97 Bool_t brother = kFALSE;
98
99 Bool_t test2 = kFALSE;
100 Bool_t test3 = kFALSE;
101 Bool_t test4 = kFALSE;
102 Bool_t test5 = kFALSE;
103
104 if(fWing != cluster->W()) return brother;
105
106 if(fTstopf >= cluster->Tstart() && fTstartf <= cluster->Tstop()) test2 = kTRUE;
107 if(cluster->Astop() == (fAstop+1)) test3 = kTRUE;
108
109 if(TMath::Abs(fTime-cluster->T()) < dtime) test4 = kTRUE;
110 if(TMath::Abs(fAnode-cluster->A()) < danode) test5 = kTRUE;
111
112 if((test2 && test3) || (test4 && test5) ) {
113 return brother = kTRUE;
114 }
115
b0f5e3fc 116 return brother;
117}
118
119//--------------------------------------
e8189707 120void AliITSRawClusterSDD::PrintInfo() {
b0f5e3fc 121 // print
122 cout << ", Anode " << fAnode << ", Time: " << fTime << ", Charge: " << fQ;
44d4400c 123 cout << ", Samples: " << fMultiplicity;
124 cout << ", X: " << fX << ", Z: " << fZ << "tstart " << fTstart << "tstop "<< fTstop <<endl;
b0f5e3fc 125}
126//--------------------------------------
127
128
129ClassImp(AliITSRawClusterSPD)
130 //--------------------------------------
131
132 AliITSRawClusterSPD::AliITSRawClusterSPD(Float_t clz,Float_t clx,Float_t Charge,Int_t ClusterSizeZ,Int_t ClusterSizeX,Int_t xstart,Int_t xstop,Int_t xstartf,Int_t xstopf,Float_t zstart,Float_t zstop,Int_t zend) {
133 // constructor
134
135 fZ = clz;
136 fX = clx;
137 fQ = Charge;
138 fNClZ = ClusterSizeZ;
139 fNClX = ClusterSizeX;
140 fXStart = xstart;
141 fXStop = xstop;
142 fXStartf = xstartf;
143 fXStopf = xstopf;
144 fZStart = zstart;
145 fZStop = zstop;
146 fZend = zend;
147}
148
149//--------------------------------------
150void AliITSRawClusterSPD::Add(AliITSRawClusterSPD* clJ) {
151 // Recolculate the new center of gravity coordinate and cluster sizes
152 // in both directions after grouping of clusters
153
154 if(this->fZStop < clJ->ZStop()) this->fZStop = clJ->ZStop();
155
156 this->fZ = (this->fZ + clJ->Z())/2.;
157 this->fX = (this->fX + clJ->X())/2.;
158 this->fQ = this->fQ + clJ->Q();
159
160 this->fXStart = clJ->XStart(); // for a comparison with the next
161 this->fXStop = clJ->XStop(); // z column
162
163 if(this->fXStartf > clJ->XStartf()) this->fXStartf = clJ->XStartf();
164 if(this->fXStopf < clJ->XStopf()) this->fXStopf = clJ->XStopf();
165 if(this->fZend < clJ->Zend()) this->fZend = clJ->Zend();
166 this->fNClX = this->fXStopf - this->fXStartf + 1;
167 (this->fNClZ)++;
168
169 return;
170}
171
172//--------------------------------------
173Bool_t AliITSRawClusterSPD::Brother(AliITSRawClusterSPD* cluster,Float_t dz,Float_t dx) {
174 // fXStart, fXstop and fZend information is used now instead of dz and dx
175 // to check an absent (or a present) of the gap between two pixels in
176 // both x and z directions. The increasing order of fZend is used.
177
178 Bool_t brother = kFALSE;
179 Bool_t test2 = kFALSE;
180 Bool_t test3 = kFALSE;
181
182 // Diagonal clusters are included:
183 if(fXStop >= (cluster->XStart() -1) && fXStart <= (cluster->XStop()+1)) test2 = kTRUE;
184
185 // Diagonal clusters are excluded:
186 // if(fXStop >= cluster->XStart() && fXStart <= cluster->XStop()) test2 = kTRUE;
187 if(cluster->Zend() == (fZend + 1)) test3 = kTRUE;
188 if(test2 && test3) {
189 // cout<<"test 2,3 0k, brother = true "<<endl;
190 return brother = kTRUE;
191 }
192 return brother;
193}
194
195//--------------------------------------
e8189707 196void AliITSRawClusterSPD::PrintInfo()
b0f5e3fc 197{
198 // print
199 cout << ", Z: " << fZ << ", X: " << fX << ", Charge: " << fQ<<endl;
200 cout << " Z cluster size: " << fNClZ <<", X cluster size "<< fNClX <<endl;
201 cout <<" XStart, XStop, XStartf,XStopf,Zend ="<<fXStart<<","<<fXStop<<","<<fXStartf<<","<<fXStopf<<","<<fZend<<endl;
202
203}
204
205
206ClassImp(AliITSRawClusterSSD)
207 //--------------------------------------
208 AliITSRawClusterSSD::AliITSRawClusterSSD(Float_t Prob,Int_t Sp,Int_t Sn) {
209 // constructor
210 //fProbability = Prob;
211 fMultiplicity = Sp;
212 fMultiplicityN = Sn;
213
214}