]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/Cal/AliTRDCalPIDNN.cxx
new event cut class by Markus for local event selection for TRD
[u/mrichter/AliRoot.git] / TRD / Cal / AliTRDCalPIDNN.cxx
index 2d13049b57fc7e8fee5de9fdd84df309375b4029..cb366b96870b186ba3120b1b04995aa379243650 100644 (file)
 
 #include <TFile.h>
 #include <TROOT.h>
-#include <TObject.h>
 #include <TMultiLayerPerceptron.h>
 
-#include "AliLog.h"
 #include "AliPID.h"
-#include "AliESD.h"
-#include "AliESDtrack.h"
-#include "AliTRDtrack.h"
+#include "AliLog.h"
 
+#include "AliTRDgeometry.h"
 #include "AliTRDCalPIDNN.h"
-#include "AliTRDcalibDB.h"
 
 ClassImp(AliTRDCalPIDNN)
 
@@ -106,7 +102,7 @@ Bool_t AliTRDCalPIDNN::LoadReferences(Char_t *refFile)
 
   // Read Networks
   for (Int_t imom = 0; imom < kNMom; imom++) {
-    for (Int_t iplane = 0; iplane < kNPlane; iplane++) {
+    for (Int_t iplane = 0; iplane < AliTRDgeometry::kNlayer; iplane++) {
       TMultiLayerPerceptron *nn = (TMultiLayerPerceptron *)
          nnFile->Get(Form("NN_Mom%d_Plane%d",imom,iplane));
       fModel->AddAt(nn,GetModelID(imom,0,iplane));
@@ -130,7 +126,7 @@ TObject *AliTRDCalPIDNN::GetModel(Int_t ip, Int_t, Int_t iplane) const
   if (ip<0 || ip>= kNMom) return 0x0;
   
   AliInfo(Form("Retrive MultiLayerPerceptron for %5.2f GeV/c for plane %d" 
-         ,fTrackMomentum[ip]
+         ,fgTrackMomentum[ip]
          ,iplane));
   
   return fModel->At(GetModelID(ip, 0, iplane));
@@ -138,7 +134,8 @@ TObject *AliTRDCalPIDNN::GetModel(Int_t ip, Int_t, Int_t iplane) const
 }
 
 //_________________________________________________________________________
-Double_t AliTRDCalPIDNN::GetProbability(Int_t spec, Float_t mom, Float_t *dedx
+Double_t AliTRDCalPIDNN::GetProbability(Int_t spec, Float_t mom
+                                      , const Float_t * const dedx
                                       , Float_t, Int_t iplane) const
 {
   //
@@ -153,9 +150,9 @@ Double_t AliTRDCalPIDNN::GetProbability(Int_t spec, Float_t mom, Float_t *dedx
   // find the interval in momentum and track segment length which applies for this data
   
   Int_t imom = 1;
-  while (imom<AliTRDCalPID::kNMom-1 && mom>fTrackMomentum[imom]) imom++;
+  while (imom<AliTRDCalPID::kNMom-1 && mom>fgTrackMomentum[imom]) imom++;
   Double_t lNN1, lNN2;
-  Double_t mom1 = fTrackMomentum[imom-1], mom2 = fTrackMomentum[imom];
+  Double_t mom1 = fgTrackMomentum[imom-1], mom2 = fgTrackMomentum[imom];
 
   TMultiLayerPerceptron *nn = 0x0;
   if(!(nn = (TMultiLayerPerceptron *) fModel->At(GetModelID(imom-1, spec, iplane/*, ilength*/)))){
@@ -164,11 +161,10 @@ Double_t AliTRDCalPIDNN::GetProbability(Int_t spec, Float_t mom, Float_t *dedx
     return 0.;
   }
 
-  Double_t ddedx[AliTRDtrack::kNMLPslice];
+  Double_t ddedx[AliTRDCalPID::kNSlicesNN];
 
-  for (int inode=0; inode<AliTRDtrack::kNMLPslice; inode++) {
-    ddedx[inode] = (((Double_t) dedx[inode]/kMLPscale)*3)          // Bug fix! Needs new reference data or different calculation of dedx!!!!
-                 / (AliTRDcalibDB::Instance()->GetNumberOfTimeBins()/AliTRDtrack::kNMLPslice);
+  for (int inode=0; inode<AliTRDCalPID::kNSlicesNN; inode++) {
+    ddedx[inode] = (Double_t) dedx[inode]/kMLPscale;
   }
 
   lNN1 = nn->Evaluate(spec, ddedx);
@@ -181,10 +177,10 @@ Double_t AliTRDCalPIDNN::GetProbability(Int_t spec, Float_t mom, Float_t *dedx
   lNN2 = nn->Evaluate(spec, ddedx);
   
   // return interpolation over momentum binning
-  if      (mom < fTrackMomentum[0]) {
+  if      (mom < fgTrackMomentum[0]) {
     return lNN1;
   }
-  else if (mom > fTrackMomentum[AliTRDCalPID::kNMom-1]) {
+  else if (mom > fgTrackMomentum[AliTRDCalPID::kNMom-1]) {
     return lNN2;
   }
   else {
@@ -200,13 +196,13 @@ void AliTRDCalPIDNN::Init()
   // Initialization
   //
 
-  fModel = new TObjArray(AliTRDCalPID::kNPlane * AliTRDCalPID::kNMom);
+  fModel = new TObjArray(AliTRDgeometry::kNlayer * AliTRDCalPID::kNMom);
   fModel->SetOwner();
   
 }
 
 //_________________________________________________________________________
-Int_t AliTRDCalPIDNN::GetModelID(Int_t mom, Int_t, Int_t plane) const
+Int_t AliTRDCalPIDNN::GetModelID(Int_t mom, Int_t /*ii*/, Int_t plane)
 {
   
   // returns the ID of the NN distribution (66 MLPs, ID from 56 to 121)