]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/programs/runhough.cxx
Small typo fixed
[u/mrichter/AliRoot.git] / HLT / programs / runhough.cxx
CommitLineData
e0c2b115 1// $Id$
2
02f030e3 3// Author: Constantin Loizides <loizides@ikf.uni-frankfurt.de
4//*-- Copyright &copy ALICE HLT Group
e0c2b115 5
4aa41877 6#include <AliHLTStandardIncludes.h>
7
8#include <AliHLTRootTypes.h>
9#include <AliHLTLogging.h>
10#include <AliHLTLogger.h>
11#include <AliHLTTransform.h>
12#include <AliHLTTrack.h>
13#include <AliHLTTrackArray.h>
14#include <AliHLTHoughTrack.h>
15#include <AliHLTClustFinderNew.h>
16#include <AliHLTMemHandler.h>
17#include <AliHLTSpacePointData.h>
18#include <AliHLTHoughBaseTransformer.h>
19#include <AliHLTHoughTransformer.h>
20#include <AliHLTHoughTransformerLUT.h>
21#include <AliHLTHoughTransformerVhdl.h>
22#include <AliHLTHoughMaxFinder.h>
23#include <AliHLTHough.h>
3e87ef69 24
e0c2b115 25#ifndef no_root
26#include <TROOT.h>
27#include <TApplication.h>
28#include <TCanvas.h>
29#include <TH2.h>
30#include <TGraph.h>
31#include <TGraphErrors.h>
32#endif
33
0bd0c1ef 34#if __GNUC__ == 3
ebbe3342 35using namespace std;
36#endif
e0c2b115 37
3e87ef69 38int main(Int_t argc,Char_t **argv)
e0c2b115 39{
40 Int_t sl=0;
41 Int_t sh=0;
42 Int_t segs=100;
43
4aa41877 44 AliHLTLogger l;
45 l.Set(AliHLTLogger::kAll);
e0c2b115 46 l.UseStderr();
47 //l.UseStdout();
48 //l.UseStream();
49
50 Char_t path[1024];
51 if(argc<2){
52 cout<<"Usage: runhough path [slow] [shigh] [segs]"<<endl;
53 exit(1);
54 }
55 strcpy(path,argv[1]);
56 if (argc>2) {
57 sl=atoi(argv[2]);
58 }
59 if (argc>3) {
60 sh=atoi(argv[3]);
61 }
62 if (argc>4) {
63 segs=atoi(argv[4]);
64 }
65
4aa41877 66 //AliHLTFFloat::SetParams(10000);
67 AliHLTTransform::Init(path);
e0c2b115 68
69#if 0
70 runhough(sl,sh,path,segs);
ebbe3342 71#else //do some comparison tests
e0c2b115 72
4aa41877 73 AliHLTHoughBaseTransformer *fh1 = new AliHLTHoughTransformerVhdl(0,0,segs);
74 AliHLTHoughBaseTransformer *fh2 = new AliHLTHoughTransformerLUT(0,0,segs);
e0c2b115 75
5a31e9df 76 fh1->CreateHistograms(64,0.1,64,-30.,30.);
77 fh2->CreateHistograms(64,0.1,64,-30.,30.);
e0c2b115 78
ebbe3342 79 fh1->Print();
e0c2b115 80
e0c2b115 81#endif
82
4aa41877 83 //AliHLTFFloat::PrintStat();
e0c2b115 84 exit(0);
85}
86
87
e0c2b115 88//----------------------------------------------------------------------------------
89// dont look beyond...
90//----------------------------------------------------------------------------------
91
92#if 0
93void runhough(Int_t sl,Int_t sh,Char_t *path,Int_t n_eta_segments, Int_t show_seg=-1)
94{
95
96 Bool_t binary = kTRUE;
97 Bool_t bit8 = kTRUE;
98 Int_t tv=1;
99 Int_t th=14000;
100
4aa41877 101 AliHLTHough *hough = new AliHLTHough();
e0c2b115 102 hough->Init(path,binary,n_eta_segments,bit8,tv);
103 hough->GetMaxFinder()->SetThreshold(th);
104 Int_t ntracks=0;
105
106 for(Int_t slice=sl;slice<=sh;slice++){
107 hough->ReadData(slice);
108 hough->Transform();
109 hough->AddAllHistograms();
110 hough->FindTrackCandidates();
111 //hough->Evaluate(5);
112
4aa41877 113 AliHLTTrackArray *tracks = (AliHLTTrackArray*)hough->GetTracks(0);
e0c2b115 114 ntracks=tracks->GetNTracks();
115 for(int i=0; i<ntracks; i++)
116 {
4aa41877 117 AliHLTHoughTrack *track = (AliHLTHoughTrack*)tracks->GetCheckedTrack(i);
e0c2b115 118 if(!track) continue;
119 if(sl==sh) cout<<"pt "<<track->GetPt()<<" psi "<<track->GetPsi()<<" eta "<<track->GetEta()<<" etaindex "<<track->GetEtaIndex()<<" weight "<<track->GetWeight()<<endl;
120 if(show_seg<0) show_seg=track->GetEtaIndex();
121 }
122
123 cout<<"Found total "<<tracks->GetNTracks()<<" tracks"<<endl;
124 hough->WriteTracks(slice);
125 }
126
127 //if((ntracks>0)&&(sl==sh)) display(hough,show_seg);
128}
129#endif
130
131#if 0
4aa41877 132void display(AliHLTHough *hough,Int_t eta_index)
e0c2b115 133{
134 //Display the data/tracks in eta_index
135
136 hough->InitEvaluate();
4aa41877 137 AliHLTHistogram *digitd = new AliHLTHistogram("Digits display","",250,0,250,250,-125,125);
138 AliHLTHistogram *trackd = new AliHLTHistogram("Found tracks display","",250,0,250,250,-125,125);
e0c2b115 139 for(int i=0; i<6; i++)
140 hough->GetEval(i)->DisplayEtaSlice(eta_index,digitd);
141
142 float xyz[3];
4aa41877 143 tracks = (AliHLTTrackArray*)hough->GetTracks(0);
e0c2b115 144 for(int i=0; i<tracks->GetNTracks(); i++)
145 {
4aa41877 146 AliHLTHoughTrack *track = (AliHLTHoughTrack*)tracks->GetCheckedTrack(i);
e0c2b115 147 if(!track) continue;
148 if(track->GetEtaIndex() != eta_index) continue;
149
150 for(int j=0; j<176; j++)
151 {
152 track->GetCrossingPoint(j,xyz);
153 trackd->Fill(xyz[0],xyz[1],1);
154 }
155 }
156
157 //Draw the parameter space
158 TCanvas *c1 = new TCanvas("c1","",2);
159 hough->GetTransformer(0)->GetHistogram(eta_index)->Draw("box");
160
161 //Draw the tracks
162 TCanvas *c2 = new TCanvas("c2","",2);
163 digitd->Draw();
164 trackd->Draw("same");
165 ((TH1F*)trackd->GetRootHisto())->SetMarkerColor(2);
166}
167#endif
168
169#if 0
170struct GoodTrack
171{
172 Int_t event;
173 Int_t label;
174 Double_t eta;
175 Int_t code;
176 Double_t px,py,pz;
177 Double_t pt;
178 Int_t nhits;
179};
180
181void geteff(char *fname)
182{
183 GoodTrack gt[15000];
184 int counter=0;
185 ifstream in(fname);
186 if(!in)
187 {
188 cerr<<"Could not open "<<fname<<endl;
189 return;
190 }
191 while(in>>gt[counter].event>>gt[counter].label>>gt[counter].code
192 >>gt[counter].px>>gt[counter].py>>gt[counter].pz>>gt[counter].pt>>gt[counter].eta>>gt[counter].nhits)
193 counter++;
194
195 char filename[100];
4aa41877 196 file = new AliHLTMemHandler();
e0c2b115 197}
198#endif