]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSneuralTracker.h
Further modifications in OpenOutput and WriteCluster
[u/mrichter/AliRoot.git] / ITS / AliITSneuralTracker.h
1 #ifndef AliITSneuralTracker_h
2 #define AliITSneuralTracker_h
3
4 #include <TObject.h>
5
6 #include "AliITSglobalRecPoint.h"
7 class TObjArray;
8
9 class AliITSneuron;
10 class AliITSneuralTrack;
11 //class AliITSglobalRecPoint;
12
13 ///////////////////////////////////////////////////////////////////////
14 //
15 // AliITSneuralTracker: 
16 //
17 // neural network MFT algorithm 
18 // for track finding in ITS stand alone
19 // according to the Denby-Peterson model with adaptments to the 
20 // ALICE multiplicity
21 // 
22 ///////////////////////////////////////////////////////////////////////
23
24 class AliITSneuralTracker : public TObject {
25
26 public:
27         
28         // constructors & destructor
29         AliITSneuralTracker();
30         AliITSneuralTracker(Int_t nsecs, Int_t nc, Double_t *c, Double_t theta);
31         virtual ~AliITSneuralTracker();
32         
33         // file reading and points array population
34         Int_t ReadFile(const Text_t *fname, Int_t evnum);
35         
36         // setters for working parameters (NOT cuts)
37         void SetDiff(Double_t a) {fDiff=a;}                 // helix adaptment parameter
38         void SetExponent(Double_t a) {fExp = a;}            // exponent which selects the high excitory values
39         void SetGainToCostRatio(Double_t a) {fRatio = a;}   // ratio between the gain and cost contributions
40         void SetTemperature(Double_t a) {fTemp = a;}        // temperature parameter in activation function
41         void SetVariationLimit(Double_t a) {fVar = a;}      // stability threshold
42         void SetInitLimits(Double_t a, Double_t b)          // intervals for initial random activations
43                 {fMin = (a<=b) ? a : b; fMax = (a<=b)? b : a;}
44         void SetVertex(Double_t x, Double_t y, Double_t z)  // estimated vertex position
45                 { fVPos[0] = x; fVPos[1] = y; fVPos[2] = z;}
46         
47         // neuron managin methods
48         Bool_t   SetEdge(AliITSneuron *n, AliITSglobalRecPoint *p, const char what); // sets the neuron's edges
49         Bool_t   CalcParams(AliITSneuron *n);              // calculation of helix parameters for the neuron
50         
51         // neural tracking (the argument is the ROOT file to store results)
52         void Go(const char* filesave, Bool_t flag = kFALSE); 
53                         
54 private:
55                 
56         // These methods are private to prevent the users to use them in incorrect sequences
57                 
58         // neuron management methods (not to be used publically)
59         Bool_t   ResetNeuron(AliITSneuron *n);             // resets all neuron's fields like in the constructor
60         Int_t    CountExits (AliITSneuron *n);             // counter for # of neurons going into n's tail
61         Int_t    CountEnters(AliITSneuron *n);             // counter for # of neurons startins from n's head
62         Double_t Angle(AliITSneuron *n, AliITSneuron *m);  // angle between two neural segments
63         Double_t Weight(AliITSneuron *n, AliITSneuron *m); // synaptic weight between two neural segments
64         
65         // neural network work-flow
66         Int_t  Initialize(Int_t snum, Int_t cnum, Bool_t flag = kFALSE); 
67                                                               // resets (or creates) neurons array for a new neural tracking
68         Bool_t Update();                            // updates the neurons and checks if stabilization has occurred
69         Int_t  Save();                              // saves the found tracks after stabilization
70         void   DoSector(Int_t sect, Bool_t flag);   // complete work on a single sector
71                 
72         Int_t     fCurvNum;  //  # of curvature cut steps
73         Double_t *fCurvCut;  //! value of all curvature cuts
74         
75         Int_t     fSectorNum;    // no. of azymuthal sectors
76         Double_t  fSectorWidth;  // width of an azymuthal sector
77         
78         Double_t fVPos[3]; // estimated vertex coords
79         
80         Double_t fMin;      // min initial random activations
81         Double_t fMax;      // max initial random activations
82         Double_t fThetaCut; // polar angle cut
83         Int_t    fThetaNum; // size of theta sectionement
84         Double_t fTemp;     // logistic function parameter
85         Double_t fVar;      // stability threshold (for mean rel. activations)
86         Double_t fRatio;    // ratio between inhibitory and excitory contributions
87         Double_t fExp;      // alignment weight
88         Double_t fDiff;     // max allowed difference between TanL exstimations from the two neuron edges
89         
90         TObjArray ***fPoints[6];  //! Collection of recpoints (sectioned in azym. secs)
91         TObjArray   *fNeurons[6]; //! Collection of neurons
92         TObjArray   *fTracks;     //! Collection of tracks
93         
94         ClassDef(AliITSneuralTracker, 1)
95 };
96         
97
98 ////////////////////////////////////////////////////////////////////////////////
99
100
101 class AliITSneuron : public TObject {
102         
103         friend class AliITSneuralTracker;
104         
105 public:
106                 
107                  AliITSneuron();
108         virtual ~AliITSneuron();
109         
110         Bool_t   ContainsID(Int_t ID) 
111                 { return (fInner->HasID(ID) && fOuter->HasID(ID)); }
112         
113 private:
114                 
115         Double_t fActivation; // Activation value
116
117         Double_t fCurv;    // curvature [= 1 / R]
118         Double_t fCX;      // curvature centre (X) in changed RF
119         Double_t fCY;      // curvature centre (X) in changed RF
120         Double_t fTanL;    // tan(dip angle) = C / freq
121         Double_t fPhase;   // 'phase' parameter
122         Double_t fDiff;    // difference between tan(lambda) estimated by the two different points
123         Double_t fLength;  // segment length
124         
125         AliITSneuron *fNext; // best outgoing unit
126         AliITSneuron *fPrev; // best incoming unit
127         
128         AliITSglobalRecPoint *fInner; // inner point 
129         AliITSglobalRecPoint *fOuter; // outer point
130         ClassDef(AliITSneuron,1) // neural tracker helper class
131 };
132
133         
134 #endif