]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/Cal/AliTRDCalPIDLQ.h
Protection against non existing online gain table (Theo)
[u/mrichter/AliRoot.git] / TRD / Cal / AliTRDCalPIDLQ.h
1 #ifndef ALITRDCALPIDLQ_H
2 #define ALITRDCALPIDLQ_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 /* $Id$ */
8
9 ////////////////////////////////////////////////////////////////////////////
10 //                                                                        //
11 // PID distributions for the LQ method                                    //
12 //                                                                        //
13 // Author:                                                                //
14 // Alex Bercuci <A.Bercuci@gsi.de>                                        //
15 //                                                                        //          
16 ////////////////////////////////////////////////////////////////////////////
17
18 #ifndef ALITRDCALPID_H
19 #include "AliTRDCalPID.h"
20 #endif
21 #ifndef ROOT_TMath
22 #include "TMath.h"
23 #endif
24
25 class AliTRDCalPIDLQ : public AliTRDCalPID
26 {
27 public:
28   enum ETRDCalPIDLQ {
29     kNLength = 4 // No of bins for tracklet length discretization 
30    ,kNN2LQtransition = 4 // index of NN slices where first LQ slice ends
31   };
32   AliTRDCalPIDLQ();
33   AliTRDCalPIDLQ(const Text_t *name, const Text_t *title);
34   virtual        ~AliTRDCalPIDLQ(){};
35
36   inline static Bool_t  CookdEdx(const Float_t * const dedx, Double_t *x, Bool_t k2D=kTRUE);
37   TObject*              GetModel(Int_t ip, Int_t iType, Int_t slices) const;
38   static Double_t       GetLength(Int_t il) { return (il<0 || il>=kNLength) ? -1. : fgTrackSegLength[il]; }
39   inline static Int_t   GetModelID(Int_t mom, Int_t spec, Int_t slices=1);
40   static Int_t          GetNrefs();
41   Double_t              GetProbability(Int_t spec, Float_t mom
42                                , const Float_t * const dedx
43                                , Float_t length, Int_t slices) const;
44   Bool_t                LoadReferences(Char_t* refFile);
45 protected:
46   static Float_t  fgTrackSegLength[kNLength]; // Track segment lengths
47
48 private:
49   AliTRDCalPIDLQ(const AliTRDCalPIDLQ& pd);
50   AliTRDCalPIDLQ&   operator=(const AliTRDCalPIDLQ &c);
51   void      Init();
52
53   ClassDef(AliTRDCalPIDLQ, 2)                 // LQ PID reference manager
54 };
55
56 //_________________________________________________________________________
57 inline Bool_t  AliTRDCalPIDLQ::CookdEdx(const Float_t * const dedx, Double_t *x, Bool_t k2D)
58 {
59 // Convert NN dEdx slices to the representation used by LQ
60
61   x[0]=0.;x[1]=0.;
62   for(Int_t islice=AliTRDCalPID::kNSlicesNN; islice--;){
63     Int_t jslice(0);
64     if(k2D) jslice = islice>kNN2LQtransition;
65     x[jslice]+=dedx[islice];
66   }
67   
68   // check data integrity
69   if(x[0]<1.e-30) return kFALSE;
70   if(k2D && x[1]<1.e-30) return kFALSE;
71
72   x[0] = TMath::Log(x[0]);
73   x[1] = k2D ? TMath::Log(x[1]) : 0.;
74   return kTRUE;
75 }
76
77 //_________________________________________________________________________
78 inline Int_t AliTRDCalPIDLQ::GetModelID(Int_t mom, Int_t spec, Int_t ii)
79 {
80 // Returns the ID of the PDF distribution 
81 // 5 species * 11 momentum ranges * 2 slices
82
83   Int_t n(GetNrefs()>>1);
84   return (ii-1)*n + (spec * AliTRDCalPID::kNMom + mom);
85 }
86
87
88 #endif
89