3 // Author: Constantin Loizides <mailto: loizides@ikf.physik.uni-frankfurt.de
8 #include <AliL3RootTypes.h>
9 #include <AliL3Transform.h>
10 #include <AliL3Track.h>
11 #include <AliL3TrackArray.h>
12 #include <AliL3HoughTrack.h>
13 #include <AliL3ClustFinderNew.h>
14 #include <AliL3MemHandler.h>
15 #include <AliL3SpacePointData.h>
16 #include <AliL3Logging.h>
17 #include <AliL3Logger.h>
18 #include <AliL3HoughBaseTransformer.h>
19 #include <AliL3HoughTransformerVhdl.h>
20 #include <AliL3HoughTransformer.h>
21 #include <AliL3Hough.h>
22 //#include <AliL3FFloat.h>
23 #include <AliL3HoughMaxFinder.h>
26 #include <TApplication.h>
30 #include <TGraphErrors.h>
34 int main(int argc,char **argv)
41 l.Set(AliL3Logger::kAll);
48 cout<<"Usage: runhough path [slow] [shigh] [segs]"<<endl;
62 //AliL3FFloat::SetParams(10000);
63 AliL3Transform::Init(path);
66 runhough(sl,sh,path,segs);
68 //VESTBO: Look here, init of six trafos
69 AliL3HoughBaseTransformer **fHoughTransformer = new AliL3HoughBaseTransformer*[6];
72 cout << "----------------------------- " << i << "----------------------------- " << endl;
74 //VESTBO: init one of them
75 fHoughTransformer[i] = new AliL3HoughTransformerVhdl(0,i,segs);
76 //VESTBO: Print parameters
77 fHoughTransformer[i]->Print();
79 //VESTBO: Play around with combinations of creating histos or/and init values.
80 fHoughTransformer[i]->CreateHistograms(64,0.1,64,-30,30);
81 //fHoughTransformer[i]->Init(sl,i,segs);
83 //VESTBO: Print parameters. Error should happen here: crash or be in endless loop, that means
84 //somehow data members get overwritten!!
85 fHoughTransformer[i]->Print();
89 //AliL3FFloat::PrintStat();
96 //----------------------------------------------------------------------------------
97 // dont look beyond...
98 //----------------------------------------------------------------------------------
101 void runhough(Int_t sl,Int_t sh,Char_t *path,Int_t n_eta_segments, Int_t show_seg=-1)
104 Bool_t binary = kTRUE;
109 AliL3Hough *hough = new AliL3Hough();
110 hough->Init(path,binary,n_eta_segments,bit8,tv);
111 hough->GetMaxFinder()->SetThreshold(th);
114 for(Int_t slice=sl;slice<=sh;slice++){
115 hough->ReadData(slice);
117 hough->AddAllHistograms();
118 hough->FindTrackCandidates();
119 //hough->Evaluate(5);
121 AliL3TrackArray *tracks = (AliL3TrackArray*)hough->GetTracks(0);
122 ntracks=tracks->GetNTracks();
123 for(int i=0; i<ntracks; i++)
125 AliL3HoughTrack *track = (AliL3HoughTrack*)tracks->GetCheckedTrack(i);
127 if(sl==sh) cout<<"pt "<<track->GetPt()<<" psi "<<track->GetPsi()<<" eta "<<track->GetEta()<<" etaindex "<<track->GetEtaIndex()<<" weight "<<track->GetWeight()<<endl;
128 if(show_seg<0) show_seg=track->GetEtaIndex();
131 cout<<"Found total "<<tracks->GetNTracks()<<" tracks"<<endl;
132 hough->WriteTracks(slice);
135 //if((ntracks>0)&&(sl==sh)) display(hough,show_seg);
140 void display(AliL3Hough *hough,Int_t eta_index)
142 //Display the data/tracks in eta_index
144 hough->InitEvaluate();
145 AliL3Histogram *digitd = new AliL3Histogram("Digits display","",250,0,250,250,-125,125);
146 AliL3Histogram *trackd = new AliL3Histogram("Found tracks display","",250,0,250,250,-125,125);
147 for(int i=0; i<6; i++)
148 hough->GetEval(i)->DisplayEtaSlice(eta_index,digitd);
151 tracks = (AliL3TrackArray*)hough->GetTracks(0);
152 for(int i=0; i<tracks->GetNTracks(); i++)
154 AliL3HoughTrack *track = (AliL3HoughTrack*)tracks->GetCheckedTrack(i);
156 if(track->GetEtaIndex() != eta_index) continue;
158 for(int j=0; j<176; j++)
160 track->GetCrossingPoint(j,xyz);
161 trackd->Fill(xyz[0],xyz[1],1);
165 //Draw the parameter space
166 TCanvas *c1 = new TCanvas("c1","",2);
167 hough->GetTransformer(0)->GetHistogram(eta_index)->Draw("box");
170 TCanvas *c2 = new TCanvas("c2","",2);
172 trackd->Draw("same");
173 ((TH1F*)trackd->GetRootHisto())->SetMarkerColor(2);
189 void geteff(char *fname)
196 cerr<<"Could not open "<<fname<<endl;
199 while(in>>gt[counter].event>>gt[counter].label>>gt[counter].code
200 >>gt[counter].px>>gt[counter].py>>gt[counter].pz>>gt[counter].pt>>gt[counter].eta>>gt[counter].nhits)
204 file = new AliL3MemHandler();