7daaf6beb8d046b05e9b60415a3c0816e9c27a18
[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   AliL3Transform::Init("/prog/alice/data/new/fixed-slice0/");
5   
6   hough = new AliL3Hough();
7   Bool_t binary = kTRUE;
8   Bool_t bit8 = kTRUE;
9   hough->Init(path,binary,n_eta_segments,bit8);
10   
11   hough->GetMaxFinder()->SetThreshold(14000);
12   
13   hough->ReadData(slice);
14   hough->Transform();
15   hough->AddAllHistograms();
16   hough->FindTrackCandidates();
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()<<" eta "<<track->GetEta()<<" etaindex "<<track->GetEtaIndex()<<" weight "<<track->GetWeight()<<endl;
25     }
26   
27   hough->WriteTracks(slice);
28   cout<<"Found in total "<<tracks->GetNTracks()<<" tracks"<<endl;
29   display(hough,25);
30   
31 }
32
33 void display(AliL3Hough *hough,Int_t eta_index)
34 {
35   //Display the data/tracks in eta_index
36   
37   hough->InitEvaluate();
38   digitd = new AliL3Histogram("Digits display","",250,0,250,250,-125,125);
39   trackd = new AliL3Histogram("Found tracks display","",250,0,250,250,-125,125);
40   for(int i=0; i<6; i++)
41     hough->GetEval(i)->DisplayEtaSlice(eta_index,digitd);
42   
43   tracks = (AliL3TrackArray*)hough->GetTracks(0);
44   float xyz[3];
45   for(int i=0; i<tracks->GetNTracks(); i++)
46     {
47       AliL3HoughTrack *track = (AliL3HoughTrack*)tracks->GetCheckedTrack(i);
48       if(!track) continue;
49       if(track->GetEtaIndex() != eta_index) continue;
50
51       for(int j=0; j<176; j++)
52         {
53           track->GetCrossingPoint(j,xyz);
54           trackd->Fill(xyz[0],xyz[1],1);
55         }
56     }
57   
58   //Draw the parameter space
59   c1 = new TCanvas("c1","",2);
60   hough->GetTransformer(0)->GetHistogram(eta_index)->Draw("box");
61   
62   //Draw the tracks
63   c2 = new TCanvas("c2","",2);
64   digitd->Draw();
65   trackd->Draw("same");
66   ((TH1F*)trackd->GetRootHisto())->SetMarkerColor(2);
67 }
68
69 struct GoodTrack
70 {
71   Int_t event;
72   Int_t label;
73   Double_t eta;
74   Int_t code;
75   Double_t px,py,pz;
76   Double_t pt;
77   Int_t nhits;
78 };
79
80 void geteff(char *fname)
81 {
82   GoodTrack gt[15000];
83   int counter=0;
84   ifstream in(fname);
85   if(!in)
86     {
87       cerr<<"Could not open "<<fname<<endl;
88       return;
89     }
90   while(in>>gt[counter].event>>gt[counter].label>>gt[counter].code
91         >>gt[counter].px>>gt[counter].py>>gt[counter].pz>>gt[counter].pt>>gt[counter].eta>>gt[counter].nhits)
92     counter++;
93   
94   char filename[100];
95   file = new AliL3MemHandler();
96   
97   
98 }