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 "AliRsnDaughter.h"
21 #include "AliRsnCutBetheBloch.h"
23 ClassImp(AliRsnCutBetheBloch)
25 //_________________________________________________________________________________________________
26 AliRsnCutBetheBloch::AliRsnCutBetheBloch() :
30 fType(AliPID::kUnknown)
33 // Default constructor.
36 fConst[0] = fConst[1] = fConst[2] = fConst[3] = fConst[4] = 0.0;
39 //_________________________________________________________________________________________________
40 AliRsnCutBetheBloch::AliRsnCutBetheBloch
41 (const char *name, Double_t fractionRange, AliPID::EParticleType type, Double_t mip, Bool_t correct) :
42 AliRsnCut(name, 0.0, fractionRange),
49 // the cut range is the relative fraction of the value:
50 // BB*(1-fraction) < TPC < BB*(1+fraction)
52 // -fraction < (TPC - BB)/BB < fraction
55 fConst[0] = fConst[1] = fConst[2] = fConst[3] = fConst[4] = 0.0;
58 //_____________________________________________________________________________
59 Double_t AliRsnCutBetheBloch::BetheBloch(AliRsnDaughter * const track)
62 // Computes the theoretical dE/dx according to
63 // a given mass hypothesis, from which betaGamma is computed
65 // This is the empirical ALEPH parameterization of the Bethe-Bloch formula.
66 // It is normalized to 1 at the minimum.
68 // The default values for the kp* parameters are for ALICE TPC.
69 // The value is computed in MIP units, multiplied by 50 to have it in energy.
73 Double_t mass = pid.ParticleMass(fType);
75 Double_t betaGamma = track->P() / mass;
76 Double_t beta = betaGamma / TMath::Sqrt(1.0 + betaGamma * betaGamma);
77 Double_t aa = TMath::Power(beta, fConst[3]);
78 Double_t bb = TMath::Power(1.0 / betaGamma, fConst[4]);
80 bb = TMath::Log(fConst[2] + bb);
82 Double_t out = (fConst[1] - aa - bb) * fConst[0] / aa;
85 Double_t kMeanCorr = 0.1;
86 Double_t meanCorr = (1 + (out - 1) * kMeanCorr);
93 //_____________________________________________________________________________
94 Double_t AliRsnCutBetheBloch::RelDiff(AliRsnDaughter *track)
97 // Relative difference between BB value and TPC signal
100 if (!track->GetRefESD()) return -99999.9;
102 // compute Bethe-Bloch with the given mass hypothesis
103 Double_t bb = BetheBloch(track);
104 return TMath::Abs((track->GetRefESD()->GetTPCsignal() - bb) / bb);
107 //_________________________________________________________________________________________________
108 Bool_t AliRsnCutBetheBloch::IsSelected(ETarget tgt, AliRsnDaughter *track)
115 if (tgt != AliRsnCut::kParticle) {
116 AliError(Form("Wrong target. Skipping cut", GetName()));
120 // if the required PID of the track is not the same as the
121 // reference of the cut, the cut is automatically skipped
122 if (track->RequiredPID() != fType) return kTRUE;
124 // retrieve the TPC signal
125 AliESDtrack *esd = track->GetRefESD();
127 AliError("ESD information unavailable");
131 // the cut range is the relative fraction of the value:
132 // BB*(1-fraction) < TPC < BB*(1+fraction)
134 // -fraction < (TPC - BB)/BB < fraction
135 // so we must compute the cut value accordingly
136 fCutValueD = RelDiff(track);
138 // then, this cut is checked inside the range
142 //_________________________________________________________________________________________________
143 Bool_t AliRsnCutBetheBloch::IsSelected(ETarget /*tgt*/, AliRsnPairParticle* /*pair*/)
149 AliWarning("Cannot apply this cut to pairs");
153 //_________________________________________________________________________________________________
154 Bool_t AliRsnCutBetheBloch::IsSelected(ETarget /*tgt*/, AliRsnEvent* /*event*/)
160 AliWarning("Cannot apply this cut to events");
164 //_________________________________________________________________________________________________
165 Bool_t AliRsnCutBetheBloch::IsSelected(ETarget /*tgt*/, AliRsnEvent* /*ev1*/, AliRsnEvent* /*ev2*/)
171 AliWarning("Cannot apply this cut to event mixing");