]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/qaRec/AliTRDpidRefMaker.h
Make run.C compilable without having to change include paths in .rootrc (Theodor)
[u/mrichter/AliRoot.git] / TRD / qaRec / AliTRDpidRefMaker.h
1 #ifndef ALITRDPIDREFMAKER_H
2 #define ALITRDPIDREFMAKER_H
3
4 //////////////////////////////////////////////////////
5 //
6 // Task to build PID reference tree for the training
7 // of neural networs for the TRD PID
8 //
9 // Authors: Alex Wilk    <wilka@uni-muenster.de>
10 //          Markus Heide <mheide@uni-muenster.de>
11 //
12 ///////////////////////////////////////////////////////
13
14 #ifndef ALITRDRECOTASK_H
15 #include "AliTRDrecoTask.h"
16 #endif
17
18 #ifndef ALIPID_H
19 #include "AliPID.h"
20 #endif
21
22 #ifndef ALITRDCALPID_H
23 #include "../Cal/AliTRDCalPID.h"
24 #endif
25
26 #ifndef ALITRDGEOMETRY_H
27 #include "../AliTRDgeometry.h"
28 #endif
29
30 class TTree;
31 class TObjArray;
32 class TEventList;
33 class TMultiLayerPerceptron;
34 class AliPID;
35 class AliTRDtrackV1;
36 class AliTRDReconstructor;
37 class AliTRDpidRefMaker : public AliTRDrecoTask
38 {
39
40 public:
41   enum  {
42     k006  =  0
43     ,k008 =  1
44     ,k010 =  2
45     ,k015 =  3
46     ,k020 =  4
47     ,k030 =  5
48     ,k040 =  6
49     ,k050 =  7
50     ,k060 =  8
51     ,k080 =  9
52     ,k100 = 10
53     ,kAll = 11
54   };
55
56   enum {
57     kGraphTrain = 0
58     ,kGraphTest = 1
59   };
60
61   enum {
62     kMoniTrain = 50
63   };
64
65   AliTRDpidRefMaker();
66
67   virtual ~AliTRDpidRefMaker();
68   
69   void    ConnectInputData(Option_t *opt);
70   void    CreateOutputObjects();
71   void    Exec(Option_t *option);
72   Int_t   GetEpochs() {return fEpochs;};
73   Int_t   GetMinTrain() {return fMinTrain;};
74   Int_t   GetTrainMomBin() {return fTrainMomBin;};
75
76   Bool_t  PostProcess();
77
78   void    SetEpochs(Int_t epochs) {fEpochs = epochs;};
79   void    SetMinTrain(Int_t mintrain) {fMinTrain = mintrain;};
80   void    SetTrainMomBin(Int_t trainmombin) {fTrainMomBin = trainmombin;};
81   void    SetDate(Int_t date) {fDate = date;};
82   void    SetDoTraining(Bool_t train) {fDoTraining = train;};
83   void    SetContinueTraining(Bool_t continTrain) {fContinueTraining = continTrain;};
84   void    SetTrainPath(Int_t path) {fTrainPath = path;};
85   void    LoadFiles(const Char_t *InFileNN, const Char_t *InFileLQ);
86
87   void    Terminate(Option_t *);
88
89   void    MakeTrainingLists();                                 // build the training and the test list
90   void    MonitorTraining(Int_t mombin);                       // monitor training process
91   void    LoadContainer(const Char_t *InFileCont);
92   //void    CreateGraphs();
93
94 private:
95   AliTRDpidRefMaker(const AliTRDpidRefMaker&);              // not implemented
96   AliTRDpidRefMaker& operator=(const AliTRDpidRefMaker&);   // not implemented
97
98   void GetV0info(AliTRDtrackV1 *TRDtrack, Float_t *v0pdg);  // get the v0 information
99   void TrainNetworks(Int_t mombin);                         // train the neural networks for a given momentum bin
100   void BuildLQRefs(Int_t mombin);                           // build the 2dim histos for a given momentum bin
101
102   AliTRDReconstructor *fReconstructor;     //! reconstructor needed for recalculation the PID
103   TObjArray     *fV0s;                     //! v0 array
104   TTree         *fNN;                      // NN data
105   TTree         *fLQ;                      // LQ data
106   TEventList *fTrain[AliTRDCalPID::kNMom][AliTRDgeometry::kNlayer];          // Training list for each momentum 
107   TEventList *fTest[AliTRDCalPID::kNMom][AliTRDgeometry::kNlayer];           // Test list for each momentum 
108   TMultiLayerPerceptron *fNet[AliTRDgeometry::kNlayer]; // artificial neural network
109
110   Int_t         fLayer;                    // TRD layer index 
111   Int_t         fTrainMomBin;              // momentum bin for the training
112   Int_t         fEpochs;                   // Number of epochs for the training of the NNs
113   Int_t         fMinTrain;                 // minimum of events needed for training
114   Int_t         fDate;                     // date stamp for training of the NNs
115   Float_t       fMom;                      // momentum
116   Float_t       *fdEdx[10];                // dEdx array
117   Float_t       fv0pid[AliPID::kSPECIES];  // pid from v0s
118   Bool_t        fDoTraining;               // checks if training will be done
119   Bool_t        fContinueTraining;         // checks if training from an older run should be continued
120   Int_t         fTrainPath;                // sets the path for continuing the training
121
122   ClassDef(AliTRDpidRefMaker, 1); // TRD reference  maker for NN
123 };
124
125 #endif