3 // Author: Constantin Loizides <loizides@ikf.uni-frankfurt.de
4 //*-- Copyright © ALICE HLT Group
6 #include <AliL3StandardIncludes.h>
8 #include <AliL3RootTypes.h>
9 #include <AliL3Logging.h>
10 #include <AliL3Logger.h>
11 #include <AliL3Transform.h>
12 #include <AliL3Track.h>
13 #include <AliL3TrackArray.h>
14 #include <AliL3HoughTrack.h>
15 #include <AliL3ClustFinderNew.h>
16 #include <AliL3MemHandler.h>
17 #include <AliL3SpacePointData.h>
18 #include <AliL3HoughBaseTransformer.h>
19 #include <AliL3HoughTransformer.h>
20 #include <AliL3HoughTransformerLUT.h>
21 #include <AliL3HoughTransformerVhdl.h>
22 #include <AliL3HoughMaxFinder.h>
23 #include <AliL3Hough.h>
27 #include <TApplication.h>
31 #include <TGraphErrors.h>
38 int main(Int_t argc,Char_t **argv)
45 l.Set(AliL3Logger::kAll);
52 cout<<"Usage: runhough path [slow] [shigh] [segs]"<<endl;
66 //AliL3FFloat::SetParams(10000);
67 AliL3Transform::Init(path);
70 runhough(sl,sh,path,segs);
71 #else //do some comparison tests
73 AliL3HoughBaseTransformer *fh1 = new AliL3HoughTransformerVhdl(0,0,segs);
74 AliL3HoughBaseTransformer *fh2 = new AliL3HoughTransformerLUT(0,0,segs);
76 fh1->CreateHistograms(64,0.1,64,-30.,30.);
77 fh2->CreateHistograms(64,0.1,64,-30.,30.);
83 //AliL3FFloat::PrintStat();
88 //----------------------------------------------------------------------------------
89 // dont look beyond...
90 //----------------------------------------------------------------------------------
93 void runhough(Int_t sl,Int_t sh,Char_t *path,Int_t n_eta_segments, Int_t show_seg=-1)
96 Bool_t binary = kTRUE;
101 AliL3Hough *hough = new AliL3Hough();
102 hough->Init(path,binary,n_eta_segments,bit8,tv);
103 hough->GetMaxFinder()->SetThreshold(th);
106 for(Int_t slice=sl;slice<=sh;slice++){
107 hough->ReadData(slice);
109 hough->AddAllHistograms();
110 hough->FindTrackCandidates();
111 //hough->Evaluate(5);
113 AliL3TrackArray *tracks = (AliL3TrackArray*)hough->GetTracks(0);
114 ntracks=tracks->GetNTracks();
115 for(int i=0; i<ntracks; i++)
117 AliL3HoughTrack *track = (AliL3HoughTrack*)tracks->GetCheckedTrack(i);
119 if(sl==sh) cout<<"pt "<<track->GetPt()<<" psi "<<track->GetPsi()<<" eta "<<track->GetEta()<<" etaindex "<<track->GetEtaIndex()<<" weight "<<track->GetWeight()<<endl;
120 if(show_seg<0) show_seg=track->GetEtaIndex();
123 cout<<"Found total "<<tracks->GetNTracks()<<" tracks"<<endl;
124 hough->WriteTracks(slice);
127 //if((ntracks>0)&&(sl==sh)) display(hough,show_seg);
132 void display(AliL3Hough *hough,Int_t eta_index)
134 //Display the data/tracks in eta_index
136 hough->InitEvaluate();
137 AliL3Histogram *digitd = new AliL3Histogram("Digits display","",250,0,250,250,-125,125);
138 AliL3Histogram *trackd = new AliL3Histogram("Found tracks display","",250,0,250,250,-125,125);
139 for(int i=0; i<6; i++)
140 hough->GetEval(i)->DisplayEtaSlice(eta_index,digitd);
143 tracks = (AliL3TrackArray*)hough->GetTracks(0);
144 for(int i=0; i<tracks->GetNTracks(); i++)
146 AliL3HoughTrack *track = (AliL3HoughTrack*)tracks->GetCheckedTrack(i);
148 if(track->GetEtaIndex() != eta_index) continue;
150 for(int j=0; j<176; j++)
152 track->GetCrossingPoint(j,xyz);
153 trackd->Fill(xyz[0],xyz[1],1);
157 //Draw the parameter space
158 TCanvas *c1 = new TCanvas("c1","",2);
159 hough->GetTransformer(0)->GetHistogram(eta_index)->Draw("box");
162 TCanvas *c2 = new TCanvas("c2","",2);
164 trackd->Draw("same");
165 ((TH1F*)trackd->GetRootHisto())->SetMarkerColor(2);
181 void geteff(char *fname)
188 cerr<<"Could not open "<<fname<<endl;
191 while(in>>gt[counter].event>>gt[counter].label>>gt[counter].code
192 >>gt[counter].px>>gt[counter].py>>gt[counter].pz>>gt[counter].pt>>gt[counter].eta>>gt[counter].nhits)
196 file = new AliL3MemHandler();