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