532bd2d0 |
1 | //$Id$ |
2 | |
82bd465a |
3 | // Author: Anders Vestbo <mailto:vestbo$fi.uib.no>, Uli Frankenfeld <mailto:franken@fi.uib.no> |
4 | //*-- Copyright © ASV |
108615fc |
5 | |
108615fc |
6 | #include <TFile.h> |
7 | #include <TDirectory.h> |
8 | #include <TClonesArray.h> |
9 | #include <TStopwatch.h> |
10 | #include <iostream.h> |
11 | |
2e1fe9ef |
12 | #include "AliL3Logging.h" |
108615fc |
13 | #include "AliLevel3.h" |
14 | #include "AliL3ConfMapper.h" |
15 | #include "AliL3Vertex.h" |
16 | #include "AliL3VertexFinder.h" |
17 | #include "AliL3TrackMerger.h" |
18 | #include "AliL3GlobalMerger.h" |
19 | #include "AliL3InterMerger.h" |
20 | #include "AliL3ConfMapPoint.h" |
21 | #include "AliL3ConfMapTrack.h" |
22 | #include "AliL3Transform.h" |
f3e63a47 |
23 | #include "AliL3ClustFinderNew.h" |
108615fc |
24 | #include "AliL3DigitData.h" |
25 | #include "AliL3TrackArray.h" |
26 | #include "AliL3MemHandler.h" |
2e1fe9ef |
27 | #ifdef use_aliroot |
108615fc |
28 | #include "AliL3FileHandler.h" |
2e1fe9ef |
29 | #endif |
108615fc |
30 | #include "AliL3Benchmark.h" |
31 | |
32 | #include "AliL3DigitData.h" |
33 | #include "AliL3TrackSegmentData.h" |
34 | #include "AliL3SpacePointData.h" |
35 | #include "AliL3VertexData.h" |
36 | |
82bd465a |
37 | //_____________________________________________________________ |
108615fc |
38 | // |
39 | // AliLevel3 |
40 | // |
41 | // Interface class for Level3 tracker. |
42 | // Tracking is done by calling constructor with input,output |
43 | // given as argument. |
44 | // You must always remember to set the tracking parameters. E.g.: |
45 | // |
46 | // AliLevel3 *level3 = new AliLevel3(inputfile,outputfile); |
47 | // level3->SetTrackerParam(); //Sets default tracking parameters |
48 | // level3->ProcessSector(2,2); //Does tracking on sector 2 (actually 2+38) |
82bd465a |
49 | //Begin_Html |
50 | /* |
51 | <img src="tpcsectorsnb.gif"> |
52 | */ |
53 | //End_Html |
108615fc |
54 | |
55 | ClassImp(AliLevel3) |
56 | |
f59eed2d |
57 | AliLevel3::AliLevel3() |
58 | { |
108615fc |
59 | fInputFile=0; |
108615fc |
60 | } |
61 | |
f59eed2d |
62 | AliLevel3::AliLevel3(Char_t *infile) |
63 | { |
108615fc |
64 | //Constructor. Calls constructor of the tracker, vertexfinder and merger classes. |
108615fc |
65 | |
108615fc |
66 | fInputFile = new TFile(infile,"READ"); |
67 | |
68 | if(!fInputFile->IsOpen()) |
69 | { |
f59eed2d |
70 | LOG(AliL3Log::kError,"AliLevel3::AliLevel3","File Open") |
71 | <<"Inputfile "<<infile<<" does not exist"<<ENDLOG; |
72 | return; |
108615fc |
73 | } |
74 | |
108615fc |
75 | } |
76 | |
f59eed2d |
77 | AliLevel3::AliLevel3(TFile *in) |
78 | { |
108615fc |
79 | fInputFile = in; |
80 | if(!in){ |
81 | LOG(AliL3Log::kError,"AliLevel3::AliLevel3","File Open") |
82 | <<"Pointer to InFile 0x0!"<<ENDLOG; |
83 | return; |
84 | } |
108615fc |
85 | |
108615fc |
86 | if(!fInputFile->IsOpen()) |
87 | { |
88 | LOG(AliL3Log::kError,"AliLevel3::AliLevel3","File Open") |
89 | <<"Inputfile does not exist"<<ENDLOG; |
90 | return; |
91 | } |
108615fc |
92 | } |
93 | |
f59eed2d |
94 | void AliLevel3::Init(Char_t *path,Bool_t binary=kTRUE,Int_t npatches=6) |
95 | { |
96 | if(!binary && !fInputFile) |
97 | { |
98 | LOG(AliL3Log::kError,"AliLevel3::Init","Files") |
99 | <<"You have not supplied the input rootfile; use the appropriate ctor!"<<ENDLOG; |
100 | return; |
101 | } |
494fad94 |
102 | |
103 | AliL3Transform::Init(path);//Initialize the detector parameters. |
108615fc |
104 | fWriteOut = kFALSE; |
105 | fGlobalMerger=0; |
108615fc |
106 | fDoRoi = kFALSE; |
532bd2d0 |
107 | fDoNonVertex = kFALSE; |
6e32a12a |
108 | fClusterDeconv = kTRUE; |
697056ae |
109 | fEta[0] = 0.; |
110 | fEta[1] = 0.9; |
f59eed2d |
111 | fUseBinary = binary; |
112 | SetPath(path); |
532bd2d0 |
113 | fFindVertex =kFALSE; |
114 | fEvent=0; |
986840b3 |
115 | |
116 | switch(npatches){ |
117 | case 1: |
118 | fNPatch = 1; //number of patches change row in process |
21896bc6 |
119 | fRow[0][0] = 0; // first row |
90ba4031 |
120 | fRow[0][1] = 175; // last row |
986840b3 |
121 | break; |
122 | case 2: |
123 | fNPatch = 2; //number of patches change row in process |
21896bc6 |
124 | fRow[0][0] = 0; // first row |
125 | fRow[0][1] = 54; |
126 | fRow[1][0] = 55; |
90ba4031 |
127 | fRow[1][1] = 175; // last row |
986840b3 |
128 | break; |
129 | case 5: |
130 | fNPatch = 5; //number of patches change row in process |
21896bc6 |
131 | fRow[0][0] = 0; // first row |
132 | fRow[0][1] = 45; |
133 | fRow[1][0] = 46; |
134 | fRow[1][1] = 77; |
135 | fRow[2][0] = 78; |
136 | fRow[2][1] = 109; |
95a00d93 |
137 | fRow[3][0] = 110; |
21896bc6 |
138 | fRow[3][1] = 141; |
139 | fRow[4][0] = 142; |
90ba4031 |
140 | fRow[4][1] = 175; // last row |
986840b3 |
141 | break; |
142 | default: |
143 | fNPatch = 6; //number of patches change row in process |
88d19ba2 |
144 | fRow[0][0] = 0; // first row |
145 | fRow[0][1] = 31; |
146 | fRow[1][0] = 32; |
147 | fRow[1][1] = 63; |
148 | fRow[2][0] = 64; |
149 | fRow[2][1] = 91; |
150 | fRow[3][0] = 92; |
151 | fRow[3][1] = 119; |
152 | fRow[4][0] = 120; |
153 | fRow[4][1] = 143; |
154 | fRow[5][0] = 144; |
155 | fRow[5][1] = 175; // last row |
156 | } |
986840b3 |
157 | |
108615fc |
158 | fVertexFinder = new AliL3VertexFinder(); |
159 | fVertex = new AliL3Vertex(); |
160 | fTracker = new AliL3ConfMapper(); |
161 | fTrackMerger = new AliL3TrackMerger(fNPatch); |
162 | fInterMerger = new AliL3InterMerger(); |
f59eed2d |
163 | #ifdef use_aliroot |
108615fc |
164 | fFileHandler = new AliL3FileHandler(); |
165 | fFileHandler->SetAliInput(fInputFile); |
f59eed2d |
166 | #else |
2e1fe9ef |
167 | fFileHandler = new AliL3MemHandler(); |
f59eed2d |
168 | #endif |
108615fc |
169 | fBenchmark = new AliL3Benchmark(); |
170 | } |
171 | |
172 | void AliLevel3::DoBench(char* name){ |
173 | fBenchmark->Analyze(name); |
174 | } |
175 | |
176 | void AliLevel3::DoMc(char* file){ |
82bd465a |
177 | #ifdef use_aliroot |
108615fc |
178 | if(!fFileHandler->IsDigit()) |
179 | fFileHandler->SetMCOutput(file); |
82bd465a |
180 | #endif |
108615fc |
181 | } |
182 | |
183 | AliLevel3::~AliLevel3(){ |
184 | //Destructor |
185 | if(fVertexFinder) delete fVertexFinder; |
186 | if(fVertex) delete fVertex; |
187 | if(fTracker) delete fTracker; |
108615fc |
188 | if(fTrackMerger) delete fTrackMerger; |
189 | if(fInterMerger) delete fInterMerger; |
190 | if(fFileHandler) delete fFileHandler; |
191 | } |
192 | |
193 | void AliLevel3::SetTrackerParam(Int_t phi_segments, Int_t eta_segments, |
83f458e3 |
194 | Int_t trackletlength, Int_t tracklength, |
195 | Int_t rowscopetracklet, Int_t rowscopetrack, |
196 | Double_t min_pt_fit, Double_t maxangle, |
197 | Double_t goodDist, Double_t hitChi2Cut, |
198 | Double_t goodHitChi2, Double_t trackChi2Cut, |
199 | Int_t maxdist,Double_t maxphi,Double_t maxeta,Bool_t vertexconstraint) |
108615fc |
200 | { |
201 | //Set parameters input to the tracker |
202 | //If no arguments are given, default parameters will be used |
203 | |
204 | fTracker->SetNSegments(phi_segments,eta_segments); |
108615fc |
205 | fTracker->SetMaxDca(min_pt_fit); |
532bd2d0 |
206 | fTracker->SetTrackCuts(hitChi2Cut,goodHitChi2,trackChi2Cut,maxdist,vertexconstraint); |
207 | fTracker->SetTrackletCuts(maxangle,goodDist,vertexconstraint); |
208 | if(vertexconstraint) |
83f458e3 |
209 | fTracker->MainVertexSettings(trackletlength,tracklength,rowscopetracklet,rowscopetrack,maxphi,maxeta); |
532bd2d0 |
210 | else |
211 | fTracker->NonVertexSettings(trackletlength,tracklength,rowscopetracklet,rowscopetrack); |
212 | |
108615fc |
213 | fTracker->SetParamDone(true); |
4ce675df |
214 | fTracker->InitVolumes(); |
108615fc |
215 | } |
216 | |
532bd2d0 |
217 | void AliLevel3::ProcessEvent(Int_t first,Int_t last,Int_t event){ |
108615fc |
218 | //Do tracking on all slices in region [first,last] |
219 | //Slices numbering in TPC goes from 0-35, which means that 1 slice |
220 | //corresponds to inner+outer sector.E.g. slice 2 corresponds to |
221 | //inner=2 + outer=38. |
222 | fGlobalMerger= new AliL3GlobalMerger(first,last); |
532bd2d0 |
223 | fEvent=event; |
108615fc |
224 | for(Int_t i=first; i<=last; i++){ |
225 | ProcessSlice(i); |
226 | fGlobalMerger->SetVertex(fVertex); |
108615fc |
227 | fGlobalMerger->InitSlice(i); |
108615fc |
228 | fGlobalMerger->FillTracks(fNTrackData,fTrackData); |
108615fc |
229 | fFileHandler->Free(); //free the memory |
230 | fNTrackData=0; |
231 | fTrackData=0; |
232 | } |
233 | fBenchmark->Start("Global Merger"); |
532bd2d0 |
234 | //fGlobalMerger->AddAllTracks(); |
a96e18ec |
235 | //fGlobalMerger->Merge(); |
236 | fGlobalMerger->SlowMerge(); |
108615fc |
237 | fBenchmark->Stop("Global Merger"); |
238 | |
239 | if(fWriteOut) WriteResults(); |
240 | delete fGlobalMerger; fGlobalMerger = 0; |
241 | } |
242 | |
243 | void AliLevel3::ProcessSlice(Int_t slice){ |
244 | char name[256]; |
91f3257c |
245 | Bool_t UseCF = kFALSE; |
e0ea9951 |
246 | #ifdef use_aliroot |
247 | UseCF = fFileHandler->IsDigit(); |
95a00d93 |
248 | #else |
249 | if(fUseBinary) |
250 | UseCF = kTRUE; //In case you are not using aliroot |
e0ea9951 |
251 | #endif |
108615fc |
252 | const Int_t maxpoints=100000; |
253 | const Int_t pointsize = maxpoints * sizeof(AliL3SpacePointData); |
254 | AliL3MemHandler *memory = new AliL3MemHandler(); |
95a00d93 |
255 | |
108615fc |
256 | fTrackMerger->Reset(); |
e0ea9951 |
257 | fTrackMerger->SetRows(fRow[0]); |
108615fc |
258 | for(Int_t patch=fNPatch-1;patch>=0;patch--){ |
a96e18ec |
259 | fFileHandler->Init(slice,patch); |
108615fc |
260 | UInt_t npoints=0; |
261 | AliL3SpacePointData *points =0; |
262 | UInt_t ndigits=0; |
263 | AliL3DigitRowData *digits =0; |
91f3257c |
264 | if(UseCF){ |
265 | if(fUseBinary){ |
266 | if(!fDoRoi){ |
6e32a12a |
267 | if(1){ //Binary to Memory |
95a00d93 |
268 | fFileHandler->Free(); |
91f3257c |
269 | sprintf(name,"%sdigits_%d_%d.raw",fPath,slice,patch); |
95a00d93 |
270 | if(!fFileHandler->SetBinaryInput(name)) return; |
271 | digits= (AliL3DigitRowData *)fFileHandler->CompBinary2Memory(ndigits); |
91f3257c |
272 | fFileHandler->CloseBinaryInput(); |
273 | } |
274 | |
6e32a12a |
275 | if(0){ //Binary to Memory with Benchmark |
91f3257c |
276 | fFileHandler->Free(); |
277 | sprintf(name,"%sdigits_%d_%d.raw",fPath,slice,patch); |
1c5eccbd |
278 | if(!memory->SetBinaryInput(name)) return; |
91f3257c |
279 | UInt_t compsize=memory->GetFileSize(); |
280 | UInt_t *comp=(UInt_t *)memory->Allocate(compsize); |
281 | memory->CompBinary2CompMemory(ndigits,comp); |
282 | memory->CloseBinaryInput(); |
283 | UInt_t datasize=memory->GetMemorySize(ndigits,comp); |
284 | digits=(AliL3DigitRowData *)fFileHandler->Allocate(datasize); |
285 | fBenchmark->Start("Unpacker"); |
286 | fFileHandler->CompMemory2Memory(ndigits,digits,comp); |
287 | fBenchmark->Stop("Unpacker"); |
288 | memory->Free(); |
289 | } |
290 | |
88d19ba2 |
291 | if(0){ //Binary to Memory with Random |
91f3257c |
292 | fFileHandler->Free(); |
293 | fFileHandler->ResetRandom(); |
294 | fFileHandler->SetRandomCluster(100); |
295 | fFileHandler->SetNGenerate(100); |
296 | sprintf(name,"%sdigits_%d_%d.raw",fPath,slice,patch); |
1c5eccbd |
297 | if(!memory->SetBinaryInput(name)) return; |
91f3257c |
298 | UInt_t compsize=memory->GetFileSize(); |
299 | UInt_t *comp=(UInt_t *)memory->Allocate(compsize); |
300 | memory->CompBinary2CompMemory(ndigits,comp); |
301 | memory->CloseBinaryInput(); |
302 | UInt_t dsize=memory->GetMemorySize(ndigits,comp); |
303 | UInt_t rsize=fFileHandler->GetRandomSize(); |
304 | digits=(AliL3DigitRowData*)fFileHandler->Allocate(dsize+rsize); |
305 | fBenchmark->Start("Unpacker"); |
306 | fFileHandler->CompMemory2Memory(ndigits,digits,comp); |
307 | fBenchmark->Stop("Unpacker"); |
308 | memory->Free(); |
309 | } |
108615fc |
310 | } |
311 | |
91f3257c |
312 | else{ //Binary to Memory with Roi |
108615fc |
313 | fFileHandler->Free(); |
91f3257c |
314 | Int_t sli[2]={0,0}; |
315 | fFileHandler->SetROI(fEta,sli); |
108615fc |
316 | sprintf(name,"%sdigits_%d_%d.raw",fPath,slice,patch); |
1c5eccbd |
317 | if(!memory->SetBinaryInput(name)) return; |
108615fc |
318 | UInt_t compsize=memory->GetFileSize(); |
319 | UInt_t *comp=(UInt_t *)memory->Allocate(compsize); |
320 | memory->CompBinary2CompMemory(ndigits,comp); |
321 | memory->CloseBinaryInput(); |
322 | UInt_t datasize=memory->GetMemorySize(ndigits,comp); |
323 | digits=(AliL3DigitRowData *)fFileHandler->Allocate(datasize); |
324 | fBenchmark->Start("Unpacker"); |
91f3257c |
325 | datasize = fFileHandler->CompMemory2Memory(ndigits,digits,comp); |
326 | fBenchmark->Stop("Unpacker"); |
108615fc |
327 | memory->Free(); |
108615fc |
328 | } |
91f3257c |
329 | }//end UseBinary |
330 | else{ |
2e1fe9ef |
331 | #ifdef use_aliroot |
21896bc6 |
332 | fBenchmark->Start("Dummy Unpacker"); |
108615fc |
333 | sprintf(name,"digits_%d_%d.raw",slice,patch); |
21896bc6 |
334 | fBenchmark->Stop("Dummy Unpacker"); |
2e1fe9ef |
335 | |
108615fc |
336 | if(0){ //Ali to Binary |
337 | fFileHandler->SetBinaryOutput(name); |
338 | fFileHandler->AliDigits2CompBinary(); |
339 | fFileHandler->CloseBinaryOutput(); |
340 | } |
341 | |
342 | if(1){ //Ali to Memory |
532bd2d0 |
343 | digits=(AliL3DigitRowData *)fFileHandler->AliDigits2Memory(ndigits,fEvent); |
108615fc |
344 | if(fWriteOut){ //Memory to Binary |
345 | fFileHandler->SetBinaryOutput(name); |
346 | fFileHandler->Memory2CompBinary(ndigits,digits); |
347 | fFileHandler->CloseBinaryOutput(); |
348 | } |
349 | } |
2e1fe9ef |
350 | #endif |
91f3257c |
351 | }//end else UseBinary |
108615fc |
352 | |
e0ea9951 |
353 | points = (AliL3SpacePointData *) memory->Allocate(pointsize); |
354 | |
494fad94 |
355 | fClusterFinder = new AliL3ClustFinderNew(); |
e0ea9951 |
356 | fClusterFinder->InitSlice(slice,patch,fRow[patch][0],fRow[patch][1] |
532bd2d0 |
357 | ,maxpoints); |
358 | fClusterFinder->SetDeconv(fClusterDeconv); |
83f458e3 |
359 | fClusterFinder->SetXYError(0.2); |
360 | fClusterFinder->SetZError(0.3); |
e0ea9951 |
361 | fClusterFinder->SetOutputArray(points); |
362 | fClusterFinder->Read(ndigits,digits); |
363 | fBenchmark->Start("Cluster Finder"); |
364 | fClusterFinder->ProcessDigits(); |
365 | fBenchmark->Stop("Cluster Finder"); |
366 | npoints = fClusterFinder->GetNumberOfClusters(); |
367 | delete fClusterFinder; |
368 | fClusterFinder =0; |
369 | fFileHandler->Free(); |
91f3257c |
370 | LOG(AliL3Log::kInformational,"AliLevel3::ProcessSlice","Cluster Finder") |
371 | <<AliL3Log::kDec<<"Found "<<npoints<<" Points"<<ENDLOG; |
372 | |
e0ea9951 |
373 | |
91f3257c |
374 | }//end UseCF |
375 | else{// if not use Clusterfinder |
376 | if(fUseBinary){//Binary to Memory |
377 | memory->Free(); |
378 | sprintf(name,"/%spoints_%d_%d.raw",fPath,slice,patch); |
1c5eccbd |
379 | if(!memory->SetBinaryInput(name)) return; |
91f3257c |
380 | points = (AliL3SpacePointData *) memory->Allocate(); |
381 | memory->Binary2Memory(npoints,points); |
382 | memory->CloseBinaryInput(); |
383 | LOG(AliL3Log::kInformational,"AliLevel3::ProcessSlice","Read Cluster") |
384 | <<AliL3Log::kDec<<"Found "<<npoints<<" Points in File"<<ENDLOG; |
385 | } |
e0ea9951 |
386 | #ifdef use_aliroot |
91f3257c |
387 | else{ |
388 | points = fFileHandler->AliPoints2Memory(npoints); |
389 | } |
e0ea9951 |
390 | #endif |
91f3257c |
391 | fBenchmark->Start("Dummy Unpacker"); |
392 | fBenchmark->Stop("Dummy Unpacker"); |
393 | fBenchmark->Start("Dummy CF"); |
394 | fBenchmark->Stop("Dummy CF"); |
395 | } |
e0ea9951 |
396 | |
108615fc |
397 | if(patch == fNPatch-1){ |
398 | // Vertex |
399 | if(fFindVertex){ |
400 | // Vertex Finder |
401 | |
402 | fBenchmark->Start("Vertex Finder Read"); |
403 | fVertexFinder->Reset(); |
404 | fVertexFinder->Read(npoints,points); |
405 | fBenchmark->Stop("Vertex Finder Read"); |
406 | fBenchmark->Start("Vertex Finder"); |
407 | fVertexFinder->Analyze(); |
408 | AliL3VertexData vertex[1]; |
409 | fVertexFinder->Write(vertex); |
410 | fVertex->Read(vertex); |
411 | fBenchmark->Stop("Vertex Finder"); |
412 | } |
413 | else{ |
414 | //use 0,0,0 for vertex |
415 | fVertex->SetZero(); |
416 | } |
417 | fTrackMerger->SetVertex(fVertex); |
418 | } |
82bd465a |
419 | fTracker->InitSector(slice,fRow[patch]);//,fEta); |
108615fc |
420 | fTracker->SetVertex(fVertex); |
421 | fBenchmark->Start("Tracker Read Hits"); |
422 | fTracker->ReadHits(npoints,points); |
423 | fBenchmark->Stop("Tracker Read Hits"); |
424 | fBenchmark->Start("MainVertexTracking A"); |
83f458e3 |
425 | fTracker->MainVertexTracking(); |
426 | //fTracker->MainVertexTracking_a(); |
108615fc |
427 | fBenchmark->Stop("MainVertexTracking A"); |
83f458e3 |
428 | //fBenchmark->Start("MainVertexTracking B"); |
429 | //fTracker->MainVertexTracking_b(); |
430 | //fBenchmark->Stop("MainVertexTracking B"); |
108615fc |
431 | fBenchmark->Start("Tracking fit"); |
532bd2d0 |
432 | if(fDoNonVertex) |
433 | fTracker->NonVertexTracking();//Do a second pass for nonvertex tracks |
108615fc |
434 | fTracker->FillTracks(); |
435 | fBenchmark->Stop("Tracking fit"); |
436 | |
437 | if(fWriteOut) |
438 | WriteSpacePoints(npoints, points, slice, patch); //do after Tracking |
e0ea9951 |
439 | |
440 | //free memory |
441 | if(UseCF) |
442 | memory->Free(); |
443 | else |
444 | fFileHandler->Free(); |
108615fc |
445 | |
446 | UInt_t ntracks0 =0; |
447 | AliL3TrackSegmentData *trackdata0 = |
448 | (AliL3TrackSegmentData *) memory->Allocate(fTracker->GetTracks()); |
449 | memory->TrackArray2Memory(ntracks0,trackdata0,fTracker->GetTracks()); |
6e32a12a |
450 | /* |
108615fc |
451 | //write tracks |
452 | if(fWriteOut){ |
6e32a12a |
453 | sprintf(name,"%stracks_tr_%d_%d.raw",fWriteOutPath,slice,patch); |
108615fc |
454 | memory->SetBinaryOutput(name); |
455 | memory->Memory2Binary(ntracks0,trackdata0); |
456 | memory->CloseBinaryOutput(); |
457 | } |
6e32a12a |
458 | */ |
108615fc |
459 | fInterMerger->Reset(); |
e0ea9951 |
460 | fInterMerger->Init(fRow[patch],patch); |
108615fc |
461 | |
108615fc |
462 | fInterMerger->FillTracks(ntracks0,trackdata0); |
108615fc |
463 | fBenchmark->Start("Inter Merger"); |
82bd465a |
464 | // fInterMerger->Merge(); |
108615fc |
465 | // fInterMerger->SlowMerge(); |
466 | |
467 | fBenchmark->Stop("Inter Merger"); |
6e32a12a |
468 | /* |
108615fc |
469 | //write inter merged tracks |
470 | if(fWriteOut){ |
6e32a12a |
471 | sprintf(name,"%stracks_im_%d_%d.raw",fWriteOutPath,slice,patch); |
108615fc |
472 | WriteTracks(name,fInterMerger,'i'); //write output of intermerger |
6e32a12a |
473 | } |
474 | */ |
108615fc |
475 | memory->Free(); |
476 | |
477 | UInt_t ntracks1 =0; |
478 | AliL3TrackSegmentData *trackdata1 = |
479 | (AliL3TrackSegmentData *) memory->Allocate(fInterMerger->GetInTracks(0)); |
480 | memory->TrackArray2Memory(ntracks1,trackdata1,fInterMerger->GetInTracks(0)); |
481 | |
482 | fTrackMerger->InitSector(slice,patch); |
108615fc |
483 | fTrackMerger->FillTracks(ntracks1,trackdata1); |
108615fc |
484 | |
485 | memory->Free(); |
486 | } |
487 | fBenchmark->Start("Patch Merger"); |
a96e18ec |
488 | fTrackMerger->SlowMerge(); |
95a00d93 |
489 | //fTrackMerger->AddAllTracks(); |
a96e18ec |
490 | //fTrackMerger->Merge(); |
108615fc |
491 | fBenchmark->Stop("Patch Merger"); |
6e32a12a |
492 | /* |
108615fc |
493 | //write merged tracks |
494 | if(fWriteOut){ |
6e32a12a |
495 | sprintf(name,"%stracks_tm_%d.raw",fWriteOutPath,slice); |
108615fc |
496 | WriteTracks(name,fTrackMerger,'o'); //write output of trackmerger |
497 | } |
6e32a12a |
498 | */ |
108615fc |
499 | fTrackData = (AliL3TrackSegmentData *) |
500 | fFileHandler->Allocate(fTrackMerger->GetOutTracks()); |
501 | |
502 | fFileHandler->TrackArray2Memory(fNTrackData,fTrackData, |
503 | fTrackMerger->GetOutTracks()); |
504 | |
505 | delete memory; |
506 | } |
507 | |
508 | void AliLevel3::WriteSpacePoints(UInt_t npoints,AliL3SpacePointData *points, |
509 | Int_t slice,Int_t patch){ |
510 | char name[256]; |
6e32a12a |
511 | sprintf(name,"%spoints_%d_%d.raw",fWriteOutPath,slice,patch); |
108615fc |
512 | AliL3MemHandler * memory = new AliL3MemHandler(); |
513 | memory->SetBinaryOutput(name); |
c51c6aaa |
514 | memory->Transform(npoints,points,slice); |
108615fc |
515 | memory->Memory2Binary(npoints,points); |
516 | memory->CloseBinaryOutput(); |
517 | delete memory; |
518 | } |
519 | |
520 | |
521 | Int_t AliLevel3::WriteTracks(char *filename,AliL3Merger *merger,char opt){ |
2e1fe9ef |
522 | AliL3MemHandler *memory = new AliL3MemHandler(); |
108615fc |
523 | memory->SetBinaryOutput(filename); |
524 | if(opt=='a'||opt=='i'){ //add intracks |
525 | for(Int_t i=0;i<merger->GetNIn();i++){ |
526 | AliL3TrackArray *tr=merger->GetInTracks(i); |
527 | memory->TrackArray2Binary(tr); |
528 | } |
529 | } |
530 | |
531 | if(opt=='o'||opt=='a'){ |
532 | AliL3TrackArray *tr=merger->GetOutTracks(); |
533 | memory->TrackArray2Binary(tr); |
534 | } |
535 | |
536 | memory->CloseBinaryOutput(); |
537 | |
538 | return 1; |
539 | } |
540 | |
541 | void AliLevel3::WriteResults() |
542 | { |
543 | //Write the resulting tracks to outputfile |
6e32a12a |
544 | Char_t fname[256]; |
545 | sprintf(fname,"%stracks.raw",fWriteOutPath); |
546 | WriteTracks(fname,fGlobalMerger,'a'); |
547 | //WriteTracks("tracks.raw",fGlobalMerger,'a'); |
548 | sprintf(fname,"%stracks_gl.raw",fWriteOutPath); |
549 | WriteTracks(fname,fGlobalMerger,'o'); |
550 | //WriteTracks("tracks_gl.raw",fGlobalMerger,'o'); |
108615fc |
551 | } |