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 <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 "AliRsnCutPIDITS.h"
31 ClassImp(AliRsnCutPIDITS)
33 //_________________________________________________________________________________________________
34 AliRsnCutPIDITS::AliRsnCutPIDITS
35 (const char *name, AliPID::EParticleType type, Bool_t isMC, Double_t momLimit, Double_t cut1, Double_t cut2) :
36 AliRsnCut(name, AliRsnCut::kDaughter, 0.0, 0.0),
39 fMomentumLimit(momLimit),
40 fLargeCut(TMath::Max(cut1, cut2)),
41 fSmallCut(TMath::Min(cut1, cut2)),
52 //_________________________________________________________________________________________________
53 AliRsnCutPIDITS::AliRsnCutPIDITS
54 (const AliRsnCutPIDITS& copy) :
56 fPIDtype(copy.fPIDtype),
58 fMomentumLimit(copy.fMomentumLimit),
59 fLargeCut(copy.fLargeCut),
60 fSmallCut(copy.fSmallCut),
61 fESDpid(copy.fESDpid),
71 //_________________________________________________________________________________________________
72 AliRsnCutPIDITS& AliRsnCutPIDITS::operator=(const AliRsnCutPIDITS& copy)
75 // Assignment operator
78 AliRsnCut::operator=(copy);
80 fPIDtype = copy.fPIDtype;
81 fMomentumLimit = copy.fMomentumLimit;
82 fLargeCut = copy.fLargeCut;
83 fSmallCut = copy.fSmallCut;
84 fESDpid = copy.fESDpid;
85 fAODpid = copy.fAODpid;
92 //_________________________________________________________________________________________________
93 void AliRsnCutPIDITS::SetMC(Bool_t yn)
96 // Properly set the PID response
100 AliITSPIDResponse itsresponse(fIsMC);
101 fESDpid.GetITSResponse() = itsresponse;
102 fAODpid.GetITSResponse() = itsresponse;
105 //_________________________________________________________________________________________________
106 Bool_t AliRsnCutPIDITS::IsSelected(TObject *object)
113 if (!TargetOK(object)) return kFALSE;
115 // reject not ITS tracks
116 // status is checked in the same way for all tracks
117 AliVTrack *vtrack = dynamic_cast<AliVTrack*>(fDaughter->GetRef());
120 AliDebug(AliLog::kDebug + 2, Form("This object is not either an ESD nor AOD track, it is an %s", fDaughter->GetRef()->ClassName()));
124 // check status, to know it track is an ITS+TPC or ITS standalone
125 // and reject it if it is of none of the allowed types
126 Bool_t isSA = kFALSE;
127 if (IsITSTPC(vtrack)) isSA = kFALSE;
128 else if (IsITSSA(vtrack)) isSA = kTRUE;
131 AliWarning("Track is neither ITS+TPC nor ITS standalone");
135 // common evaluation variables
136 Double_t mom = vtrack->P();
137 Int_t k, nITSpidLayers;
139 // retrieve real object type
140 AliESDtrack *esdTrack = fDaughter->GetRefESDtrack();
141 AliAODTrack *aodTrack = fDaughter->GetRefAODtrack();
144 AliDebug(AliLog::kDebug + 2, "Checking an ESD track");
146 // count PID layers and reject if they are too few
148 UChar_t itsCluMap = esdTrack->GetITSClusterMap();
149 for(k = 2; k < 6; k++) if(itsCluMap & (1 << k)) ++nITSpidLayers;
150 if (nITSpidLayers < 3)
152 AliDebug(AliLog::kDebug+2, "Rejecting track with too few ITS pid layers");
156 // create the PID response object and compute nsigma
157 AliITSPIDResponse &itsrsp = fESDpid.GetITSResponse();
158 fCutValueD = itsrsp.GetNumberOfSigmas(mom, esdTrack->GetITSsignal(), fPIDtype, nITSpidLayers, isSA);
162 AliDebug(AliLog::kDebug + 2, "Checking an AOD track");
164 // count PID layers and reject if they are too few
166 for(k = 2; k < 6; k++) if (TESTBIT(aodTrack->GetITSClusterMap(), k)) ++nITSpidLayers;
167 if (nITSpidLayers < 3)
169 AliDebug(AliLog::kDebug+2, "Rejecting track with too few ITS pid layers");
174 fCutValueD = fAODpid.NumberOfSigmasITS(aodTrack, fPIDtype);
178 AliDebug(AliLog::kDebug + 2, Form("This object is not either an ESD nor AOD track, it is an %s", fDaughter->GetRef()->ClassName()));
182 // determine cut range from the momentum
183 if (mom < fMomentumLimit)
194 // check the cut using the standard AliRsnCut facilities
198 //_________________________________________________________________________________________________
199 void AliRsnCutPIDITS::Print(const Option_t *) const
202 // Print information on this cut
205 AliInfo(Form("Cut name, type : %s %s", GetName(), ClassName()));
206 AliInfo(Form("ITS PID cut: limit, large, small: %.3f %.3f %.3f", fMomentumLimit, fLargeCut, fSmallCut));