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