2 // Class AliRsnCutBetheBloch
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()]
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.
15 // authors: Martin Vala (martin.vala@cern.ch)
16 // Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
20 #include "AliExternalTrackParam.h"
22 #include "AliRsnDaughter.h"
23 #include "AliRsnCutBetheBloch.h"
25 ClassImp(AliRsnCutBetheBloch)
27 //_________________________________________________________________________________________________
28 AliRsnCutBetheBloch::AliRsnCutBetheBloch() :
29 AliRsnCut(AliRsnCut::kDaughter),
32 fType(AliPID::kUnknown)
35 // Default constructor.
38 fConst[0] = fConst[1] = fConst[2] = fConst[3] = fConst[4] = 0.0;
41 //_________________________________________________________________________________________________
42 AliRsnCutBetheBloch::AliRsnCutBetheBloch
43 (const char *name, Double_t fractionRange, AliPID::EParticleType type, Double_t mip, Bool_t correct) :
44 AliRsnCut(name, AliRsnCut::kDaughter, 0.0, fractionRange),
51 // the cut range is the relative fraction of the value:
52 // BB*(1-fraction) < TPC < BB*(1+fraction)
54 // -fraction < (TPC - BB)/BB < fraction
57 fConst[0] = fConst[1] = fConst[2] = fConst[3] = fConst[4] = 0.0;
60 //_____________________________________________________________________________
61 Double_t AliRsnCutBetheBloch::BetheBloch(AliRsnDaughter * const trackRef)
64 // Computes the theoretical dE/dx according to
65 // a given mass hypothesis, from which betaGamma is computed
67 // This is the empirical ALEPH parameterization of the Bethe-Bloch formula.
68 // It is normalized to 1 at the minimum.
70 // The default values for the kp* parameters are for ALICE TPC.
71 // The value is computed in MIP units, multiplied by 50 to have it in energy.
75 Double_t mass = pid.ParticleMass(fType);
77 // get the track momentum at the inner wall of TPC: if absent cut is not passed
78 AliExternalTrackParam track(*trackRef->GetRefESDtrack()->GetInnerParam());
80 Double_t betaGamma = track.P() / mass;
81 Double_t beta = betaGamma / TMath::Sqrt(1.0 + betaGamma * betaGamma);
82 Double_t aa = TMath::Power(beta, fConst[3]);
83 Double_t bb = TMath::Power(1.0 / betaGamma, fConst[4]);
85 bb = TMath::Log(fConst[2] + bb);
87 Double_t out = (fConst[1] - aa - bb) * fConst[0] / aa;
90 Double_t kMeanCorr = 0.1;
91 Double_t meanCorr = (1 + (out - 1) * kMeanCorr);
98 //_____________________________________________________________________________
99 Double_t AliRsnCutBetheBloch::RelDiff(AliRsnDaughter *track)
102 // Relative difference between BB value and TPC signal
105 if (!track->GetRefESDtrack()) return -99999.9;
107 // compute Bethe-Bloch with the given mass hypothesis
108 Double_t bb = BetheBloch(track);
109 return TMath::Abs((track->GetRefESDtrack()->GetTPCsignal() - bb) / bb);
112 //_________________________________________________________________________________________________
113 Bool_t AliRsnCutBetheBloch::IsSelected(TObject *obj1, TObject* /*obj2*/)
120 if (!AliRsnCut::TargetOK(obj1))
122 AliError(Form("Wrong target. Skipping cut", GetName()));
126 // dynamic cast the object into AliRsnDaughter
127 AliRsnDaughter *track = dynamic_cast<AliRsnDaughter*>(obj1);
129 // retrieve the TPC signal
130 AliESDtrack *esd = track->GetRefESDtrack();
132 AliError("ESD information unavailable");
135 if (!track->GetRefESDtrack()->GetInnerParam()) {
136 AliDebug(AliLog::kDebug+2, "Rejecting a track with no info at the TPC inner wall");
140 // the cut range is the relative fraction of the value:
141 // BB*(1-fraction) < TPC < BB*(1+fraction)
143 // -fraction < (TPC - BB)/BB < fraction
144 // so we must compute the cut value accordingly
145 fCutValueD = RelDiff(track);
147 // then, this cut is checked inside the range