]>
Commit | Line | Data |
---|---|---|
3e87ef69 | 1 | // @(#) $Id$ |
532bd2d0 | 2 | |
3e87ef69 | 3 | // Author: Anders Vestbo <mailto:vestbo@fi.uib.no>, Uli Frankenfeld <mailto:franken@fi.uib.no> |
4 | //*-- Copyright © ALICE HLT Group | |
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" | |
3e87ef69 | 30 | #include "AliL3Fitter.h" |
2e1fe9ef | 31 | #ifdef use_aliroot |
108615fc | 32 | #include "AliL3FileHandler.h" |
2e1fe9ef | 33 | #endif |
108615fc | 34 | #include "AliL3Benchmark.h" |
108615fc | 35 | #include "AliL3DigitData.h" |
36 | #include "AliL3TrackSegmentData.h" | |
37 | #include "AliL3SpacePointData.h" | |
38 | #include "AliL3VertexData.h" | |
b2a02bce | 39 | #include "AliL3DDLDataFileHandler.h" |
108615fc | 40 | |
3e87ef69 | 41 | /** \class AliLevel3 |
42 | <pre> | |
82bd465a | 43 | //_____________________________________________________________ |
108615fc | 44 | // |
45 | // AliLevel3 | |
46 | // | |
47 | // Interface class for Level3 tracker. | |
045549b7 | 48 | // For example how to use, see exa/runtracker.C (root) |
49 | // or programs/runtracker.cxx (standalone program). | |
3e87ef69 | 50 | //Begin_Html |
51 | //<img src="tpcsectorsnb.gif"> | |
82bd465a | 52 | //End_Html |
3e87ef69 | 53 | </pre> |
54 | */ | |
108615fc | 55 | |
56 | ClassImp(AliLevel3) | |
57 | ||
6f388e0d | 58 | Bool_t AliLevel3::fSetTracks2FirstPoint = kTRUE;//Define track parameters at first point |
1f1942b8 | 59 | Bool_t AliLevel3::fDoVertexFit = kTRUE;//Include the vertex in the final track fit |
6f388e0d | 60 | |
f59eed2d | 61 | AliLevel3::AliLevel3() |
62 | { | |
045549b7 | 63 | //Default constructor. Should also be used when input is from binary files. |
64 | //In that case the path to where the binary files are located has to be | |
65 | //passed to the AliLevel::Init function. | |
66 | ||
108615fc | 67 | fInputFile=0; |
108615fc | 68 | } |
69 | ||
f59eed2d | 70 | AliLevel3::AliLevel3(Char_t *infile) |
71 | { | |
045549b7 | 72 | //Constructor to use for when input is anything else but binary files, |
73 | //meaning rootfiles or raw files. | |
108615fc | 74 | |
a27af97b | 75 | fInputFile = infile; |
b2a02bce | 76 | } |
02f030e3 | 77 | |
b2a02bce | 78 | void AliLevel3::Init(Char_t *path,EFileType filetype,Int_t npatches) |
79 | { | |
045549b7 | 80 | if((filetype!=kBinary) && (filetype!=kDate) && !fInputFile) |
f59eed2d | 81 | { |
82 | LOG(AliL3Log::kError,"AliLevel3::Init","Files") | |
83 | <<"You have not supplied the input rootfile; use the appropriate ctor!"<<ENDLOG; | |
84 | return; | |
85 | } | |
494fad94 | 86 | |
108615fc | 87 | fWriteOut = kFALSE; |
3e87ef69 | 88 | fPileUp = kFALSE; |
89 | fNoCF=kFALSE; | |
a27af97b | 90 | fUseBinary = (filetype==kBinary); |
eeddc64d | 91 | SetPath(path); |
3e87ef69 | 92 | |
108615fc | 93 | fDoRoi = kFALSE; |
532bd2d0 | 94 | fDoNonVertex = kFALSE; |
eeddc64d | 95 | fFindVertex = kFALSE; |
96 | SetClusterFinderParam(); | |
97 | ||
697056ae | 98 | fEta[0] = 0.; |
e968605e | 99 | fEta[1] = 1.1; |
eeddc64d | 100 | |
532bd2d0 | 101 | fEvent=0; |
1f1942b8 | 102 | #ifdef use_aliroot /*just to be sure*/ |
103 | AliL3FileHandler::CleanStaticIndex(); | |
104 | #endif | |
986840b3 | 105 | |
106 | switch(npatches){ | |
3e87ef69 | 107 | case 0: |
108 | fNPatch = 1; | |
109 | fRow[0][0] = AliL3Transform::GetFirstRow(3); | |
110 | fRow[0][1] = AliL3Transform::GetLastRow(5); | |
111 | break; | |
986840b3 | 112 | case 1: |
113 | fNPatch = 1; //number of patches change row in process | |
68a27388 | 114 | fRow[0][0] = 0; |
3e87ef69 | 115 | fRow[0][1] = AliL3Transform::GetLastRow(-1); |
986840b3 | 116 | break; |
117 | case 2: | |
118 | fNPatch = 2; //number of patches change row in process | |
21896bc6 | 119 | fRow[0][0] = 0; // first row |
68a27388 | 120 | fRow[0][1] = AliL3Transform::GetLastRow(1); |
121 | fRow[1][0] = AliL3Transform::GetFirstRow(2); | |
122 | fRow[1][1] = AliL3Transform::GetLastRow(5); | |
986840b3 | 123 | break; |
68a27388 | 124 | default: |
125 | fNPatch = 6; | |
126 | fRow[0][0] = AliL3Transform::GetFirstRow(0); | |
127 | fRow[0][1] = AliL3Transform::GetLastRow(0); | |
128 | fRow[1][0] = AliL3Transform::GetFirstRow(1); | |
129 | fRow[1][1] = AliL3Transform::GetLastRow(1); | |
130 | fRow[2][0] = AliL3Transform::GetFirstRow(2); | |
131 | fRow[2][1] = AliL3Transform::GetLastRow(2); | |
132 | fRow[3][0] = AliL3Transform::GetFirstRow(3); | |
133 | fRow[3][1] = AliL3Transform::GetLastRow(3); | |
134 | fRow[4][0] = AliL3Transform::GetFirstRow(4); | |
135 | fRow[4][1] = AliL3Transform::GetLastRow(4); | |
136 | fRow[5][0] = AliL3Transform::GetFirstRow(5); | |
137 | fRow[5][1] = AliL3Transform::GetLastRow(5); | |
88d19ba2 | 138 | } |
986840b3 | 139 | |
108615fc | 140 | fVertexFinder = new AliL3VertexFinder(); |
141 | fVertex = new AliL3Vertex(); | |
142 | fTracker = new AliL3ConfMapper(); | |
143 | fTrackMerger = new AliL3TrackMerger(fNPatch); | |
144 | fInterMerger = new AliL3InterMerger(); | |
0a86fbb7 | 145 | fGlobalMerger = new AliL3GlobalMerger(); |
146 | SetMergerParameters();//Set default merger parameters | |
f59eed2d | 147 | #ifdef use_aliroot |
a27af97b | 148 | if(filetype==kRoot){ |
1f1942b8 | 149 | fFileHandler = new AliL3FileHandler(kTRUE); //static version |
a27af97b | 150 | fFileHandler->SetAliInput(fInputFile); |
151 | }else if(filetype==kRaw){ | |
152 | fFileHandler = new AliL3DDLDataFileHandler(); | |
153 | fFileHandler->SetReaderInput(fInputFile); | |
045549b7 | 154 | }else if(filetype==kDate){ |
155 | fFileHandler = new AliL3DDLDataFileHandler(); | |
156 | fFileHandler->SetReaderInput(fInputFile,-1); | |
a27af97b | 157 | }else{ |
158 | fFileHandler = new AliL3MemHandler(); | |
159 | } | |
f59eed2d | 160 | #else |
b2a02bce | 161 | if(filetype==kRaw){ |
162 | fFileHandler = new AliL3DDLDataFileHandler(); | |
163 | fFileHandler->SetReaderInput(fInputFile); | |
164 | }else{ | |
165 | fFileHandler = new AliL3MemHandler(); | |
166 | } | |
f59eed2d | 167 | #endif |
108615fc | 168 | fBenchmark = new AliL3Benchmark(); |
169 | } | |
170 | ||
171 | void AliLevel3::DoBench(char* name){ | |
172 | fBenchmark->Analyze(name); | |
3e87ef69 | 173 | delete fBenchmark; |
174 | fBenchmark = new AliL3Benchmark(); | |
108615fc | 175 | } |
176 | ||
177 | void AliLevel3::DoMc(char* file){ | |
82bd465a | 178 | #ifdef use_aliroot |
68a27388 | 179 | if(!fFileHandler->IsDigit(fEvent)) |
108615fc | 180 | fFileHandler->SetMCOutput(file); |
82bd465a | 181 | #endif |
108615fc | 182 | } |
183 | ||
184 | AliLevel3::~AliLevel3(){ | |
185 | //Destructor | |
eeddc64d | 186 | if(fVertexFinder) delete fVertexFinder; |
187 | if(fVertex) delete fVertex; | |
108615fc | 188 | if(fTracker) delete fTracker; |
108615fc | 189 | if(fTrackMerger) delete fTrackMerger; |
190 | if(fInterMerger) delete fInterMerger; | |
191 | if(fFileHandler) delete fFileHandler; | |
0a86fbb7 | 192 | if(fGlobalMerger) delete fGlobalMerger; |
108615fc | 193 | } |
194 | ||
eeddc64d | 195 | void AliLevel3::SetClusterFinderParam(Float_t fXYError, Float_t fZError, Bool_t deconv) |
196 | { | |
197 | fXYClusterError=fXYError; | |
198 | fZClusterError=fZError; | |
199 | fClusterDeconv=deconv; | |
200 | } | |
201 | ||
108615fc | 202 | void AliLevel3::SetTrackerParam(Int_t phi_segments, Int_t eta_segments, |
83f458e3 | 203 | Int_t trackletlength, Int_t tracklength, |
204 | Int_t rowscopetracklet, Int_t rowscopetrack, | |
205 | Double_t min_pt_fit, Double_t maxangle, | |
206 | Double_t goodDist, Double_t hitChi2Cut, | |
207 | Double_t goodHitChi2, Double_t trackChi2Cut, | |
1f1942b8 | 208 | Int_t maxdist,Double_t maxphi,Double_t maxeta, |
209 | 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); | |
4ce675df | 222 | fTracker->InitVolumes(); |
108615fc | 223 | } |
224 | ||
0a86fbb7 | 225 | void AliLevel3::SetMergerParameters(Double_t maxy,Double_t maxz,Double_t maxkappa,Double_t maxpsi,Double_t maxtgl) |
226 | { | |
227 | fGlobalMerger->SetParameter(maxy,maxz,maxkappa,maxpsi,maxtgl); | |
228 | } | |
229 | ||
532bd2d0 | 230 | void AliLevel3::ProcessEvent(Int_t first,Int_t last,Int_t event){ |
108615fc | 231 | //Do tracking on all slices in region [first,last] |
eeddc64d | 232 | //Slices numbering in TPC goes from 0-35, which means that one slice |
108615fc | 233 | //corresponds to inner+outer sector.E.g. slice 2 corresponds to |
234 | //inner=2 + outer=38. | |
0a86fbb7 | 235 | |
236 | fGlobalMerger->Setup(first,last); | |
1f1942b8 | 237 | #ifdef use_aliroot |
238 | if(fEvent!=event) AliL3FileHandler::CleanStaticIndex(); | |
239 | #endif | |
532bd2d0 | 240 | fEvent=event; |
108615fc | 241 | for(Int_t i=first; i<=last; i++){ |
242 | ProcessSlice(i); | |
243 | fGlobalMerger->SetVertex(fVertex); | |
108615fc | 244 | fGlobalMerger->InitSlice(i); |
108615fc | 245 | fGlobalMerger->FillTracks(fNTrackData,fTrackData); |
108615fc | 246 | fFileHandler->Free(); //free the memory |
247 | fNTrackData=0; | |
248 | fTrackData=0; | |
249 | } | |
3e87ef69 | 250 | fBenchmark->Start("Global track merger"); |
251 | //fGlobalMerger->AddAllTracks(); | |
3e87ef69 | 252 | fGlobalMerger->Merge(); |
0a86fbb7 | 253 | //fGlobalMerger->SlowMerge(fWriteOutPath); |
3e87ef69 | 254 | fBenchmark->Stop("Global track merger"); |
255 | ||
256 | FitGlobalTracks(); | |
257 | ||
108615fc | 258 | if(fWriteOut) WriteResults(); |
3e87ef69 | 259 | fFileHandler->FreeDigitsTree(); |
108615fc | 260 | } |
261 | ||
262 | void AliLevel3::ProcessSlice(Int_t slice){ | |
263 | char name[256]; | |
91f3257c | 264 | Bool_t UseCF = kFALSE; |
e0ea9951 | 265 | #ifdef use_aliroot |
68a27388 | 266 | UseCF = fFileHandler->IsDigit(fEvent); |
a27af97b | 267 | #endif |
95a00d93 | 268 | if(fUseBinary) |
b2a02bce | 269 | UseCF = kTRUE; //In case you are not using aliroot |
3e87ef69 | 270 | if(fNoCF == kTRUE) //In case you don't want to run with cluster finder |
271 | UseCF = kFALSE; | |
272 | ||
273 | const Int_t maxpoints=120000; | |
108615fc | 274 | const Int_t pointsize = maxpoints * sizeof(AliL3SpacePointData); |
275 | AliL3MemHandler *memory = new AliL3MemHandler(); | |
eeddc64d | 276 | |
108615fc | 277 | fTrackMerger->Reset(); |
e0ea9951 | 278 | fTrackMerger->SetRows(fRow[0]); |
e968605e | 279 | |
108615fc | 280 | for(Int_t patch=fNPatch-1;patch>=0;patch--){ |
eeddc64d | 281 | fFileHandler->Init(slice,patch,&fRow[patch][0]); |
108615fc | 282 | UInt_t npoints=0; |
283 | AliL3SpacePointData *points =0; | |
284 | UInt_t ndigits=0; | |
285 | AliL3DigitRowData *digits =0; | |
91f3257c | 286 | if(UseCF){ |
287 | if(fUseBinary){ | |
288 | if(!fDoRoi){ | |
6e32a12a | 289 | if(1){ //Binary to Memory |
95a00d93 | 290 | fFileHandler->Free(); |
e968605e | 291 | if(fNPatch == 1) |
3e87ef69 | 292 | sprintf(name,"%sdigits_%d_%d_%d.raw",fPath,fEvent,slice,-1); |
e968605e | 293 | else |
3e87ef69 | 294 | sprintf(name,"%sdigits_%d_%d_%d.raw",fPath,fEvent,slice,patch); |
95a00d93 | 295 | if(!fFileHandler->SetBinaryInput(name)) return; |
3e87ef69 | 296 | if(fPileUp) |
297 | { //Read binary files which are not RLE | |
298 | digits = (AliL3DigitRowData*)fFileHandler->Allocate(); | |
299 | fFileHandler->Binary2Memory(ndigits,digits); | |
300 | } | |
301 | else //Read RLE binary files | |
302 | digits= (AliL3DigitRowData *)fFileHandler->CompBinary2Memory(ndigits); | |
303 | ||
e968605e | 304 | fFileHandler->CloseBinaryInput(); |
91f3257c | 305 | } |
306 | ||
6e32a12a | 307 | if(0){ //Binary to Memory with Benchmark |
3e87ef69 | 308 | fFileHandler->Free(); |
309 | if(fNPatch == 1) | |
310 | sprintf(name,"%sdigits_%d_%d_%d.raw",fPath,fEvent,slice,-1); | |
311 | else | |
312 | sprintf(name,"%sdigits_%d_%d_%d.raw",fPath,fEvent,slice,patch); | |
1c5eccbd | 313 | if(!memory->SetBinaryInput(name)) return; |
91f3257c | 314 | UInt_t compsize=memory->GetFileSize(); |
315 | UInt_t *comp=(UInt_t *)memory->Allocate(compsize); | |
316 | memory->CompBinary2CompMemory(ndigits,comp); | |
317 | memory->CloseBinaryInput(); | |
318 | UInt_t datasize=memory->GetMemorySize(ndigits,comp); | |
319 | digits=(AliL3DigitRowData *)fFileHandler->Allocate(datasize); | |
320 | fBenchmark->Start("Unpacker"); | |
321 | fFileHandler->CompMemory2Memory(ndigits,digits,comp); | |
322 | fBenchmark->Stop("Unpacker"); | |
323 | memory->Free(); | |
324 | } | |
325 | ||
88d19ba2 | 326 | if(0){ //Binary to Memory with Random |
91f3257c | 327 | fFileHandler->Free(); |
328 | fFileHandler->ResetRandom(); | |
329 | fFileHandler->SetRandomCluster(100); | |
330 | fFileHandler->SetNGenerate(100); | |
3e87ef69 | 331 | if(fNPatch == 1) |
332 | sprintf(name,"%sdigits_%d_%d_%d.raw",fPath,fEvent,slice,-1); | |
333 | else | |
334 | sprintf(name,"%sdigits_%d_%d_%d.raw",fPath,fEvent,slice,patch); | |
1c5eccbd | 335 | if(!memory->SetBinaryInput(name)) return; |
91f3257c | 336 | UInt_t compsize=memory->GetFileSize(); |
337 | UInt_t *comp=(UInt_t *)memory->Allocate(compsize); | |
338 | memory->CompBinary2CompMemory(ndigits,comp); | |
339 | memory->CloseBinaryInput(); | |
340 | UInt_t dsize=memory->GetMemorySize(ndigits,comp); | |
341 | UInt_t rsize=fFileHandler->GetRandomSize(); | |
342 | digits=(AliL3DigitRowData*)fFileHandler->Allocate(dsize+rsize); | |
343 | fBenchmark->Start("Unpacker"); | |
344 | fFileHandler->CompMemory2Memory(ndigits,digits,comp); | |
345 | fBenchmark->Stop("Unpacker"); | |
346 | memory->Free(); | |
347 | } | |
108615fc | 348 | } |
349 | ||
91f3257c | 350 | else{ //Binary to Memory with Roi |
108615fc | 351 | fFileHandler->Free(); |
91f3257c | 352 | Int_t sli[2]={0,0}; |
353 | fFileHandler->SetROI(fEta,sli); | |
3e87ef69 | 354 | if(fNPatch==1) |
355 | sprintf(name,"%sdigits_%d_%d_%d.raw",fPath,fEvent,slice,-1); | |
356 | else | |
357 | sprintf(name,"%sdigits_%d_%d_%d.raw",fPath,fEvent,slice,patch); | |
1c5eccbd | 358 | if(!memory->SetBinaryInput(name)) return; |
108615fc | 359 | UInt_t compsize=memory->GetFileSize(); |
360 | UInt_t *comp=(UInt_t *)memory->Allocate(compsize); | |
361 | memory->CompBinary2CompMemory(ndigits,comp); | |
362 | memory->CloseBinaryInput(); | |
363 | UInt_t datasize=memory->GetMemorySize(ndigits,comp); | |
364 | digits=(AliL3DigitRowData *)fFileHandler->Allocate(datasize); | |
365 | fBenchmark->Start("Unpacker"); | |
91f3257c | 366 | datasize = fFileHandler->CompMemory2Memory(ndigits,digits,comp); |
367 | fBenchmark->Stop("Unpacker"); | |
108615fc | 368 | memory->Free(); |
108615fc | 369 | } |
91f3257c | 370 | }//end UseBinary |
371 | else{ | |
2e1fe9ef | 372 | #ifdef use_aliroot |
21896bc6 | 373 | fBenchmark->Start("Dummy Unpacker"); |
3e87ef69 | 374 | if(fNPatch==1) |
375 | sprintf(name,"digits_%d_%d_%d.raw",fEvent,slice,-1); | |
376 | else | |
377 | sprintf(name,"digits_%d_%d_%d.raw",fEvent,slice,patch); | |
21896bc6 | 378 | fBenchmark->Stop("Dummy Unpacker"); |
2e1fe9ef | 379 | |
02f030e3 | 380 | if(0){ //Ali to Binary |
108615fc | 381 | fFileHandler->SetBinaryOutput(name); |
382 | fFileHandler->AliDigits2CompBinary(); | |
383 | fFileHandler->CloseBinaryOutput(); | |
384 | } | |
385 | ||
b2a02bce | 386 | if(1){ //Ali to Memory |
3e87ef69 | 387 | digits=(AliL3DigitRowData *)fFileHandler->AliAltroDigits2Memory(ndigits,fEvent); |
02f030e3 | 388 | if(0){ //Memory to Binary |
108615fc | 389 | fFileHandler->SetBinaryOutput(name); |
390 | fFileHandler->Memory2CompBinary(ndigits,digits); | |
391 | fFileHandler->CloseBinaryOutput(); | |
392 | } | |
393 | } | |
2e1fe9ef | 394 | #endif |
91f3257c | 395 | }//end else UseBinary |
108615fc | 396 | |
e0ea9951 | 397 | points = (AliL3SpacePointData *) memory->Allocate(pointsize); |
494fad94 | 398 | fClusterFinder = new AliL3ClustFinderNew(); |
eeddc64d | 399 | fClusterFinder->InitSlice(slice,patch,fRow[patch][0],fRow[patch][1],maxpoints); |
532bd2d0 | 400 | fClusterFinder->SetDeconv(fClusterDeconv); |
eeddc64d | 401 | fClusterFinder->SetXYError(fXYClusterError); |
402 | fClusterFinder->SetZError(fZClusterError); | |
c3dd27a3 | 403 | if((fXYClusterError>0)&&(fZClusterError>0)) |
404 | fClusterFinder->SetCalcErr(kFALSE); | |
e0ea9951 | 405 | fClusterFinder->SetOutputArray(points); |
3e87ef69 | 406 | fBenchmark->Start("Cluster finder"); |
e968605e | 407 | fClusterFinder->Read(ndigits,digits); |
e0ea9951 | 408 | fClusterFinder->ProcessDigits(); |
3e87ef69 | 409 | fBenchmark->Stop("Cluster finder"); |
e0ea9951 | 410 | npoints = fClusterFinder->GetNumberOfClusters(); |
411 | delete fClusterFinder; | |
c3dd27a3 | 412 | fClusterFinder = 0; |
e0ea9951 | 413 | fFileHandler->Free(); |
91f3257c | 414 | LOG(AliL3Log::kInformational,"AliLevel3::ProcessSlice","Cluster Finder") |
415 | <<AliL3Log::kDec<<"Found "<<npoints<<" Points"<<ENDLOG; | |
91f3257c | 416 | }//end UseCF |
417 | else{// if not use Clusterfinder | |
418 | if(fUseBinary){//Binary to Memory | |
419 | memory->Free(); | |
3e87ef69 | 420 | if(fNPatch==1) |
421 | sprintf(name,"%s/points_%d_%d_%d.raw",fPath,fEvent,slice,-1); | |
422 | else | |
423 | sprintf(name,"%s/points_%d_%d_%d.raw",fPath,fEvent,slice,patch); | |
1c5eccbd | 424 | if(!memory->SetBinaryInput(name)) return; |
91f3257c | 425 | points = (AliL3SpacePointData *) memory->Allocate(); |
426 | memory->Binary2Memory(npoints,points); | |
427 | memory->CloseBinaryInput(); | |
428 | LOG(AliL3Log::kInformational,"AliLevel3::ProcessSlice","Read Cluster") | |
429 | <<AliL3Log::kDec<<"Found "<<npoints<<" Points in File"<<ENDLOG; | |
430 | } | |
e0ea9951 | 431 | #ifdef use_aliroot |
91f3257c | 432 | else{ |
433 | points = fFileHandler->AliPoints2Memory(npoints); | |
434 | } | |
e0ea9951 | 435 | #endif |
91f3257c | 436 | fBenchmark->Start("Dummy Unpacker"); |
437 | fBenchmark->Stop("Dummy Unpacker"); | |
438 | fBenchmark->Start("Dummy CF"); | |
439 | fBenchmark->Stop("Dummy CF"); | |
440 | } | |
e0ea9951 | 441 | |
108615fc | 442 | if(patch == fNPatch-1){ |
443 | // Vertex | |
444 | if(fFindVertex){ | |
445 | // Vertex Finder | |
446 | ||
447 | fBenchmark->Start("Vertex Finder Read"); | |
448 | fVertexFinder->Reset(); | |
449 | fVertexFinder->Read(npoints,points); | |
450 | fBenchmark->Stop("Vertex Finder Read"); | |
451 | fBenchmark->Start("Vertex Finder"); | |
452 | fVertexFinder->Analyze(); | |
453 | AliL3VertexData vertex[1]; | |
454 | fVertexFinder->Write(vertex); | |
455 | fVertex->Read(vertex); | |
456 | fBenchmark->Stop("Vertex Finder"); | |
457 | } | |
458 | else{ | |
459 | //use 0,0,0 for vertex | |
460 | fVertex->SetZero(); | |
461 | } | |
462 | fTrackMerger->SetVertex(fVertex); | |
463 | } | |
3e87ef69 | 464 | |
e968605e | 465 | fTracker->InitSector(slice,fRow[patch],fEta); |
108615fc | 466 | fTracker->SetVertex(fVertex); |
3e87ef69 | 467 | fBenchmark->Start("Tracker setup"); |
108615fc | 468 | fTracker->ReadHits(npoints,points); |
3e87ef69 | 469 | fTracker->MainVertexTracking_a(); |
470 | fBenchmark->Stop("Tracker setup"); | |
471 | fBenchmark->Start("Track follower"); | |
472 | fTracker->MainVertexTracking_b(); | |
473 | fBenchmark->Stop("Track follower"); | |
532bd2d0 | 474 | if(fDoNonVertex) |
475 | fTracker->NonVertexTracking();//Do a second pass for nonvertex tracks | |
3e87ef69 | 476 | fBenchmark->Start("Sector track fitting"); |
108615fc | 477 | fTracker->FillTracks(); |
3e87ef69 | 478 | fBenchmark->Stop("Sector track fitting"); |
108615fc | 479 | |
480 | if(fWriteOut) | |
481 | WriteSpacePoints(npoints, points, slice, patch); //do after Tracking | |
e0ea9951 | 482 | |
483 | //free memory | |
484 | if(UseCF) | |
485 | memory->Free(); | |
486 | else | |
487 | fFileHandler->Free(); | |
108615fc | 488 | |
489 | UInt_t ntracks0 =0; | |
490 | AliL3TrackSegmentData *trackdata0 = | |
491 | (AliL3TrackSegmentData *) memory->Allocate(fTracker->GetTracks()); | |
492 | memory->TrackArray2Memory(ntracks0,trackdata0,fTracker->GetTracks()); | |
e968605e | 493 | |
108615fc | 494 | //write tracks |
495 | if(fWriteOut){ | |
3e87ef69 | 496 | if(fNPatch==1) |
497 | sprintf(name,"%s/tracks_tr_%d_%d_%d.raw",fWriteOutPath,fEvent,slice,-1); | |
498 | else | |
499 | sprintf(name,"%s/tracks_tr_%d_%d_%d.raw",fWriteOutPath,fEvent,slice,patch); | |
108615fc | 500 | memory->SetBinaryOutput(name); |
501 | memory->Memory2Binary(ntracks0,trackdata0); | |
502 | memory->CloseBinaryOutput(); | |
503 | } | |
e968605e | 504 | |
108615fc | 505 | fInterMerger->Reset(); |
e0ea9951 | 506 | fInterMerger->Init(fRow[patch],patch); |
108615fc | 507 | |
108615fc | 508 | fInterMerger->FillTracks(ntracks0,trackdata0); |
4baac26f | 509 | |
510 | //fBenchmark->Start("Inter Merger"); | |
82bd465a | 511 | // fInterMerger->Merge(); |
4baac26f | 512 | // fInterMerger->SlowMerge(); |
108615fc | 513 | |
4baac26f | 514 | //fBenchmark->Stop("Inter Merger"); |
6e32a12a | 515 | /* |
108615fc | 516 | //write inter merged tracks |
517 | if(fWriteOut){ | |
6e32a12a | 518 | sprintf(name,"%stracks_im_%d_%d.raw",fWriteOutPath,slice,patch); |
108615fc | 519 | WriteTracks(name,fInterMerger,'i'); //write output of intermerger |
6e32a12a | 520 | } |
521 | */ | |
108615fc | 522 | memory->Free(); |
523 | ||
524 | UInt_t ntracks1 =0; | |
525 | AliL3TrackSegmentData *trackdata1 = | |
526 | (AliL3TrackSegmentData *) memory->Allocate(fInterMerger->GetInTracks(0)); | |
527 | memory->TrackArray2Memory(ntracks1,trackdata1,fInterMerger->GetInTracks(0)); | |
528 | ||
529 | fTrackMerger->InitSector(slice,patch); | |
108615fc | 530 | fTrackMerger->FillTracks(ntracks1,trackdata1); |
108615fc | 531 | |
532 | memory->Free(); | |
533 | } | |
3e87ef69 | 534 | //fBenchmark->Start("Patch Merger"); |
68a27388 | 535 | //fTrackMerger->SlowMerge(); |
e968605e | 536 | fTrackMerger->AddAllTracks(); |
537 | //fTrackMerger->Merge(); | |
3e87ef69 | 538 | //fBenchmark->Stop("Patch Merger"); |
6e32a12a | 539 | /* |
108615fc | 540 | //write merged tracks |
541 | if(fWriteOut){ | |
6e32a12a | 542 | sprintf(name,"%stracks_tm_%d.raw",fWriteOutPath,slice); |
108615fc | 543 | WriteTracks(name,fTrackMerger,'o'); //write output of trackmerger |
544 | } | |
6e32a12a | 545 | */ |
108615fc | 546 | fTrackData = (AliL3TrackSegmentData *) |
547 | fFileHandler->Allocate(fTrackMerger->GetOutTracks()); | |
548 | ||
549 | fFileHandler->TrackArray2Memory(fNTrackData,fTrackData, | |
550 | fTrackMerger->GetOutTracks()); | |
551 | ||
552 | delete memory; | |
553 | } | |
554 | ||
3e87ef69 | 555 | void AliLevel3::FitGlobalTracks() |
556 | { | |
1f1942b8 | 557 | AliL3Fitter *fitter = new AliL3Fitter(fVertex,AliLevel3::DoVertexFit()); |
3e87ef69 | 558 | if(fNPatch==1) |
559 | fitter->LoadClusters(fWriteOutPath,fEvent,kTRUE); | |
560 | else | |
561 | fitter->LoadClusters(fWriteOutPath,fEvent,kFALSE); | |
562 | ||
563 | fBenchmark->Start("Global track fitter"); | |
564 | AliL3TrackArray *tracks = fGlobalMerger->GetOutTracks(); | |
565 | for(Int_t i=0; i<tracks->GetNTracks(); i++) | |
566 | { | |
567 | AliL3Track *tr = tracks->GetCheckedTrack(i); | |
568 | if(!tr) continue; | |
569 | fitter->FitHelix(tr); | |
1f1942b8 | 570 | if(AliLevel3::IsTracksAtFirstPoint()) |
571 | tr->UpdateToFirstPoint(); | |
3e87ef69 | 572 | } |
573 | fBenchmark->Stop("Global track fitter"); | |
574 | delete fitter; | |
575 | } | |
576 | ||
108615fc | 577 | void AliLevel3::WriteSpacePoints(UInt_t npoints,AliL3SpacePointData *points, |
3e87ef69 | 578 | Int_t slice,Int_t patch) |
579 | { | |
108615fc | 580 | char name[256]; |
3e87ef69 | 581 | if(fNPatch==1) |
582 | sprintf(name,"%s/points_%d_%d_%d.raw",fWriteOutPath,fEvent,slice,-1); | |
583 | else | |
584 | sprintf(name,"%s/points_%d_%d_%d.raw",fWriteOutPath,fEvent,slice,patch); | |
108615fc | 585 | AliL3MemHandler * memory = new AliL3MemHandler(); |
586 | memory->SetBinaryOutput(name); | |
c51c6aaa | 587 | memory->Transform(npoints,points,slice); |
108615fc | 588 | memory->Memory2Binary(npoints,points); |
589 | memory->CloseBinaryOutput(); | |
590 | delete memory; | |
591 | } | |
592 | ||
3e87ef69 | 593 | Int_t AliLevel3::WriteTracks(char *filename,AliL3Merger *merger,char opt) |
594 | { | |
2e1fe9ef | 595 | AliL3MemHandler *memory = new AliL3MemHandler(); |
108615fc | 596 | memory->SetBinaryOutput(filename); |
597 | if(opt=='a'||opt=='i'){ //add intracks | |
598 | for(Int_t i=0;i<merger->GetNIn();i++){ | |
599 | AliL3TrackArray *tr=merger->GetInTracks(i); | |
600 | memory->TrackArray2Binary(tr); | |
601 | } | |
602 | } | |
603 | ||
604 | if(opt=='o'||opt=='a'){ | |
605 | AliL3TrackArray *tr=merger->GetOutTracks(); | |
606 | memory->TrackArray2Binary(tr); | |
607 | } | |
608 | ||
609 | memory->CloseBinaryOutput(); | |
610 | ||
611 | return 1; | |
612 | } | |
613 | ||
614 | void AliLevel3::WriteResults() | |
615 | { | |
616 | //Write the resulting tracks to outputfile | |
6e32a12a | 617 | Char_t fname[256]; |
3e87ef69 | 618 | sprintf(fname,"%s/tracks_%d.raw",fWriteOutPath,fEvent); |
6e32a12a | 619 | WriteTracks(fname,fGlobalMerger,'a'); |
620 | //WriteTracks("tracks.raw",fGlobalMerger,'a'); | |
3e87ef69 | 621 | sprintf(fname,"%s/tracks_gl_%d.raw",fWriteOutPath,fEvent); |
6e32a12a | 622 | WriteTracks(fname,fGlobalMerger,'o'); |
623 | //WriteTracks("tracks_gl.raw",fGlobalMerger,'o'); | |
108615fc | 624 | } |