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