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 momLimit, Double_t cut1, Double_t cut2) :
36 AliRsnCut(name, AliRsnCut::kDaughter, 0.0, 0.0),
38 fMomentumLimit(momLimit),
39 fLargeCut(TMath::Max(cut1, cut2)),
40 fSmallCut(TMath::Min(cut1, cut2)),
49 //_________________________________________________________________________________________________
50 AliRsnCutPIDTPC::AliRsnCutPIDTPC
51 (const AliRsnCutPIDTPC& copy) :
53 fPIDtype(copy.fPIDtype),
54 fMomentumLimit(copy.fMomentumLimit),
55 fLargeCut(copy.fLargeCut),
56 fSmallCut(copy.fSmallCut),
57 fESDpid(copy.fESDpid),
65 //_________________________________________________________________________________________________
66 AliRsnCutPIDTPC& AliRsnCutPIDTPC::operator=(const AliRsnCutPIDTPC& copy)
69 // Assignment operator
72 AliRsnCut::operator=(copy);
74 fPIDtype = copy.fPIDtype;
75 fMomentumLimit = copy.fMomentumLimit;
76 fLargeCut = copy.fLargeCut;
77 fSmallCut = copy.fSmallCut;
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 // status is checked in the same way for all tracks
107 AliVTrack *vtrack = dynamic_cast<AliVTrack*>(fDaughter->GetRef());
110 AliDebug(AliLog::kDebug + 2, Form("This object is not either an ESD nor AOD track, it is an %s", fDaughter->GetRef()->ClassName()));
113 ULong_t status = (ULong_t)vtrack->GetStatus();
114 if ((status & AliESDtrack::kTPCin) == 0)
116 AliDebug(AliLog::kDebug + 2, "Track is not found in TPC");
120 // common evaluation variables
123 // retrieve real object type
124 AliESDtrack *esdTrack = fDaughter->GetRefESDtrack();
125 AliAODTrack *aodTrack = fDaughter->GetRefAODtrack();
128 AliDebug(AliLog::kDebug + 2, "Checking an ESD track");
130 mom = esdTrack->GetInnerParam()->P();
132 AliTPCPIDResponse &tpcrsp = fESDpid.GetTPCResponse();
133 fCutValueD = tpcrsp.GetNumberOfSigmas(mom, esdTrack->GetTPCsignal(), esdTrack->GetTPCsignalN(), fPIDtype);
137 AliDebug(AliLog::kDebug + 2, "Checking an AOD track");
139 AliAODPid *pidObj = aodTrack->GetDetPid();
140 mom = pidObj->GetTPCmomentum();
142 fCutValueD = fAODpid.NumberOfSigmasTPC(aodTrack, fPIDtype);
146 AliDebug(AliLog::kDebug + 2, Form("This object is not either an ESD nor AOD track, it is an %s", fDaughter->GetRef()->ClassName()));
150 // determine cut range from the momentum
151 if (mom < fMomentumLimit)
162 // check the cut using the standard AliRsnCut facilities
166 //_________________________________________________________________________________________________
167 void AliRsnCutPIDTPC::Print(const Option_t *) const
170 // Print information on this cut
173 AliInfo(Form("Cut name, type : %s %s", GetName(), ClassName()));
174 AliInfo(Form("TPC PID cut: limit, large, small: %.3ff %.3ff %.3ff", fMomentumLimit, fLargeCut, fSmallCut));