]>
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 | |
e968605e | 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.; |
e968605e | 143 | fEta[1] = 1.1; |
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"); | |
e968605e | 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]); |
e968605e | 283 | |
284 | ||
108615fc | 285 | for(Int_t patch=fNPatch-1;patch>=0;patch--){ |
eeddc64d | 286 | fFileHandler->Init(slice,patch,&fRow[patch][0]); |
108615fc | 287 | UInt_t npoints=0; |
288 | AliL3SpacePointData *points =0; | |
289 | UInt_t ndigits=0; | |
290 | AliL3DigitRowData *digits =0; | |
91f3257c | 291 | if(UseCF){ |
292 | if(fUseBinary){ | |
293 | if(!fDoRoi){ | |
6e32a12a | 294 | if(1){ //Binary to Memory |
95a00d93 | 295 | fFileHandler->Free(); |
e968605e | 296 | if(fNPatch == 1) |
297 | sprintf(name,"%sdigits_%d_%d.raw",fPath,slice,-1); | |
298 | else | |
299 | sprintf(name,"%sdigits_%d_%d.raw",fPath,slice,patch); | |
95a00d93 | 300 | if(!fFileHandler->SetBinaryInput(name)) return; |
301 | digits= (AliL3DigitRowData *)fFileHandler->CompBinary2Memory(ndigits); | |
e968605e | 302 | fFileHandler->CloseBinaryInput(); |
91f3257c | 303 | } |
304 | ||
6e32a12a | 305 | if(0){ //Binary to Memory with Benchmark |
91f3257c | 306 | fFileHandler->Free(); |
307 | sprintf(name,"%sdigits_%d_%d.raw",fPath,slice,patch); | |
1c5eccbd | 308 | if(!memory->SetBinaryInput(name)) return; |
91f3257c | 309 | UInt_t compsize=memory->GetFileSize(); |
310 | UInt_t *comp=(UInt_t *)memory->Allocate(compsize); | |
311 | memory->CompBinary2CompMemory(ndigits,comp); | |
312 | memory->CloseBinaryInput(); | |
313 | UInt_t datasize=memory->GetMemorySize(ndigits,comp); | |
314 | digits=(AliL3DigitRowData *)fFileHandler->Allocate(datasize); | |
315 | fBenchmark->Start("Unpacker"); | |
316 | fFileHandler->CompMemory2Memory(ndigits,digits,comp); | |
317 | fBenchmark->Stop("Unpacker"); | |
318 | memory->Free(); | |
319 | } | |
320 | ||
88d19ba2 | 321 | if(0){ //Binary to Memory with Random |
91f3257c | 322 | fFileHandler->Free(); |
323 | fFileHandler->ResetRandom(); | |
324 | fFileHandler->SetRandomCluster(100); | |
325 | fFileHandler->SetNGenerate(100); | |
326 | sprintf(name,"%sdigits_%d_%d.raw",fPath,slice,patch); | |
1c5eccbd | 327 | if(!memory->SetBinaryInput(name)) return; |
91f3257c | 328 | UInt_t compsize=memory->GetFileSize(); |
329 | UInt_t *comp=(UInt_t *)memory->Allocate(compsize); | |
330 | memory->CompBinary2CompMemory(ndigits,comp); | |
331 | memory->CloseBinaryInput(); | |
332 | UInt_t dsize=memory->GetMemorySize(ndigits,comp); | |
333 | UInt_t rsize=fFileHandler->GetRandomSize(); | |
334 | digits=(AliL3DigitRowData*)fFileHandler->Allocate(dsize+rsize); | |
335 | fBenchmark->Start("Unpacker"); | |
336 | fFileHandler->CompMemory2Memory(ndigits,digits,comp); | |
337 | fBenchmark->Stop("Unpacker"); | |
338 | memory->Free(); | |
339 | } | |
108615fc | 340 | } |
341 | ||
91f3257c | 342 | else{ //Binary to Memory with Roi |
108615fc | 343 | fFileHandler->Free(); |
91f3257c | 344 | Int_t sli[2]={0,0}; |
345 | fFileHandler->SetROI(fEta,sli); | |
108615fc | 346 | sprintf(name,"%sdigits_%d_%d.raw",fPath,slice,patch); |
1c5eccbd | 347 | if(!memory->SetBinaryInput(name)) return; |
108615fc | 348 | UInt_t compsize=memory->GetFileSize(); |
349 | UInt_t *comp=(UInt_t *)memory->Allocate(compsize); | |
350 | memory->CompBinary2CompMemory(ndigits,comp); | |
351 | memory->CloseBinaryInput(); | |
352 | UInt_t datasize=memory->GetMemorySize(ndigits,comp); | |
353 | digits=(AliL3DigitRowData *)fFileHandler->Allocate(datasize); | |
354 | fBenchmark->Start("Unpacker"); | |
91f3257c | 355 | datasize = fFileHandler->CompMemory2Memory(ndigits,digits,comp); |
356 | fBenchmark->Stop("Unpacker"); | |
108615fc | 357 | memory->Free(); |
108615fc | 358 | } |
91f3257c | 359 | }//end UseBinary |
360 | else{ | |
2e1fe9ef | 361 | #ifdef use_aliroot |
21896bc6 | 362 | fBenchmark->Start("Dummy Unpacker"); |
108615fc | 363 | sprintf(name,"digits_%d_%d.raw",slice,patch); |
21896bc6 | 364 | fBenchmark->Stop("Dummy Unpacker"); |
2e1fe9ef | 365 | |
108615fc | 366 | if(0){ //Ali to Binary |
367 | fFileHandler->SetBinaryOutput(name); | |
368 | fFileHandler->AliDigits2CompBinary(); | |
369 | fFileHandler->CloseBinaryOutput(); | |
370 | } | |
371 | ||
372 | if(1){ //Ali to Memory | |
532bd2d0 | 373 | digits=(AliL3DigitRowData *)fFileHandler->AliDigits2Memory(ndigits,fEvent); |
4baac26f | 374 | if(0){ //Memory to Binary |
108615fc | 375 | fFileHandler->SetBinaryOutput(name); |
376 | fFileHandler->Memory2CompBinary(ndigits,digits); | |
377 | fFileHandler->CloseBinaryOutput(); | |
378 | } | |
379 | } | |
2e1fe9ef | 380 | #endif |
91f3257c | 381 | }//end else UseBinary |
108615fc | 382 | |
e0ea9951 | 383 | points = (AliL3SpacePointData *) memory->Allocate(pointsize); |
384 | ||
494fad94 | 385 | fClusterFinder = new AliL3ClustFinderNew(); |
eeddc64d | 386 | fClusterFinder->InitSlice(slice,patch,fRow[patch][0],fRow[patch][1],maxpoints); |
532bd2d0 | 387 | fClusterFinder->SetDeconv(fClusterDeconv); |
eeddc64d | 388 | fClusterFinder->SetXYError(fXYClusterError); |
389 | fClusterFinder->SetZError(fZClusterError); | |
c3dd27a3 | 390 | if((fXYClusterError>0)&&(fZClusterError>0)) |
391 | fClusterFinder->SetCalcErr(kFALSE); | |
e0ea9951 | 392 | fClusterFinder->SetOutputArray(points); |
e0ea9951 | 393 | fBenchmark->Start("Cluster Finder"); |
e968605e | 394 | fClusterFinder->Read(ndigits,digits); |
e0ea9951 | 395 | fClusterFinder->ProcessDigits(); |
396 | fBenchmark->Stop("Cluster Finder"); | |
397 | npoints = fClusterFinder->GetNumberOfClusters(); | |
398 | delete fClusterFinder; | |
c3dd27a3 | 399 | fClusterFinder = 0; |
e0ea9951 | 400 | fFileHandler->Free(); |
91f3257c | 401 | LOG(AliL3Log::kInformational,"AliLevel3::ProcessSlice","Cluster Finder") |
402 | <<AliL3Log::kDec<<"Found "<<npoints<<" Points"<<ENDLOG; | |
91f3257c | 403 | }//end UseCF |
404 | else{// if not use Clusterfinder | |
405 | if(fUseBinary){//Binary to Memory | |
406 | memory->Free(); | |
407 | sprintf(name,"/%spoints_%d_%d.raw",fPath,slice,patch); | |
1c5eccbd | 408 | if(!memory->SetBinaryInput(name)) return; |
91f3257c | 409 | points = (AliL3SpacePointData *) memory->Allocate(); |
410 | memory->Binary2Memory(npoints,points); | |
411 | memory->CloseBinaryInput(); | |
412 | LOG(AliL3Log::kInformational,"AliLevel3::ProcessSlice","Read Cluster") | |
413 | <<AliL3Log::kDec<<"Found "<<npoints<<" Points in File"<<ENDLOG; | |
414 | } | |
e0ea9951 | 415 | #ifdef use_aliroot |
91f3257c | 416 | else{ |
417 | points = fFileHandler->AliPoints2Memory(npoints); | |
418 | } | |
e0ea9951 | 419 | #endif |
91f3257c | 420 | fBenchmark->Start("Dummy Unpacker"); |
421 | fBenchmark->Stop("Dummy Unpacker"); | |
422 | fBenchmark->Start("Dummy CF"); | |
423 | fBenchmark->Stop("Dummy CF"); | |
424 | } | |
e0ea9951 | 425 | |
108615fc | 426 | if(patch == fNPatch-1){ |
427 | // Vertex | |
428 | if(fFindVertex){ | |
429 | // Vertex Finder | |
430 | ||
431 | fBenchmark->Start("Vertex Finder Read"); | |
432 | fVertexFinder->Reset(); | |
433 | fVertexFinder->Read(npoints,points); | |
434 | fBenchmark->Stop("Vertex Finder Read"); | |
435 | fBenchmark->Start("Vertex Finder"); | |
436 | fVertexFinder->Analyze(); | |
437 | AliL3VertexData vertex[1]; | |
438 | fVertexFinder->Write(vertex); | |
439 | fVertex->Read(vertex); | |
440 | fBenchmark->Stop("Vertex Finder"); | |
441 | } | |
442 | else{ | |
443 | //use 0,0,0 for vertex | |
444 | fVertex->SetZero(); | |
445 | } | |
446 | fTrackMerger->SetVertex(fVertex); | |
447 | } | |
e968605e | 448 | fTracker->InitSector(slice,fRow[patch],fEta); |
108615fc | 449 | fTracker->SetVertex(fVertex); |
450 | fBenchmark->Start("Tracker Read Hits"); | |
451 | fTracker->ReadHits(npoints,points); | |
452 | fBenchmark->Stop("Tracker Read Hits"); | |
453 | fBenchmark->Start("MainVertexTracking A"); | |
83f458e3 | 454 | fTracker->MainVertexTracking(); |
455 | //fTracker->MainVertexTracking_a(); | |
108615fc | 456 | fBenchmark->Stop("MainVertexTracking A"); |
83f458e3 | 457 | //fBenchmark->Start("MainVertexTracking B"); |
458 | //fTracker->MainVertexTracking_b(); | |
459 | //fBenchmark->Stop("MainVertexTracking B"); | |
108615fc | 460 | fBenchmark->Start("Tracking fit"); |
532bd2d0 | 461 | if(fDoNonVertex) |
462 | fTracker->NonVertexTracking();//Do a second pass for nonvertex tracks | |
108615fc | 463 | fTracker->FillTracks(); |
464 | fBenchmark->Stop("Tracking fit"); | |
465 | ||
466 | if(fWriteOut) | |
467 | WriteSpacePoints(npoints, points, slice, patch); //do after Tracking | |
e0ea9951 | 468 | |
469 | //free memory | |
470 | if(UseCF) | |
471 | memory->Free(); | |
472 | else | |
473 | fFileHandler->Free(); | |
108615fc | 474 | |
475 | UInt_t ntracks0 =0; | |
476 | AliL3TrackSegmentData *trackdata0 = | |
477 | (AliL3TrackSegmentData *) memory->Allocate(fTracker->GetTracks()); | |
478 | memory->TrackArray2Memory(ntracks0,trackdata0,fTracker->GetTracks()); | |
e968605e | 479 | |
108615fc | 480 | //write tracks |
481 | if(fWriteOut){ | |
6e32a12a | 482 | sprintf(name,"%stracks_tr_%d_%d.raw",fWriteOutPath,slice,patch); |
108615fc | 483 | memory->SetBinaryOutput(name); |
484 | memory->Memory2Binary(ntracks0,trackdata0); | |
485 | memory->CloseBinaryOutput(); | |
486 | } | |
e968605e | 487 | |
108615fc | 488 | fInterMerger->Reset(); |
e0ea9951 | 489 | fInterMerger->Init(fRow[patch],patch); |
108615fc | 490 | |
108615fc | 491 | fInterMerger->FillTracks(ntracks0,trackdata0); |
4baac26f | 492 | |
493 | //fBenchmark->Start("Inter Merger"); | |
82bd465a | 494 | // fInterMerger->Merge(); |
4baac26f | 495 | // fInterMerger->SlowMerge(); |
108615fc | 496 | |
4baac26f | 497 | //fBenchmark->Stop("Inter Merger"); |
6e32a12a | 498 | /* |
108615fc | 499 | //write inter merged tracks |
500 | if(fWriteOut){ | |
6e32a12a | 501 | sprintf(name,"%stracks_im_%d_%d.raw",fWriteOutPath,slice,patch); |
108615fc | 502 | WriteTracks(name,fInterMerger,'i'); //write output of intermerger |
6e32a12a | 503 | } |
504 | */ | |
108615fc | 505 | memory->Free(); |
506 | ||
507 | UInt_t ntracks1 =0; | |
508 | AliL3TrackSegmentData *trackdata1 = | |
509 | (AliL3TrackSegmentData *) memory->Allocate(fInterMerger->GetInTracks(0)); | |
510 | memory->TrackArray2Memory(ntracks1,trackdata1,fInterMerger->GetInTracks(0)); | |
511 | ||
512 | fTrackMerger->InitSector(slice,patch); | |
108615fc | 513 | fTrackMerger->FillTracks(ntracks1,trackdata1); |
108615fc | 514 | |
515 | memory->Free(); | |
516 | } | |
517 | fBenchmark->Start("Patch Merger"); | |
68a27388 | 518 | //fTrackMerger->SlowMerge(); |
e968605e | 519 | fTrackMerger->AddAllTracks(); |
520 | //fTrackMerger->Merge(); | |
108615fc | 521 | fBenchmark->Stop("Patch Merger"); |
6e32a12a | 522 | /* |
108615fc | 523 | //write merged tracks |
524 | if(fWriteOut){ | |
6e32a12a | 525 | sprintf(name,"%stracks_tm_%d.raw",fWriteOutPath,slice); |
108615fc | 526 | WriteTracks(name,fTrackMerger,'o'); //write output of trackmerger |
527 | } | |
6e32a12a | 528 | */ |
108615fc | 529 | fTrackData = (AliL3TrackSegmentData *) |
530 | fFileHandler->Allocate(fTrackMerger->GetOutTracks()); | |
531 | ||
532 | fFileHandler->TrackArray2Memory(fNTrackData,fTrackData, | |
533 | fTrackMerger->GetOutTracks()); | |
534 | ||
535 | delete memory; | |
536 | } | |
537 | ||
538 | void AliLevel3::WriteSpacePoints(UInt_t npoints,AliL3SpacePointData *points, | |
539 | Int_t slice,Int_t patch){ | |
540 | char name[256]; | |
6e32a12a | 541 | sprintf(name,"%spoints_%d_%d.raw",fWriteOutPath,slice,patch); |
108615fc | 542 | AliL3MemHandler * memory = new AliL3MemHandler(); |
543 | memory->SetBinaryOutput(name); | |
c51c6aaa | 544 | memory->Transform(npoints,points,slice); |
108615fc | 545 | memory->Memory2Binary(npoints,points); |
546 | memory->CloseBinaryOutput(); | |
547 | delete memory; | |
548 | } | |
549 | ||
108615fc | 550 | Int_t AliLevel3::WriteTracks(char *filename,AliL3Merger *merger,char opt){ |
2e1fe9ef | 551 | AliL3MemHandler *memory = new AliL3MemHandler(); |
108615fc | 552 | memory->SetBinaryOutput(filename); |
553 | if(opt=='a'||opt=='i'){ //add intracks | |
554 | for(Int_t i=0;i<merger->GetNIn();i++){ | |
555 | AliL3TrackArray *tr=merger->GetInTracks(i); | |
556 | memory->TrackArray2Binary(tr); | |
557 | } | |
558 | } | |
559 | ||
560 | if(opt=='o'||opt=='a'){ | |
561 | AliL3TrackArray *tr=merger->GetOutTracks(); | |
562 | memory->TrackArray2Binary(tr); | |
563 | } | |
564 | ||
565 | memory->CloseBinaryOutput(); | |
566 | ||
567 | return 1; | |
568 | } | |
569 | ||
570 | void AliLevel3::WriteResults() | |
571 | { | |
572 | //Write the resulting tracks to outputfile | |
6e32a12a | 573 | Char_t fname[256]; |
574 | sprintf(fname,"%stracks.raw",fWriteOutPath); | |
575 | WriteTracks(fname,fGlobalMerger,'a'); | |
576 | //WriteTracks("tracks.raw",fGlobalMerger,'a'); | |
577 | sprintf(fname,"%stracks_gl.raw",fWriteOutPath); | |
578 | WriteTracks(fname,fGlobalMerger,'o'); | |
579 | //WriteTracks("tracks_gl.raw",fGlobalMerger,'o'); | |
108615fc | 580 | } |