Adding Domenico Colella as responsible for SPD part in TRI pp
[u/mrichter/AliRoot.git] / TRD / TRDrec / AliTRDCalPIDLQ.h
CommitLineData
44dbae42 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
9ded305e 18#ifndef ALITRDCALPID_H
44dbae42 19#include "AliTRDCalPID.h"
9ded305e 20#endif
21#ifndef ROOT_TMath
22#include "TMath.h"
23#endif
44dbae42 24
25class AliTRDCalPIDLQ : public AliTRDCalPID
26{
9ded305e 27public:
28 enum ETRDCalPIDLQ {
29 kNLength = 4 // No of bins for tracklet length discretization
11d80e40 30 ,kNN2LQtransition = 4 // index of NN slices where first LQ slice ends
44dbae42 31 };
44dbae42 32 AliTRDCalPIDLQ();
33 AliTRDCalPIDLQ(const Text_t *name, const Text_t *title);
9ded305e 34 virtual ~AliTRDCalPIDLQ(){};
44dbae42 35
11d80e40 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;
9ded305e 38 static Double_t GetLength(Int_t il) { return (il<0 || il>=kNLength) ? -1. : fgTrackSegLength[il]; }
11d80e40 39 inline static Int_t GetModelID(Int_t mom, Int_t spec, Int_t slices=1);
40 static Int_t GetNrefs();
9ded305e 41 Double_t GetProbability(Int_t spec, Float_t mom
1fcc78b7 42 , const Float_t * const dedx
11d80e40 43 , Float_t length, Int_t slices) const;
9ded305e 44 Bool_t LoadReferences(Char_t* refFile);
9ded305e 45protected:
2e32a5ae 46 static Float_t fgTrackSegLength[kNLength]; // Track segment lengths
47
9ded305e 48private:
44dbae42 49 AliTRDCalPIDLQ(const AliTRDCalPIDLQ& pd);
50 AliTRDCalPIDLQ& operator=(const AliTRDCalPIDLQ &c);
9ded305e 51 void Init();
44dbae42 52
2e32a5ae 53 ClassDef(AliTRDCalPIDLQ, 2) // LQ PID reference manager
44dbae42 54};
9ded305e 55
56//_________________________________________________________________________
11d80e40 57inline Bool_t AliTRDCalPIDLQ::CookdEdx(const Float_t * const dedx, Double_t *x, Bool_t k2D)
9ded305e 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--;){
11d80e40 63 Int_t jslice(0);
64 if(k2D) jslice = islice>kNN2LQtransition;
9ded305e 65 x[jslice]+=dedx[islice];
66 }
67
68 // check data integrity
69 if(x[0]<1.e-30) return kFALSE;
11d80e40 70 if(k2D && x[1]<1.e-30) return kFALSE;
9ded305e 71
72 x[0] = TMath::Log(x[0]);
11d80e40 73 x[1] = k2D ? TMath::Log(x[1]) : 0.;
9ded305e 74 return kTRUE;
75}
76
11d80e40 77//_________________________________________________________________________
78inline 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
44dbae42 88#endif
89