]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSdEdxSamples.h
Coverity
[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
83 if(i<fNSamples && fdxSamples[i]>0.)
84 return fdESamples[i]/(fdxSamples[i]*100.);
85 else return 0.;
86 }
87
9189f38b 88 Double_t GetMomentum() const {
89 return fP;
90 }
91 Double_t GetMomentumAtSample(Int_t i) const{
92 if(i<fNSamples) return fPAtSample[i];
93 else return 0.;
94 }
95 Int_t GetParticleSpecieMC() const {
96 return fParticleSpecie;
97 }
0d66557a 98 UInt_t GetClusterMap() const{
99 return fClusterMap;
100 }
101 Bool_t HasPointOnLayer(Int_t iLay) const{
102 return fClusterMap&(1<<iLay);
103 }
104 UInt_t GetLayersForPid() const{
105 return fLayersForPid;
106 }
107 Bool_t UseLayerForPid(Int_t iLay) const{
108 return fLayersForPid&(1<<iLay);
109 }
110
111 void PrintAll() const;
112 void PrintClusterMap() const;
9189f38b 113
114 Double_t GetTruncatedMean(Double_t frac=0.5, Double_t mindedx=0.) const;
115 Double_t GetWeightedMean(Double_t mindedx=0.) const;
116 void GetConditionalProbabilities(AliITSPidParams* pars, Double_t condprob[AliPID::kSPECIES], Double_t mindedx=0.) const;
117
92329a66 118
9189f38b 119 protected:
0d66557a 120
121 void SetClusterMapFromdE(){
122 fClusterMap=0;
123 for(Int_t i=0; i<fNSamples; i++)
124 if(fdESamples[i]>0.) SetPointOnLayer(i);
125 }
126
92329a66 127 enum{kMaxSamples=10}; // max. n. of layers with dE/dx info
128
0d66557a 129 Int_t fNSamples; // number of samples
130 UInt_t fClusterMap; // map of clusters in layers
131 Double_t fdESamples[kMaxSamples]; // dE samples (keV)
132 Double_t fdxSamples[kMaxSamples]; // dx samples (cm)
133 Double_t fP; // track momentum
134 Int_t fParticleSpecie; // MC generated particle
135 Double_t fPAtSample[kMaxSamples]; // track momentum at specific samples
136 UInt_t fLayersForPid; // bit-map to enable/disable layers in PID
137
138 ClassDef(AliITSdEdxSamples,3);
9189f38b 139
140};
141#endif