]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/STEERBase/AliTRDPIDResponse.h
Commit message
[u/mrichter/AliRoot.git] / STEER / STEERBase / AliTRDPIDResponse.h
1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 *                                                                        *
4 * Author: The ALICE Off-line Project.                                    *
5 * Contributors are mentioned in the code where appropriate.              *
6 *                                                                        *
7 * Permission to use, copy, modify and distribute this software and its   *
8 * documentation strictly for non-commercial purposes is hereby granted   *
9 * without fee, provided that the above copyright notice appears in all   *
10 * copies and that both the copyright notice and this permission notice   *
11 * appear in the supporting documentation. The authors make no claims     *
12 * about the suitability of this software for any purpose. It is          *
13 * provided "as is" without express or implied warranty.                  *
14 **************************************************************************/
15 //
16 // PID Response class for the TRD detector
17 // Based on 1D Likelihood approach
18 // For further information see implementation file
19 //
20 #ifndef ALITRDPIDRESPONSE_H
21 #define ALITRDPIDRESPONSE_H
22
23 #ifndef ROOT_TObject
24 #include <TObject.h>
25 #endif
26
27 #ifndef ALIPID_H
28 #include "AliPID.h"
29 #endif
30
31 class TObjArray;
32 class AliVTrack;
33 class AliTRDPIDResponseObject;
34 class AliTRDdEdxParams;
35
36 class AliTRDPIDResponse : public TObject {
37   public:
38     enum ETRDPIDResponseStatus {
39       kIsOwner = BIT(14)
40     };
41     enum ETRDPIDResponseDef {
42         kNlayer = 6
43        ,kNPBins = 6
44     };
45     enum ETRDPIDMethod {
46         kNN   = 0,
47         kLQ2D = 1,
48         kLQ1D = 2
49     };
50     enum ETRDPIDNMethod {
51         kNMethod=3
52     };
53     enum ETRDNslices {
54         kNslicesLQ1D = 1,
55         kNslicesLQ2D = 2,
56         kNslicesNN = 7
57     };
58     AliTRDPIDResponse();
59     AliTRDPIDResponse(const AliTRDPIDResponse &ref);
60     AliTRDPIDResponse& operator=(const AliTRDPIDResponse &ref);
61     ~AliTRDPIDResponse();
62     
63     Double_t GetNumberOfSigmas(const AliVTrack *track, AliPID::EParticleType type) const;
64     Double_t GetSignalDelta( const AliVTrack* track, AliPID::EParticleType type, Bool_t ratio=kFALSE, Double_t *info=0x0) const;
65     static Double_t MeandEdx(const Double_t * xx, const Float_t * par);
66     static Double_t MeanTR(const Double_t * xx, const Float_t * par);
67     static Double_t MeandEdxTR(const Double_t * xx, const Float_t * par);
68     static Double_t ResolutiondEdxTR(const Double_t * xx,  const Float_t * par);
69
70     Int_t    GetResponse(Int_t n, const Double_t * const dedx, const Float_t * const p, Double_t prob[AliPID::kSPECIES],ETRDPIDMethod PIDmethod=kLQ1D, Bool_t kNorm=kTRUE) const;
71     inline ETRDNslices  GetNumberOfSlices(ETRDPIDMethod PIDmethod=kLQ1D) const;
72     
73     Bool_t    IsOwner() const {return TestBit(kIsOwner);}
74     
75     void      SetOwner();
76     void      SetGainNormalisationFactor(Double_t gainFactor) { fGainNormalisationFactor = gainFactor; }
77
78     Bool_t SetPIDResponseObject(const AliTRDPIDResponseObject * obj);
79     Bool_t SetdEdxParams(const AliTRDdEdxParams * par);
80     
81     Bool_t    Load(const Char_t *filename = NULL);
82   
83     Bool_t    IdentifiedAsElectron(Int_t nTracklets, const Double_t *like, Double_t p, Double_t level,Double_t centrality=-1,ETRDPIDMethod PIDmethod=kLQ1D) const;
84   
85   private:
86     Bool_t    CookdEdx(Int_t nSlice, const Double_t * const in, Double_t *out,ETRDPIDMethod PIDmethod=kLQ1D) const;
87     Double_t  GetProbabilitySingleLayer(Int_t species, Double_t plocal, Double_t *dEdx,ETRDPIDMethod PIDmethod=kLQ1D) const;
88     
89     const AliTRDPIDResponseObject *fkPIDResponseObject;   // PID References and Params
90     const AliTRDdEdxParams * fkTRDdEdxParams; //parametrisation for truncated mean
91     Double_t  fGainNormalisationFactor;         // Gain normalisation factor
92   
93   ClassDef(AliTRDPIDResponse, 3)    // Tool for TRD PID
94 };
95
96 AliTRDPIDResponse::ETRDNslices AliTRDPIDResponse::GetNumberOfSlices(ETRDPIDMethod PIDmethod) const {
97   // Get the current number of slices
98   ETRDNslices slices = kNslicesLQ1D;
99   switch(PIDmethod){
100     case kLQ1D: slices = kNslicesLQ1D; break;
101     case kLQ2D: slices = kNslicesLQ2D; break;
102     case kNN:   slices = kNslicesNN; break;
103   };
104   return slices;
105 }
106 #endif
107