]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/hough/AliL3Hough.cxx
Writing in addition merged tracks (C.Cheshkov)
[u/mrichter/AliRoot.git] / HLT / hough / AliL3Hough.cxx
CommitLineData
3e87ef69 1// @(#) $Id$
b1886074 2
3// Author: Anders Vestbo <mailto:vestbo@fi.uib.no>
3e87ef69 4//*-- Copyright &copy ALICE HLT Group
b1886074 5
e06900d5 6#include "AliL3StandardIncludes.h"
0309a5ee 7#include <sys/time.h>
f000f8a5 8
e06900d5 9#include "AliL3Logging.h"
b1886074 10#include "AliL3HoughMerger.h"
11#include "AliL3HoughIntMerger.h"
12#include "AliL3HoughGlobalMerger.h"
f80b98cb 13#include "AliL3Histogram.h"
f000f8a5 14#include "AliL3Hough.h"
15#include "AliL3HoughTransformer.h"
6c97129d 16#include "AliL3HoughClusterTransformer.h"
636080ea 17#include "AliL3HoughTransformerLUT.h"
b46b53c1 18#include "AliL3HoughTransformerVhdl.h"
0bd0c1ef 19#include "AliL3HoughTransformerRow.h"
f000f8a5 20#include "AliL3HoughMaxFinder.h"
3e87ef69 21#include "AliL3Benchmark.h"
95a00d93 22#ifdef use_aliroot
f80b98cb 23#include "AliL3FileHandler.h"
95a00d93 24#else
25#include "AliL3MemHandler.h"
26#endif
d96f6a4a 27#include "AliL3DataHandler.h"
f80b98cb 28#include "AliL3DigitData.h"
29#include "AliL3HoughEval.h"
30#include "AliL3Transform.h"
f80b98cb 31#include "AliL3TrackArray.h"
32#include "AliL3HoughTrack.h"
b2a02bce 33#include "AliL3DDLDataFileHandler.h"
95a00d93 34
0bd0c1ef 35#if __GNUC__ == 3
e06900d5 36using namespace std;
37#endif
b1886074 38
aa641eb8 39/** /class AliL3Hough
40//<pre>
b1886074 41//_____________________________________________________________
42// AliL3Hough
43//
237d3f5c 44// Interface class for the Hough transform
b1886074 45//
237d3f5c 46// Example how to use:
47//
48// AliL3Hough *hough = new AliL3Hough(path,kTRUE,NumberOfEtaSegments);
49// hough->ReadData(slice);
50// hough->Transform();
51// hough->FindTrackCandidates();
52//
53// AliL3TrackArray *tracks = hough->GetTracks(patch);
0bd0c1ef 54//
aa641eb8 55//</pre>
56*/
f000f8a5 57
58ClassImp(AliL3Hough)
59
60AliL3Hough::AliL3Hough()
61{
b1886074 62 //Constructor
63
6dbc57b4 64 fBinary = kFALSE;
a6008206 65 fAddHistograms = kFALSE;
6dbc57b4 66 fDoIterative = kFALSE;
67 fWriteDigits = kFALSE;
68 fUse8bits = kFALSE;
69
70 fMemHandler = 0;
237d3f5c 71 fHoughTransformer = 0;
6dbc57b4 72 fEval = 0;
73 fPeakFinder = 0;
74 fTracks = 0;
b2a02bce 75 fGlobalTracks = 0;
6dbc57b4 76 fMerger = 0;
77 fInterMerger = 0;
78 fGlobalMerger = 0;
3e87ef69 79 fBenchmark = 0;
80
6dbc57b4 81 fNEtaSegments = 0;
82 fNPatches = 0;
83 fVersion = 0;
84 fCurrentSlice = 0;
b2a02bce 85 fEvent = 0;
5a31e9df 86
0bd0c1ef 87 fKappaSpread = 6;
88 fPeakRatio = 0.5;
89 fInputFile = 0;
90 fInputPtr = 0;
5a31e9df 91
6dbc57b4 92 SetTransformerParams();
93 SetThreshold();
636080ea 94 SetNSaveIterations();
3e87ef69 95 SetPeakThreshold();
1f1942b8 96#ifdef use_aliroot
97 //just be sure that index is empty for new event
98 AliL3FileHandler::CleanStaticIndex();
de3c3890 99#ifdef use_newio
100 fRunLoader = 0;
101#endif
1f1942b8 102#endif
f000f8a5 103}
104
917e711b 105AliL3Hough::AliL3Hough(Char_t *path,Bool_t binary,Int_t netasegments,Bool_t bit8,Int_t tv,Char_t *infile,Char_t *ptr)
b46b53c1 106{
917e711b 107 //Normal constructor
b46b53c1 108 fBinary = binary;
109 strcpy(fPath,path);
917e711b 110 fNEtaSegments = netasegments;
b46b53c1 111 fAddHistograms = kFALSE;
6dbc57b4 112 fDoIterative = kFALSE;
113 fWriteDigits = kFALSE;
114 fUse8bits = bit8;
115 fVersion = tv;
5a31e9df 116 fKappaSpread=6;
117 fPeakRatio=0.5;
0bd0c1ef 118 if(!fBinary) {
119 if(infile) {
120 fInputFile = infile;
121 fInputPtr = 0;
122 }
123 else {
124 fInputFile = 0;
125 fInputPtr = ptr;
126 }
127 }
128 else {
b2a02bce 129 fInputFile = 0;
0bd0c1ef 130 fInputPtr = 0;
131 }
1f1942b8 132#ifdef use_aliroot
133 //just be sure that index is empty for new event
134 AliL3FileHandler::CleanStaticIndex();
de3c3890 135#ifdef use_newio
136 fRunLoader = 0;
137#endif
1f1942b8 138#endif
b46b53c1 139}
f000f8a5 140
f000f8a5 141AliL3Hough::~AliL3Hough()
142{
237d3f5c 143 //dtor
144
b1886074 145 CleanUp();
146 if(fMerger)
147 delete fMerger;
1f1942b8 148 //cout << "Cleaned class merger " << endl;
b1886074 149 if(fInterMerger)
150 delete fInterMerger;
1f1942b8 151 //cout << "Cleaned class inter " << endl;
a6008206 152 if(fPeakFinder)
153 delete fPeakFinder;
1f1942b8 154 //cout << "Cleaned class peak " << endl;
1c404dd5 155 if(fGlobalMerger)
156 delete fGlobalMerger;
1f1942b8 157 //cout << "Cleaned class global " << endl;
3e87ef69 158 if(fBenchmark)
159 delete fBenchmark;
1f1942b8 160 //cout << "Cleaned class bench " << endl;
b2a02bce 161 if(fGlobalTracks)
162 delete fGlobalTracks;
1f1942b8 163 //cout << "Cleaned class globaltracks " << endl;
f000f8a5 164}
165
b1886074 166void AliL3Hough::CleanUp()
f000f8a5 167{
b1886074 168 //Cleanup memory
169
1c404dd5 170 for(Int_t i=0; i<fNPatches; i++)
4fc9a6a4 171 {
b1886074 172 if(fTracks[i]) delete fTracks[i];
1f1942b8 173 //cout << "Cleaned tracks " << i << endl;
b1886074 174 if(fEval[i]) delete fEval[i];
1f1942b8 175 //cout << "Cleaned eval " << i << endl;
b1886074 176 if(fHoughTransformer[i]) delete fHoughTransformer[i];
1f1942b8 177 //cout << "Cleaned traf " << i << endl;
b1886074 178 if(fMemHandler[i]) delete fMemHandler[i];
1f1942b8 179 //cout << "Cleaned mem " << i << endl;
4fc9a6a4 180 }
b1886074 181
3e87ef69 182 if(fTracks) delete [] fTracks;
1f1942b8 183 //cout << "Cleaned class tracks " << endl;
3e87ef69 184 if(fEval) delete [] fEval;
1f1942b8 185 //cout << "Cleaned class eval " << endl;
3e87ef69 186 if(fHoughTransformer) delete [] fHoughTransformer;
1f1942b8 187 //cout << "Cleaned cleass trafo " << endl;
3e87ef69 188 if(fMemHandler) delete [] fMemHandler;
1f1942b8 189 //cout << "Cleaned class mem " << endl;
f000f8a5 190}
191
917e711b 192void AliL3Hough::Init(Char_t *path,Bool_t binary,Int_t netasegments,Bool_t bit8,Int_t tv,Char_t *infile,Char_t *ptr,Float_t zvertex)
f000f8a5 193{
917e711b 194 //Normal init of the AliL3Hough
d96f6a4a 195 fBinary = binary;
196 strcpy(fPath,path);
917e711b 197 fNEtaSegments = netasegments;
6dbc57b4 198 fWriteDigits = kFALSE;
199 fUse8bits = bit8;
200 fVersion = tv;
0bd0c1ef 201 if(!fBinary) {
202 if(infile) {
203 fInputFile = infile;
204 fInputPtr = 0;
205 }
206 else {
207 fInputFile = 0;
208 fInputPtr = ptr;
209 }
210 }
211 else {
b2a02bce 212 fInputFile = 0;
0bd0c1ef 213 fInputPtr = 0;
214 }
215 fZVertex = zvertex;
6dbc57b4 216
217 Init(); //do the rest
218}
219
e06900d5 220void AliL3Hough::Init(Bool_t doit, Bool_t addhists)
a4639de2 221{
917e711b 222 // Init
6dbc57b4 223 fDoIterative = doit;
224 fAddHistograms = addhists;
b46b53c1 225
26abc209 226 fNPatches = AliL3Transform::GetNPatches();
3e87ef69 227
237d3f5c 228 fHoughTransformer = new AliL3HoughBaseTransformer*[fNPatches];
95a00d93 229 fMemHandler = new AliL3MemHandler*[fNPatches];
3e87ef69 230
1c404dd5 231 fTracks = new AliL3TrackArray*[fNPatches];
232 fEval = new AliL3HoughEval*[fNPatches];
b2a02bce 233
234 fGlobalTracks = new AliL3TrackArray("AliL3HoughTrack");
235
1c404dd5 236 for(Int_t i=0; i<fNPatches; i++)
f80b98cb 237 {
6dbc57b4 238 switch (fVersion){ //choose Transformer
b46b53c1 239 case 1:
636080ea 240 fHoughTransformer[i] = new AliL3HoughTransformerLUT(0,i,fNEtaSegments);
b46b53c1 241 break;
6c97129d 242 case 2:
243 fHoughTransformer[i] = new AliL3HoughClusterTransformer(0,i,fNEtaSegments);
244 break;
636080ea 245 case 3:
246 fHoughTransformer[i] = new AliL3HoughTransformerVhdl(0,i,fNEtaSegments,fNSaveIterations);
247 break;
5a31e9df 248 case 4:
0bd0c1ef 249 fHoughTransformer[i] = new AliL3HoughTransformerRow(0,i,fNEtaSegments,kFALSE,fZVertex);
5a31e9df 250 break;
b46b53c1 251 default:
3e87ef69 252 fHoughTransformer[i] = new AliL3HoughTransformer(0,i,fNEtaSegments,kFALSE,kFALSE);
b46b53c1 253 }
aa641eb8 254
de3c3890 255 // fHoughTransformer[i]->CreateHistograms(fNBinX[i],fLowPt[i],fNBinY[i],-fPhi[i],fPhi[i]);
256 fHoughTransformer[i]->CreateHistograms(fNBinX[i],-fLowPt[i],fLowPt[i],fNBinY[i],-fPhi[i],fPhi[i]);
b2a02bce 257 //fHoughTransformer[i]->CreateHistograms(fLowPt[i],fUpperPt[i],fPtRes[i],fNBinY[i],fPhi[i]);
1f1942b8 258
b2a02bce 259 fHoughTransformer[i]->SetLowerThreshold(fThreshold[i]);
260 fHoughTransformer[i]->SetUpperThreshold(100);
261
0309a5ee 262 LOG(AliL3Log::kInformational,"AliL3Hough::Init","Version")
6dbc57b4 263 <<"Initializing Hough transformer version "<<fVersion<<ENDLOG;
a4639de2 264
b1886074 265 fEval[i] = new AliL3HoughEval();
266 fTracks[i] = new AliL3TrackArray("AliL3HoughTrack");
d96f6a4a 267 if(fUse8bits)
268 fMemHandler[i] = new AliL3DataHandler();
269 else
95a00d93 270#ifdef use_aliroot
d96f6a4a 271 {
b2a02bce 272 if(!fInputFile) {
0bd0c1ef 273 if(!fInputPtr) {
274 /* In case of reading digits file */
275 fMemHandler[i] = new AliL3FileHandler(kTRUE); //use static index
276 if(!fBinary) {
de3c3890 277#if use_newio
278 if(!fRunLoader) {
279#endif
280 Char_t filename[1024];
281 sprintf(filename,"%s/digitfile.root",fPath);
282 fMemHandler[i]->SetAliInput(filename);
283#if use_newio
284 }
285 else {
286 fMemHandler[i]->SetAliInput(fRunLoader);
287 }
288#endif
0bd0c1ef 289 }
290 }
291 else {
292 /* In case of reading from DATE */
293 fMemHandler[i] = new AliL3DDLDataFileHandler();
294 fMemHandler[i]->SetReaderInput(fInputPtr,-1);
3bb06991 295 }
b2a02bce 296 }
297 else {
298 /* In case of reading rawdata from ROOT file */
299 fMemHandler[i] = new AliL3DDLDataFileHandler();
300 fMemHandler[i]->SetReaderInput(fInputFile);
301 }
d96f6a4a 302 }
95a00d93 303#else
304 fMemHandler[i] = new AliL3MemHandler();
305#endif
a6008206 306 }
6dbc57b4 307
de3c3890 308 fPeakFinder = new AliL3HoughMaxFinder("KappaPhi",50000);
1c404dd5 309 fMerger = new AliL3HoughMerger(fNPatches);
b1886074 310 fInterMerger = new AliL3HoughIntMerger();
237d3f5c 311 fGlobalMerger = 0;
3e87ef69 312 fBenchmark = new AliL3Benchmark();
b2a02bce 313}
314
315void AliL3Hough::SetTransformerParams(Float_t ptres,Float_t ptmin,Float_t ptmax,Int_t ny,Int_t patch)
316{
917e711b 317 // Setup the parameters for the Hough Transformer
b2a02bce 318 Int_t mrow;
319 Float_t psi=0;
320 if(patch==-1)
321 mrow = 80;
322 else
323 mrow = AliL3Transform::GetLastRow(patch);
324 if(ptmin)
325 {
326 Double_t lineradius = sqrt(pow(AliL3Transform::Row2X(mrow),2) + pow(AliL3Transform::GetMaxY(mrow),2));
327 Double_t kappa = -1*AliL3Transform::GetBField()*AliL3Transform::GetBFact()/ptmin;
328 psi = AliL3Transform::Deg2Rad(10) - asin(lineradius*kappa/2);
329 cout<<"Calculated psi range "<<psi<<" in patch "<<patch<<endl;
330 }
331
332 if(patch==-1)
333 {
334 Int_t i=0;
335 while(i < 6)
336 {
337 fPtRes[i] = ptres;
338 fLowPt[i] = ptmin;
339 fUpperPt[i] = ptmax;
340 fNBinY[i] = ny;
341 fPhi[i] = psi;
342 fNBinX[i]=0;
343 i++;
344 }
345 return;
346 }
347
348 fPtRes[patch] = ptres;
349 fLowPt[patch] = ptmin;
350 fUpperPt[patch] = ptmax;
351 fNBinY[patch] = ny;
352 fPhi[patch] = psi;
353}
de3c3890 354/*
b2a02bce 355void AliL3Hough::SetTransformerParams(Int_t nx,Int_t ny,Float_t ptmin,Int_t patch)
356{
917e711b 357 // Setup the parameters for the Hough Transformer
b2a02bce 358
359 Int_t mrow=80;
360 Double_t lineradius = sqrt(pow(AliL3Transform::Row2X(mrow),2) + pow(AliL3Transform::GetMaxY(mrow),2));
361 Double_t kappa = -1*AliL3Transform::GetBField()*AliL3Transform::GetBFact()/ptmin;
362 Double_t psi = AliL3Transform::Deg2Rad(10) - asin(lineradius*kappa/2);
363 cout<<"Calculated psi range "<<psi<<" in patch "<<patch<<endl;
364
365 Int_t i=0;
366 while(i < 6)
367 {
368 fLowPt[i] = ptmin;
369 fNBinY[i] = ny;
370 fNBinX[i] = nx;
371 fPhi[i] = psi;
372 i++;
373 }
374}
de3c3890 375*/
0615a438 376void AliL3Hough::SetTransformerParams(Int_t nx,Int_t ny,Float_t ptmin,Int_t /*patch*/)
de3c3890 377{
917e711b 378 // Setup the parameters for the Hough Transformer
de3c3890 379
380
381 Int_t mrow=79;
382 Double_t lineradius = sqrt(pow(AliL3Transform::Row2X(mrow),2) + pow(AliL3Transform::GetMaxY(mrow),2));
383 Double_t alpha1 = AliL3Transform::GetMaxY(mrow)/pow(lineradius,2);
384 Double_t kappa = 1*AliL3Transform::GetBField()*AliL3Transform::GetBFact()/ptmin;
385 Double_t psi = AliL3Transform::Deg2Rad(10) - asin(lineradius*kappa/2);
0fdf7509 386 // cout<<"Calculated psi range "<<psi<<" in patch "<<patch<<endl;
de3c3890 387 AliL3HoughTrack track;
388 track.SetTrackParameters(kappa,psi,1);
389 Float_t hit[3];
390 Int_t mrow2 = 158;
391 track.GetCrossingPoint(mrow2,hit);
392 Double_t lineradius2 = sqrt(pow(AliL3Transform::Row2X(mrow2),2) + pow(AliL3Transform::GetMaxY(mrow2),2));
393 Double_t alpha2 = hit[1]/pow(lineradius2,2);
0fdf7509 394 // cout<<"Calculated alphas range "<<alpha1<<" "<<alpha2<<" in patch "<<patch<<endl;
de3c3890 395
396 Int_t i=0;
397 while(i < 6)
398 {
399 fLowPt[i] = 1.15*alpha1;
400 fNBinY[i] = ny;
401 fNBinX[i] = nx;
402 fPhi[i] = 1.15*alpha2;
403 i++;
404 }
405}
b2a02bce 406
407void AliL3Hough::SetTransformerParams(Int_t nx,Int_t ny,Float_t lpt,Float_t phi)
408{
409 Int_t i=0;
410 while(i < 6)
411 {
412 fLowPt[i] = lpt;
413 fNBinY[i] = ny;
414 fNBinX[i] = nx;
415 fPhi[i] = phi;
416 i++;
417 }
418}
419
420void AliL3Hough::SetThreshold(Int_t t3,Int_t patch)
421{
917e711b 422 // Set digits threshold
b2a02bce 423 if(patch==-1)
424 {
425 Int_t i=0;
426 while(i < 6)
427 fThreshold[i++]=t3;
428 return;
429 }
430 fThreshold[patch]=t3;
431}
3e87ef69 432
b2a02bce 433void AliL3Hough::SetPeakThreshold(Int_t threshold,Int_t patch)
434{
917e711b 435 // Set Peak Finder threshold
b2a02bce 436 if(patch==-1)
437 {
438 Int_t i=0;
439 while(i < 6)
440 fPeakThreshold[i++]=threshold;
441 return;
442 }
443 fPeakThreshold[patch]=threshold;
3e87ef69 444}
445
446void AliL3Hough::DoBench(Char_t *name)
447{
448 fBenchmark->Analyze(name);
a6008206 449}
450
451void AliL3Hough::Process(Int_t minslice,Int_t maxslice)
452{
453 //Process all slices [minslice,maxslice].
1c404dd5 454 fGlobalMerger = new AliL3HoughGlobalMerger(minslice,maxslice);
b1886074 455
a6008206 456 for(Int_t i=minslice; i<=maxslice; i++)
457 {
b1886074 458 ReadData(i);
459 Transform();
0bd0c1ef 460 if(fAddHistograms) {
461 if(fVersion != 4)
462 AddAllHistograms();
463 else
464 AddAllHistogramsRows();
465 }
a6008206 466 FindTrackCandidates();
3e87ef69 467 //Evaluate();
468 //fGlobalMerger->FillTracks(fTracks[0],i);
f80b98cb 469 }
4fc9a6a4 470}
f80b98cb 471
e06900d5 472void AliL3Hough::ReadData(Int_t slice,Int_t eventnr)
4fc9a6a4 473{
b1886074 474 //Read data from files, binary or root.
3bb06991 475
1f1942b8 476#ifdef use_aliroot
477 if(fEvent!=eventnr) //just be sure that index is empty for new event
478 AliL3FileHandler::CleanStaticIndex();
479#endif
3bb06991 480 fCurrentSlice = slice;
1f1942b8 481
1c404dd5 482 for(Int_t i=0; i<fNPatches; i++)
f80b98cb 483 {
4fc9a6a4 484 fMemHandler[i]->Free();
485 UInt_t ndigits=0;
486 AliL3DigitRowData *digits =0;
487 Char_t name[256];
3fe49b5b 488 fMemHandler[i]->Init(slice,i);
a6008206 489 if(fBinary)//take input data from binary files
4fc9a6a4 490 {
d96f6a4a 491 if(fUse8bits)
b2a02bce 492 sprintf(name,"%s/binaries/digits_c8_%d_%d_%d.raw",fPath,eventnr,slice,i);
d96f6a4a 493 else
b2a02bce 494 sprintf(name,"%s/binaries/digits_%d_%d_%d.raw",fPath,eventnr,slice,i);
636080ea 495
4fc9a6a4 496 fMemHandler[i]->SetBinaryInput(name);
497 digits = (AliL3DigitRowData *)fMemHandler[i]->CompBinary2Memory(ndigits);
498 fMemHandler[i]->CloseBinaryInput();
499 }
500 else //read data from root file
501 {
95a00d93 502#ifdef use_aliroot
5a31e9df 503 if(fEvent!=eventnr)
504 fMemHandler[i]->FreeDigitsTree();//or else the new event is not loaded
3e87ef69 505 digits=(AliL3DigitRowData *)fMemHandler[i]->AliAltroDigits2Memory(ndigits,eventnr);
95a00d93 506#else
507 cerr<<"You cannot read from rootfile now"<<endl;
508#endif
4fc9a6a4 509 }
aa641eb8 510
636080ea 511 //set input data and init transformer
512 fHoughTransformer[i]->SetInputData(ndigits,digits);
513 fHoughTransformer[i]->Init(slice,i,fNEtaSegments);
b1886074 514 }
5a31e9df 515
516 fEvent=eventnr;
b1886074 517}
518
917e711b 519void AliL3Hough::Transform(Int_t *rowrange)
b1886074 520{
521 //Transform all data given to the transformer within the given slice
522 //(after ReadData(slice))
0309a5ee 523
524 Double_t initTime,cpuTime;
525 initTime = GetCpuTime();
1c404dd5 526 for(Int_t i=0; i<fNPatches; i++)
b1886074 527 {
0bd0c1ef 528 // In case of Row transformer reset the arrays only once
529 if((fVersion != 4) || (i == 0))
530 fHoughTransformer[i]->Reset();//Reset the histograms
3e87ef69 531 fBenchmark->Start("Hough Transform");
917e711b 532 if(!rowrange)
237d3f5c 533 fHoughTransformer[i]->TransformCircle();
534 else
917e711b 535 fHoughTransformer[i]->TransformCircleC(rowrange,1);
3e87ef69 536 fBenchmark->Stop("Hough Transform");
b1886074 537 }
0309a5ee 538 cpuTime = GetCpuTime() - initTime;
539 LOG(AliL3Log::kInformational,"AliL3Hough::Transform()","Timing")
540 <<"Transform done in average per patch of "<<cpuTime*1000/fNPatches<<" ms"<<ENDLOG;
b1886074 541}
542
543void AliL3Hough::MergePatches()
544{
917e711b 545 // Merge patches if they are not summed
b1886074 546 if(fAddHistograms) //Nothing to merge here
547 return;
b1886074 548 fMerger->MergePatches(kTRUE);
b1886074 549}
550
551void AliL3Hough::MergeInternally()
552{
917e711b 553 // Merge patches internally
b1886074 554 if(fAddHistograms)
555 fInterMerger->FillTracks(fTracks[0]);
556 else
557 fInterMerger->FillTracks(fMerger->GetOutTracks());
558
559 fInterMerger->MMerge();
560}
561
562void AliL3Hough::ProcessSliceIter()
563{
564 //Process current slice (after ReadData(slice)) iteratively.
565
6c97129d 566 if(!fAddHistograms)
b1886074 567 {
6c97129d 568 for(Int_t i=0; i<fNPatches; i++)
569 {
570 ProcessPatchIter(i);
571 fMerger->FillTracks(fTracks[i],i); //Copy tracks to merger
572 }
573 }
574 else
575 {
576 for(Int_t i=0; i<10; i++)
577 {
578 Transform();
579 AddAllHistograms();
580 InitEvaluate();
581 AliL3HoughBaseTransformer *tr = fHoughTransformer[0];
582 for(Int_t j=0; j<fNEtaSegments; j++)
583 {
584 AliL3Histogram *hist = tr->GetHistogram(j);
585 if(hist->GetNEntries()==0) continue;
586 fPeakFinder->Reset();
587 fPeakFinder->SetHistogram(hist);
588 fPeakFinder->FindAbsMaxima();
589 AliL3HoughTrack *track = (AliL3HoughTrack*)fTracks[0]->NextTrack();
590 track->SetTrackParameters(fPeakFinder->GetXPeak(0),fPeakFinder->GetYPeak(0),fPeakFinder->GetWeight(0));
591 track->SetEtaIndex(j);
592 track->SetEta(tr->GetEta(j,fCurrentSlice));
593 for(Int_t k=0; k<fNPatches; k++)
594 {
595 fEval[i]->SetNumOfPadsToLook(2);
596 fEval[i]->SetNumOfRowsToMiss(2);
597 fEval[i]->RemoveFoundTracks();
3e87ef69 598 /*
6c97129d 599 Int_t nrows=0;
600 if(!fEval[i]->LookInsideRoad(track,nrows))
601 {
602 fTracks[0]->Remove(fTracks[0]->GetNTracks()-1);
603 fTracks[0]->Compress();
604 }
3e87ef69 605 */
6c97129d 606 }
607 }
608
609 }
610
f80b98cb 611 }
4fc9a6a4 612}
613
b1886074 614void AliL3Hough::ProcessPatchIter(Int_t patch)
615{
616 //Process patch in a iterative way.
617 //transform + peakfinding + evaluation + transform +...
618
917e711b 619 Int_t numoftries = 5;
237d3f5c 620 AliL3HoughBaseTransformer *tr = fHoughTransformer[patch];
b1886074 621 AliL3TrackArray *tracks = fTracks[patch];
622 tracks->Reset();
623 AliL3HoughEval *ev = fEval[patch];
624 ev->InitTransformer(tr);
6c97129d 625 //ev->RemoveFoundTracks();
626 ev->SetNumOfRowsToMiss(3);
b5a207b4 627 ev->SetNumOfPadsToLook(2);
b1886074 628 AliL3Histogram *hist;
917e711b 629 for(Int_t t=0; t<numoftries; t++)
b1886074 630 {
631 tr->Reset();
632 tr->TransformCircle();
633 for(Int_t i=0; i<fNEtaSegments; i++)
634 {
635 hist = tr->GetHistogram(i);
636 if(hist->GetNEntries()==0) continue;
6c97129d 637 fPeakFinder->Reset();
b1886074 638 fPeakFinder->SetHistogram(hist);
6c97129d 639 fPeakFinder->FindAbsMaxima();
640 //fPeakFinder->FindPeak1();
b1886074 641 AliL3HoughTrack *track = (AliL3HoughTrack*)tracks->NextTrack();
6c97129d 642 track->SetTrackParameters(fPeakFinder->GetXPeak(0),fPeakFinder->GetYPeak(0),fPeakFinder->GetWeight(0));
643 track->SetEtaIndex(i);
644 track->SetEta(tr->GetEta(i,fCurrentSlice));
3e87ef69 645 /*
6c97129d 646 Int_t nrows=0;
647 if(!ev->LookInsideRoad(track,nrows))
b1886074 648 {
649 tracks->Remove(tracks->GetNTracks()-1);
650 tracks->Compress();
651 }
3e87ef69 652 */
b1886074 653 }
654 }
6c97129d 655 fTracks[0]->QSort();
b1886074 656 LOG(AliL3Log::kInformational,"AliL3Hough::ProcessPatch","NTracks")
657 <<AliL3Log::kDec<<"Found "<<tracks->GetNTracks()<<" tracks in patch "<<patch<<ENDLOG;
658}
659
a6008206 660void AliL3Hough::AddAllHistograms()
4fc9a6a4 661{
a6008206 662 //Add the histograms within one etaslice.
663 //Resulting histogram are in patch=0.
b1886074 664
0309a5ee 665 Double_t initTime,cpuTime;
666 initTime = GetCpuTime();
3e87ef69 667 fBenchmark->Start("Add Histograms");
a6008206 668 for(Int_t i=0; i<fNEtaSegments; i++)
669 {
670 AliL3Histogram *hist0 = fHoughTransformer[0]->GetHistogram(i);
1c404dd5 671 for(Int_t j=1; j<fNPatches; j++)
a6008206 672 {
673 AliL3Histogram *hist = fHoughTransformer[j]->GetHistogram(i);
674 hist0->Add(hist);
675 }
676 }
3e87ef69 677 fBenchmark->Stop("Add Histograms");
b1886074 678 fAddHistograms = kTRUE;
0309a5ee 679 cpuTime = GetCpuTime() - initTime;
680 LOG(AliL3Log::kInformational,"AliL3Hough::AddAllHistograms()","Timing")
681 <<"Adding histograms in "<<cpuTime*1000<<" ms"<<ENDLOG;
a6008206 682}
683
0bd0c1ef 684void AliL3Hough::AddAllHistogramsRows()
685{
686 //Add the histograms within one etaslice.
687 //Resulting histogram are in patch=0.
688
689 Double_t initTime,cpuTime;
690 initTime = GetCpuTime();
691 fBenchmark->Start("Add HistogramsRows");
692
de3c3890 693 UChar_t *tracknrows = ((AliL3HoughTransformerRow *)fHoughTransformer[0])->GetTrackNRows();
694 UChar_t *trackfirstrow = ((AliL3HoughTransformerRow *)fHoughTransformer[0])->GetTrackFirstRow();
695 UChar_t *tracklastrow = ((AliL3HoughTransformerRow *)fHoughTransformer[0])->GetTrackLastRow();
696
0bd0c1ef 697 for(Int_t i=0; i<fNEtaSegments; i++)
698 {
699 UChar_t *rowcount = ((AliL3HoughTransformerRow *)fHoughTransformer[0])->GetRowCount(i);
700 UChar_t *gapcount = ((AliL3HoughTransformerRow *)fHoughTransformer[0])->GetGapCount(i);
de3c3890 701 UChar_t *currentrowcount = ((AliL3HoughTransformerRow *)fHoughTransformer[0])->GetCurrentRowCount(i);
0bd0c1ef 702
703 AliL3Histogram *hist = fHoughTransformer[0]->GetHistogram(i);
704 Int_t xmin = hist->GetFirstXbin();
705 Int_t xmax = hist->GetLastXbin();
706 Int_t ymin = hist->GetFirstYbin();
707 Int_t ymax = hist->GetLastYbin();
708
709 for(Int_t ybin=ymin; ybin<=ymax; ybin++)
710 {
711 for(Int_t xbin=xmin; xbin<=xmax; xbin++)
712 {
713 Int_t bin = hist->GetBin(xbin,ybin);
de3c3890 714 if(tracklastrow[bin] > (currentrowcount[bin] + 1))
715 gapcount[bin]++;
716 if(gapcount[bin] < MAX_N_GAPS)
717 if(rowcount[bin] >= MIN_TRACK_LENGTH)
718 if(((Int_t)rowcount[bin] + (Int_t)gapcount[bin])>=((Int_t)tracknrows[bin]-MAX_MISS_ROWS))
719 hist->AddBinContent(bin,(rowcount[bin]+trackfirstrow[bin]+159-tracklastrow[bin]));
0bd0c1ef 720 }
721 }
722 }
723
724 fBenchmark->Stop("Add HistogramsRows");
725 fAddHistograms = kTRUE;
726 cpuTime = GetCpuTime() - initTime;
727 LOG(AliL3Log::kInformational,"AliL3Hough::AddAllHistogramsRows()","Timing")
728 <<"Adding histograms in "<<cpuTime*1000<<" ms"<<ENDLOG;
729}
730
b2a02bce 731void AliL3Hough::AddTracks()
732{
917e711b 733 // Add current slice slice tracks to the global list of found tracks
b2a02bce 734 if(!fTracks[0])
735 {
736 cerr<<"AliL3Hough::AddTracks : No tracks"<<endl;
737 return;
738 }
739 AliL3TrackArray *tracks = fTracks[0];
740 for(Int_t i=0; i<tracks->GetNTracks(); i++)
741 {
742 AliL3Track *track = tracks->GetCheckedTrack(i);
743 if(!track) continue;
744 if(track->GetNHits()!=1) cerr<<"NHITS "<<track->GetNHits()<<endl;
745 UInt_t *ids = track->GetHitNumbers();
746 ids[0] = (fCurrentSlice&0x7f)<<25;
747 }
748
749 fGlobalTracks->AddTracks(fTracks[0],0,fCurrentSlice);
750}
751
de3c3890 752void AliL3Hough::FindTrackCandidatesRow()
a6008206 753{
917e711b 754 // Find AliL3HoughTransformerRow track candidates
de3c3890 755 if(fVersion != 4) {
756 LOG(AliL3Log::kError,"AliL3Hough::FindTrackCandidatesRow()","")
757 <<"Incompatible Peak Finder version!"<<ENDLOG;
758 return;
759 }
760
a6008206 761 //Look for peaks in histograms, and find the track candidates
917e711b 762 Int_t npatches;
de3c3890 763 if(fAddHistograms)
917e711b 764 npatches = 1; //Histograms have been added.
de3c3890 765 else
917e711b 766 npatches = fNPatches;
de3c3890 767
768 Double_t initTime,cpuTime;
769 initTime = GetCpuTime();
770 fBenchmark->Start("Find Maxima");
917e711b 771 for(Int_t i=0; i<npatches; i++)
de3c3890 772 {
773 AliL3HoughBaseTransformer *tr = fHoughTransformer[i];
774 fTracks[i]->Reset();
775 fPeakFinder->Reset();
776
777 for(Int_t j=0; j<fNEtaSegments; j++)
778 {
779 AliL3Histogram *hist = tr->GetHistogram(j);
780 if(hist->GetNEntries()==0) continue;
781 fPeakFinder->SetHistogram(hist);
782 fPeakFinder->SetEtaSlice(j);
783#ifdef do_mc
784 LOG(AliL3Log::kInformational,"AliL3Hough::FindTrackCandidates()","")
785 <<"Starting "<<j<<" etaslice"<<ENDLOG;
786#endif
787 fPeakFinder->SetThreshold(fPeakThreshold[i]);
788 fPeakFinder->FindAdaptedRowPeaks(1,0,0);//Maxima finder for HoughTransformerRow
789
790 //fPeakFinder->FindMaxima(fPeakThreshold[i]); //Simple maxima finder
791 }
a6008206 792
de3c3890 793 for(Int_t k=0; k<fPeakFinder->GetEntries(); k++)
794 {
abbb084b 795 // if(fPeakFinder->GetWeight(k) < 0) continue;
de3c3890 796 AliL3HoughTrack *track = (AliL3HoughTrack*)fTracks[i]->NextTrack();
797 Float_t psi = atan((fPeakFinder->GetXPeak(k)-fPeakFinder->GetYPeak(k))/(AliL3HoughTransformerRow::GetBeta1()-AliL3HoughTransformerRow::GetBeta2()));
798 Float_t kappa = 2.0*(fPeakFinder->GetXPeak(k)*cos(psi)-AliL3HoughTransformerRow::GetBeta1()*sin(psi));
799 // track->SetTrackParameters(fPeakFinder->GetXPeak(k),fPeakFinder->GetYPeak(k),fPeakFinder->GetWeight(k));
800 track->SetTrackParameters(kappa,psi,fPeakFinder->GetWeight(k));
801 track->SetBinXY(fPeakFinder->GetXPeak(k),fPeakFinder->GetYPeak(k),fPeakFinder->GetXPeakSize(k),fPeakFinder->GetYPeakSize(k));
802 Int_t etaindex = (fPeakFinder->GetStartEta(k)+fPeakFinder->GetEndEta(k))/2;
803 track->SetEtaIndex(etaindex);
804 Float_t starteta = tr->GetEta(fPeakFinder->GetStartEta(k),fCurrentSlice);
805 Float_t endeta = tr->GetEta(fPeakFinder->GetEndEta(k),fCurrentSlice);
806 track->SetEta((starteta+endeta)/2.0);
807 track->SetRowRange(AliL3Transform::GetFirstRow(0),AliL3Transform::GetLastRow(5));
808 track->SetSector(fCurrentSlice);
809 track->SetSlice(fCurrentSlice);
810#ifdef do_mc
811 Int_t label = tr->GetTrackID(etaindex,fPeakFinder->GetXPeak(k),fPeakFinder->GetYPeak(k));
812 track->SetMCid(label);
813 // cout<<"Track found with label "<<label<<" at "<<fPeakFinder->GetXPeak(k)<<" "<<fPeakFinder->GetYPeak(k)<<" with weight "<<fPeakFinder->GetWeight(k)<<endl;
814#endif
815 }
816 LOG(AliL3Log::kInformational,"AliL3Hough::FindTrackCandidates()","")
817 <<"Found "<<fTracks[i]->GetNTracks()<<" tracks in patch "<<i<<ENDLOG;
818 fTracks[i]->QSort();
819 }
820 fBenchmark->Stop("Find Maxima");
821 cpuTime = GetCpuTime() - initTime;
822 LOG(AliL3Log::kInformational,"AliL3Hough::FindTrackCandidates()","Timing")
823 <<"Maxima finding done in "<<cpuTime*1000<<" ms"<<ENDLOG;
824}
825
826void AliL3Hough::FindTrackCandidates()
827{
917e711b 828 // Find AliL3HoughTransformer track candidates
de3c3890 829 if(fVersion == 4) {
830 LOG(AliL3Log::kError,"AliL3Hough::FindTrackCandidatesRow()","")
831 <<"Incompatible Peak Finder version!"<<ENDLOG;
832 return;
833 }
834
917e711b 835 Int_t npatches;
a6008206 836 if(fAddHistograms)
917e711b 837 npatches = 1; //Histograms have been added.
a6008206 838 else
917e711b 839 npatches = fNPatches;
b1886074 840
0309a5ee 841 Double_t initTime,cpuTime;
842 initTime = GetCpuTime();
3e87ef69 843 fBenchmark->Start("Find Maxima");
917e711b 844 for(Int_t i=0; i<npatches; i++)
a6008206 845 {
237d3f5c 846 AliL3HoughBaseTransformer *tr = fHoughTransformer[i];
b1886074 847 fTracks[i]->Reset();
6c97129d 848
a6008206 849 for(Int_t j=0; j<fNEtaSegments; j++)
850 {
851 AliL3Histogram *hist = tr->GetHistogram(j);
b1886074 852 if(hist->GetNEntries()==0) continue;
3fe49b5b 853 fPeakFinder->Reset();
a6008206 854 fPeakFinder->SetHistogram(hist);
de3c3890 855#ifdef do_mc
856 cout<<"Starting "<<j<<" etaslice"<<endl;
857#endif
b2a02bce 858 fPeakFinder->SetThreshold(fPeakThreshold[i]);
de3c3890 859 fPeakFinder->FindAdaptedPeaks(fKappaSpread,fPeakRatio);
b2a02bce 860
3fe49b5b 861 for(Int_t k=0; k<fPeakFinder->GetEntries(); k++)
a6008206 862 {
b1886074 863 AliL3HoughTrack *track = (AliL3HoughTrack*)fTracks[i]->NextTrack();
3fe49b5b 864 track->SetTrackParameters(fPeakFinder->GetXPeak(k),fPeakFinder->GetYPeak(k),fPeakFinder->GetWeight(k));
a6008206 865 track->SetEtaIndex(j);
afd8fed4 866 track->SetEta(tr->GetEta(j,fCurrentSlice));
26abc209 867 track->SetRowRange(AliL3Transform::GetFirstRow(0),AliL3Transform::GetLastRow(5));
a6008206 868 }
869 }
b2a02bce 870 cout<<"Found "<<fTracks[i]->GetNTracks()<<" tracks in patch "<<i<<endl;
b1886074 871 fTracks[i]->QSort();
a6008206 872 }
3e87ef69 873 fBenchmark->Stop("Find Maxima");
0309a5ee 874 cpuTime = GetCpuTime() - initTime;
875 LOG(AliL3Log::kInformational,"AliL3Hough::FindTrackCandidates()","Timing")
876 <<"Maxima finding done in "<<cpuTime*1000<<" ms"<<ENDLOG;
a6008206 877}
878
3fe49b5b 879void AliL3Hough::InitEvaluate()
880{
881 //Pass the transformer objects to the AliL3HoughEval objects:
882 //This will provide the evaluation objects with all the necessary
208b54c5 883 //data and parameters it needs.
3fe49b5b 884
885 for(Int_t i=0; i<fNPatches; i++)
886 fEval[i]->InitTransformer(fHoughTransformer[i]);
887}
888
917e711b 889Int_t AliL3Hough::Evaluate(Int_t roadwidth,Int_t nrowstomiss)
a6008206 890{
891 //Evaluate the tracks, by looking along the road in the raw data.
3fe49b5b 892 //If track does not cross all padrows - rows2miss, it is removed from the arrray.
0309a5ee 893 //If histograms were not added, the check is done locally in patch,
894 //meaning that nrowstomiss is the number of padrows the road can miss with respect
895 //to the number of rows in the patch.
896 //If the histograms were added, the comparison is done globally in the _slice_,
897 //meaing that nrowstomiss is the number of padrows the road can miss with
898 //respect to the total number of padrows in the slice.
899 //
900 //Return value = number of tracks which were removed (only in case of fAddHistograms)
a6008206 901
b1886074 902 if(!fTracks[0])
a6008206 903 {
b1886074 904 LOG(AliL3Log::kError,"AliL3Hough::Evaluate","Track Array")
905 <<"No tracks to work with..."<<ENDLOG;
0309a5ee 906 return 0;
a6008206 907 }
908
917e711b 909 Int_t removedtracks=0;
0309a5ee 910 AliL3TrackArray *tracks=0;
a4639de2 911
0309a5ee 912 if(fAddHistograms)
a4639de2 913 {
0309a5ee 914 tracks = fTracks[0];
0309a5ee 915 for(Int_t i=0; i<tracks->GetNTracks(); i++)
a6008206 916 {
a4639de2 917 AliL3Track *track = tracks->GetCheckedTrack(i);
918 if(!track) continue;
919 track->SetNHits(0);
0309a5ee 920 }
f80b98cb 921 }
f000f8a5 922
a4639de2 923 for(Int_t i=0; i<fNPatches; i++)
917e711b 924 EvaluatePatch(i,roadwidth,nrowstomiss);
a4639de2 925
aa641eb8 926 //Here we check the tracks globally;
927 //how many good rows (padrows with signal)
928 //did it cross in the slice
929 if(fAddHistograms)
0309a5ee 930 {
931 for(Int_t j=0; j<tracks->GetNTracks(); j++)
932 {
a4639de2 933 AliL3HoughTrack *track = (AliL3HoughTrack*)tracks->GetCheckedTrack(j);
934
935 if(track->GetNHits() < AliL3Transform::GetNRows() - nrowstomiss)
0309a5ee 936 {
937 tracks->Remove(j);
917e711b 938 removedtracks++;
0309a5ee 939 }
940 }
941 tracks->Compress();
942 tracks->QSort();
943 }
a4639de2 944
917e711b 945 return removedtracks;
a4639de2 946}
947
917e711b 948void AliL3Hough::EvaluatePatch(Int_t i,Int_t roadwidth,Int_t nrowstomiss)
a4639de2 949{
950 //Evaluate patch i.
0309a5ee 951
a4639de2 952 fEval[i]->InitTransformer(fHoughTransformer[i]);
917e711b 953 fEval[i]->SetNumOfPadsToLook(roadwidth);
a4639de2 954 fEval[i]->SetNumOfRowsToMiss(nrowstomiss);
955 //fEval[i]->RemoveFoundTracks();
0309a5ee 956
a4639de2 957 AliL3TrackArray *tracks=0;
958
959 if(!fAddHistograms)
960 tracks = fTracks[i];
961 else
962 tracks = fTracks[0];
963
964 Int_t nrows=0;
965 for(Int_t j=0; j<tracks->GetNTracks(); j++)
966 {
967 AliL3HoughTrack *track = (AliL3HoughTrack*)tracks->GetCheckedTrack(j);
968 if(!track)
969 {
970 LOG(AliL3Log::kWarning,"AliL3Hough::EvaluatePatch","Track array")
971 <<"Track object missing!"<<ENDLOG;
972 continue;
973 }
974 nrows=0;
3e87ef69 975 Int_t rowrange[2] = {AliL3Transform::GetFirstRow(i),AliL3Transform::GetLastRow(i)};
976 Bool_t result = fEval[i]->LookInsideRoad(track,nrows,rowrange);
a4639de2 977 if(fAddHistograms)
978 {
979 Int_t pre=track->GetNHits();
980 track->SetNHits(pre+nrows);
981 }
3e87ef69 982 else//the track crossed too few good padrows (padrows with signal) in the patch, so remove it
983 {
984 if(result == kFALSE)
985 tracks->Remove(j);
986 }
a4639de2 987 }
988
989 tracks->Compress();
a4639de2 990
a6008206 991}
f80b98cb 992
44c7f8de 993void AliL3Hough::MergeEtaSlices()
b1886074 994{
44c7f8de 995 //Merge tracks found in neighbouring eta slices.
996 //Removes the track with the lower weight.
997
3e87ef69 998 fBenchmark->Start("Merge Eta-slices");
44c7f8de 999 AliL3TrackArray *tracks = fTracks[0];
1000 if(!tracks)
b1886074 1001 {
44c7f8de 1002 cerr<<"AliL3Hough::MergeEtaSlices : No tracks "<<endl;
b1886074 1003 return;
1004 }
44c7f8de 1005 for(Int_t j=0; j<tracks->GetNTracks(); j++)
b1886074 1006 {
44c7f8de 1007 AliL3HoughTrack *track1 = (AliL3HoughTrack*)tracks->GetCheckedTrack(j);
1008 if(!track1) continue;
1009 for(Int_t k=j+1; k<tracks->GetNTracks(); k++)
1010 {
1011 AliL3HoughTrack *track2 = (AliL3HoughTrack*)tracks->GetCheckedTrack(k);
1012 if(!track2) continue;
1013 if(abs(track1->GetEtaIndex() - track2->GetEtaIndex()) != 1) continue;
3e87ef69 1014 if(fabs(track1->GetKappa()-track2->GetKappa()) < 0.006 &&
1015 fabs(track1->GetPsi()- track2->GetPsi()) < 0.1)
44c7f8de 1016 {
3e87ef69 1017 //cout<<"Merging track in slices "<<track1->GetEtaIndex()<<" "<<track2->GetEtaIndex()<<endl;
1018 if(track1->GetWeight() > track2->GetWeight())
1019 tracks->Remove(k);
1020 else
1021 tracks->Remove(j);
44c7f8de 1022 }
1023 }
b1886074 1024 }
3e87ef69 1025 fBenchmark->Stop("Merge Eta-slices");
44c7f8de 1026 tracks->Compress();
b1886074 1027}
1028
b2a02bce 1029void AliL3Hough::WriteTracks(Char_t *path)
1030{
917e711b 1031 // Write found tracks into file
b2a02bce 1032 //cout<<"AliL3Hough::WriteTracks : Sorting the tracsk"<<endl;
1033 //fGlobalTracks->QSort();
1034
1035 Char_t filename[1024];
1036 sprintf(filename,"%s/tracks_%d.raw",path,fEvent);
1037 AliL3MemHandler mem;
1038 mem.SetBinaryOutput(filename);
1039 mem.TrackArray2Binary(fGlobalTracks);
1040 mem.CloseBinaryOutput();
1041 fGlobalTracks->Reset();
1042}
1043
3fe49b5b 1044void AliL3Hough::WriteTracks(Int_t slice,Char_t *path)
1c404dd5 1045{
917e711b 1046 // Write found tracks slice by slice into file
c2f25cd2 1047
3e87ef69 1048 AliL3MemHandler mem;
95a00d93 1049 Char_t fname[100];
b5a207b4 1050 if(fAddHistograms)
1051 {
b2a02bce 1052 sprintf(fname,"%s/tracks_ho_%d_%d.raw",path,fEvent,slice);
3e87ef69 1053 mem.SetBinaryOutput(fname);
1054 mem.TrackArray2Binary(fTracks[0]);
1055 mem.CloseBinaryOutput();
b5a207b4 1056 }
1057 else
1058 {
1059 for(Int_t i=0; i<fNPatches; i++)
1060 {
b2a02bce 1061 sprintf(fname,"%s/tracks_ho_%d_%d_%d.raw",path,fEvent,slice,i);
3e87ef69 1062 mem.SetBinaryOutput(fname);
1063 mem.TrackArray2Binary(fTracks[i]);
1064 mem.CloseBinaryOutput();
b5a207b4 1065 }
1066 }
1c404dd5 1067}
208b54c5 1068
a6008206 1069void AliL3Hough::WriteDigits(Char_t *outfile)
1070{
1071 //Write the current data to a new rootfile.
917e711b 1072#ifdef use_aliroot
a6008206 1073
1c404dd5 1074 for(Int_t i=0; i<fNPatches; i++)
a6008206 1075 {
1076 AliL3DigitRowData *tempPt = (AliL3DigitRowData*)fHoughTransformer[i]->GetDataPointer();
1077 fMemHandler[i]->AliDigits2RootFile(tempPt,outfile);
1078 }
208b54c5 1079#else
1080 cerr<<"AliL3Hough::WriteDigits : You need to compile with AliROOT!"<<endl;
1081 return;
1082#endif
4fc9a6a4 1083}
208b54c5 1084
0309a5ee 1085Double_t AliL3Hough::GetCpuTime()
1086{
1087 //Return the Cputime in seconds.
1088 struct timeval tv;
1089 gettimeofday( &tv, NULL );
1090 return tv.tv_sec+(((Double_t)tv.tv_usec)/1000000.);
0309a5ee 1091}
60a3d829 1092