]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/AliTPCclusterKr.cxx
bug fixed
[u/mrichter/AliRoot.git] / TPC / AliTPCclusterKr.cxx
CommitLineData
e2a4d72c 1/**************************************************************************\r
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
3 * *\r
4 * Author: The ALICE Off-line Project. *\r
5 * Contributors are mentioned in the code where appropriate. *\r
6 * *\r
7 * Permission to use, copy, modify and distribute this software and its *\r
8 * documentation strictly for non-commercial purposes is hereby granted *\r
9 * without fee, provided that the above copyright notice appears in all *\r
10 * copies and that both the copyright notice and this permission notice *\r
11 * appear in the supporting documentation. The authors make no claims *\r
12 * about the suitability of this software for any purpose. It is *\r
13 * provided "as is" without express or implied warranty. *\r
14 **************************************************************************/\r
15\r
16/* $Id: AliTPCclusterKr.cxx,v 1.7 2008/01/22 17:24:53 matyja Exp $ */\r
17\r
18//-----------------------------------------------------------------\r
19// Implementation of the TPC Kr cluster class\r
20//\r
21// Origin: Adam Matyja, INP PAN, adam.matyja@ifj.edu.pl\r
22//-----------------------------------------------------------------\r
23\r
24#include "AliTPCclusterKr.h"\r
25#include "AliCluster.h"\r
26#include "AliTPCvtpr.h"\r
27#include "TObjArray.h"\r
28//#include "TH1F.h"\r
29#include "TMath.h"\r
30#include "TArrayI.h"\r
31\r
32ClassImp(AliTPCclusterKr)\r
33\r
34\r
35AliTPCclusterKr::AliTPCclusterKr()\r
36:AliCluster(),\r
37 fMax(),\r
38 fADCcluster(0),\r
39 fSec(0),\r
40 fNPads(0),\r
41 fNRows(0),\r
42 fTimebins1D(0),\r
43 fPads1D(0),\r
44 fPadRMS(0),\r
45 fRowRMS(0),\r
46 fTimebinRMS(0),\r
47 fSize(0),\r
48 fCenterX(0),\r
49 fCenterY(0),\r
50 fCenterT(0),\r
51 fCluster(0)\r
52{\r
53//\r
54// default constructor\r
55//\r
56 fCluster=new TObjArray();\r
57}\r
58\r
59AliTPCclusterKr::AliTPCclusterKr(const AliTPCclusterKr &param)\r
60:AliCluster(param),\r
61 fMax(),\r
62 fADCcluster(0),\r
63 fSec(0),\r
64 fNPads(0),\r
65 fNRows(0),\r
66 fTimebins1D(0),\r
67 fPads1D(0),\r
68 fPadRMS(0),\r
69 fRowRMS(0),\r
70 fTimebinRMS(0),\r
71 fSize(0),\r
72 fCenterX(0),\r
73 fCenterY(0),\r
74 fCenterT(0),\r
75 fCluster(0)\r
76{\r
77//\r
78// copy constructor\r
79//\r
80 fADCcluster = param.fADCcluster;\r
81 fSec = param.fSec ;\r
82 fNPads = param.fNPads;\r
83 fNRows = param.fNRows;\r
84 fMax = param.fMax;\r
85 // fCluster = param.fCluster;\r
86 fCenterX = param.fCenterX;\r
87 fCenterY = param.fCenterY;\r
88 fCenterT = param.fCenterT;\r
89 fCluster=new TObjArray(*(param.fCluster));\r
90 fSize = param.fSize;\r
91 fTimebins1D = param.fTimebins1D;\r
92 fPads1D = param.fPads1D;\r
93 fPadRMS = param.fPadRMS;\r
94 fRowRMS = param.fRowRMS;\r
95 fTimebinRMS = param.fTimebinRMS;\r
96} \r
97\r
98AliTPCclusterKr &AliTPCclusterKr::operator = (const AliTPCclusterKr & param)\r
99{\r
100 //\r
101 // assignment operator\r
102 // \r
103 (AliCluster&)(*this) = (AliCluster&)param;\r
104 fADCcluster = param.fADCcluster;\r
105 fSec = param.fSec ;\r
106 fNPads = param.fNPads;\r
107 fNRows = param.fNRows;\r
108 fMax = param.fMax;\r
109 // fCluster=param.fCluster;\r
110 fCenterX = param.fCenterX;\r
111 fCenterY = param.fCenterY;\r
112 fCenterT = param.fCenterT;\r
113 delete fCluster;\r
114 fCluster=new TObjArray(*(param.fCluster));\r
115 fSize=param.fSize;\r
116 fTimebins1D = param.fTimebins1D;\r
117 fPads1D = param.fPads1D;\r
118 fPadRMS = param.fPadRMS;\r
119 fRowRMS = param.fRowRMS;\r
120 fTimebinRMS = param.fTimebinRMS;\r
121 return (*this);\r
122}\r
123\r
124AliTPCclusterKr::~AliTPCclusterKr()\r
125{\r
126 //\r
127 // destructor\r
128 //\r
129 if(fCluster) {\r
130 fCluster->SetOwner(kTRUE);\r
131 fCluster->Delete();\r
132 delete fCluster;\r
133 }\r
134 fCluster=0;\r
135}\r
136\r
137////____________________________________________________________________________\r
138void AliTPCclusterKr::SetCenter(){\r
139 //\r
140 // calculate geometrical center of the cluster\r
141 //\r
142 Double_t rX=0;\r
143 Double_t rY=0;\r
144 Double_t rT=0;\r
145\r
146 Short_t adc;\r
147 fADCcluster=0;\r
148 for(Int_t iter = 0; iter < fCluster->GetEntriesFast(); ++iter) {\r
149 AliTPCvtpr *iclus=(AliTPCvtpr *)fCluster->At(iter);\r
150\r
151 //for( std::vector<AliTPCvtpr*>::iterator iclus = fCluster.begin();\r
152 //iclus != fCluster.end(); ++iclus ) {\r
153 adc = (iclus)->GetAdc();\r
154 fADCcluster+=adc;\r
155 rX += ((iclus)->GetX() * adc);\r
156 rY += ((iclus)->GetY() * adc);\r
157 rT += ((iclus)->GetT() * adc);\r
158 }\r
159 fCenterX=rX/fADCcluster;\r
160 fCenterY=rY/fADCcluster;\r
161 fCenterT=rT/fADCcluster;\r
162\r
163 return;\r
164}\r
165\r
166void AliTPCclusterKr::SetPadRMS(){\r
167 //\r
168 // calculate RMS in pad direction\r
169 //\r
170 // TH1F *histo= new TH1F("","",200,0,200);\r
171 TArrayI *array= new TArrayI(fCluster->GetEntriesFast());\r
172 for(Int_t i=0;i<fCluster->GetEntriesFast();i++)\r
173 {\r
174 array->SetAt(((AliTPCvtpr *)(fCluster->At(i)))->GetPad(),i);\r
175 //histo->Fill( ((AliTPCvtpr *)(fCluster->At(i)))->GetPad() );\r
176 }\r
177 // fPadRMS=histo->GetRMS();\r
178 fPadRMS=TMath::RMS(array->GetSize(),array->GetArray());\r
179 // delete histo;\r
180 delete array;\r
181 return;\r
182}\r
183\r
184void AliTPCclusterKr::SetRowRMS(){\r
185 //\r
186 // calculate RMS in row direction\r
187 //\r
188 TArrayI *array= new TArrayI(fCluster->GetEntriesFast());\r
189 // TH1F *histo= new TH1F("","",120,0,120);\r
190 for(Int_t i=0;i<fCluster->GetEntriesFast();i++)\r
191 {\r
192 array->SetAt(((AliTPCvtpr *)(fCluster->At(i)))->GetRow(),i);\r
193 // histo->Fill( ((AliTPCvtpr *)(fCluster->At(i)))->GetRow() );\r
194 }\r
195 // fRowRMS=histo->GetRMS();\r
196 fRowRMS=TMath::RMS(array->GetSize(),array->GetArray());\r
197 // delete histo;\r
198 delete array;\r
199 return;\r
200}\r
201\r
202void AliTPCclusterKr::SetTimebinRMS(){\r
203 //\r
204 // calculate RMS in timebin direction\r
205 //\r
206 TArrayI *array= new TArrayI(fCluster->GetEntriesFast());\r
207 // TH1F *histo= new TH1F("","",1000,0,1000);\r
208 for(Int_t i=0;i<fCluster->GetEntriesFast();i++)\r
209 {\r
210 array->SetAt(((AliTPCvtpr *)(fCluster->At(i)))->GetTime(),i);\r
211 // histo->Fill( ((AliTPCvtpr *)(fCluster->At(i)))->GetTime() );\r
212 }\r
213 fTimebinRMS=TMath::RMS(array->GetSize(),array->GetArray());\r
214 //histo->GetRMS();\r
215 // delete histo;\r
216 delete array;\r
217 return;\r
218}\r
219\r
220void AliTPCclusterKr::SetRMS(){\r
221 //\r
222 // calculate RMS in pad,row,timebin direction\r
223 //\r
224 TArrayI *arrayPad = new TArrayI(fCluster->GetEntriesFast());\r
225 TArrayI *arrayRow = new TArrayI(fCluster->GetEntriesFast());\r
226 TArrayI *arrayTime= new TArrayI(fCluster->GetEntriesFast());\r
227 // TH1F *histoPad= new TH1F("p","p",200,0,200);\r
228 // TH1F *histoRow= new TH1F("r","r",120,0,120);\r
229 // TH1F *histoTime= new TH1F("t","t",1000,0,1000);\r
230 for(Int_t i=0;i<fCluster->GetEntriesFast();i++)\r
231 {\r
232 arrayPad->SetAt(((AliTPCvtpr *)(fCluster->At(i)))->GetPad(),i);\r
233 arrayRow->SetAt(((AliTPCvtpr *)(fCluster->At(i)))->GetRow(),i);\r
234 arrayTime->SetAt(((AliTPCvtpr *)(fCluster->At(i)))->GetTime(),i);\r
235\r
236 //histoPad->Fill( ((AliTPCvtpr *)(fCluster->At(i)))->GetPad() );\r
237 //histoRow->Fill( ((AliTPCvtpr *)(fCluster->At(i)))->GetRow() );\r
238 //histoTime->Fill( ((AliTPCvtpr *)(fCluster->At(i)))->GetTime() );\r
239 }\r
240 // fPadRMS=histoPad->GetRMS();\r
241 fPadRMS=TMath::RMS(arrayPad->GetSize(),arrayPad->GetArray());\r
242 fRowRMS=TMath::RMS(arrayRow->GetSize(),arrayRow->GetArray());\r
243 //histoRow->GetRMS();\r
244 fTimebinRMS=TMath::RMS(arrayTime->GetSize(),arrayTime->GetArray());\r
245 //histoTime->GetRMS();\r
246\r
247 delete arrayPad;\r
248 delete arrayRow;\r
249 delete arrayTime;\r
250 // delete histoPad;\r
251 // delete histoRow;\r
252 // delete histoTime;\r
253\r
254 return;\r
255}\r
256\r
257\r
258void AliTPCclusterKr::Set1D(){\r
259 //\r
260 //\r
261 //\r
262 Short_t maxTime=0;\r
263 Short_t minTime=1000;\r
264 Short_t maxPad=0;\r
265 Short_t minPad=1000;\r
266 \r
267 for(Int_t i=0;i<fCluster->GetEntriesFast();i++)\r
268 {\r
269 if(((AliTPCvtpr *)(fCluster->At(i)))->GetPad()>maxPad)maxPad =((AliTPCvtpr *)(fCluster->At(i)))->GetPad();\r
270 if(((AliTPCvtpr *)(fCluster->At(i)))->GetPad()<minPad)minPad =((AliTPCvtpr *)(fCluster->At(i)))->GetPad();\r
271 if(((AliTPCvtpr *)(fCluster->At(i)))->GetTime()>maxTime)maxTime=((AliTPCvtpr *)(fCluster->At(i)))->GetTime();\r
272 if(((AliTPCvtpr *)(fCluster->At(i)))->GetTime()<minTime)minTime=((AliTPCvtpr *)(fCluster->At(i)))->GetTime();\r
273 }\r
274 fPads1D=maxPad-minPad+1;\r
275 fTimebins1D=maxTime-minTime+1;\r
276 return;\r
277}\r