ROOT logo
#ifndef ALITRDCALPIDLQ_H
#define ALITRDCALPIDLQ_H

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

/* $Id$ */

////////////////////////////////////////////////////////////////////////////
//                                                                        //
// PID distributions for the LQ method                                    //
//                                                                        //
// Author:                                                                //
// Alex Bercuci <A.Bercuci@gsi.de>                                        //
//                                                                        //          
////////////////////////////////////////////////////////////////////////////

#ifndef ALITRDCALPID_H
#include "AliTRDCalPID.h"
#endif
#ifndef ROOT_TMath
#include "TMath.h"
#endif

class AliTRDCalPIDLQ : public AliTRDCalPID
{
public:
  enum ETRDCalPIDLQ {
    kNLength = 4 // No of bins for tracklet length discretization 
   ,kNN2LQtransition = 4 // index of NN slices where first LQ slice ends
  };
  AliTRDCalPIDLQ();
  AliTRDCalPIDLQ(const Text_t *name, const Text_t *title);
  virtual        ~AliTRDCalPIDLQ(){};

  inline static Bool_t  CookdEdx(const Float_t * const dedx, Double_t *x, Bool_t k2D=kTRUE);
  TObject*              GetModel(Int_t ip, Int_t iType, Int_t slices) const;
  static Double_t       GetLength(Int_t il) { return (il<0 || il>=kNLength) ? -1. : fgTrackSegLength[il]; }
  inline static Int_t   GetModelID(Int_t mom, Int_t spec, Int_t slices=1);
  static Int_t          GetNrefs();
  Double_t              GetProbability(Int_t spec, Float_t mom
                               , const Float_t * const dedx
                               , Float_t length, Int_t slices) const;
  Bool_t                LoadReferences(Char_t* refFile);
protected:
  static Float_t  fgTrackSegLength[kNLength]; // Track segment lengths

private:
  AliTRDCalPIDLQ(const AliTRDCalPIDLQ& pd);
  AliTRDCalPIDLQ&   operator=(const AliTRDCalPIDLQ &c);
  void      Init();

  ClassDef(AliTRDCalPIDLQ, 2)                 // LQ PID reference manager
};

//_________________________________________________________________________
inline Bool_t  AliTRDCalPIDLQ::CookdEdx(const Float_t * const dedx, Double_t *x, Bool_t k2D)
{
// Convert NN dEdx slices to the representation used by LQ

  x[0]=0.;x[1]=0.;
  for(Int_t islice=AliTRDCalPID::kNSlicesNN; islice--;){
    Int_t jslice(0);
    if(k2D) jslice = islice>kNN2LQtransition;
    x[jslice]+=dedx[islice];
  }
  
  // check data integrity
  if(x[0]<1.e-30) return kFALSE;
  if(k2D && x[1]<1.e-30) return kFALSE;

  x[0] = TMath::Log(x[0]);
  x[1] = k2D ? TMath::Log(x[1]) : 0.;
  return kTRUE;
}

//_________________________________________________________________________
inline Int_t AliTRDCalPIDLQ::GetModelID(Int_t mom, Int_t spec, Int_t ii)
{
// Returns the ID of the PDF distribution 
// 5 species * 11 momentum ranges * 2 slices

  Int_t n(GetNrefs()>>1);
  return (ii-1)*n + (spec * AliTRDCalPID::kNMom + mom);
}


#endif

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