AliMDC event loop and rootification separated, c interface to AliMDC, command line...
[u/mrichter/AliRoot.git] / RAW / AliHoughFilter.cxx
CommitLineData
e10815f1 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/* $Id$ */
17
18///////////////////////////////////////////////////////////////////////////////
19// //
20// high level filter algorithm for TPC using a hough transformation //
21// //
22///////////////////////////////////////////////////////////////////////////////
23
24
25#include <TStopwatch.h>
26
27#include "AliL3StandardIncludes.h"
28#include "AliL3Logging.h"
29#include "AliL3Transform.h"
30#include "AliL3Hough.h"
31#include "AliLog.h"
32
33#include "AliHoughFilter.h"
34
35
36ClassImp(AliHoughFilter)
37
38//_____________________________________________________________________________
39AliHoughFilter::AliHoughFilter()
40{
41// default constructor
42
43 AliL3Log::fgLevel = AliL3Log::kError;
44 if (AliDebugLevel() > 0) AliL3Log::fgLevel = AliL3Log::kWarning;
45 if (AliDebugLevel() > 1) AliL3Log::fgLevel = AliL3Log::kInformational;
46 if (AliDebugLevel() > 2) AliL3Log::fgLevel = AliL3Log::kDebug;
47 if (!AliL3Transform::Init("./", kFALSE)) {
48 AliError("HLT initialization failed!");
49 }
50}
51
52//_____________________________________________________________________________
53Bool_t AliHoughFilter::Filter(AliRawEvent* event, AliESD* esd)
54{
55// TPC hough transformation
56
57 TStopwatch timer;
58 timer.Start();
59
60 Float_t ptmin = 0.1*AliL3Transform::GetSolenoidField();
61
62 AliL3Hough *hough1 = new AliL3Hough();
63
64 hough1->SetThreshold(4);
65 hough1->CalcTransformerParams(ptmin);
66 hough1->SetPeakThreshold(70,-1);
67 // Attention Z of the vertex to be taken from the event head!
68 // So far for debug purposes it is fixed by hand...
69 hough1->Init(100,4,event,3.82147);
70 hough1->SetAddHistograms();
71
72 AliL3Hough *hough2 = new AliL3Hough();
73
74 hough2->SetThreshold(4);
75 hough2->CalcTransformerParams(ptmin);
76 hough2->SetPeakThreshold(70,-1);
77 hough2->Init(100,4,event,3.82147);
78 hough2->SetAddHistograms();
79
80 Int_t nglobaltracks = 0;
81 /* In case we run HLT code in 2 threads */
82 hough1->StartProcessInThread(0,17);
83 hough2->StartProcessInThread(18,35);
84
85 if(hough1->WaitForThreadFinish())
86 AliFatal(" Can not join the required thread! ");
87 if(hough2->WaitForThreadFinish())
88 AliFatal(" Can not join the required thread! ");
89
90 /* In case we run HLT code in the main thread
91 for(Int_t slice=0; slice<=17; slice++)
92 {
93 hough1->ReadData(slice,0);
94 hough1->Transform();
95 hough1->AddAllHistogramsRows();
96 hough1->FindTrackCandidatesRow();
97 hough1->AddTracks();
98 }
99 for(Int_t slice=18; slice<=35; slice++)
100 {
101 hough2->ReadData(slice,0);
102 hough2->Transform();
103 hough2->AddAllHistogramsRows();
104 hough2->FindTrackCandidatesRow();
105 hough2->AddTracks();
106 }
107 */
108
109 nglobaltracks += hough1->FillESD(esd);
110 nglobaltracks += hough2->FillESD(esd);
111
112 /* In case we want to debug the ESD
113 gSystem->MakeDirectory("hough1");
114 hough1->WriteTracks("./hough1");
115 gSystem->MakeDirectory("hough2");
116 hough2->WriteTracks("./hough2");
117 */
118
119 delete hough1;
120 delete hough2;
121
122 printf("Filter has found %d TPC tracks in %f seconds\n", nglobaltracks,timer.RealTime());
123
124 return kFALSE;
125}