2 // Class AliRsnCutPIDTPC
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)
19 #include <Riostream.h>
21 #include "AliESDpid.h"
22 #include "AliTOFT0maker.h"
23 #include "AliTOFcalib.h"
24 #include "AliCDBManager.h"
25 #include "AliITSPIDResponse.h"
27 #include "AliRsnEvent.h"
28 #include "AliRsnDaughter.h"
29 #include "AliRsnCutPIDTPC.h"
31 ClassImp(AliRsnCutPIDTPC)
33 //_________________________________________________________________________________________________
34 AliRsnCutPIDTPC::AliRsnCutPIDTPC
35 (const char *name, AliPID::EParticleType type, Double_t min, Double_t max, Bool_t rejectOutside) :
36 AliRsnCut(name, AliRsnCut::kDaughter, min, max),
37 fRejectOutside(rejectOutside),
49 //_________________________________________________________________________________________________
50 AliRsnCutPIDTPC::AliRsnCutPIDTPC
51 (const AliRsnCutPIDTPC& copy) :
53 fRejectOutside(copy.fRejectOutside),
54 fMomMin(copy.fMomMin),
55 fMomMax(copy.fMomMax),
56 fRefType(copy.fRefType),
57 fESDpid(copy.fESDpid),
65 //_________________________________________________________________________________________________
66 AliRsnCutPIDTPC& AliRsnCutPIDTPC::operator=(const AliRsnCutPIDTPC& copy)
69 // Assignment operator
72 AliRsnCut::operator=(copy);
74 fRejectOutside = copy.fRejectOutside;
75 fMomMin = copy.fMomMin;
76 fMomMax = copy.fMomMax;
77 fRefType = copy.fRefType;
78 fESDpid = copy.fESDpid;
79 fAODpid = copy.fAODpid;
84 //_________________________________________________________________________________________________
85 void AliRsnCutPIDTPC::SetBBParam(Double_t p0, Double_t p1, Double_t p2, Double_t p3, Double_t p4)
88 // Properly set the Bethe-Bloch parameters in all places where it is needed.
91 fESDpid.GetTPCResponse().SetBetheBlochParameters(p0, p1, p2, p3, p4);
92 fAODpid.GetTPCResponse().SetBetheBlochParameters(p0, p1, p2, p3, p4);
95 //_________________________________________________________________________________________________
96 Bool_t AliRsnCutPIDTPC::IsSelected(TObject *object)
103 if (!TargetOK(object)) return kFALSE;
105 // reject not TPC tracks
106 AliVTrack *vtrack = dynamic_cast<AliVTrack*>(fDaughter->GetRef());
107 if (!vtrack) return kFALSE;
110 AliDebug(AliLog::kDebug + 2, "Track is not found in TPC");
114 // common evaluation variables
116 AliESDtrack *esdTrack = fDaughter->GetRefESDtrack();
117 AliAODTrack *aodTrack = fDaughter->GetRefAODtrack();
119 // get inner momentum and check it w.r. to allowed range:
120 // all tracks outside it will pass the cut or not, depending on 'fRejectOutside'
122 mom = esdTrack->GetInnerParam()->P();
124 mom = aodTrack->GetDetPid()->GetTPCmomentum();
127 AliDebug(AliLog::kDebug + 2, Form("Impossible to process an object of type '%s'. Cut applicable only to ESD/AOD tracks", fDaughter->GetRef()->ClassName()));
130 if ((mom < fMomMin || mom > fMomMax))
132 AliDebug(AliLog::kDebug + 2, Form("Track momentum = %.5f, outside allowed range", mom));
133 return (!fRejectOutside);
136 // assign PID nsigmas to default cut check value
137 // since bad object types are rejected before, here we have an ESD track or AOD track
139 fCutValueD = fESDpid.GetTPCResponse().GetNumberOfSigmas(mom, esdTrack->GetTPCsignal(), esdTrack->GetTPCsignalN(), fRefType);
141 fCutValueD = fAODpid.NumberOfSigmasTPC(aodTrack, fRefType);
143 // use AliRsnCut default method to check cut
147 //_________________________________________________________________________________________________
148 void AliRsnCutPIDTPC::Print(const Option_t *) const
151 // Print information on this cut
154 AliInfo(Form("Cut name : %s", GetName()));
155 AliInfo(Form("--> cut range (nsigma) : %.3f %.3f", fMinD, fMaxD));
156 AliInfo(Form("--> momentum range : %.3f %.3f", fMomMin, fMomMax));
157 AliInfo(Form("--> tracks outside range are: %s", (fRejectOutside ? "rejected" : "accepted")));