]>
Commit | Line | Data |
---|---|---|
31d9405a | 1 | //$Id$ |
2 | ||
b661165c | 3 | // Author: Uli Frankenfeld <mailto:franken@fi.uib.no> |
4 | //*-- Copyright © Uli | |
108615fc | 5 | |
6 | #include <math.h> | |
7 | #include <iostream.h> | |
108615fc | 8 | |
9 | #include "AliL3Transform.h" | |
10 | #include "AliL3Logging.h" | |
11 | #include "AliL3MemHandler.h" | |
12 | #include "AliL3FileHandler.h" | |
13 | ||
0d319e67 | 14 | #include "AliTPCDigitsArray.h" |
108615fc | 15 | #include "AliTPCClustersArray.h" |
16 | #include "AliTPCcluster.h" | |
17 | #include "AliTPCClustersRow.h" | |
108615fc | 18 | |
19 | #include "AliL3DigitData.h" | |
20 | #include "AliL3TrackSegmentData.h" | |
21 | #include "AliL3SpacePointData.h" | |
22 | #include "AliL3TrackArray.h" | |
b661165c | 23 | |
108615fc | 24 | //_____________________________________________________________ |
b661165c | 25 | // AliL3FileHandler |
108615fc | 26 | // |
27 | // The L3 Binary File handler | |
28 | // | |
29 | ||
30 | ClassImp(AliL3FileHandler) | |
31 | ||
32 | AliL3FileHandler::AliL3FileHandler(){ | |
33 | //Default constructor | |
34 | fInAli = 0; | |
35 | fParam = 0; | |
36 | fTransformer = 0; | |
37 | fMC =0; | |
a6e4f9d6 | 38 | fLastIndex=0; |
39 | fDigits=0; | |
40 | fDigitsTree=0; | |
108615fc | 41 | } |
42 | ||
43 | ||
44 | AliL3FileHandler::~AliL3FileHandler(){ | |
45 | //Destructor | |
46 | if(fTransformer) delete fTransformer; | |
47 | if(fMC) CloseMCOutput(); | |
a6e4f9d6 | 48 | if(fDigitsTree) delete fDigitsTree; |
8f1a9904 | 49 | if(fInAli) CloseAliInput(); |
a6e4f9d6 | 50 | |
108615fc | 51 | } |
52 | ||
53 | Bool_t AliL3FileHandler::SetMCOutput(char *name){ | |
54 | fMC = fopen(name,"w"); | |
55 | if(!fMC){ | |
56 | LOG(AliL3Log::kWarning,"AliL3FileHandler::SetMCOutput","File Open") | |
57 | <<"Pointer to File = 0x0 "<<ENDLOG; | |
58 | return kFALSE; | |
59 | } | |
60 | return kTRUE; | |
61 | } | |
62 | ||
63 | Bool_t AliL3FileHandler::SetMCOutput(FILE *file){ | |
64 | fMC = file; | |
65 | if(!fMC){ | |
66 | LOG(AliL3Log::kWarning,"AliL3FileHandler::SetMCOutput","File Open") | |
67 | <<"Pointer to File = 0x0 "<<ENDLOG; | |
68 | return kFALSE; | |
69 | } | |
70 | return kTRUE; | |
71 | } | |
72 | ||
73 | void AliL3FileHandler::CloseMCOutput(){ | |
74 | if(!fMC){ | |
75 | LOG(AliL3Log::kWarning,"AliL3FileHandler::CloseMCOutPut","File Close") | |
76 | <<"Nothing to Close"<<ENDLOG; | |
77 | return; | |
78 | } | |
79 | fclose(fMC); | |
80 | fMC =0; | |
81 | } | |
82 | ||
83 | Bool_t AliL3FileHandler::SetAliInput(){ | |
84 | if(!fInAli->IsOpen()){ | |
85 | LOG(AliL3Log::kError,"AliL3FileHandler::SetAliInput","File Open") | |
86 | <<"Ali File "<<fInAli->GetName()<<" does not exist"<<ENDLOG; | |
87 | return kFALSE; | |
88 | } | |
89 | fParam = (AliTPCParam*)fInAli->Get("75x40_100x60"); | |
90 | if(!fParam){ | |
91 | LOG(AliL3Log::kError,"AliL3FileHandler::SetAliInput","File Open") | |
92 | <<"No AliTPCParam 75x40_100x60 in File "<<fInAli->GetName()<<ENDLOG; | |
93 | return kFALSE; | |
94 | } | |
95 | fTransformer = new AliL3Transform(); | |
96 | return kTRUE; | |
97 | } | |
98 | ||
99 | Bool_t AliL3FileHandler::SetAliInput(char *name){ | |
100 | fInAli= new TFile(name,"READ"); | |
101 | if(!fInAli){ | |
102 | LOG(AliL3Log::kWarning,"AliL3FileHandler::SetAliInput","File Open") | |
103 | <<"Pointer to TFile = 0x0 "<<ENDLOG; | |
104 | return kFALSE; | |
105 | } | |
106 | return SetAliInput(); | |
107 | } | |
108 | ||
109 | Bool_t AliL3FileHandler::SetAliInput(TFile *file){ | |
110 | fInAli=file; | |
111 | if(!fInAli){ | |
112 | LOG(AliL3Log::kWarning,"AliL3FileHandler::SetAliInput","File Open") | |
113 | <<"Pointer to TFile = 0x0 "<<ENDLOG; | |
114 | return kFALSE; | |
115 | } | |
116 | return SetAliInput(); | |
117 | } | |
118 | ||
119 | void AliL3FileHandler::CloseAliInput(){ | |
120 | if(!fInAli){ | |
121 | LOG(AliL3Log::kWarning,"AliL3FileHandler::CloseAliInput","File Close") | |
122 | <<"Nothing to Close"<<ENDLOG; | |
123 | return; | |
124 | } | |
125 | if(fInAli->IsOpen()) fInAli->Close(); | |
126 | delete fInAli; | |
127 | fInAli = 0; | |
8f1a9904 | 128 | |
108615fc | 129 | } |
130 | ||
131 | Bool_t AliL3FileHandler::IsDigit(){ | |
132 | if(!fInAli){ | |
133 | LOG(AliL3Log::kWarning,"AliL3FileHandler::IsDigit","File") | |
134 | <<"Pointer to TFile = 0x0 "<<ENDLOG; | |
135 | return kTRUE; //may you are use binary input which is Digits!! | |
136 | } | |
03b6adf7 | 137 | TTree *t=(TTree*)fInAli->Get("TreeD_75x40_100x60_0"); |
108615fc | 138 | if(t){ |
139 | LOG(AliL3Log::kInformational,"AliL3FileHandler::IsDigit","File Type") | |
140 | <<"Found Digit Tree -> Use Fast Cluster Finder"<<ENDLOG; | |
141 | return kTRUE; | |
142 | } | |
143 | else{ | |
144 | LOG(AliL3Log::kInformational,"AliL3FileHandler::IsDigit","File Type") | |
145 | <<"No Digit Tree -> Use Cluster Tree"<<ENDLOG; | |
146 | return kFALSE; | |
147 | } | |
148 | } | |
149 | ||
150 | ///////////////////////////////////////// Digit IO | |
31d9405a | 151 | Bool_t AliL3FileHandler::AliDigits2Binary(Int_t event){ |
108615fc | 152 | Bool_t out = kTRUE; |
153 | UInt_t nrow; | |
31d9405a | 154 | AliL3DigitRowData* data = AliDigits2Memory(nrow,event); |
108615fc | 155 | out = Memory2Binary(nrow,data); |
156 | Free(); | |
157 | return out; | |
158 | } | |
159 | ||
160 | ||
31d9405a | 161 | Bool_t AliL3FileHandler::AliDigits2CompBinary(Int_t event){ |
108615fc | 162 | Bool_t out = kTRUE; |
163 | UInt_t ndigits=0; | |
31d9405a | 164 | AliL3DigitRowData* digits = AliDigits2Memory(ndigits,event); |
108615fc | 165 | out = Memory2CompBinary(ndigits,digits); |
166 | Free(); | |
167 | return out; | |
168 | } | |
169 | ||
170 | ||
31d9405a | 171 | AliL3DigitRowData * AliL3FileHandler::AliDigits2Memory(UInt_t & nrow,Int_t event){ |
108615fc | 172 | AliL3DigitRowData *data = 0; |
173 | nrow=0; | |
174 | if(!fInAli){ | |
175 | LOG(AliL3Log::kWarning,"AliL3FileHandler::AliDigits2Memory","File") | |
176 | <<"No Input avalible: no object TFile"<<ENDLOG; | |
177 | return 0; | |
178 | } | |
179 | if(!fInAli->IsOpen()){ | |
180 | LOG(AliL3Log::kWarning,"AliL3FileHandler::AliDigits2Memory","File") | |
181 | <<"No Input avalible: TFile not opend"<<ENDLOG; | |
182 | return 0; | |
183 | } | |
184 | ||
a6e4f9d6 | 185 | if(!fDigitsTree) |
186 | GetDigitsTree(event); | |
187 | ||
108615fc | 188 | UShort_t dig; |
189 | Int_t time,pad,sector,row; | |
190 | Int_t nrows=0; | |
191 | Int_t ndigitcount=0; | |
a6e4f9d6 | 192 | Int_t entries = (Int_t)fDigitsTree->GetEntries(); |
108615fc | 193 | Int_t ndigits[entries]; |
194 | Int_t lslice,lrow; | |
a6e4f9d6 | 195 | |
196 | for(Int_t n=fLastIndex; n<fDigitsTree->GetEntries(); n++) | |
108615fc | 197 | { |
a6e4f9d6 | 198 | fDigitsTree->GetEvent(n); |
199 | fParam->AdjustSectorRow(fDigits->GetID(),sector,row); | |
108615fc | 200 | fTransformer->Sector2Slice(lslice,lrow,sector,row); |
a6e4f9d6 | 201 | //if(fSlice != lslice || lrow<fRowMin || lrow>fRowMax) continue; |
202 | if(lslice < fSlice) continue; | |
203 | if(lslice != fSlice) break; | |
204 | if(lrow < fRowMin) continue; | |
205 | if(lrow > fRowMax) break; | |
108615fc | 206 | |
207 | Float_t xyz[3]; | |
208 | ndigits[lrow] = 0; | |
a6e4f9d6 | 209 | fDigits->First(); |
108615fc | 210 | do { |
a6e4f9d6 | 211 | time=fDigits->CurrentRow(); |
212 | pad=fDigits->CurrentColumn(); | |
213 | dig = fDigits->GetDigit(time,pad); | |
108615fc | 214 | if(dig<=fParam->GetZeroSup()) continue; |
215 | if(time < fParam->GetMaxTBin()-1 && time > 0) | |
a6e4f9d6 | 216 | if(fDigits->GetDigit(time+1,pad) <= fParam->GetZeroSup() |
217 | && fDigits->GetDigit(time-1,pad) <= fParam->GetZeroSup()) | |
108615fc | 218 | continue; |
219 | ||
220 | fTransformer->Raw2Local(xyz,sector,row,pad,time); | |
221 | if(fParam->GetPadRowRadii(sector,row)<230./250.*fabs(xyz[2])) | |
222 | continue; | |
223 | ||
224 | ndigits[lrow]++; //for this row only | |
225 | ndigitcount++; //total number of digits to be published | |
226 | ||
a6e4f9d6 | 227 | } while (fDigits->Next()); |
108615fc | 228 | |
229 | nrows++; | |
230 | } | |
231 | Int_t size = sizeof(AliL3DigitData)*ndigitcount | |
8f1a9904 | 232 | + nrows*sizeof(AliL3DigitRowData); |
108615fc | 233 | |
234 | LOG(AliL3Log::kDebug,"AliL3FileHandler::AliDigits2Memory","Digits") | |
a6e4f9d6 | 235 | <<AliL3Log::kDec<<"Found "<<ndigitcount<<" Digits"<<ENDLOG; |
236 | ||
108615fc | 237 | data=(AliL3DigitRowData*) Allocate(size); |
238 | nrow = (UInt_t)nrows; | |
239 | AliL3DigitRowData *tempPt = data; | |
a6e4f9d6 | 240 | for(Int_t n=fLastIndex; n<fDigitsTree->GetEntries(); n++) |
108615fc | 241 | { |
a6e4f9d6 | 242 | fDigitsTree->GetEvent(n); |
108615fc | 243 | Float_t xyz[3]; |
a6e4f9d6 | 244 | fParam->AdjustSectorRow(fDigits->GetID(),sector,row); |
108615fc | 245 | fTransformer->Sector2Slice(lslice,lrow,sector,row); |
a6e4f9d6 | 246 | //if(fSlice != lslice || lrow<fRowMin || lrow>fRowMax) continue; |
247 | if(lslice < fSlice) continue; | |
248 | if(lslice != fSlice) break; | |
249 | if(lrow < fRowMin) continue; | |
250 | if(lrow > fRowMax) break; | |
251 | ||
108615fc | 252 | tempPt->fRow = lrow; |
253 | tempPt->fNDigit = ndigits[lrow]; | |
254 | ||
255 | Int_t localcount=0; | |
a6e4f9d6 | 256 | fDigits->First(); |
108615fc | 257 | do { |
a6e4f9d6 | 258 | //dig=fDigits->CurrentDigit(); |
03b6adf7 | 259 | //if (dig<=fParam->GetZeroSup()) continue; |
a6e4f9d6 | 260 | time=fDigits->CurrentRow(); |
261 | pad=fDigits->CurrentColumn(); | |
262 | dig = fDigits->GetDigit(time,pad); | |
03b6adf7 | 263 | if (dig <= fParam->GetZeroSup()) continue; |
264 | if(time < fParam->GetMaxTBin()-1 && time > 0) | |
a6e4f9d6 | 265 | if(fDigits->GetDigit(time-1,pad) <= fParam->GetZeroSup() && |
266 | fDigits->GetDigit(time+1,pad) <= fParam->GetZeroSup()) continue; | |
108615fc | 267 | |
268 | //Exclude data outside cone: | |
269 | fTransformer->Raw2Local(xyz,sector,row,pad,time); | |
270 | if(fParam->GetPadRowRadii(sector,row)<230./250.*fabs(xyz[2])) | |
271 | continue; | |
272 | ||
273 | if(localcount >= ndigits[lrow]) | |
274 | LOG(AliL3Log::kFatal,"AliL3FileHandler::AliDigits2Binary","Memory") | |
03b6adf7 | 275 | <<AliL3Log::kDec<<"Mismatch: localcount "<<localcount<<" ndigits " |
276 | <<ndigits[lrow]<<ENDLOG; | |
277 | ||
108615fc | 278 | tempPt->fDigitData[localcount].fCharge=dig; |
279 | tempPt->fDigitData[localcount].fPad=pad; | |
280 | tempPt->fDigitData[localcount].fTime=time; | |
281 | localcount++; | |
a6e4f9d6 | 282 | } while (fDigits->Next()); |
108615fc | 283 | |
284 | Byte_t *tmp = (Byte_t*)tempPt; | |
285 | Int_t size = sizeof(AliL3DigitRowData) | |
286 | + ndigits[lrow]*sizeof(AliL3DigitData); | |
287 | tmp += size; | |
288 | tempPt = (AliL3DigitRowData*)tmp; | |
a6e4f9d6 | 289 | //fLastIndex=n; |
108615fc | 290 | } |
a6e4f9d6 | 291 | //fLastIndex++; |
108615fc | 292 | return data; |
293 | } | |
294 | ||
a6e4f9d6 | 295 | Bool_t AliL3FileHandler::GetDigitsTree(Int_t event) |
296 | { | |
297 | ||
298 | fInAli->cd(); | |
299 | Char_t dname[100]; | |
300 | sprintf(dname,"TreeD_75x40_100x60_%d",event); | |
301 | fDigitsTree = (TTree*)fInAli->Get("TreeD_75x40_100x60_0"); | |
302 | if(!fDigitsTree) | |
303 | { | |
304 | LOG(AliL3Log::kError,"AliL3FileHandler::GetDigitsTree","Digits Tree") | |
305 | <<AliL3Log::kHex<<"Error getting digitstree "<<(Int_t)fDigitsTree<<ENDLOG; | |
306 | return kFALSE; | |
307 | } | |
308 | fDigitsTree->GetBranch("Segment")->SetAddress(&fDigits); | |
309 | return kTRUE; | |
310 | } | |
311 | ||
0d319e67 | 312 | void AliL3FileHandler::AliDigits2RootFile(AliL3DigitRowData *rowPt,Char_t *new_digitsfile) |
313 | { | |
314 | //Write digits to a new alirootfile. | |
315 | ||
316 | if(!fInAli) | |
317 | { | |
8f1a9904 | 318 | printf("AliL3FileHandler::AliDigits2RootFile : No rootfile\n"); |
0d319e67 | 319 | return; |
320 | } | |
321 | if(!fParam) | |
322 | { | |
323 | printf("AliL3FileHandler::AliDigits2RootFile : No parameter object. Run on rootfile\n"); | |
324 | return; | |
325 | } | |
326 | if(!fTransformer) | |
327 | { | |
328 | printf("AliL3FileHandler::AliDigits2RootFile : No transform object\n"); | |
329 | return; | |
330 | } | |
331 | ||
332 | //Get the original digitstree: | |
333 | fInAli->cd(); | |
334 | AliTPCDigitsArray *old_array = new AliTPCDigitsArray(); | |
335 | old_array->Setup(fParam); | |
336 | old_array->SetClass("AliSimDigits"); | |
03b6adf7 | 337 | Bool_t ok = old_array->ConnectTree("TreeD_75x40_100x60_0"); |
0d319e67 | 338 | if(!ok) |
339 | { | |
340 | printf("AliL3FileHandler::AliDigits2RootFile : No digits tree object\n"); | |
341 | return; | |
342 | } | |
0d319e67 | 343 | |
03b6adf7 | 344 | Bool_t create=kFALSE; |
345 | TFile *digFile; | |
346 | ||
8f1a9904 | 347 | digFile = TFile::Open(new_digitsfile,"NEW"); |
348 | if(digFile->IsOpen()) | |
03b6adf7 | 349 | { |
03b6adf7 | 350 | create = kTRUE; |
351 | fParam->Write(fParam->GetTitle()); | |
352 | } | |
353 | else | |
354 | { | |
8f1a9904 | 355 | LOG(AliL3Log::kDebug,"AliL3FileHandler::AliDigits2RootFile","Rootfile") |
356 | <<"Rootfile did already exist, so I will just open it for updates"<<ENDLOG; | |
03b6adf7 | 357 | digFile = TFile::Open(new_digitsfile,"UPDATE"); |
358 | create=kFALSE; | |
359 | } | |
360 | if(!digFile->IsOpen()) | |
361 | { | |
8f1a9904 | 362 | LOG(AliL3Log::kError,"AliL3FileHandler::AliDigits2RootFile","Rootfile") |
363 | <<"Error opening rootfile "<<new_digitsfile<<ENDLOG; | |
03b6adf7 | 364 | return; |
365 | } | |
366 | ||
367 | digFile->cd(); | |
368 | ||
369 | //setup a new one, or connect it to the existing one: | |
0d319e67 | 370 | AliTPCDigitsArray *arr = new AliTPCDigitsArray; |
371 | arr->SetClass("AliSimDigits"); | |
372 | arr->Setup(fParam); | |
03b6adf7 | 373 | if(create) |
374 | arr->MakeTree(); | |
375 | else | |
376 | { | |
377 | Bool_t ok = arr->ConnectTree("TreeD_75x40_100x60_0"); | |
378 | if(!ok) | |
379 | { | |
380 | printf("AliL3FileHandler::AliDigits2RootFile : No digits tree object in existing file\n"); | |
381 | return; | |
382 | } | |
383 | } | |
0d319e67 | 384 | for(Int_t i=fRowMin; i<=fRowMax; i++) |
385 | { | |
03b6adf7 | 386 | |
387 | if(rowPt->fRow != i) printf("AliL3FileHandler::AliDigits2RootFile : Mismatching row numbering!!!\n"); | |
388 | ||
0d319e67 | 389 | Int_t sector,row; |
390 | fTransformer->Slice2Sector(fSlice,i,sector,row); | |
391 | AliDigits * dig = arr->CreateRow(sector,row); | |
392 | AliDigits *old_dig = old_array->LoadRow(sector,row); | |
393 | if(!old_dig) | |
394 | printf("AliL3FileHandler::AliDigits2RootFile : No padrow %d %d\n",sector,row); | |
395 | ||
396 | AliL3DigitData *digPt = rowPt->fDigitData; | |
397 | for(UInt_t j=0; j<rowPt->fNDigit; j++) | |
398 | { | |
399 | UShort_t charge = digPt[j].fCharge; | |
400 | UChar_t pad = digPt[j].fPad; | |
401 | UShort_t time = digPt[j].fTime; | |
03b6adf7 | 402 | |
403 | if(charge == 0) //Only write the digits that has not been removed | |
404 | continue; | |
405 | dig->SetDigitFast(old_dig->GetDigit(time,pad),time,pad); | |
0d319e67 | 406 | ((AliSimDigits*)dig)->SetTrackIDFast(((AliSimDigits*)old_dig)->GetTrackID((Int_t)time,(Int_t)pad,0),time,pad,0); |
407 | ((AliSimDigits*)dig)->SetTrackIDFast(((AliSimDigits*)old_dig)->GetTrackID((Int_t)time,(Int_t)pad,1),time,pad,1); | |
408 | ((AliSimDigits*)dig)->SetTrackIDFast(((AliSimDigits*)old_dig)->GetTrackID((Int_t)time,(Int_t)pad,2),time,pad,2); | |
409 | ||
410 | } | |
411 | UpdateRowPointer(rowPt); | |
412 | arr->StoreRow(sector,row); | |
413 | arr->ClearRow(sector,row); | |
414 | old_array->ClearRow(sector,row); | |
415 | } | |
416 | digFile->cd(); | |
417 | char treeName[100]; | |
03b6adf7 | 418 | sprintf(treeName,"TreeD_%s_0",fParam->GetTitle()); |
8f1a9904 | 419 | printf("Writing tree to file....."); |
0d319e67 | 420 | arr->GetTree()->Write(treeName,TObject::kOverwrite); |
8f1a9904 | 421 | printf("done\n"); |
0d319e67 | 422 | digFile->Close(); |
03b6adf7 | 423 | //arr->GetTree()->Delete(); |
424 | //delete arr; | |
0d319e67 | 425 | } |
426 | ||
108615fc | 427 | ///////////////////////////////////////// Point IO |
428 | Bool_t AliL3FileHandler::AliPoints2Binary(){ | |
429 | Bool_t out = kTRUE; | |
430 | UInt_t npoint; | |
431 | AliL3SpacePointData *data = AliPoints2Memory(npoint); | |
432 | out = Memory2Binary(npoint,data); | |
433 | Free(); | |
434 | return out; | |
435 | } | |
436 | ||
437 | AliL3SpacePointData * AliL3FileHandler::AliPoints2Memory(UInt_t & npoint){ | |
438 | AliL3SpacePointData *data = 0; | |
439 | npoint=0; | |
440 | if(!fInAli){ | |
441 | LOG(AliL3Log::kWarning,"AliL3FileHandler::AliPoints2Memory","File") | |
442 | <<"No Input avalible: no object TFile"<<ENDLOG; | |
443 | return 0; | |
444 | } | |
445 | if(!fInAli->IsOpen()){ | |
446 | LOG(AliL3Log::kWarning,"AliL3FileHandler::AliPoints2Memory","File") | |
447 | <<"No Input avalible: TFile not opend"<<ENDLOG; | |
448 | return 0; | |
449 | } | |
450 | TDirectory *savedir = gDirectory; | |
451 | fInAli->cd(); | |
8f1a9904 | 452 | |
453 | Char_t cname[100]; | |
454 | Int_t eventn = 0; | |
455 | sprintf(cname,"TreeC_TPC_%d",eventn); | |
108615fc | 456 | AliTPCClustersArray carray; |
457 | carray.Setup(fParam); | |
458 | carray.SetClusterType("AliTPCcluster"); | |
8f1a9904 | 459 | Bool_t clusterok = carray.ConnectTree(cname); |
108615fc | 460 | if(!clusterok) return 0; |
461 | ||
462 | AliTPCClustersRow ** clusterrow = | |
463 | new AliTPCClustersRow*[ (int)carray.GetTree()->GetEntries()]; | |
464 | Int_t *rows = new int[ (int)carray.GetTree()->GetEntries()]; | |
465 | Int_t *sects = new int[ (int)carray.GetTree()->GetEntries()]; | |
466 | Int_t sum=0; | |
467 | ||
468 | Int_t lslice,lrow; | |
469 | for(Int_t i=0; i<carray.GetTree()->GetEntries(); i++){ | |
470 | AliSegmentID *s = carray.LoadEntry(i); | |
471 | Int_t sector,row; | |
472 | fParam->AdjustSectorRow(s->GetID(),sector,row); | |
473 | rows[i] = row; | |
474 | sects[i] = sector; | |
475 | clusterrow[i] = 0; | |
476 | fTransformer->Sector2Slice(lslice,lrow,sector,row); | |
477 | if(fSlice != lslice || lrow<fRowMin || lrow>fRowMax) continue; | |
478 | clusterrow[i] = carray.GetRow(sector,row); | |
479 | if(clusterrow[i]) | |
480 | sum+=clusterrow[i]->GetArray()->GetEntriesFast(); | |
481 | } | |
482 | UInt_t size = sum*sizeof(AliL3SpacePointData); | |
483 | ||
484 | LOG(AliL3Log::kDebug,"AliL3FileHandler::AliPoints2Memory","File") | |
485 | <<AliL3Log::kDec<<"Found "<<sum<<" SpacePoints"<<ENDLOG; | |
486 | ||
487 | data = (AliL3SpacePointData *) Allocate(size); | |
488 | npoint = sum; | |
489 | UInt_t n=0; | |
490 | for(Int_t i=0; i<carray.GetTree()->GetEntries(); i++){ | |
491 | if(!clusterrow[i]) continue; | |
492 | Int_t row = rows[i]; | |
493 | Int_t sector = sects[i]; | |
494 | fTransformer->Sector2Slice(lslice,lrow,sector,row); | |
495 | Int_t entries_in_row = clusterrow[i]->GetArray()->GetEntriesFast(); | |
496 | for(Int_t j = 0;j<entries_in_row;j++){ | |
497 | AliTPCcluster *c = (AliTPCcluster*)(*clusterrow[i])[j]; | |
498 | data[n].fZ = c->GetZ(); | |
499 | data[n].fY = c->GetY(); | |
500 | data[n].fX = fParam->GetPadRowRadii(sector,row); | |
501 | data[n].fID = n+((fSlice&0x7f)<<25)+((fPatch&0x7)<<22);//uli | |
502 | data[n].fPadRow = lrow; | |
503 | data[n].fXYErr = c->GetSigmaY2(); | |
504 | data[n].fZErr = c->GetSigmaZ2(); | |
505 | if(fMC) fprintf(fMC,"%d %d\n",data[n].fID,c->GetLabel(0)); | |
506 | n++; | |
507 | } | |
508 | } | |
509 | for(Int_t i=0;i<carray.GetTree()->GetEntries();i++){ | |
510 | Int_t row = rows[i]; | |
511 | Int_t sector = sects[i]; | |
512 | if(carray.GetRow(sector,row)) | |
513 | carray.ClearRow(sector,row); | |
514 | } | |
515 | ||
516 | delete [] clusterrow; | |
517 | delete [] rows; | |
518 | delete [] sects; | |
519 | savedir->cd(); | |
520 | ||
521 | return data; | |
522 | } | |
523 |