]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/exa/runhough.C
replaces AliPHOSAliEnFile: references to AliEn removed
[u/mrichter/AliRoot.git] / HLT / exa / runhough.C
1 //$Id$
2
3 /**
4    Run this macro for Hough track candidate finder
5    (see steering class AliL3Hough).
6    In argument path, you have to provide the path to 
7    the directory where the data files should be located. 
8    In case of reading from a rootfile, you have to
9    make a symbolic link "digitfile.root", which points 
10    to the rootfile containing AliROOT digits tree 
11    and a symbolic link "alirunfile.root" pointing to a file 
12    containing the ALIROOT geometry (TPC param).
13    For NEWIO, make sure that the file TPC.Digits.root is in the 
14    path (or make a symlink to it)!
15  
16    Also provide the neccessary parameters in SetHoughParameters.C.
17
18    RUN with ALIROOT (not ROOT) if using root files.
19
20 */
21
22 #ifndef __CINT__
23 #include "AliL3Logger.h"
24 #include "AliL3FileHandler.h"
25 #include "AliL3DigitData.h"
26 #include "AliL3Transform.h"
27 #include "AliL3Hough.h"
28 #include "AliL3TrackArray.h"
29 #include "AliL3Track.h"
30 #include "AliL3HoughTrack.h"
31 #include <TNtuple.h>
32 #include <TRandom.h>
33 #include <TSystem.h>
34 #include <TStopwatch.h>
35 #include <stdio.h>
36 #include <iostream.h>
37 #include <time.h>
38 #endif
39
40 void runhough(Char_t *path,Char_t *outpath,Int_t s1=0,Int_t s2=35,Int_t nevent=1)
41 {
42
43   Bool_t isinit=AliL3Transform::Init(path,kTRUE);
44   if(!isinit){
45     cerr << "Could not create transform settings, please check log for error messages!" << endl;
46     return;
47   }
48
49   Int_t tversion=1; //0 = normal transformer
50                     //1 = LUT transformer
51
52   AliL3Hough *hough = new AliL3Hough();
53 #ifdef __CINT__
54   Char_t macroname[1024];
55   sprintf(macroname,"SetHoughParameters.C");
56   gROOT->LoadMacro(macroname);
57   SetHoughParameters(hough,path,tversion);
58 #else /*compiled version*/
59   Bool_t binary = kFALSE;    //binary files input
60   Int_t n_eta_segments=100;
61   Double_t histptmin = 0.5; //mininum pt to find (controls the histogram range) 
62   Int_t threshold=6000;  //peak threshold
63   //Int_t threshold=5000;  //peak threshold
64   Int_t nxbins = 140;
65   Int_t nybins = 150;
66   //Int_t nxbins = 190;
67   //Int_t nybins = 200;
68   Int_t patch=-1; //-1 -> Hough transform on slices (means adding histograms)
69   hough->SetThreshold(4); //noise threshold on single digits
70   hough->SetTransformerParams(nxbins,nybins,histptmin,patch);
71   hough->SetPeakThreshold(threshold,patch);
72   hough->Init(path,binary,n_eta_segments,kFALSE,tversion); 
73 #endif
74
75   TStopwatch tloader;tloader.Stop();
76   TStopwatch ttransform;ttransform.Stop();
77   TStopwatch tfinder;tfinder.Stop();
78
79   for(Int_t ev=0; ev<nevent; ev++)
80     {
81       AliL3FileHandler::LoadStaticIndex(0,ev);
82       for(Int_t slice=s1; slice<=s2; slice++)
83         {
84           cout<<"Processing slice "<<slice<<endl;
85           tloader.Start(0);hough->ReadData(slice,ev);tloader.Stop();
86           ttransform.Start(0);hough->Transform();ttransform.Stop();
87           tfinder.Start(0);
88           hough->AddAllHistograms();
89           hough->FindTrackCandidates();
90           hough->AddTracks();
91           tfinder.Stop();
92 #if 0 /*print track list */
93           AliL3TrackArray *tracks = (AliL3TrackArray*)hough->GetTracks(0);
94           tracks->QSort();
95           for(int i=0; i<tracks->GetNTracks(); i++)
96             {
97               AliL3HoughTrack *track = (AliL3HoughTrack*)tracks->GetCheckedTrack(i);
98               if(!track) continue;
99               cout<<"pt "<<track->GetPt()<<" psi "<<track->GetPsi()<<" eta "<<track->GetEta()<<" etaindex "<<track->GetEtaIndex()<<" weight "<<track->GetWeight()<<endl;
100             }
101 #endif
102         }
103       hough->WriteTracks(outpath);
104       AliL3FileHandler::SaveStaticIndex(0,ev);
105     }
106
107   cout << " --- Timing values --- " << endl;
108   cout << "Data  Loading:     "; tloader.Print("m");
109   cout << "Hough Transforming "; ttransform.Print("m");
110   cout << "Track Finding      "; tfinder.Print("m");
111   
112   delete hough;
113 }
114