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 ©) :
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 ©)
68 // Assignment operator
71 AliRsnCut::operator=(copy);
76 fRejectOutside = copy.fRejectOutside;
77 fMomMin = copy.fMomMin;
78 fMomMax = copy.fMomMax;
79 fRefType = copy.fRefType;
80 fESDpid = copy.fESDpid;
81 fAODpid = copy.fAODpid;
86 //_________________________________________________________________________________________________
87 Bool_t AliRsnCutPIDITS::IsSelected(TObject *object)
94 if (!TargetOK(object)) return kFALSE;
96 // reject not ITS tracks
97 // status is checked in the same way for all tracks
98 AliVTrack *vtrack = fDaughter->Ref2Vtrack();
100 AliDebug(AliLog::kDebug + 2, Form("Impossible to process an object of type '%s'. Cut applicable only to ESD/AOD tracks", fDaughter->GetRef()->ClassName()));
104 // check status, to know it track is an ITS+TPC or ITS standalone
105 // and reject it if it is of none of them
106 Bool_t isSA = kFALSE;
107 if (IsTPC(vtrack)) isSA = kFALSE;
108 else if (IsSA(vtrack)) isSA = kTRUE;
110 AliDebug(AliLog::kDebug + 2, "Status flags unmatched");
114 // common evaluation variables
115 Int_t k, nITSpidLayers = 0;
116 Double_t mom = vtrack->P();
117 AliESDtrack *esdTrack = fDaughter->Ref2ESDtrack();
118 AliAODTrack *aodTrack = fDaughter->Ref2AODtrack();
120 // count number of PID layers...
122 UChar_t itsCluMap = esdTrack->GetITSClusterMap();
123 for (k = 2; k < 6; k++) if (itsCluMap & (1 << k)) ++nITSpidLayers;
124 } else if (aodTrack) {
125 for (k = 2; k < 6; k++) if (TESTBIT(aodTrack->GetITSClusterMap(), k)) ++nITSpidLayers;
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 // ...and reject tracks where it is smaller than 3
131 if (nITSpidLayers < 3) {
132 AliDebug(AliLog::kDebug + 2, "Rejecting track with too few ITS pid layers");
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 if (!fESDpid) fESDpid = new AliESDpid(fIsMC);
140 fCutValueD = fESDpid->GetITSResponse().GetNumberOfSigmas(mom, esdTrack->GetITSsignal(), fRefType, nITSpidLayers, isSA);
142 if (!fAODpid) fAODpid = new AliAODpidUtil(fIsMC);
143 fCutValueD = fAODpid->NumberOfSigmasITS(aodTrack, fRefType);
146 // use AliRsnCut default method to check cut
147 Bool_t cutCheck = OkRangeD();
149 // now check the momentum:
150 // -- if it stays inside the accepted range, track just checked
151 // with respect to the nsigma band
152 // -- if it stays outside the accepted range and 'fRejectOutside' is kTRUE,
153 // track is always rejected, while if 'fRejectOutside' is kFALSE,
154 // track is accepted if it stays inside the nsigma band
155 if ((mom >= fMomMin && mom <= fMomMax))
158 AliDebug(AliLog::kDebug + 2, Form("Track momentum = %.5f, outside allowed range", mom));
159 return ((!fRejectOutside) && cutCheck);
163 //_________________________________________________________________________________________________
164 void AliRsnCutPIDITS::Print(const Option_t *) const
167 // Print information on this cut
170 AliInfo(Form("Cut name : %s", GetName()));
171 AliInfo(Form("--> cut range (nsigma) : %.3f %.3f", fMinD, fMaxD));
172 AliInfo(Form("--> momentum range : %.3f %.3f", fMomMin, fMomMax));
173 AliInfo(Form("--> tracks outside range are: %s", (fRejectOutside ? "rejected" : "accepted")));