2 // Class AliRsnCutPIDITS
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 "AliESDtrackCuts.h"
20 #include "AliAODpidUtil.h"
21 #include "AliAnalysisManager.h"
22 #include "AliESDInputHandler.h"
24 #include "AliRsnDaughter.h"
26 #include "AliRsnCutPIDITS.h"
28 ClassImp(AliRsnCutPIDITS)
30 //_________________________________________________________________________________________________
31 AliRsnCutPIDITS::AliRsnCutPIDITS
32 (const char *name, AliPID::EParticleType ref, Double_t min, Double_t max, Bool_t rejectOutside) :
33 AliRsnCut(name, AliRsnCut::kDaughter, min, max),
35 fRejectOutside(rejectOutside),
47 //_________________________________________________________________________________________________
48 AliRsnCutPIDITS::AliRsnCutPIDITS
49 (const AliRsnCutPIDITS& copy) :
52 fRejectOutside(copy.fRejectOutside),
53 fMomMin(copy.fMomMin),
54 fMomMax(copy.fMomMax),
55 fRefType(copy.fRefType),
56 fESDpid(copy.fESDpid),
64 //_________________________________________________________________________________________________
65 AliRsnCutPIDITS& AliRsnCutPIDITS::operator=(const AliRsnCutPIDITS& copy)
68 // Assignment operator
71 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 Bool_t AliRsnCutPIDITS::IsSelected(TObject *object)
92 if (!TargetOK(object)) return kFALSE;
94 // reject not ITS tracks
95 // status is checked in the same way for all tracks
96 AliVTrack *vtrack = fDaughter->Ref2Vtrack();
98 AliDebug(AliLog::kDebug + 2, Form("Impossible to process an object of type '%s'. Cut applicable only to ESD/AOD tracks", fDaughter->GetRef()->ClassName()));
102 // check status, to know it track is an ITS+TPC or ITS standalone
103 // and reject it if it is of none of them
104 Bool_t isSA = kFALSE;
105 if (IsTPC(vtrack)) isSA = kFALSE;
106 else if (IsSA(vtrack)) isSA = kTRUE;
108 AliDebug(AliLog::kDebug + 2, "Status flags unmatched");
112 // common evaluation variables
113 Int_t k, nITSpidLayers = 0;
114 Double_t mom = vtrack->P();
115 AliESDtrack *esdTrack = fDaughter->Ref2ESDtrack();
116 AliAODTrack *aodTrack = fDaughter->Ref2AODtrack();
118 // count number of PID layers...
120 UChar_t itsCluMap = esdTrack->GetITSClusterMap();
121 for (k = 2; k < 6; k++) if (itsCluMap & (1 << k)) ++nITSpidLayers;
122 } else if (aodTrack) {
123 for (k = 2; k < 6; k++) if (TESTBIT(aodTrack->GetITSClusterMap(), k)) ++nITSpidLayers;
125 AliDebug(AliLog::kDebug + 2, Form("Impossible to process an object of type '%s'. Cut applicable only to ESD/AOD tracks", fDaughter->GetRef()->ClassName()));
128 // ...and reject tracks where it is smaller than 3
129 if (nITSpidLayers < 3) {
130 AliDebug(AliLog::kDebug + 2, "Rejecting track with too few ITS pid layers");
134 // assign PID nsigmas to default cut check value
135 // since bad object types are rejected before, here we have an ESD track or AOD track
137 if (!fESDpid) fESDpid = new AliESDpid(fIsMC);
138 fCutValueD = fESDpid->GetITSResponse().GetNumberOfSigmas(mom, esdTrack->GetITSsignal(), fRefType, nITSpidLayers, isSA);
140 if (!fAODpid) fAODpid = new AliAODpidUtil(fIsMC);
141 fCutValueD = fAODpid->NumberOfSigmasITS(aodTrack, fRefType);
144 // use AliRsnCut default method to check cut
145 Bool_t cutCheck = OkRangeD();
147 // now check the momentum:
148 // -- if it stays inside the accepted range, track just checked
149 // with respect to the nsigma band
150 // -- if it stays outside the accepted range and 'fRejectOutside' is kTRUE,
151 // track is always rejected, while if 'fRejectOutside' is kFALSE,
152 // track is accepted if it stays inside the nsigma band
153 if ((mom >= fMomMin && mom <= fMomMax))
156 AliDebug(AliLog::kDebug + 2, Form("Track momentum = %.5f, outside allowed range", mom));
157 return ((!fRejectOutside) && cutCheck);
161 //_________________________________________________________________________________________________
162 void AliRsnCutPIDITS::Print(const Option_t *) const
165 // Print information on this cut
168 AliInfo(Form("Cut name : %s", GetName()));
169 AliInfo(Form("--> cut range (nsigma) : %.3f %.3f", fMinD, fMaxD));
170 AliInfo(Form("--> momentum range : %.3f %.3f", fMomMin, fMomMax));
171 AliInfo(Form("--> tracks outside range are: %s", (fRejectOutside ? "rejected" : "accepted")));