Changes for #82873: Module debugging broken (Christian)
[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
7196ee4f 87 Bool_t accept = kFALSE;
3dced4f8 88 Bool_t isTOF = MatchTOF(track);
89 Double_t nsTPC = TMath::Abs(pid->NumberOfSigmasTPC(track, AliPID::kKaon));
90 Double_t nsTOF = TMath::Abs(pid->NumberOfSigmasTOF(track, AliPID::kKaon));
2895972e 91
4e4fb2f6 92 // if only one detector is chosen, do this here
93 if (fOnlyTPC) {
7196ee4f 94 AliDebugClass(1, Form("Checking only TPC: nsigma = %f - cut = %f", nsTPC, fCutTPC));
95 accept = (nsTPC <= fCutTPC);
4e4fb2f6 96 } else if (fOnlyTOF) {
7196ee4f 97 if (!isTOF) {
98 AliDebugClass(1, "Checking only TOF: rejecting non-TOF track");
99 accept = kFALSE;
100 } else {
101 AliDebugClass(1, Form("Checking only TOF: nsigma = %f - cut = %f", nsTOF, fCutTOF));
102 accept = (nsTOF <= fCutTOF);
103 }
4e4fb2f6 104 } else {
105 // combined PID:
106 // below momentum threshold, start with TPC
107 if (track->P() < fTOFthreshold) {
7196ee4f 108 AliDebugClass(1, Form("Checking both PID: p = %f below threshold (TOF not required)", track->P()));
109 if (isTOF) {
110 AliDebugClass(1, Form("TOF present: nsigmaTPC: = %f - cut = %f", nsTPC, fCutTPC));
111 AliDebugClass(1, Form("TOF present: nsigmaTOF: = %f - cut = %f", nsTOF, fCutTOF));
112 accept = ((nsTPC <= fCutTPC) && (nsTOF <= fCutTOF));
113 } else {
114 AliDebugClass(1, Form("TOF absent : nsigmaTPC: = %f - cut = %f", nsTPC, fCutTPC));
115 accept = (nsTPC <= fCutTPC);
116 }
4e4fb2f6 117 } else {
7196ee4f 118 AliDebugClass(1, Form("Checking both PID: p = %f above threshold (TOF required)", track->P()));
119 if (isTOF) {
120 AliDebugClass(1, Form("TOF present: nsigmaTPC: = %f - cut = %f", nsTPC, fCutTPC));
121 AliDebugClass(1, Form("TOF present: nsigmaTOF: = %f - cut = %f", nsTOF, fCutTOF));
122 accept = ((nsTPC <= fCutTPC) && (nsTOF <= fCutTOF));
123 } else {
124 AliDebugClass(1, "TOF absent : track rejected");
125 accept = kFALSE;
126 }
4e4fb2f6 127 }
2895972e 128 }
7196ee4f 129
130 AliDebugClass(1, Form("Track %s", (accept ? "accepted" : "rejected")));
131 return accept;
2895972e 132}