be2170c3741fcc452d504cca99436110560160e2
[u/mrichter/AliRoot.git] / HLT / exa / runhough.C
1 void runhough(Int_t slice,Char_t *path,Int_t n_eta_segments)
2 {
3   
4
5   hough = new AliL3Hough();
6   hough->Init(path,kTRUE,n_eta_segments,kTRUE);
7   
8   hough->ReadData(slice);
9
10   hough->Transform();
11
12   hough->SetPeakThreshold(1);
13   hough->AddAllHistograms();
14   hough->FindTrackCandidates();
15   
16   hough->WriteTracks(slice);
17   
18   //hough->Evaluate();
19   tracks = (AliL3TrackArray*)hough->GetTracks(0);
20   for(int i=0; i<tracks->GetNTracks(); i++)
21     {
22       track = (AliL3HoughTrack*)tracks->GetCheckedTrack(i);
23       if(!track) continue;
24       cout<<"pt "<<track->GetPt()<<" psi "<<track->GetPsi()<<" etaindex "<<track->GetEtaIndex()<<" weight "<<track->GetWeight()<<endl;
25     }
26   
27
28   display(hough,0);
29   
30 }
31
32 void display(AliL3Hough *hough,Int_t eta_index)
33 {
34   //Display the data/tracks in eta_index
35   
36   hough->InitEvaluate();
37   digitd = new AliL3Histogram("Digits display","",250,0,250,250,-125,125);
38   trackd = new AliL3Histogram("Found tracks display","",250,0,250,250,-125,125);
39   for(int i=0; i<6; i++)
40     hough->GetEval(i)->DisplayEtaSlice(eta_index,digitd);
41   
42   tracks = (AliL3TrackArray*)hough->GetTracks(0);
43   float xyz[3];
44   for(int i=0; i<tracks->GetNTracks(); i++)
45     {
46       AliL3HoughTrack *track = (AliL3HoughTrack*)tracks->GetCheckedTrack(i);
47       if(!track) continue;
48       if(track->GetEtaIndex() != eta_index) continue;
49
50       for(int j=0; j<176; j++)
51         {
52           track->GetCrossingPoint(j,xyz);
53           trackd->Fill(xyz[0],xyz[1],1);
54         }
55     }
56   
57   //Draw the parameter space
58   c1 = new TCanvas("c1","",2);
59   hough->GetTransformer(0)->GetHistogram(eta_index)->Draw("lego");
60   return;
61   //Draw the tracks
62   c2 = new TCanvas("c2","",2);
63   digitd->Draw();
64   trackd->Draw("same");
65   ((TH1F*)trackd->GetRootHisto())->SetMarkerColor(2);
66 }