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