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