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