Added a macro
[u/mrichter/AliRoot.git] / HLT / hough / testPF.C
1 void testPF(char *rootfile,int patch)
2 {
3   gStyle->SetOptStat(0);
4   
5   Int_t xbin = 70;
6   Int_t ybin = 70;
7   Float_t xrange[2] = {-0.006 , 0.006}; //Pt 0.2->
8   //Float_t yrange[2] = {-0.17 , 0.17}; //slice 2 0.55->0.88
9   Float_t yrange[2] = {-0.26 , 0.26};// -15 - 15
10   //Float_t yrange[2] = {0.55 , 0.88}; //slice 2 0.55->0.88
11   
12   TH2F *hist = new TH2F("hist","Parameter space",xbin,xrange[0],xrange[1],ybin,yrange[0],yrange[1]);
13   hist->GetXaxis()->SetTitle("#kappa [cm^{-1}]");
14   hist->GetYaxis()->SetTitle("#Phi [rad]");
15   SetTH1Options(hist);
16
17   Int_t xr[2] = {0,250};
18   Int_t yr[2] = {-125,125};
19  
20   TH2F *raw = new TH2F("raw","",250,xr[0],xr[1],250,yr[0],yr[1]);
21   TH2F *road = new TH2F("road","",250,0,250,250,yr[0],yr[1]);
22   TH2F *peaks = new TH2F("peaks","",xbin,xrange[0],xrange[1],ybin,yrange[0],yrange[1]);
23   peaks->SetMarkerStyle(3);
24   peaks->SetMarkerColor(2);
25   
26   real_peaks = new TH2F("real_peaks","",xbin,xrange[0],xrange[1],ybin,yrange[0],yrange[1]);
27   real_peaks->SetMarkerStyle(3);
28   real_peaks->SetMarkerColor(4);
29
30   int slice = 2,n_phi_segments=30;
31   float eta[2] = {0.3,0.4};
32   //float eta[2] = {0.03,0.04};
33   
34   a = new AliL3HoughTransformer(slice,patch,eta,n_phi_segments);
35   a->GetPixels(rootfile,raw);
36   a->InitTemplates(hist);
37   a->Transform2Circle(hist);
38     
39   b = new AliL3HoughMaxFinder("KappaPhi");
40   tracks = (AliL3TrackArray*)b->FindPeak(hist,3,0.95,5);
41
42   c = new AliL3HoughEval(a);
43   c->LookInsideRoad(tracks);
44
45   for(int i=0; i<tracks->GetNTracks(); i++)
46     {
47       track = (AliL3HoughTrack*)tracks->GetCheckedTrack(i);
48       peaks->Fill(track->GetKappa(),track->GetPhi0(),1);
49       if(!track) continue;
50       printf("Pt %f phi0 %f weight %d\n",track->GetPt(),track->GetPhi0(),track->GetWeight());
51     }  
52   
53   c2 = new TCanvas("c2","",800,800);
54   //  c2->Divide(2,2);
55   //c2->cd(1);
56   hist->Draw("box");
57   peaks->Draw("same");
58   real_peaks->Draw("same");
59   
60   
61   /*
62   AliL3TrackArray *tracks = b->FindMaxima(hist);
63   
64   track = (AliL3HoughTrack*)tracks->GetCheckedTrack(0);
65   peaks->Fill(track->GetKappa(),track->GetPhi0(),track->GetWeight());
66   int xbin = hist->GetXaxis()->FindBin(track->GetKappa());
67   int ybin = hist->GetYaxis()->FindBin(track->GetPhi0());
68   
69   TH1D *proj_kappa = hist->ProjectionX("proj_kappa",ybin,ybin);
70   TH1D *proj_phi = hist->ProjectionY("proj_phi",xbin,xbin);
71   
72   TCanvas *c1 = new TCanvas("c1","",800,800);
73   c1->Divide(2,2);
74   c1->cd(1);
75   hist->Draw("box");
76   peaks->Draw("same");
77   
78   c1->cd(3);
79   proj_kappa->Draw();
80   c1->cd(4);
81   proj_phi->Draw();
82   return;
83   */
84   delete a;
85   delete b;
86   delete c;
87
88 }