2 // Class AliRsnCutPIDNSigma
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 "AliPIDResponse.h"
20 #include "AliAnalysisManager.h"
21 #include "AliInputEventHandler.h"
22 #include "AliMultiInputEventHandler.h"
24 #include "AliRsnCutPIDNSigma.h"
26 ClassImp(AliRsnCutPIDNSigma)
28 //_________________________________________________________________________________________________
29 AliRsnCutPIDNSigma::AliRsnCutPIDNSigma
30 (const char *name, AliPID::EParticleType species, EDetector det, Double_t nsigma) :
31 AliRsnCut(name, AliRsnCut::kDaughter, -nsigma, nsigma),
36 fRejectOutside(kFALSE),
37 fRejectUnmatched(kFALSE)
44 //_________________________________________________________________________________________________
45 AliRsnCutPIDNSigma::AliRsnCutPIDNSigma
46 (const AliRsnCutPIDNSigma& copy) :
48 fSpecies(copy.fSpecies),
49 fDetector(copy.fDetector),
50 fMomMin(copy.fMomMin),
51 fMomMax(copy.fMomMax),
52 fRejectOutside(copy.fRejectOutside),
53 fRejectUnmatched(copy.fRejectUnmatched)
60 //_________________________________________________________________________________________________
61 AliRsnCutPIDNSigma& AliRsnCutPIDNSigma::operator=(const AliRsnCutPIDNSigma& copy)
64 // Assignment operator
67 AliRsnCut::operator=(copy);
69 fSpecies = copy.fSpecies;
70 fDetector = copy.fDetector;
71 fMomMin = copy.fMomMin;
72 fMomMax = copy.fMomMax;
73 fRejectOutside = copy.fRejectOutside;
74 fRejectUnmatched = copy.fRejectUnmatched;
79 //_________________________________________________________________________________________________
80 Bool_t AliRsnCutPIDNSigma::IsSelected(TObject *object)
87 if (!TargetOK(object)) return kFALSE;
89 // check initialization of PID object
90 AliPIDResponse *pid = fEvent->GetPIDResponse();
92 AliFatal("NULL PID response");
96 // get reference momentum, for range cut
97 Double_t momentum = -1.0;
98 if (!fDaughter->GetRefVtrack()) {
99 AliDebugClass(2, "Referenced daughter is not a track");
102 if (fDetector == kTPC)
103 momentum = fDaughter->GetRefVtrack()->GetTPCmomentum();
105 momentum = fDaughter->GetRef()->P();
107 // check momentum range, if required
108 if (fRejectOutside) {
109 if (momentum < fMomMin || momentum > fMomMax) {
110 AliDebugClass(2, Form("Track momentum = %.5f, outside allowed range [%.2f - %.2f]", momentum, fMomMin, fMomMax));
115 // matching check, if required
116 if (fRejectUnmatched) {
120 AliDebug(3, "Rejecting track not matched in ITS");
126 AliDebug(3, "Rejecting track not matched in TPC");
132 AliDebug(3, "Rejecting track not matched in TOF");
137 AliWarning("Required to reject unmatched tracks, but no detector defined. Track rejected");
143 // the number of sigmas is set as cut value, which is then checked
144 // using the basic functions available in AliRsnCut
147 fCutValueD = pid->NumberOfSigmasITS(fDaughter->GetRef(), fSpecies);
150 fCutValueD = pid->NumberOfSigmasTPC(fDaughter->GetRef(), fSpecies);
153 fCutValueD = pid->NumberOfSigmasTOF(fDaughter->GetRef(), fSpecies);
163 //_________________________________________________________________________________________________
164 void AliRsnCutPIDNSigma::Print(const Option_t *) const
167 // Print information on this cut
170 Char_t mom[100], det[10], match[100];
173 sprintf(mom, "Tracks are accepted only in the momentum range %.2f --> %.2f", fMomMin, fMomMax);
175 sprintf(mom, "No check in momentum range");
177 if (fRejectUnmatched)
178 sprintf(match, "Unmatched tracks are rejected");
180 sprintf(match, "No check on track matching");
183 case kITS: sprintf(det, "ITS"); break;
184 case kTPC: sprintf(det, "TPC"); break;
185 case kTOF: sprintf(det, "TOF"); break;
186 default : sprintf(det, "undefined");
189 AliInfo(Form("Cut name : %s", GetName()));
190 AliInfo(Form("--> PID detector : %s", det));
191 AliInfo(Form("--> match criteria: %s", match));
192 AliInfo(Form("--> momentum range: %s", mom));