ROOT logo
#ifndef ALITRDPIDREFMAKERNN_H
#define ALITRDPIDREFMAKERNN_H
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 * See cxx source for full Copyright notice                               */

/* $Id: AliTRDpidRefMakerNN.h 27496 2008-07-22 08:35:45Z cblume $ */

//////////////////////////////////////////////////////
//
// Task to build PID reference tree for the training
// of neural networs for the TRD PID
//
// Authors: Alex Wilk    <wilka@uni-muenster.de>
//          Markus Heide <mheide@uni-muenster.de>
//
///////////////////////////////////////////////////////

#ifndef ALITRDPIDREFMAKER_H
#include "AliTRDpidRefMaker.h"
#endif
#ifndef ALITRDCALPID_H
#include "AliTRDCalPID.h"
#endif

class TEventList;
class TMultiLayerPerceptron;
class AliTRDpidRefMakerNN : public AliTRDpidRefMaker
{

public:
  enum ETRDpidRefMakerNNgraph {
    kGraphTrain = 1
    ,kGraphTest = 2
  };

  enum ETRDpidRefMakerNNmoni {
    kMoniTrain = 50
  };

  enum ETRDpidRefMakerNNsteer{
    kMaxStat    = 20000 // maximum statistics/PID bin
   ,kMinStat    = 50     // minimum statistics/PID bin
  };
  AliTRDpidRefMakerNN();
  AliTRDpidRefMakerNN(const char *n);
  virtual ~AliTRDpidRefMakerNN();
  
  Int_t   GetEpochs() const {return fEpochs;};
  Int_t   GetMinTrain() const {return fMinTrain;};
  Int_t   GetTrainMomBin() const {return fTrainMomBin;};

  Bool_t  PostProcess();

  void    SetEpochs(Int_t epochs) {fEpochs = epochs;};
  void    SetMinTrain(Int_t mintrain) {fMinTrain = mintrain;};
  void    SetTrainMomBin(Int_t trainmombin) {fTrainMomBin = trainmombin;};
  void    SetDate(Int_t date) {fDate = date;};
  void    SetDoTraining(Bool_t train) {fDoTraining = train;};
  void    SetContinueTraining(Bool_t continTrain) {fContinueTraining = continTrain;};
  void    SetTrainPath(Int_t path) {fTrainPath = path;};
  Bool_t  LoadFile(const Char_t *InFileNN);
  void    SetScaledEdx(Float_t s) {fScale = s;};

  Bool_t  MakeTrainingSample();                     // convert AnalysisResults.root to training file
  void    MakeTrainingLists(Int_t mombin = 0);      // build the training and the test list
  void    MonitorTraining(Int_t mombin);            // monitor training process

protected:
  void MakeRefs(Int_t mombin);                         // train the neural networks for a given momentum bin

private:
  AliTRDpidRefMakerNN(const AliTRDpidRefMakerNN&);              // not implemented
  AliTRDpidRefMakerNN& operator=(const AliTRDpidRefMakerNN&);   // not implemented
  void    MakeTrainTestTrees();

  TEventList *fTrain[AliTRDCalPID::kNMom];          // Training list for each momentum
  TEventList *fTest[AliTRDCalPID::kNMom];           // Test list for each momentum
  TMultiLayerPerceptron *fNet; // artificial neural network

  Int_t         fTrainMomBin;              // momentum bin for the training
  Int_t         fEpochs;                   // Number of epochs for the training of the NNs
  Int_t         fMinTrain;                 // minimum of events needed for training
  Int_t         fDate;                     // date stamp for training of the NNs
  Bool_t        fDoTraining;               // checks if training will be done
  Bool_t        fContinueTraining;         // checks if training from an older run should be continued
  Int_t         fTrainPath;                // sets the path for continuing the training

  Float_t       fScale;                    // scaling factor
  Int_t         fLy;                       // TRD layer
  Int_t         fNtrkl;                    // No. tracklets
  TTree         *fTrainData[AliTRDCalPID::kNMom];//Tree for reference data for all momentum bins 
  TFile         *fRef;                     //file containing reference data

  ClassDef(AliTRDpidRefMakerNN, 3);        // TRD reference  maker for NN
};

#endif
 AliTRDpidRefMakerNN.h:1
 AliTRDpidRefMakerNN.h:2
 AliTRDpidRefMakerNN.h:3
 AliTRDpidRefMakerNN.h:4
 AliTRDpidRefMakerNN.h:5
 AliTRDpidRefMakerNN.h:6
 AliTRDpidRefMakerNN.h:7
 AliTRDpidRefMakerNN.h:8
 AliTRDpidRefMakerNN.h:9
 AliTRDpidRefMakerNN.h:10
 AliTRDpidRefMakerNN.h:11
 AliTRDpidRefMakerNN.h:12
 AliTRDpidRefMakerNN.h:13
 AliTRDpidRefMakerNN.h:14
 AliTRDpidRefMakerNN.h:15
 AliTRDpidRefMakerNN.h:16
 AliTRDpidRefMakerNN.h:17
 AliTRDpidRefMakerNN.h:18
 AliTRDpidRefMakerNN.h:19
 AliTRDpidRefMakerNN.h:20
 AliTRDpidRefMakerNN.h:21
 AliTRDpidRefMakerNN.h:22
 AliTRDpidRefMakerNN.h:23
 AliTRDpidRefMakerNN.h:24
 AliTRDpidRefMakerNN.h:25
 AliTRDpidRefMakerNN.h:26
 AliTRDpidRefMakerNN.h:27
 AliTRDpidRefMakerNN.h:28
 AliTRDpidRefMakerNN.h:29
 AliTRDpidRefMakerNN.h:30
 AliTRDpidRefMakerNN.h:31
 AliTRDpidRefMakerNN.h:32
 AliTRDpidRefMakerNN.h:33
 AliTRDpidRefMakerNN.h:34
 AliTRDpidRefMakerNN.h:35
 AliTRDpidRefMakerNN.h:36
 AliTRDpidRefMakerNN.h:37
 AliTRDpidRefMakerNN.h:38
 AliTRDpidRefMakerNN.h:39
 AliTRDpidRefMakerNN.h:40
 AliTRDpidRefMakerNN.h:41
 AliTRDpidRefMakerNN.h:42
 AliTRDpidRefMakerNN.h:43
 AliTRDpidRefMakerNN.h:44
 AliTRDpidRefMakerNN.h:45
 AliTRDpidRefMakerNN.h:46
 AliTRDpidRefMakerNN.h:47
 AliTRDpidRefMakerNN.h:48
 AliTRDpidRefMakerNN.h:49
 AliTRDpidRefMakerNN.h:50
 AliTRDpidRefMakerNN.h:51
 AliTRDpidRefMakerNN.h:52
 AliTRDpidRefMakerNN.h:53
 AliTRDpidRefMakerNN.h:54
 AliTRDpidRefMakerNN.h:55
 AliTRDpidRefMakerNN.h:56
 AliTRDpidRefMakerNN.h:57
 AliTRDpidRefMakerNN.h:58
 AliTRDpidRefMakerNN.h:59
 AliTRDpidRefMakerNN.h:60
 AliTRDpidRefMakerNN.h:61
 AliTRDpidRefMakerNN.h:62
 AliTRDpidRefMakerNN.h:63
 AliTRDpidRefMakerNN.h:64
 AliTRDpidRefMakerNN.h:65
 AliTRDpidRefMakerNN.h:66
 AliTRDpidRefMakerNN.h:67
 AliTRDpidRefMakerNN.h:68
 AliTRDpidRefMakerNN.h:69
 AliTRDpidRefMakerNN.h:70
 AliTRDpidRefMakerNN.h:71
 AliTRDpidRefMakerNN.h:72
 AliTRDpidRefMakerNN.h:73
 AliTRDpidRefMakerNN.h:74
 AliTRDpidRefMakerNN.h:75
 AliTRDpidRefMakerNN.h:76
 AliTRDpidRefMakerNN.h:77
 AliTRDpidRefMakerNN.h:78
 AliTRDpidRefMakerNN.h:79
 AliTRDpidRefMakerNN.h:80
 AliTRDpidRefMakerNN.h:81
 AliTRDpidRefMakerNN.h:82
 AliTRDpidRefMakerNN.h:83
 AliTRDpidRefMakerNN.h:84
 AliTRDpidRefMakerNN.h:85
 AliTRDpidRefMakerNN.h:86
 AliTRDpidRefMakerNN.h:87
 AliTRDpidRefMakerNN.h:88
 AliTRDpidRefMakerNN.h:89
 AliTRDpidRefMakerNN.h:90
 AliTRDpidRefMakerNN.h:91
 AliTRDpidRefMakerNN.h:92
 AliTRDpidRefMakerNN.h:93
 AliTRDpidRefMakerNN.h:94
 AliTRDpidRefMakerNN.h:95
 AliTRDpidRefMakerNN.h:96
 AliTRDpidRefMakerNN.h:97