]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/exa/runhough.C
Added files for the reference version based on an old version of Anders'
[u/mrichter/AliRoot.git] / HLT / exa / runhough.C
CommitLineData
b2a02bce 1//$Id$
086f41d8 2
3/**
b2a02bce 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).
1f1942b8 13 For NEWIO, make sure that the file TPC.Digits.root is in the
14 path (or make a symlink to it)!
b2a02bce 15
16 Also provide the neccessary parameters in SetHoughParameters.C.
17
18 RUN with ALIROOT (not ROOT) if using root files.
19
086f41d8 20*/
21
1f1942b8 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
40void runhough(Char_t *path,Char_t *outpath,Int_t s1=0,Int_t s2=35,Int_t nevent=1)
e0f350ab 41{
3e87ef69 42
b2a02bce 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 }
3e87ef69 48
1f1942b8 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");
b2a02bce 56 gROOT->LoadMacro(macroname);
1f1942b8 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
e0f350ab 74
1f1942b8 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++)
e0f350ab 80 {
1f1942b8 81 AliL3FileHandler::LoadStaticIndex(0,ev);
82 for(Int_t slice=s1; slice<=s2; slice++)
e0f350ab 83 {
b2a02bce 84 cout<<"Processing slice "<<slice<<endl;
1f1942b8 85 tloader.Start(0);hough->ReadData(slice,ev);tloader.Stop();
86 ttransform.Start(0);hough->Transform();ttransform.Stop();
87 tfinder.Start(0);
b2a02bce 88 hough->AddAllHistograms();
89 hough->FindTrackCandidates();
90 hough->AddTracks();
1f1942b8 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
e0f350ab 102 }
b2a02bce 103 hough->WriteTracks(outpath);
1f1942b8 104 AliL3FileHandler::SaveStaticIndex(0,ev);
e0f350ab 105 }
1f1942b8 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");
e0f350ab 111
b2a02bce 112 delete hough;
e0f350ab 113}
73232360 114