]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/programs/runhough.cxx
Small typo fixed
[u/mrichter/AliRoot.git] / HLT / programs / runhough.cxx
1 // $Id$
2
3 // Author: Constantin Loizides <loizides@ikf.uni-frankfurt.de
4 //*-- Copyright &copy ALICE HLT Group
5
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>
24
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
34 #if __GNUC__ == 3
35 using namespace std;
36 #endif
37
38 int main(Int_t argc,Char_t **argv)
39 {
40   Int_t sl=0;
41   Int_t sh=0;
42   Int_t segs=100;
43
44   AliHLTLogger l;
45   l.Set(AliHLTLogger::kAll);
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
66   //AliHLTFFloat::SetParams(10000);
67   AliHLTTransform::Init(path);
68
69 #if 0
70   runhough(sl,sh,path,segs);
71 #else //do some comparison tests
72
73   AliHLTHoughBaseTransformer *fh1 = new AliHLTHoughTransformerVhdl(0,0,segs);
74   AliHLTHoughBaseTransformer *fh2 = new AliHLTHoughTransformerLUT(0,0,segs);
75
76   fh1->CreateHistograms(64,0.1,64,-30.,30.);
77   fh2->CreateHistograms(64,0.1,64,-30.,30.);
78
79   fh1->Print();
80
81 #endif
82
83   //AliHLTFFloat::PrintStat();
84   exit(0);
85 }
86
87
88 //----------------------------------------------------------------------------------
89 // dont look beyond...
90 //----------------------------------------------------------------------------------
91
92 #if 0
93 void 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
101   AliHLTHough *hough = new AliHLTHough();
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
113     AliHLTTrackArray *tracks = (AliHLTTrackArray*)hough->GetTracks(0);
114     ntracks=tracks->GetNTracks();
115     for(int i=0; i<ntracks; i++)
116       {
117         AliHLTHoughTrack *track = (AliHLTHoughTrack*)tracks->GetCheckedTrack(i);
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
132 void display(AliHLTHough *hough,Int_t eta_index)
133 {
134   //Display the data/tracks in eta_index
135   
136   hough->InitEvaluate();
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);
139   for(int i=0; i<6; i++)
140     hough->GetEval(i)->DisplayEtaSlice(eta_index,digitd);
141   
142   float xyz[3];
143   tracks = (AliHLTTrackArray*)hough->GetTracks(0);
144   for(int i=0; i<tracks->GetNTracks(); i++)
145     {
146       AliHLTHoughTrack *track = (AliHLTHoughTrack*)tracks->GetCheckedTrack(i);
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
170 struct 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
181 void 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];
196   file = new AliHLTMemHandler();
197 }
198 #endif