]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSdEdxSamples.h
Activating binomial errors for the efficiencies
[u/mrichter/AliRoot.git] / ITS / AliITSdEdxSamples.h
CommitLineData
9189f38b 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
9189f38b 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
17class AliITSPidParams;
18
19class AliITSdEdxSamples : public TObject {
20
21 public:
22 AliITSdEdxSamples();
92329a66 23 AliITSdEdxSamples(Int_t nSamples, Double_t* esamples, Double_t* xsamples, Double_t mom, Int_t specie=0);
24 AliITSdEdxSamples(const AliITSdEdxSamples& source);
accb90b5 25 AliITSdEdxSamples& operator=(const AliITSdEdxSamples& source);
9189f38b 26 virtual ~AliITSdEdxSamples(){};
27
92329a66 28 void SetdESamples(Int_t nSamples, Double_t* samples);
29 void SetdxSamples(Int_t nSamples, Double_t* samples);
30 void SetSamplesAndMomenta(Int_t nSamples, Double_t* esamples, Double_t* xsamples, Double_t* mom);
0d66557a 31 void SetNSamples(Int_t nSamples){
32 fNSamples=nSamples;
33 }
34 void SetLayerSample(Int_t iLayer, Bool_t haspoint, Double_t dE=0., Double_t dx=0., Double_t p=0.);
35
9189f38b 36 void SetMomentum(Double_t mom){
37 fP=mom;
38 }
39 void SetParticleSpecieMC(Int_t specie){
40 fParticleSpecie=specie;
41 }
0d66557a 42 void SetClusterMap(UInt_t map){
43 fClusterMap=map;
44 }
45 void SetPointOnLayer(Int_t iLay){
46 fClusterMap|=(1<<iLay);
47 }
48 void SetLayersForPID(UInt_t laypid){
49 fLayersForPid=laypid;
50 }
51 void SetUseLayerForPid(Int_t iLay){
52 fLayersForPid|=(1<<iLay);
53 }
54 void SetNotUseLayerForPid(Int_t iLay){
55 if(fLayersForPid&(1<<iLay)) fLayersForPid-=(1<<iLay);
56 }
9189f38b 57
58 Int_t GetNumberOfSamples() const {
59 return fNSamples;
60 }
0d66557a 61 Int_t GetNumberOfEffectiveSamples() const{
62 Int_t nS=0;
63 for (Int_t il=0; il<fNSamples; il++) if(HasPointOnLayer(il)) nS++;
64 return nS;
65 }
66
92329a66 67 Double_t GetdESample(Int_t i) const {
68 if(i<fNSamples) return fdESamples[i];
69 else return 0.;
70 }
71 Double_t GetNehPairs(Int_t i) const {
72 if(i<fNSamples) return fdESamples[i]*1000./3.63;
73 else return 0.;
74 }
75 Double_t GetQfC(Int_t i) const{
76 return GetNehPairs(i)*1.6E-4;
77 }
78 Double_t GetdxSample(Int_t i) const {
79 if(i<fNSamples) return fdxSamples[i];
9189f38b 80 else return 0.;
81 }
92329a66 82 Double_t GetdEdxSample(Int_t i) const { // keV/100um
b34fed4e 83 if(i<fNSamples && fdxSamples[i]>0.) return fdESamples[i]/(fdxSamples[i]*100.);
92329a66 84 else return 0.;
85 }
86
9189f38b 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 }
0d66557a 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;
9189f38b 112
113 Double_t GetTruncatedMean(Double_t frac=0.5, Double_t mindedx=0.) const;
114 Double_t GetWeightedMean(Double_t mindedx=0.) const;
b34fed4e 115 void GetConditionalProbabilities(const AliITSPidParams* pars, Double_t condprob[AliPID::kSPECIES], Double_t mindedx=0.) const;
9189f38b 116
92329a66 117
9189f38b 118 protected:
0d66557a 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
92329a66 126 enum{kMaxSamples=10}; // max. n. of layers with dE/dx info
127
0d66557a 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);
9189f38b 138
139};
140#endif