]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/exa/deconvclusters.C
f0630a9cb73ff012300b5b8a32769a25c5102679
[u/mrichter/AliRoot.git] / HLT / exa / deconvclusters.C
1 //$Id$
2
3 /* Example of how to use the AliL3ClusterFitter to fit clusters
4    to the track candidates given as a AliL3TrackArray.
5
6    The path "path" should contain the link to the digitsfile, 
7    and the directories called fitter (for the results) and hough
8    (for the track files). For NEWIO, make sure that the file 
9    TPC.Digits.root is in the path!
10
11    Also provide the neccessary parameters in SetFitParameters.C.
12
13    RUN with ALIROOT (not ROOT), no other method is 
14    supported right now.
15 */
16
17 void deconvclusters(char *path,int minslice=0,int maxslice=35,int nevent=1)
18 {
19   
20   AliL3Transform::Init(path,kTRUE);
21   
22   char filename[1024];
23   AliL3FileHandler *file = new AliL3FileHandler();
24   UInt_t ndigits=0;
25   
26   sprintf(filename,"%s/digitfile.root",path);
27   
28   file->SetAliInput(filename);
29   int index=0;
30   
31   AliL3ClusterFitter *fitter = new AliL3ClusterFitter(path);
32   
33   char macroname[1024];
34   gROOT->LoadMacro("SetFitParameters.C");
35   SetFitParameters(fitter);
36   
37   int patch=-1;
38   int rowrange[2] = {0,AliL3Transform::GetNRows()-1};
39   
40   for(int ev=0; ev<nevent; ev++)
41     {
42       fitter->LoadSeeds(rowrange,kFALSE,ev);//Takes input from global hough tracks
43       
44       for(int slice=minslice; slice<=maxslice; slice++)
45         {
46           file->Init(slice,-1);
47           cout<<"Processing event "<<ev<<" slice "<<slice<<" patch "<<patch<<endl;
48           AliL3DigitRowData *digits = (AliL3DigitRowData*)file->AliAltroDigits2Memory(ndigits,ev);
49           
50           fitter->Init(slice,patch);
51           fitter->SetInputData(digits);
52           
53           fitter->FindClusters();
54           
55           fitter->WriteClusters();
56           
57           file->Free();
58           
59         }
60       
61       //If you want a refit of the clusters;-------------------------
62       AliL3Vertex vertex;
63       AliL3TrackArray *tracks = fitter->GetSeeds(); //The seeds are the input tracks from circle HT
64       AliL3Fitter *ft = new AliL3Fitter(&vertex,1);
65       sprintf(filename,"%s/fitter/",path);
66       ft->LoadClusters(filename,0,kTRUE);
67       for(Int_t i=0; i<tracks->GetNTracks(); i++)
68         {
69           track = tracks->GetCheckedTrack(i);
70           if(!track) continue;
71           if(track->GetNHits() < 40) continue;
72           ft->SortTrackClusters(track);
73           ft->FitHelix(track);
74           ft->UpdateTrack(track);
75         }
76       delete ft;
77       //-------------------------------------------------------------
78       
79       fitter->WriteTracks(5); //Write the final tracks
80       file->FreeDigitsTree();
81     }
82   delete fitter;
83 }
84
85
86 void deconvlocally(char *path,int minslice=0,int maxslice=17)
87 {
88   
89   AliL3Transform::Init(path,kTRUE);
90   
91   char filename[1024];
92   AliL3FileHandler *file = new AliL3FileHandler();
93   UInt_t ndigits=0;
94   
95   sprintf(filename,"%s/digitfile.root",path);
96   
97   file->SetAliInput(filename);
98   int index=0;
99   
100   AliL3ClusterFitter *fitter = new AliL3ClusterFitter(path);
101   
102   char macroname[1024];
103   sprintf(macroname,"%s/SetFitParameters.C",path);
104   gROOT->LoadMacro(macroname);
105   SetFitParameters(fitter);
106   
107   int patch=-1;
108   
109   for(int slice=minslice; slice<=maxslice; slice++)
110     {
111       file->Init(slice,patch);
112       cout<<"Processing slice "<<slice<<" patch "<<patch<<endl;
113       AliL3DigitRowData *digits = (AliL3DigitRowData*)file->AliAltroDigits2Memory(ndigits);
114       
115       fitter->Init(slice,patch);
116       fitter->LoadLocalSegments();
117       
118       fitter->SetInputData(digits);
119       
120       fitter->FindClusters();
121       fitter->WriteClusters();
122       
123       file->Free();
124     
125     }
126   
127   fitter->WriteTracks(5);
128   delete fitter;
129 }
130