]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSdEdxSamples.h
Fix
[u/mrichter/AliRoot.git] / ITS / AliITSdEdxSamples.h
1 #ifndef ALIITSDEDXSAMPLES_H
2 #define ALIITSDEDXSAMPLES_H
3 /* Copyright(c) 2009-2012, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 ///////////////////////////////////////////////////////////////////
7 //                                                               //
8 // Class to store information for PID with ITS                   //
9 // and truncated mean computation methods                        //
10 // Origin: F.Prino, Torino, prino@to.infn.it                     //
11 //                                                               //
12 ///////////////////////////////////////////////////////////////////
13
14 #include <TObject.h>
15 #include "AliPID.h"
16
17 class AliITSPidParams;
18
19 class AliITSdEdxSamples : public TObject {
20
21  public:
22   AliITSdEdxSamples();
23   AliITSdEdxSamples(Int_t nSamples, Double_t* esamples, Double_t* xsamples, Double_t mom, Int_t specie=0);
24   AliITSdEdxSamples(const AliITSdEdxSamples& source);
25   virtual ~AliITSdEdxSamples(){};
26
27   void SetdESamples(Int_t nSamples, Double_t* samples);
28   void SetdxSamples(Int_t nSamples, Double_t* samples);
29   void SetSamplesAndMomenta(Int_t nSamples, Double_t* esamples, Double_t* xsamples, Double_t* mom);
30   void SetNSamples(Int_t nSamples){
31     fNSamples=nSamples;
32   }
33   void SetLayerSample(Int_t iLayer, Bool_t haspoint, Double_t dE=0., Double_t dx=0., Double_t p=0.);
34
35   void SetMomentum(Double_t mom){
36     fP=mom;
37   }
38   void SetParticleSpecieMC(Int_t specie){
39     fParticleSpecie=specie;
40   }
41   void SetClusterMap(UInt_t map){
42     fClusterMap=map;
43   }
44   void SetPointOnLayer(Int_t iLay){
45     fClusterMap|=(1<<iLay);
46   }
47   void SetLayersForPID(UInt_t laypid){
48     fLayersForPid=laypid;
49   }
50   void SetUseLayerForPid(Int_t iLay){
51     fLayersForPid|=(1<<iLay);
52   }
53   void SetNotUseLayerForPid(Int_t iLay){
54     if(fLayersForPid&(1<<iLay)) fLayersForPid-=(1<<iLay);
55   }
56
57   Int_t GetNumberOfSamples() const {
58     return fNSamples;
59   }
60   Int_t GetNumberOfEffectiveSamples() const{
61     Int_t nS=0;
62     for (Int_t il=0; il<fNSamples; il++)  if(HasPointOnLayer(il)) nS++;
63     return nS;
64   }
65
66   Double_t GetdESample(Int_t i) const {
67     if(i<fNSamples) return fdESamples[i];
68     else return 0.;
69   }
70   Double_t GetNehPairs(Int_t i) const {
71     if(i<fNSamples) return fdESamples[i]*1000./3.63;
72     else return 0.;
73   }
74   Double_t GetQfC(Int_t i) const{
75     return GetNehPairs(i)*1.6E-4;
76   }
77   Double_t GetdxSample(Int_t i) const {
78     if(i<fNSamples) return fdxSamples[i];
79     else return 0.;
80   }
81   Double_t GetdEdxSample(Int_t i) const { // keV/100um
82     if(i<fNSamples && fdxSamples[i]>0.) 
83       return fdESamples[i]/(fdxSamples[i]*100.);
84     else return 0.;
85   }
86
87   Double_t GetMomentum() const {
88     return fP;
89   }
90   Double_t GetMomentumAtSample(Int_t i) const{
91     if(i<fNSamples) return fPAtSample[i];
92     else return 0.;
93   } 
94   Int_t GetParticleSpecieMC() const {
95     return fParticleSpecie;
96   }
97   UInt_t GetClusterMap() const{
98     return fClusterMap;
99   }
100   Bool_t HasPointOnLayer(Int_t iLay) const{
101     return fClusterMap&(1<<iLay);
102   }
103   UInt_t GetLayersForPid() const{
104     return fLayersForPid;
105   }
106   Bool_t UseLayerForPid(Int_t iLay) const{
107     return fLayersForPid&(1<<iLay);
108   }
109
110   void PrintAll() const;
111   void PrintClusterMap() const;
112
113   Double_t GetTruncatedMean(Double_t frac=0.5, Double_t mindedx=0.) const;
114   Double_t GetWeightedMean(Double_t mindedx=0.) const;
115   void     GetConditionalProbabilities(AliITSPidParams* pars, Double_t condprob[AliPID::kSPECIES], Double_t mindedx=0.) const;
116
117
118  protected:
119
120   void SetClusterMapFromdE(){
121     fClusterMap=0;
122     for(Int_t i=0; i<fNSamples; i++)
123       if(fdESamples[i]>0.) SetPointOnLayer(i);
124   }
125
126   enum{kMaxSamples=10}; // max. n. of layers with dE/dx info
127
128   Int_t    fNSamples;                // number of samples
129   UInt_t   fClusterMap;              // map of clusters in layers
130   Double_t fdESamples[kMaxSamples];  // dE samples (keV)
131   Double_t fdxSamples[kMaxSamples];  // dx samples (cm)
132   Double_t fP;                       // track momentum
133   Int_t    fParticleSpecie;          // MC generated particle
134   Double_t fPAtSample[kMaxSamples];  // track momentum at specific samples
135   UInt_t   fLayersForPid;            // bit-map to enable/disable layers in PID
136
137   ClassDef(AliITSdEdxSamples,3);
138
139 };
140 #endif