]>
Commit | Line | Data |
---|---|---|
5f292941 | 1 | // ARGUMENTS: |
2 | // 1. number of azymuthal sectors (it's better not to go under 8 or over 40) | |
3 | // 2. the ROOT file to read (WITHOUT exstension) | |
4 | // 3. event number | |
5 | // 4. if specified a string, a fstream named like the argument is opened and | |
6 | // the elapsed CPU time is stored (not useful) | |
7 | ||
8 | // the macro will save a file named, for example "galice_<nsecs>.root" | |
9 | // containing may AliITSneuralTrack objects | |
10 | ||
11 | void AliITSNeuralRecognition | |
12 | (Int_t nsecs = 20, | |
13 | const char* rfile = "its_recpoints_v1.root") | |
14 | { | |
15 | TStopwatch timer; | |
16 | Double_t CONVERT = TMath::Pi() / 180.0; | |
17 | //cout << "Reading file " << rfile << " and saving in " << wfile << endl; | |
18 | ||
19 | // ================================== | |
20 | // ==== VERTEX READING ============== | |
21 | // ================================== | |
22 | ||
23 | // If a "its_vertex.txt" file is provided, | |
24 | // the vertex position is read from it. | |
25 | fstream f_vert("its_vertex.txt", ios::in); | |
26 | Double_t Vx, Vy, Vz, dummy; | |
27 | f_vert >> dummy >> Vx >> Vy >> Vz; | |
28 | if (fabs(Vx) < 0.05) Vx = 0.0; | |
29 | if (fabs(Vy) < 0.05) Vy = 0.0; | |
30 | cout << "Vertex position (x, y, z): " << Vx << ' ' << Vy << ' ' << Vz << endl; | |
31 | ||
32 | ||
33 | // ================================== | |
34 | // ==== CURVATURE CUT DEFINITION ==== | |
35 | // ================================== | |
36 | ||
37 | // These values define the curvature cuts for all steps | |
38 | // within a sector. | |
39 | // For a greater clarity, the cuts are indicated in units | |
40 | // of transverse momentum (GeV/c) but these value have no | |
41 | // exact physical meaning, but are useful to understand | |
42 | // well what means a choice in the value of a certain | |
43 | // curvature constraint | |
44 | // NOTE: be careful to make sure that the 'ncuts' variable | |
45 | // have the same value of the dimension of the allocated arrays | |
46 | ||
47 | Int_t ncuts; | |
48 | Double_t *p, *cut; | |
49 | ||
50 | ncuts = 6; | |
51 | p = new Double_t[6]; | |
52 | cut = new Double_t[6]; | |
53 | cut[ 0] = 2.0 * 0.0003; | |
54 | cut[ 1] = 2.0 * 0.0006; | |
55 | cut[ 2] = 2.0 * 0.0009; | |
56 | cut[ 3] = 2.0 * 0.0010; | |
57 | cut[ 4] = 2.0 * 0.0012; | |
58 | cut[ 5] = 2.0 * 0.0015; | |
59 | ||
60 | ||
61 | // ========================== | |
62 | // ==== OTHER PARAMETERS ==== | |
63 | // ========================== | |
64 | ||
65 | Double_t helix_min[5] = { 0.000, 0.000, 0.000, 0.00, 0.0 }; | |
66 | Double_t helix_max[5] = { 0.0215, 0.0215, 0.0206, 0.75, 0.1 }; | |
67 | ||
68 | Double_t theta2D_min[5] = { 0.0, 0.0, 0.0, 0.0, 0.0 }; | |
69 | Double_t theta2D_max[5] = { 1.0, 0.7, 0.8, 3.0, 30.0 }; | |
70 | ||
71 | Double_t theta3D_min[5] = { 0.0, 0.0, 0.0, 0.0, 0.0 }; | |
72 | Double_t theta3D_max[5] = { 1.2, 1.2, 2.0, 5.0, 5.0 }; | |
73 | ||
74 | Double_t temp = 1.0; // temperature parameter | |
75 | Double_t var = 0.00001; // stabilization threshold | |
76 | ||
77 | Double_t exp = 20.0; // straight-line excitator | |
78 | Double_t gtoc = 6.0; // gain/cost contribution ratio | |
79 | ||
80 | Double_t min = 0.4; // minimum in random activation initialization | |
81 | Double_t max = 0.6; // maximum in random activation initialization | |
82 | Double_t actmin = 0.55; // activation threshold for binary map conversion | |
83 | ||
84 | ||
85 | // ========================= | |
86 | // ==== NEURAL TRACKING ==== | |
87 | // ========================= | |
88 | ||
89 | AliITSNeuralTracker *ANN = new AliITSNeuralTracker(); | |
90 | ||
91 | ANN->SetVertex(Vx, Vy, Vz); | |
92 | ||
93 | ANN->SetCurvatureCuts(ncuts, cut); | |
94 | ANN->SetTemperature(temp); | |
95 | ANN->SetVariationLimit(var); | |
96 | ANN->SetGainToCostRatio(gtoc); | |
97 | ANN->SetWeightExponent(exp); | |
98 | ANN->SetInitInterval(min, max); | |
99 | ANN->SetActThreshold(actmin); | |
100 | ||
101 | ANN->SetPolarInterval(45.0); | |
102 | ANN->SetThetaCuts2D(theta2D_min, theta2D_max); | |
103 | ANN->SetThetaCuts3D(theta3D_min, theta3D_max); | |
104 | ANN->SetHelixMatchCuts(helix_min, helix_max); | |
105 | ||
106 | TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(rfile); | |
107 | if (!file) file = new TFile("its_recpoints_v1.root"); | |
108 | TTree *points = 0; | |
109 | points = (TTree*)file->Get("TreeP"); | |
110 | if (!points) { | |
111 | cerr << "No points found!!!" << endl; | |
112 | return; | |
113 | } | |
114 | ||
115 | cout << "Storing points..." << endl; | |
116 | ANN->CreateArrayStructure(nsecs); | |
117 | if (!ANN->ArrangePoints(points)) { | |
118 | cout << "Problems occurred while storing points. Aborted" << endl; | |
119 | return; | |
120 | } | |
121 | delete points; | |
122 | file.Close(); | |
123 | ||
124 | cout << "Matching points..." << endl; | |
125 | ANN->StoreAbsoluteMatches(); | |
126 | //ANN->PrintMatches(0); | |
127 | ||
128 | TCanvas *c = 0;//new TCanvas("c", "c", 0, 0, 500, 500); | |
129 | //c->Range(-50, -50, 50, 50); | |
130 | ||
131 | timer.Start(); | |
132 | ANN->NeuralTracking("its_chains.root", c); | |
133 | timer.Stop(); | |
134 | timer.Print(); | |
135 | ||
136 | delete ANN; | |
137 | } |