Variable shadowing fixed
[u/mrichter/AliRoot.git] / ITS / AliITSRawClusterSDD.cxx
CommitLineData
41b19549 1/**************************************************************************
2 * Copyright(c) 2000-2004, 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#include <Riostream.h>
16#include <TMath.h>
17
18#include "AliITSRawClusterSDD.h"
19
20////////////////////////////////////////////////////
21// Cluster classes for set:ITS //
22// Raw Clusters for SDD //
23// //
24////////////////////////////////////////////////////
25
26ClassImp(AliITSRawClusterSDD)
27//______________________________________________________________________
a8d73343 28AliITSRawClusterSDD::AliITSRawClusterSDD():
29fX(0),
30fZ(0),
31fQ(0),
32fWing(0),
33fAnode(0),
34fTime(0),
35fAsigma(0),
36fTsigma(0),
37fPeakAmplitude(0),
38fSumAmplitude(0),
39fPeakPosition(-1),
40fNanodes(1),
41fTstart(0),
42fTstop(0),
43fTstartf(0),
44fTstopf(0),
45fAstart(0),
46fAstop(0)
47{
41b19549 48 // default constructor
a8d73343 49 fMultiplicity = 0;
41b19549 50}
51
52//______________________________________________________________________
53AliITSRawClusterSDD::AliITSRawClusterSDD(Int_t wing,
082dbaa2 54 Float_t anode,Float_t time,
55 Float_t charge,Float_t peakAmplitude,
56 Int_t peakPosition,
57 Float_t asigma,Float_t tsigma,
58 Float_t driftPath,
59 Float_t anodeOffset,
60 Int_t samples,Int_t tstart,
61 Int_t tstop,Int_t tstartf,
62 Int_t tstopf,Int_t anodes,
63 Int_t astart, Int_t astop):
a8d73343 64fX(0),
65fZ(0),
082dbaa2 66fQ(charge),
a8d73343 67fWing(wing),
082dbaa2 68fAnode(anode),
69fTime(time),
70fAsigma(asigma),
71fTsigma(tsigma),
72fPeakAmplitude(peakAmplitude),
a8d73343 73fSumAmplitude(0),
082dbaa2 74fPeakPosition(peakPosition),
75fNanodes(anodes),
76fTstart(tstart),
77fTstop(tstop),
78fTstartf(tstartf),
79fTstopf(tstopf),
80fAstart(astart),
81fAstop(astop){
41b19549 82 // constructor
83
41b19549 84 Int_t sign = 1;
85 for(Int_t i=0;i<fWing; i++) sign *= (-1);
082dbaa2 86 fX = driftPath*sign/10000.;
87 fZ = anodeOffset/10000.;
88 fMultiplicity = samples;
41b19549 89}
90//______________________________________________________________________
91AliITSRawClusterSDD::AliITSRawClusterSDD(const AliITSRawClusterSDD & source):
a8d73343 92 AliITSRawCluster(source),
93fX(source.fX),
94fZ(source.fZ),
95fQ(source.fQ),
96fWing(source.fWing),
97fAnode(source.fAnode),
98fTime(source.fTime),
99fAsigma(source.fAsigma),
100fTsigma(source.fTsigma),
101fPeakAmplitude(source.fPeakAmplitude),
102fSumAmplitude(source.fSumAmplitude),
103fPeakPosition(source.fPeakPosition),
104fNanodes(source.fNanodes),
105fTstart(source.fTstart),
106fTstop(source.fTstop),
107fTstartf(source.fTstartf),
108fTstopf(source.fTstopf),
109fAstart(source.fAstart),
110fAstop(source.fAstop){
41b19549 111 // copy constructor
112
41b19549 113 fMultiplicity = source.fMultiplicity;
41b19549 114}
115//______________________________________________________________________
116void AliITSRawClusterSDD::Add(AliITSRawClusterSDD* clJ) {
117 // add
118
119 fAnode = (fAnode*fQ + clJ->A()*clJ->Q())/(fQ+clJ->Q());
120 fTime = ( fTime*fQ + clJ->T()*clJ->Q())/(fQ+clJ->Q());
121 fX = ( fX*fQ + clJ->X()*clJ->Q())/(fQ+clJ->Q());
122 fZ = ( fZ*fQ + clJ->Z()*clJ->Q())/(fQ+clJ->Q());
123 fQ += clJ->Q();
124 if(fSumAmplitude == 0) fSumAmplitude += fPeakAmplitude;
125 /*
126 fAnode = (fAnode*fSumAmplitude+clJ->A()*clJ->PeakAmpl())/
127 (fSumAmplitude+clJ->PeakAmpl());
128 fTime = (fTime*fSumAmplitude +clJ->T()*clJ->PeakAmpl())/
129 (fSumAmplitude+clJ->PeakAmpl());
130 fX = (fX*fSumAmplitude +clJ->X()*clJ->PeakAmpl())/
131 (fSumAmplitude+clJ->PeakAmpl());
132 fZ = (fZ*fSumAmplitude +clJ->Z()*clJ->PeakAmpl())/
133 (fSumAmplitude+clJ->PeakAmpl());
134 */
135 fSumAmplitude += clJ->PeakAmpl();
136
137 fTstart = clJ->Tstart();
138 fTstop = clJ->Tstop();
139 if(fTstartf > clJ->Tstartf()) fTstartf = clJ->Tstartf();
140 if( fTstopf < clJ->Tstopf() ) fTstopf = clJ->Tstopf();
141 if( fAstop < clJ->Astop() ) fAstop = clJ->Astop();
142
143 fMultiplicity += (Int_t) (clJ->Samples());
144 (fNanodes)++;
145 if(clJ->PeakAmpl() > fPeakAmplitude) {
146 fPeakAmplitude = clJ->PeakAmpl();
147 fPeakPosition = clJ->PeakPos();
148 } // end if
149
150 return;
151}
152//______________________________________________________________________
153Bool_t AliITSRawClusterSDD::Brother(AliITSRawClusterSDD* cluster,
154 Float_t danode,Float_t dtime) {
155 // compare this with "cluster"
156 Bool_t brother = kFALSE;
157 Bool_t test2 = kFALSE;
158 Bool_t test3 = kFALSE;
159 Bool_t test4 = kFALSE;
160 Bool_t test5 = kFALSE;
161
162 if(fWing != cluster->W()) return brother;
163
164 if(fTstopf >= cluster->Tstart() &&
165 fTstartf <= cluster->Tstop()) test2 = kTRUE;
166 if(cluster->Astop() == (fAstop+1)) test3 = kTRUE;
167
168 if(TMath::Abs(fTime-cluster->T()) < dtime) test4 = kTRUE;
169 if(TMath::Abs(fAnode-cluster->A()) < danode) test5 = kTRUE;
170
171 if((test2 && test3) || (test4 && test5) ) {
172 return brother = kTRUE;
173 } // end if
174
175 return brother;
176}
177//______________________________________________________________________
178void AliITSRawClusterSDD::PrintInfo() const {
179 // print
180
181 cout << ", Anode " << fAnode << ", Time: " << fTime << ", Charge: " << fQ;
182 cout << ", Samples: " << fMultiplicity;
183 cout << ", X: " << fX << ", Z: " << fZ << "tstart " << fTstart
184 << "tstop "<< fTstop <<endl;
185}