]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/RESONANCES/AliRsnCutBetheBloch.cxx
Main changes:
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnCutBetheBloch.cxx
CommitLineData
5eb970a4 1//
2// Class AliRsnCutBetheBloch
3//
4// General implementation of a single cut strategy, which can be:
5// - a value contained in a given interval [--> IsBetween() ]
6// - a value equal to a given reference [--> MatchesValue()]
7//
8// In all cases, the reference value(s) is (are) given as data members
9// and each kind of cut requires a given value type (Int, UInt, Double),
10// but the cut check procedure is then automatized and chosen thanks to
11// an enumeration of the implemented cut types.
12// At the end, the user (or any other point which uses this object) has
13// to use the method IsSelected() to check if this cut has been passed.
14//
15// authors: Martin Vala (martin.vala@cern.ch)
16// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
17//
18#include "TMath.h"
19
20#include "AliLog.h"
21#include "AliESDtrack.h"
22
23#include "AliRsnDaughter.h"
24#include "AliRsnCutBetheBloch.h"
25
26ClassImp(AliRsnCutBetheBloch)
27
28//_________________________________________________________________________________________________
29AliRsnCutBetheBloch::AliRsnCutBetheBloch() :
30 AliRsnCut(),
31 fCorrect(kTRUE),
32 fMass(1.0),
33 fMIP(50.0)
34{
35//
36// Default constructor.
37//
38
39 fConst[0] = fConst[1] = fConst[2] = fConst[3] = fConst[4] = 0.0;
40}
41
42//_________________________________________________________________________________________________
43AliRsnCutBetheBloch::AliRsnCutBetheBloch
44(const char *name, Double_t fractionRange, Double_t mass, Double_t mip, Bool_t correct) :
45 AliRsnCut(name, -fractionRange, fractionRange),
46 fCorrect(correct),
47 fMass(mass),
48 fMIP(mip)
49{
50//
51// Main constructor.
52// the cut range is the relative fraction of the value:
53// BB*(1-fraction) < TPC < BB*(1+fraction)
54// which means:
55// -fraction < (TPC - BB)/BB < fraction
56//
57
58 fConst[0] = fConst[1] = fConst[2] = fConst[3] = fConst[4] = 0.0;
59}
60
61//_________________________________________________________________________________________________
62AliRsnCutBetheBloch::AliRsnCutBetheBloch
63(const char *name, Double_t fractionRange, AliPID::EParticleType type, Double_t mip, Bool_t correct) :
64 AliRsnCut(name, -fractionRange, fractionRange),
65 fCorrect(correct),
66 fMass(0.0),
67 fMIP(mip)
68{
69//
70// Main constructor.
71// the cut range is the relative fraction of the value:
72// BB*(1-fraction) < TPC < BB*(1+fraction)
73// which means:
74// -fraction < (TPC - BB)/BB < fraction
75//
76
77 SetMass(type);
78 fConst[0] = fConst[1] = fConst[2] = fConst[3] = fConst[4] = 0.0;
79}
80
81//_____________________________________________________________________________
82Double_t AliRsnCutBetheBloch::BetheBloch(AliRsnDaughter *track)
83{
84//
85// Computes the theoretical dE/dx according to
86// a given mass hypothesis, from which betaGamma is computed
87//
88// This is the empirical ALEPH parameterization of the Bethe-Bloch formula.
89// It is normalized to 1 at the minimum.
90//
91// The default values for the kp* parameters are for ALICE TPC.
92// The value is computed in MIP units, multiplied by 50 to have it in energy.
93//
94
95 Double_t betaGamma = track->P() / fMass;
96 Double_t beta = betaGamma / TMath::Sqrt(1.0 + betaGamma * betaGamma);
97 Double_t aa = TMath::Power(beta, fConst[3]);
98 Double_t bb = TMath::Power(1.0 / betaGamma, fConst[4]);
99
100 bb = TMath::Log(fConst[2] + bb);
101
102 Double_t out = (fConst[1] - aa - bb) * fConst[0] / aa;
103
104 if (fCorrect)
105 {
106 Double_t kMeanCorr = 0.1;
107 Double_t meanCorr = (1 + (out - 1) * kMeanCorr);
108 out *= meanCorr;
109 }
110
111 return out * fMIP;
112}
113
114//_________________________________________________________________________________________________
115Bool_t AliRsnCutBetheBloch::IsSelected(ETarget tgt, AliRsnDaughter *track)
116{
117//
118// Cut checker.
119//
120
121 // coherence check
122 if (tgt != AliRsnCut::kParticle)
123 {
124 AliError(Form("Wrong target. Skipping cut", GetName()));
125 return kTRUE;
126 }
127
128 // retrieve the TPC signal
129 AliVParticle *vpart = track->GetRef();
130 AliESDtrack *esd = dynamic_cast<AliESDtrack*>(vpart);
131 if (!esd) {
132 AliError("ESD information unavailable");
133 return kTRUE;
134 }
135
136 // compute Bethe-Bloch with the given mass hypothesis
137 Double_t bb = BetheBloch(track);
138
139 // the cut range is the relative fraction of the value:
140 // BB*(1-fraction) < TPC < BB*(1+fraction)
141 // which means:
142 // -fraction < (TPC - BB)/BB < fraction
143 // so we must compute the cut value accordingly
144 fCutValueD = (esd->GetTPCsignal() - bb) / bb;
145
146 // then, this cut is checked inside the range
147 return OkRange();
148}
149
150//_________________________________________________________________________________________________
151Bool_t AliRsnCutBetheBloch::IsSelected(ETarget tgt, AliRsnPairParticle *pair)
152{
153//
154// Cut checker
155//
156
157 AliWarning("Cannot apply this cut to pairs");
158 return kTRUE;
159}
160
161//_________________________________________________________________________________________________
162Bool_t AliRsnCutBetheBloch::IsSelected(ETarget tgt, AliRsnEvent *event)
163{
164//
165// Cut checker
166//
167
168 AliWarning("Cannot apply this cut to events");
169 return kTRUE;
170}
171
172//_________________________________________________________________________________________________
173Bool_t AliRsnCutBetheBloch::IsSelected(ETarget tgt, AliRsnEvent *ev1, AliRsnEvent *ev2)
174{
175//
176// Cut checker
177//
178
179 AliWarning("Cannot apply this cut to event mixing");
180 return kTRUE;
181}