]>
Commit | Line | Data |
---|---|---|
0bd0c1ef | 1 | // $Id$ |
2 | ||
3 | #ifndef __CINT__ | |
4 | #include "AliL3Logger.h" | |
5 | #include "AliL3FileHandler.h" | |
6 | #include "AliL3DigitData.h" | |
7 | #include "AliL3Transform.h" | |
8 | #include "AliL3Hough.h" | |
9 | #include "AliL3TrackArray.h" | |
10 | #include "AliL3Track.h" | |
11 | #include "AliL3HoughTrack.h" | |
12 | #include "AliL3Fitter.h" | |
13 | #include "AliL3ClusterFitter.h" | |
14 | #include "AliL3Vertex.h" | |
15 | #include "AliL3Benchmark.h" | |
16 | #include <AliRunLoader.h> | |
17 | #include <AliStack.h> | |
18 | #include <TParticle.h> | |
19 | #include <TNtuple.h> | |
20 | #include <TRandom.h> | |
21 | #include <TSystem.h> | |
22 | #include <TStopwatch.h> | |
23 | #include <TBenchmark.h> | |
24 | #include <stdio.h> | |
25 | #include <iostream.h> | |
26 | #include <time.h> | |
27 | #endif | |
28 | ||
29 | Int_t runrowhough(Char_t *path="./",Char_t *outpath="./fitter",int s1=0,int s2=35,int nevent=1,Bool_t skip=kTRUE) | |
30 | { | |
31 | Bool_t isinit=AliL3Transform::Init(path,kTRUE); | |
32 | if(!isinit){ | |
33 | cerr << "Could not create transform settings, please check log for error messages!" << endl; | |
34 | return 1; | |
35 | } | |
36 | Float_t ptmin = 0.1*AliL3Transform::GetSolenoidField(); | |
37 | Float_t zvertex; | |
38 | ||
39 | { | |
40 | AliRunLoader *rl = AliRunLoader::Open("galice.root"); | |
41 | rl->LoadHeader(); | |
42 | rl->LoadKinematics(); | |
43 | AliStack* stack = rl->Stack(); | |
44 | TParticle *orig = (TParticle*)stack->Particle(0); | |
45 | Float_t xori = orig->Vx(); | |
46 | Float_t yori = orig->Vy(); | |
47 | zvertex = orig->Vz(); | |
48 | cout<<" Primary vertex at ("<<xori<<","<<yori<<","<<zvertex<<")"<<endl; | |
49 | if (rl->LoadgAlice()) { | |
50 | cerr<<"Error occured while loading gAlice"<<endl; | |
51 | return 1; | |
52 | } | |
53 | delete rl; | |
54 | } | |
55 | ||
56 | cout<<" Hough Tranform will run with ptmin="<<ptmin<<" and zvertex="<<zvertex<<endl; | |
57 | ||
58 | AliL3Benchmark *fBenchmark = new AliL3Benchmark(); | |
59 | AliL3Hough *hough = new AliL3Hough(); | |
60 | hough->SetThreshold(4); | |
61 | hough->SetTransformerParams(140,76,ptmin,-1); | |
62 | hough->SetPeakThreshold(50,-1); | |
63 | hough->Init(path, kFALSE, 100, kFALSE,4,0,0,zvertex); | |
64 | hough->SetAddHistograms(); | |
65 | ||
66 | for(int ev=0; ev<nevent; ev++) | |
67 | { | |
68 | for(int slice=s1; slice<=s2; slice++) | |
69 | { | |
70 | cout<<"Processing slice "<<slice<<endl; | |
71 | hough->ReadData(slice,ev); | |
72 | hough->Transform(); | |
73 | hough->AddAllHistogramsRows(); | |
74 | hough->FindTrackCandidates(); | |
75 | hough->AddTracks(); | |
76 | } | |
77 | hough->WriteTracks(outpath); | |
78 | Char_t bname[100]; | |
79 | sprintf(bname,"rowhough_%d",ev); | |
80 | hough->DoBench(bname); | |
81 | ||
82 | if(!skip) { | |
83 | // Run cluster fitter | |
84 | AliL3ClusterFitter *fitter = new AliL3ClusterFitter(path); | |
85 | ||
86 | // Set debug flag for the cluster fitter | |
87 | // fitter->Debug(); | |
88 | ||
89 | // Setting fitter parameters | |
90 | fitter->SetInnerWidthFactor(1,1.5); | |
91 | fitter->SetOuterWidthFactor(1,1.5); | |
92 | fitter->SetNmaxOverlaps(5); | |
93 | ||
94 | // fitter->SetChiSqMax(5,kFALSE); //isolated clusters | |
95 | fitter->SetChiSqMax(5,kTRUE); //overlapping clusters | |
96 | ||
97 | Int_t rowrange[2] = {0,AliL3Transform::GetNRows()-1}; | |
98 | ||
99 | // Takes input from global hough tracks produced by HT | |
100 | fitter->LoadSeeds(rowrange,kFALSE,ev,zvertex); | |
101 | ||
102 | UInt_t ndigits; | |
103 | ||
104 | for(int slice=s1; slice<=s2; slice++) | |
105 | { | |
106 | for(Int_t ipatch = 0; ipatch < AliL3Transform::GetNPatches(); ipatch++) | |
107 | { | |
108 | // Read digits | |
109 | hough->GetMemHandler(ipatch)->Free(); | |
110 | hough->GetMemHandler(ipatch)->Init(slice,ipatch); | |
111 | AliL3DigitRowData *digits = (AliL3DigitRowData *)hough->GetMemHandler(ipatch)->AliAltroDigits2Memory(ndigits,ev); | |
112 | ||
113 | fBenchmark->Start("Fitter Init"); | |
114 | fitter->Init(slice,ipatch); | |
115 | fBenchmark->Stop("Fitter Init"); | |
116 | fitter->SetInputData(digits); | |
117 | fBenchmark->Start("Fitter cluster finder"); | |
118 | fitter->FindClusters(); | |
119 | fBenchmark->Stop("Fitter cluster finder"); | |
120 | fitter->WriteClusters(); | |
121 | } | |
122 | } | |
123 | ||
124 | // Refit of the clusters | |
125 | AliL3Vertex vertex; | |
126 | //The seeds are the input tracks from circle HT | |
127 | AliL3TrackArray *tracks = fitter->GetSeeds(); | |
128 | AliL3Fitter *ft = new AliL3Fitter(&vertex,1); | |
129 | ||
130 | ft->LoadClusters("./fitter/",ev,kFALSE); | |
131 | fBenchmark->Start("Track fitter"); | |
132 | for(Int_t i=0; i<tracks->GetNTracks(); i++) | |
133 | { | |
134 | AliL3Track *track = tracks->GetCheckedTrack(i); | |
135 | if(!track) continue; | |
136 | if(track->GetNHits() < 20) continue; | |
137 | ft->SortTrackClusters(track); | |
138 | ft->FitHelix(track); | |
139 | track->UpdateToFirstPoint(); | |
140 | } | |
141 | fBenchmark->Stop("Track fitter"); | |
142 | delete ft; | |
143 | ||
144 | //Write the final tracks | |
145 | fitter->WriteTracks(20); | |
146 | ||
147 | delete fitter; | |
148 | } | |
149 | } | |
150 | ||
151 | if(!skip) { | |
152 | fBenchmark->Analyze("fitter"); | |
153 | } | |
154 | ||
155 | hough->DoBench("rowhough"); | |
156 | delete hough; | |
157 | delete fBenchmark; | |
158 | return 0; | |
159 | } |