]>
Commit | Line | Data |
---|---|---|
b9d722bc | 1 | #ifndef ALIITSNNEURALTRACKER_H |
2 | #define ALIITSNNEURALTRACKER_H | |
3 | ||
4 | class TObjArray; | |
5 | class TCanvas; | |
6 | ||
7 | /////////////////////////////////////////////////////////////////////// | |
8 | // | |
9 | // AliITSneuralTracker: | |
10 | // | |
11 | // neural network MFT algorithm | |
12 | // for track finding in ITS stand alone | |
13 | // according to the Denby-Peterson model with adaptments to the | |
14 | // ALICE multiplicity | |
15 | // | |
16 | /////////////////////////////////////////////////////////////////////// | |
17 | ||
18 | class AliITSNeuralTracker : public TObject { | |
19 | ||
20 | public: | |
21 | ||
22 | AliITSNeuralTracker(); | |
23 | virtual ~AliITSNeuralTracker(); | |
24 | ||
25 | // ****************************************************************************** | |
26 | // * Embedded utility class --> >>> NODE <<< | |
27 | // ****************************************************************************** | |
28 | // * This class inherits from AliITSNeuralPoint and adds some | |
29 | // * utility pointers for quick path-finding among neurons. | |
30 | // ****************************************************************************** | |
31 | class AliITSNode : public AliITSNeuralPoint { | |
32 | public: | |
33 | AliITSNode() | |
34 | {fInnerOf = fOuterOf = fMatches = 0; fNext = fPrev = 0;} | |
35 | ||
36 | AliITSNode(AliITSNeuralPoint *p, Bool_t init = kTRUE) // declared inline | |
37 | : AliITSNeuralPoint(p) | |
38 | { | |
39 | fInnerOf = fOuterOf = fMatches = 0; | |
40 | fNext = fPrev = 0; | |
41 | if (init) { | |
42 | fInnerOf = new TObjArray; | |
43 | fOuterOf = new TObjArray; | |
44 | fMatches = new TObjArray; | |
45 | } | |
46 | } | |
47 | ||
48 | AliITSNode(AliITSRecPoint *p, AliITSgeomMatrix *gm) | |
49 | : AliITSNeuralPoint(p,gm) | |
50 | {fInnerOf = fOuterOf = fMatches = 0; fNext = fPrev = 0;} | |
51 | ||
52 | virtual ~AliITSNode() | |
53 | {fInnerOf = fOuterOf = fMatches = 0; fNext = fPrev = 0;} | |
54 | ||
55 | Double_t ThetaDeg() {return GetTheta()*180.0/TMath::Pi();} | |
56 | ||
57 | Int_t GetSector(Double_t sec_width) {return (Int_t)(GetPhi()/sec_width);} | |
58 | Int_t GetThetaCell() {return (Int_t)(ThetaDeg());} | |
59 | ||
60 | Int_t fPosInTree; | |
61 | ||
62 | TObjArray *fInnerOf; //! | |
63 | TObjArray *fOuterOf; //! | |
64 | TObjArray *fMatches; //! | |
65 | ||
66 | AliITSNode *fNext; //! | |
67 | AliITSNode *fPrev; //! | |
68 | }; | |
69 | // ****************************************************************************** | |
70 | ||
71 | ||
72 | ||
73 | // ****************************************************************************** | |
74 | // * Embedded utility class --> >>> NEURON <<< | |
75 | // ****************************************************************************** | |
76 | // * Simple class implementing the neural unit. | |
77 | // * Contains the activation and some other pointers | |
78 | // * for purposes similar to the ones in AliITSnode. | |
79 | // ****************************************************************************** | |
80 | class AliITSneuron : public TObject { | |
81 | public: | |
82 | AliITSneuron():fUsed(0),fActivation(0.),fInner(0),fOuter(0),fGain(0) { } | |
83 | virtual ~AliITSneuron() {fInner=fOuter=0;fGain=0;} | |
84 | ||
85 | Double_t Weight(AliITSneuron *n); | |
86 | void Add2Gain(AliITSneuron *n, Double_t mult_const, Double_t exponent); | |
87 | ||
88 | Int_t fUsed; // utility flag | |
89 | Double_t fActivation; // Activation value | |
90 | AliITSNode *fInner; //! inner point | |
91 | AliITSNode *fOuter; //! outer point | |
92 | TObjArray *fGain; //! list of sequenced units | |
93 | }; | |
94 | // ****************************************************************************** | |
95 | ||
96 | ||
97 | ||
98 | // ****************************************************************************** | |
99 | // * Embedded utility class --> >>> CONNECTION <<< | |
100 | // ****************************************************************************** | |
101 | // * Used to implement the neural weighted connection | |
102 | // * in such a way to speed up the retrieval of the | |
103 | // * links among neuron, for a fast update procedure. | |
104 | // ****************************************************************************** | |
105 | class AliITSlink : public TObject { | |
106 | public: | |
107 | AliITSlink() : fWeight(0.), fLinked(0) { } | |
108 | virtual ~AliITSlink() {fLinked = 0;} | |
109 | ||
110 | Double_t fWeight; // Weight value | |
111 | AliITSneuron *fLinked; //! the connected neuron | |
112 | }; | |
113 | // ****************************************************************************** | |
114 | ||
115 | ||
116 | // Cut related setters | |
117 | ||
118 | void SetHelixMatchCuts(Double_t *min, Double_t *max); | |
119 | void SetThetaCuts2D(Double_t *min, Double_t *max); | |
120 | void SetThetaCuts3D(Double_t *min, Double_t *max); | |
121 | void SetCurvatureCuts(Int_t n, Double_t *cuts); | |
122 | void SetVertex(Double_t x, Double_t y, Double_t z) {fVX=x; fVY=y; fVZ=z;} | |
123 | void SetPolarInterval(Double_t dtheta) {fPolarInterval=dtheta;} | |
124 | ||
125 | // Neural work-flow related setters | |
126 | ||
127 | void SetActThreshold(Double_t val) {fActMinimum = val;} | |
128 | void SetWeightExponent(Double_t a) {fAlignExponent = a;} | |
129 | void SetGainToCostRatio(Double_t a) {fGain2CostRatio = a;} | |
130 | void SetInitInterval(Double_t a, Double_t b) {fEdge1 = a; fEdge2 = b;} | |
131 | void SetTemperature(Double_t a) {fTemperature = a;} | |
132 | void SetVariationLimit(Double_t a) {fStabThreshold = a;} | |
133 | ||
134 | // Points array arrangement & control | |
135 | ||
136 | void CreateArrayStructure(Int_t nsecs); | |
137 | Int_t ArrangePoints(TTree *pts_tree); | |
138 | void StoreAbsoluteMatches(); | |
139 | Bool_t PassCurvCut(AliITSNode *p1, AliITSNode *p2, Int_t curv_idx, Double_t vx, Double_t vy, Double_t vz); | |
140 | Int_t PassAllCuts(AliITSNode *p1, AliITSNode *p2, Int_t curv_idx, Double_t vx, Double_t vy, Double_t vz); | |
141 | void PrintPoints(); | |
142 | void PrintMatches(Bool_t stop = kTRUE); | |
143 | ||
144 | // Neural tracker work-flow | |
145 | ||
146 | void NeuralTracking(const char* filesave, TCanvas*& display); | |
147 | void Display(TCanvas*& canvas); | |
148 | void ResetNodes(Int_t isector); | |
149 | Int_t CreateNeurons(Int_t sector, Int_t curv); // create neurons | |
150 | Int_t LinkNeurons(); // create neural connections | |
151 | Double_t Activate(AliITSneuron* &n); // calculates the new neural activation | |
152 | Bool_t Update(); // an updating cycle | |
153 | void CleanNetwork(); // removes deactivated units and resolves competitions | |
154 | Int_t Save(Int_t sector_idx); // save found tracks for # sector | |
155 | TTree* GetChains() {return fChains;} | |
156 | void WriteChains() {fChains->Write();} | |
157 | ||
158 | private: | |
159 | ||
160 | Bool_t CheckOccupation(); | |
161 | ||
162 | Int_t fSectorNum; // number of azymuthal sectors | |
163 | Double_t fSectorWidth; // width of an azymuthal sector (in RADIANS) [used internally] | |
164 | Double_t fPolarInterval; // width of a polar sector (in DEGREES) | |
165 | ||
166 | Double_t fThetaCut2DMin[5]; // lower edge of theta cut range (in DEGREES) | |
167 | Double_t fThetaCut2DMax[5]; // upper edge of theta cut range (in DEGREES) | |
168 | Double_t fThetaCut3DMin[5]; // lower edge of theta cut range (in DEGREES) | |
169 | Double_t fThetaCut3DMax[5]; // upper edge of theta cut range (in DEGREES) | |
170 | Double_t fHelixMatchCutMin[5]; // lower edge of helix matching cut range | |
171 | Double_t fHelixMatchCutMax[5]; // lower edge of helix matching cut range | |
172 | Int_t fCurvNum; // # of curvature cut steps | |
173 | Double_t *fCurvCut; //! value of all curvature cuts | |
174 | ||
175 | Bool_t fStructureOK; // flag to avoid MANY segfault errors | |
176 | ||
177 | Double_t fVX, fVY, fVZ; // estimated vertex coords (for helix matching cut) | |
178 | ||
179 | Double_t fActMinimum; // minimum activation to turn 'on' the unit at the end | |
180 | Double_t fEdge1, fEdge2; // initialization interval for activations | |
181 | ||
182 | Double_t fTemperature; // logistic function temperature parameter | |
183 | Double_t fStabThreshold; // stability threshold | |
184 | Double_t fGain2CostRatio; // ratio between inhibitory and excitory contributions | |
185 | Double_t fAlignExponent; // alignment-dependent weight term | |
186 | ||
187 | Int_t fPoint[6]; // Track point in layers | |
188 | TTree *fChains; //! Output tree | |
189 | ||
190 | TObjArray *fPoints[6][180]; //! recpoints arranged into sectors for processing | |
191 | TObjArray *fNeurons; //! neurons | |
192 | ||
193 | ClassDef(AliITSNeuralTracker, 1) | |
194 | }; | |
195 | ||
196 | ||
197 | //////////////////////////////////////////////////////////////////////////////// | |
198 | ||
199 | #endif |