Using TMath::Abs instead of fabs
[u/mrichter/AliRoot.git] / HLT / exa / runhough.C
CommitLineData
086f41d8 1// $Id$
2
3/**
4 Shows how to use the hough code. Stores tracks parameters
5 in files.
6*/
7
8void runhough(Int_t slice,Char_t *path,Int_t n_eta_segments,Int_t vseg=-1)
e0f350ab 9{
10
086f41d8 11 //AliL3Transform::Init("/prog/alice/data/new/fixed-slice0/");
12 AliL3Transform::Init(path);
13
1772d17b 14 hough = new AliL3Hough();
73232360 15 Bool_t binary = kTRUE;
16 Bool_t bit8 = kTRUE;
17 hough->Init(path,binary,n_eta_segments,bit8);
18
19 hough->GetMaxFinder()->SetThreshold(14000);
e0f350ab 20
1772d17b 21 hough->ReadData(slice);
e0f350ab 22 hough->Transform();
e0f350ab 23 hough->AddAllHistograms();
24 hough->FindTrackCandidates();
25
e0f350ab 26 //hough->Evaluate();
27 tracks = (AliL3TrackArray*)hough->GetTracks(0);
28 for(int i=0; i<tracks->GetNTracks(); i++)
29 {
30 track = (AliL3HoughTrack*)tracks->GetCheckedTrack(i);
31 if(!track) continue;
73232360 32 cout<<"pt "<<track->GetPt()<<" psi "<<track->GetPsi()<<" eta "<<track->GetEta()<<" etaindex "<<track->GetEtaIndex()<<" weight "<<track->GetWeight()<<endl;
086f41d8 33 if(vseg==-1) vseg=track->GetEtaIndex();
e0f350ab 34 }
35
73232360 36 hough->WriteTracks(slice);
086f41d8 37 cout<<"Found in slice " << slice << " total "<<tracks->GetNTracks()<<" tracks"<<endl;
38 display(hough,vseg);
e0f350ab 39
40}
41
42void display(AliL3Hough *hough,Int_t eta_index)
43{
44 //Display the data/tracks in eta_index
45
46 hough->InitEvaluate();
47 digitd = new AliL3Histogram("Digits display","",250,0,250,250,-125,125);
48 trackd = new AliL3Histogram("Found tracks display","",250,0,250,250,-125,125);
49 for(int i=0; i<6; i++)
50 hough->GetEval(i)->DisplayEtaSlice(eta_index,digitd);
51
52 tracks = (AliL3TrackArray*)hough->GetTracks(0);
53 float xyz[3];
54 for(int i=0; i<tracks->GetNTracks(); i++)
55 {
56 AliL3HoughTrack *track = (AliL3HoughTrack*)tracks->GetCheckedTrack(i);
57 if(!track) continue;
58 if(track->GetEtaIndex() != eta_index) continue;
59
60 for(int j=0; j<176; j++)
61 {
62 track->GetCrossingPoint(j,xyz);
63 trackd->Fill(xyz[0],xyz[1],1);
64 }
65 }
66
67 //Draw the parameter space
68 c1 = new TCanvas("c1","",2);
73232360 69 hough->GetTransformer(0)->GetHistogram(eta_index)->Draw("box");
70
e0f350ab 71 //Draw the tracks
72 c2 = new TCanvas("c2","",2);
73 digitd->Draw();
74 trackd->Draw("same");
75 ((TH1F*)trackd->GetRootHisto())->SetMarkerColor(2);
76}
73232360 77
78struct GoodTrack
79{
80 Int_t event;
81 Int_t label;
82 Double_t eta;
83 Int_t code;
84 Double_t px,py,pz;
85 Double_t pt;
86 Int_t nhits;
87};
88
89void geteff(char *fname)
90{
91 GoodTrack gt[15000];
92 int counter=0;
93 ifstream in(fname);
94 if(!in)
95 {
96 cerr<<"Could not open "<<fname<<endl;
97 return;
98 }
99 while(in>>gt[counter].event>>gt[counter].label>>gt[counter].code
100 >>gt[counter].px>>gt[counter].py>>gt[counter].pz>>gt[counter].pt>>gt[counter].eta>>gt[counter].nhits)
101 counter++;
102
103 char filename[100];
104 file = new AliL3MemHandler();
105
106
107}