]>
Commit | Line | Data |
---|---|---|
b2a02bce | 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 | |
1f1942b8 | 9 | TPC.Digits.root is in the path (symlink)! |
b2a02bce | 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 | ||
1f1942b8 | 17 | #ifndef __CINT__ |
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" | |
28 | #include <TNtuple.h> | |
29 | #include <TRandom.h> | |
30 | #include <TSystem.h> | |
31 | #include <TStopwatch.h> | |
32 | #include <stdio.h> | |
33 | #include <iostream.h> | |
34 | #include <time.h> | |
35 | #endif | |
36 | ||
37 | void deconvclusters(Char_t *path,Int_t minslice=0,Int_t maxslice=35,Int_t nevent=1) | |
b2a02bce | 38 | { |
39 | ||
40 | AliL3Transform::Init(path,kTRUE); | |
41 | ||
1f1942b8 | 42 | Char_t filename[1024]; |
43 | AliL3FileHandler *file = new AliL3FileHandler(kTRUE); //static index | |
b2a02bce | 44 | UInt_t ndigits=0; |
45 | ||
46 | sprintf(filename,"%s/digitfile.root",path); | |
b2a02bce | 47 | file->SetAliInput(filename); |
b2a02bce | 48 | AliL3ClusterFitter *fitter = new AliL3ClusterFitter(path); |
49 | ||
1f1942b8 | 50 | #ifdef __CINT__ |
51 | Char_t macroname[1024]; | |
b2a02bce | 52 | gROOT->LoadMacro("SetFitParameters.C"); |
53 | SetFitParameters(fitter); | |
1f1942b8 | 54 | #else /*compiled version */ |
55 | fitter->SetInnerWidthFactor(1,1); | |
56 | fitter->SetOuterWidthFactor(1,1); | |
57 | fitter->SetNmaxOverlaps(5); | |
58 | ||
59 | fitter->SetChiSqMax(5,0); | |
60 | fitter->SetChiSqMax(5,1); | |
61 | fitter->SetChiSqMax(5,2); | |
62 | #endif | |
63 | ||
64 | TStopwatch tloader;tloader.Stop(); | |
65 | TStopwatch tfinder;tfinder.Stop(); | |
66 | TStopwatch trefitter;trefitter.Stop(); | |
67 | ||
68 | Int_t patch=-1; | |
69 | Int_t rowrange[2] = {0,AliL3Transform::GetNRows()-1}; | |
70 | for(Int_t ev=0; ev<nevent; ev++) | |
b2a02bce | 71 | { |
1f1942b8 | 72 | AliL3FileHandler::LoadStaticIndex(0,ev); |
73 | fitter->LoadSeeds(rowrange,kFALSE,ev); //Takes input from global hough tracks | |
b2a02bce | 74 | |
1f1942b8 | 75 | for(Int_t slice=minslice; slice<=maxslice; slice++) |
b2a02bce | 76 | { |
1f1942b8 | 77 | tloader.Start(0); |
b2a02bce | 78 | file->Init(slice,-1); |
79 | cout<<"Processing event "<<ev<<" slice "<<slice<<" patch "<<patch<<endl; | |
80 | AliL3DigitRowData *digits = (AliL3DigitRowData*)file->AliAltroDigits2Memory(ndigits,ev); | |
b2a02bce | 81 | fitter->Init(slice,patch); |
82 | fitter->SetInputData(digits); | |
1f1942b8 | 83 | tloader.Stop(); |
b2a02bce | 84 | |
1f1942b8 | 85 | tfinder.Start(0); |
b2a02bce | 86 | fitter->FindClusters(); |
b2a02bce | 87 | fitter->WriteClusters(); |
1f1942b8 | 88 | tfinder.Stop(); |
89 | ||
90 | tloader.Start(0); | |
b2a02bce | 91 | file->Free(); |
1f1942b8 | 92 | tloader.Stop(); |
b2a02bce | 93 | } |
94 | ||
95 | //If you want a refit of the clusters;------------------------- | |
1f1942b8 | 96 | tloader.Start(0); |
b2a02bce | 97 | AliL3Vertex vertex; |
1f1942b8 | 98 | AliL3TrackArray *tracks = fitter->GetSeeds(); //The seeds are the |
99 | //input tracks from circle HT | |
b2a02bce | 100 | AliL3Fitter *ft = new AliL3Fitter(&vertex,1); |
101 | sprintf(filename,"%s/fitter/",path); | |
102 | ft->LoadClusters(filename,0,kTRUE); | |
1f1942b8 | 103 | tloader.Stop(); |
104 | ||
105 | trefitter.Start(0); | |
b2a02bce | 106 | for(Int_t i=0; i<tracks->GetNTracks(); i++) |
107 | { | |
1f1942b8 | 108 | AliL3Track *track = tracks->GetCheckedTrack(i); |
b2a02bce | 109 | if(!track) continue; |
110 | if(track->GetNHits() < 40) continue; | |
111 | ft->SortTrackClusters(track); | |
112 | ft->FitHelix(track); | |
1f1942b8 | 113 | track->UpdateToFirstPoint(); |
b2a02bce | 114 | } |
1f1942b8 | 115 | trefitter.Stop(); |
b2a02bce | 116 | //------------------------------------------------------------- |
1f1942b8 | 117 | tloader.Start(0); |
118 | delete ft; | |
b2a02bce | 119 | fitter->WriteTracks(5); //Write the final tracks |
120 | file->FreeDigitsTree(); | |
1f1942b8 | 121 | tloader.Stop(); |
b2a02bce | 122 | } |
1f1942b8 | 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"); | |
127 | ||
b2a02bce | 128 | delete fitter; |
129 | } | |
130 | ||
1f1942b8 | 131 | void deconvlocally(Char_t *path,Int_t minslice=0,Int_t maxslice=17) |
b2a02bce | 132 | { |
133 | ||
134 | AliL3Transform::Init(path,kTRUE); | |
135 | ||
1f1942b8 | 136 | Char_t filename[1024]; |
137 | AliL3FileHandler *file = new AliL3FileHandler(kTRUE); | |
b2a02bce | 138 | UInt_t ndigits=0; |
139 | ||
140 | sprintf(filename,"%s/digitfile.root",path); | |
b2a02bce | 141 | file->SetAliInput(filename); |
b2a02bce | 142 | AliL3ClusterFitter *fitter = new AliL3ClusterFitter(path); |
143 | ||
1f1942b8 | 144 | #ifdef __CINT__ |
145 | Char_t macroname[1024]; | |
b2a02bce | 146 | sprintf(macroname,"%s/SetFitParameters.C",path); |
147 | gROOT->LoadMacro(macroname); | |
148 | SetFitParameters(fitter); | |
1f1942b8 | 149 | #else /*compiled version */ |
150 | fitter->SetInnerWidthFactor(1,1); | |
151 | fitter->SetOuterWidthFactor(1,1); | |
152 | fitter->SetNmaxOverlaps(5); | |
153 | ||
154 | fitter->SetChiSqMax(5,0); | |
155 | fitter->SetChiSqMax(5,1); | |
156 | fitter->SetChiSqMax(5,2); | |
157 | #endif | |
b2a02bce | 158 | |
1f1942b8 | 159 | Int_t patch=-1; |
b2a02bce | 160 | |
1f1942b8 | 161 | for(Int_t slice=minslice; slice<=maxslice; slice++) |
b2a02bce | 162 | { |
163 | file->Init(slice,patch); | |
164 | cout<<"Processing slice "<<slice<<" patch "<<patch<<endl; | |
165 | AliL3DigitRowData *digits = (AliL3DigitRowData*)file->AliAltroDigits2Memory(ndigits); | |
166 | ||
167 | fitter->Init(slice,patch); | |
168 | fitter->LoadLocalSegments(); | |
169 | ||
170 | fitter->SetInputData(digits); | |
171 | ||
172 | fitter->FindClusters(); | |
173 | fitter->WriteClusters(); | |
174 | ||
175 | file->Free(); | |
176 | ||
177 | } | |
178 | ||
179 | fitter->WriteTracks(5); | |
180 | delete fitter; | |
181 | } | |
182 |