3 /* Example of how to use the AliL3ClusterFitter to fit clusters
4 to the track candidates given as a AliL3TrackArray.
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 (symlink)!
11 Also provide the neccessary parameters in SetFitParameters.C.
13 RUN with ALIROOT (not ROOT), no other method is
18 #include "AliL3Logger.h"
19 #include "AliL3FileHandler.h"
20 #include "AliL3DigitData.h"
21 #include "AliL3Track.h"
22 #include "AliL3Transform.h"
23 #include "AliL3Hough.h"
24 #include "AliL3Fitter.h"
25 #include "AliL3ClusterFitter.h"
26 #include "AliL3Vertex.h"
27 #include "AliL3TrackArray.h"
31 #include <TStopwatch.h>
37 void deconvclusters(Char_t *path,Int_t minslice=0,Int_t maxslice=35,Int_t nevent=1)
40 AliL3Transform::Init(path,kTRUE);
42 Char_t filename[1024];
43 AliL3FileHandler *file = new AliL3FileHandler(kTRUE); //static index
46 sprintf(filename,"%s/digitfile.root",path);
47 file->SetAliInput(filename);
48 AliL3ClusterFitter *fitter = new AliL3ClusterFitter(path);
51 Char_t macroname[1024];
52 gROOT->LoadMacro("SetFitParameters.C");
53 SetFitParameters(fitter);
54 #else /*compiled version */
55 fitter->SetInnerWidthFactor(1,1);
56 fitter->SetOuterWidthFactor(1,1);
57 fitter->SetNmaxOverlaps(5);
59 fitter->SetChiSqMax(5,0);
60 fitter->SetChiSqMax(5,1);
61 fitter->SetChiSqMax(5,2);
64 TStopwatch tloader;tloader.Stop();
65 TStopwatch tfinder;tfinder.Stop();
66 TStopwatch trefitter;trefitter.Stop();
69 Int_t rowrange[2] = {0,AliL3Transform::GetNRows()-1};
70 for(Int_t ev=0; ev<nevent; ev++)
72 AliL3FileHandler::LoadStaticIndex(0,ev);
73 fitter->LoadSeeds(rowrange,kFALSE,ev); //Takes input from global hough tracks
75 for(Int_t slice=minslice; slice<=maxslice; slice++)
79 cout<<"Processing event "<<ev<<" slice "<<slice<<" patch "<<patch<<endl;
80 AliL3DigitRowData *digits = (AliL3DigitRowData*)file->AliAltroDigits2Memory(ndigits,ev);
81 fitter->Init(slice,patch);
82 fitter->SetInputData(digits);
86 fitter->FindClusters();
87 fitter->WriteClusters();
95 //If you want a refit of the clusters;-------------------------
98 AliL3TrackArray *tracks = fitter->GetSeeds(); //The seeds are the
99 //input tracks from circle HT
100 AliL3Fitter *ft = new AliL3Fitter(&vertex,1);
101 sprintf(filename,"%s/fitter/",path);
102 ft->LoadClusters(filename,0,kTRUE);
106 for(Int_t i=0; i<tracks->GetNTracks(); i++)
108 AliL3Track *track = tracks->GetCheckedTrack(i);
110 if(track->GetNHits() < 40) continue;
111 ft->SortTrackClusters(track);
113 track->UpdateToFirstPoint();
116 //-------------------------------------------------------------
119 fitter->WriteTracks(5); //Write the final tracks
120 file->FreeDigitsTree();
123 cout << " --- Timing values --- " << endl;
124 cout << "Data Loading: "; tloader.Print("m");
125 cout << "Cluster Deconvolution "; tfinder.Print("m");
126 cout << "Track ReFitter "; trefitter.Print("m");
131 void deconvlocally(Char_t *path,Int_t minslice=0,Int_t maxslice=17)
134 AliL3Transform::Init(path,kTRUE);
136 Char_t filename[1024];
137 AliL3FileHandler *file = new AliL3FileHandler(kTRUE);
140 sprintf(filename,"%s/digitfile.root",path);
141 file->SetAliInput(filename);
142 AliL3ClusterFitter *fitter = new AliL3ClusterFitter(path);
145 Char_t macroname[1024];
146 sprintf(macroname,"%s/SetFitParameters.C",path);
147 gROOT->LoadMacro(macroname);
148 SetFitParameters(fitter);
149 #else /*compiled version */
150 fitter->SetInnerWidthFactor(1,1);
151 fitter->SetOuterWidthFactor(1,1);
152 fitter->SetNmaxOverlaps(5);
154 fitter->SetChiSqMax(5,0);
155 fitter->SetChiSqMax(5,1);
156 fitter->SetChiSqMax(5,2);
161 for(Int_t slice=minslice; slice<=maxslice; slice++)
163 file->Init(slice,patch);
164 cout<<"Processing slice "<<slice<<" patch "<<patch<<endl;
165 AliL3DigitRowData *digits = (AliL3DigitRowData*)file->AliAltroDigits2Memory(ndigits);
167 fitter->Init(slice,patch);
168 fitter->LoadLocalSegments();
170 fitter->SetInputData(digits);
172 fitter->FindClusters();
173 fitter->WriteClusters();
179 fitter->WriteTracks(5);