coverity
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnCutKaonForPhi2010.cxx
CommitLineData
2895972e 1//
4e4fb2f6 2// This cut implements all the checks done to accept a track as a Kaon
3// for the PbPb analysis using 2010 runs.
4// It is based on standard cuts on track quality and nsigma cuts
5// with respect to the TPC and TOF signals for the PID.
2895972e 6//
7
8#include <Riostream.h>
9
10#include "AliPID.h"
11#include "AliPIDResponse.h"
12#include "AliRsnCutKaonForPhi2010.h"
13
14ClassImp(AliRsnCutKaonForPhi2010)
15
16//__________________________________________________________________________________________________
0efb7042 17AliRsnCutKaonForPhi2010::AliRsnCutKaonForPhi2010
18(const char *name, Double_t nSigmaTPC, Double_t nSigmaTOF, Double_t tofLimit) :
19 AliRsnCut(name, AliRsnTarget::kDaughter),
4e4fb2f6 20 fOnlyQuality(kFALSE),
21 fOnlyTPC(kFALSE),
22 fOnlyTOF(kFALSE),
0efb7042 23 fCutTPC(nSigmaTPC),
24 fCutTOF(nSigmaTOF),
25 fTOFthreshold(tofLimit),
4e4fb2f6 26 fCutQuality(Form("%s_quality", name))
2895972e 27{
28//
29// Constructor
30// Initialize the contained cuts and sets defaults
31//
32
33 // track quality
34 //fCutQuality.AddStatusFlag(AliESDtrack::kTPCin , kTRUE);
35 //fCutQuality.AddStatusFlag(AliESDtrack::kTPCrefit, kTRUE);
36 //fCutQuality.AddStatusFlag(AliESDtrack::kITSrefit, kTRUE);
37 fCutQuality.SetPtRange(0.15, 1E+20);
38 fCutQuality.SetEtaRange(-0.8, 0.8);
39 fCutQuality.SetDCARPtFormula("0.0182+0.0350/pt^1.01");
40 fCutQuality.SetDCAZmax(2.0);
41 fCutQuality.SetSPDminNClusters(1);
42 fCutQuality.SetITSminNClusters(0);
43 fCutQuality.SetITSmaxChi2(1E+20);
44 fCutQuality.SetTPCminNClusters(70);
45 fCutQuality.SetTPCmaxChi2(4.0);
46 fCutQuality.SetRejectKinkDaughters();
47 fCutQuality.SetAODTestFilterBit(5);
48}
49
50//__________________________________________________________________________________________________
51Bool_t AliRsnCutKaonForPhi2010::IsSelected(TObject *obj)
52{
53//
54// Global check
55//
56
57 // coherence check
58 if (!TargetOK(obj)) return kFALSE;
59
60 // check track
61 AliVTrack *track = fDaughter->Ref2Vtrack();
62 if (!track) {
63 if (!fDaughter->GetRef()) AliWarning("NULL ref");
64 return kFALSE;
65 }
66
67 // check flags
68 if ((track->GetStatus() & AliESDtrack::kTPCin ) == 0) return kFALSE;
69 if ((track->GetStatus() & AliESDtrack::kTPCrefit) == 0) return kFALSE;
70 if ((track->GetStatus() & AliESDtrack::kITSrefit) == 0) return kFALSE;
71
72 // quality
73 if (!fCutQuality.IsSelected(obj)) return kFALSE;
74
4e4fb2f6 75 // if not PID is done, exit here
76 if (fOnlyQuality) return kTRUE;
77
2895972e 78 // check initialization of PID object
79 AliPIDResponse *pid = fEvent->GetPIDResponse();
80 if (!pid) {
81 AliFatal("NULL PID response");
82 return kFALSE;
83 }
84
3dced4f8 85 // check if TOF is matched
86 // and computes all values used in the PID cut
87 Bool_t isTOF = MatchTOF(track);
88 Double_t nsTPC = TMath::Abs(pid->NumberOfSigmasTPC(track, AliPID::kKaon));
89 Double_t nsTOF = TMath::Abs(pid->NumberOfSigmasTOF(track, AliPID::kKaon));
2895972e 90
4e4fb2f6 91 // if only one detector is chosen, do this here
92 if (fOnlyTPC) {
3dced4f8 93 return (nsTPC <= fCutTPC);
4e4fb2f6 94 } else if (fOnlyTOF) {
3dced4f8 95 return (isTOF && (nsTOF <= fCutTOF));
4e4fb2f6 96 } else {
97 // combined PID:
98 // below momentum threshold, start with TPC
99 if (track->P() < fTOFthreshold) {
3dced4f8 100 if (isTOF)
101 return ((nsTPC <= fCutTPC) && (nsTOF <= fCutTOF));
102 else
103 return (nsTPC <= fCutTPC);
4e4fb2f6 104 } else {
3dced4f8 105 if (isTOF)
106 return ((nsTPC <= fCutTPC) && (nsTOF <= fCutTOF));
107 else
108 return kFALSE;
4e4fb2f6 109 }
2895972e 110 }
111}