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