Line data Source code
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 : AliITSdEdxSamples& operator=(const AliITSdEdxSamples& source);
26 0 : virtual ~AliITSdEdxSamples(){};
27 :
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);
31 : void SetNSamples(Int_t nSamples){
32 0 : fNSamples=nSamples;
33 0 : }
34 : void SetLayerSample(Int_t iLayer, Bool_t haspoint, Double_t dE=0., Double_t dx=0., Double_t p=0.);
35 :
36 : void SetMomentum(Double_t mom){
37 0 : fP=mom;
38 0 : }
39 : void SetParticleSpecieMC(Int_t specie){
40 0 : fParticleSpecie=specie;
41 0 : }
42 : void SetClusterMap(UInt_t map){
43 0 : fClusterMap=map;
44 0 : }
45 : void SetPointOnLayer(Int_t iLay){
46 0 : fClusterMap|=(1<<iLay);
47 0 : }
48 : void SetLayersForPID(UInt_t laypid){
49 0 : fLayersForPid=laypid;
50 0 : }
51 : void SetUseLayerForPid(Int_t iLay){
52 0 : fLayersForPid|=(1<<iLay);
53 0 : }
54 : void SetNotUseLayerForPid(Int_t iLay){
55 0 : if(fLayersForPid&(1<<iLay)) fLayersForPid-=(1<<iLay);
56 0 : }
57 :
58 : Int_t GetNumberOfSamples() const {
59 0 : return fNSamples;
60 : }
61 : Int_t GetNumberOfEffectiveSamples() const{
62 : Int_t nS=0;
63 0 : for (Int_t il=0; il<fNSamples; il++) if(HasPointOnLayer(il)) nS++;
64 0 : return nS;
65 : }
66 :
67 : Double_t GetdESample(Int_t i) const {
68 0 : if(i<fNSamples) return fdESamples[i];
69 0 : else return 0.;
70 0 : }
71 : Double_t GetNehPairs(Int_t i) const {
72 0 : if(i<fNSamples) return fdESamples[i]*1000./3.63;
73 0 : else return 0.;
74 0 : }
75 : Double_t GetQfC(Int_t i) const{
76 0 : return GetNehPairs(i)*1.6E-4;
77 : }
78 : Double_t GetdxSample(Int_t i) const {
79 0 : if(i<fNSamples) return fdxSamples[i];
80 0 : else return 0.;
81 0 : }
82 : Double_t GetdEdxSample(Int_t i) const { // keV/100um
83 0 : if(i<fNSamples && fdxSamples[i]>0.) return fdESamples[i]/(fdxSamples[i]*100.);
84 0 : else return 0.;
85 0 : }
86 :
87 : Double_t GetMomentum() const {
88 0 : return fP;
89 : }
90 : Double_t GetMomentumAtSample(Int_t i) const{
91 0 : if(i<fNSamples) return fPAtSample[i];
92 0 : else return 0.;
93 0 : }
94 : Int_t GetParticleSpecieMC() const {
95 0 : return fParticleSpecie;
96 : }
97 : UInt_t GetClusterMap() const{
98 0 : return fClusterMap;
99 : }
100 : Bool_t HasPointOnLayer(Int_t iLay) const{
101 0 : return fClusterMap&(1<<iLay);
102 : }
103 : UInt_t GetLayersForPid() const{
104 0 : return fLayersForPid;
105 : }
106 : Bool_t UseLayerForPid(Int_t iLay) const{
107 0 : 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(const AliITSPidParams* pars, Double_t condprob[AliPID::kSPECIES], Double_t mindedx=0.) const;
116 :
117 :
118 : protected:
119 :
120 : void SetClusterMapFromdE(){
121 0 : fClusterMap=0;
122 0 : for(Int_t i=0; i<fNSamples; i++)
123 0 : if(fdESamples[i]>0.) SetPointOnLayer(i);
124 0 : }
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 118 : ClassDef(AliITSdEdxSamples,3);
138 :
139 : };
140 : #endif
|