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