ROOT logo
//
// This cut implements all the checks done to accept a track as a Kaon
// for the pp analysis using 2010 runs.
// It is based on standard cuts on track quality and nsigma cuts
// with respect to the TPC and TOF signals for the PID.
//

#include <Riostream.h>

#include "AliPID.h"
#include "AliPIDResponse.h"
#include "AliESDpid.h"
#include "AliAODpidUtil.h"

#include "AliRsnCutKaonForPhi2010PP.h"

ClassImp(AliRsnCutKaonForPhi2010PP)

//__________________________________________________________________________________________________
AliRsnCutKaonForPhi2010PP::AliRsnCutKaonForPhi2010PP(const char *name) :
   AliRsnCut(name, AliRsnTarget::kDaughter, -3.0, 3.0),
   fNSigmaTPCLow(5.0),
   fNSigmaTPCHigh(3.0),
   fLimitTPC(0.350),
   fNSigmaTOF(3.0),
   fMyPID(0x0),
   fCutQuality(Form("%sQuality", name))
{
//
// Constructor
// Initialize the contained cuts and sets defaults
//

   // track quality
   //fCutQuality.AddStatusFlag(AliESDtrack::kTPCin   , kTRUE);
   //fCutQuality.AddStatusFlag(AliESDtrack::kTPCrefit, kTRUE);
   //fCutQuality.AddStatusFlag(AliESDtrack::kITSrefit, kTRUE);
   fCutQuality.SetPtRange(0.15, 1E+20);
   fCutQuality.SetEtaRange(-0.8, 0.8);
   fCutQuality.SetDCARPtFormula("0.0182+0.0350/pt^1.01");
   fCutQuality.SetDCAZmax(2.0);
   fCutQuality.SetSPDminNClusters(1);
   fCutQuality.SetITSminNClusters(0);
   fCutQuality.SetITSmaxChi2(1E+20);
   fCutQuality.SetTPCminNClusters(70);
   fCutQuality.SetTPCmaxChi2(4.0);
   fCutQuality.SetRejectKinkDaughters();
   fCutQuality.SetAODTestFilterBit(5);
}

//__________________________________________________________________________________________________
AliRsnCutKaonForPhi2010PP::AliRsnCutKaonForPhi2010PP(const AliRsnCutKaonForPhi2010PP &copy) :
   AliRsnCut(copy),
   fNSigmaTPCLow(copy.fNSigmaTPCLow),
   fNSigmaTPCHigh(copy.fNSigmaTPCHigh),
   fLimitTPC(copy.fLimitTPC),
   fNSigmaTOF(copy.fNSigmaTOF),
   fMyPID(copy.fMyPID),
   fCutQuality(copy.fCutQuality)
{
//
// Copy constructor
//
}

//__________________________________________________________________________________________________
AliRsnCutKaonForPhi2010PP &AliRsnCutKaonForPhi2010PP::operator=(const AliRsnCutKaonForPhi2010PP &copy)
{
//
// Assignment operator
//

   AliRsnCut::operator=(copy);
   if (this == &copy)
      return *this;
   fNSigmaTPCLow = copy.fNSigmaTPCLow;
   fNSigmaTPCHigh = copy.fNSigmaTPCHigh;
   fLimitTPC = copy.fLimitTPC;
   fNSigmaTOF = copy.fNSigmaTOF;
   fMyPID = copy.fMyPID;
   fCutQuality = copy.fCutQuality;

   return *this;
}

//__________________________________________________________________________________________________
void AliRsnCutKaonForPhi2010PP::InitMyPID(Bool_t isMC, Bool_t isESD)
{
//
// Initialize manual PID object
//

   if (isESD)
      fMyPID = new AliESDpid(isMC);
   else
      fMyPID = new AliAODpidUtil(isMC);
}

//__________________________________________________________________________________________________
Bool_t AliRsnCutKaonForPhi2010PP::IsSelected(TObject *obj)
{
//
// Global check
//

   // coherence check
   if (!TargetOK(obj)) return kFALSE;

   // check track
   AliVTrack *track = dynamic_cast<AliVTrack *>(fDaughter->GetRef());
   if (!track) return kFALSE;

   // check flags
   if ((track->GetStatus() & AliESDtrack::kTPCin   ) == 0) return kFALSE;
   if ((track->GetStatus() & AliESDtrack::kTPCrefit) == 0) return kFALSE;
   if ((track->GetStatus() & AliESDtrack::kITSrefit) == 0) return kFALSE;

   // quality
   if (!fCutQuality.IsSelected(obj)) return kFALSE;

   // check initialization of PID object
   AliPIDResponse *pid = fEvent->GetPIDResponse();
   if (!pid) {
      AliFatal("NULL PID response");
      return kFALSE;
   }

   // PID TPC :
   // depends on momentum
   // and if local PID object is initialized, it is used instead of that got from manager
   Double_t mom = track->GetTPCmomentum();
   mom = TMath::Abs(mom);
   if (mom < fLimitTPC)
      SetRangeD(0.0, fNSigmaTPCLow);
   else
      SetRangeD(0.0, fNSigmaTPCHigh);
   if (fMyPID)
      fCutValueD = TMath::Abs(fMyPID->NumberOfSigmasTPC(track, AliPID::kKaon));
   else
      fCutValueD = TMath::Abs(pid->NumberOfSigmasTPC(track, AliPID::kKaon));
   if (!OkRangeD()) return kFALSE;

   // if TOF is not matched, end here
   // otherwise check TOF
   if (!MatchTOF(track))
      return kTRUE;
   else {
      SetRangeD(0.0, fNSigmaTOF);
      fCutValueD = TMath::Abs(pid->NumberOfSigmasTOF(track, AliPID::kKaon));
      return OkRangeD();
   }
}
 AliRsnCutKaonForPhi2010PP.cxx:1
 AliRsnCutKaonForPhi2010PP.cxx:2
 AliRsnCutKaonForPhi2010PP.cxx:3
 AliRsnCutKaonForPhi2010PP.cxx:4
 AliRsnCutKaonForPhi2010PP.cxx:5
 AliRsnCutKaonForPhi2010PP.cxx:6
 AliRsnCutKaonForPhi2010PP.cxx:7
 AliRsnCutKaonForPhi2010PP.cxx:8
 AliRsnCutKaonForPhi2010PP.cxx:9
 AliRsnCutKaonForPhi2010PP.cxx:10
 AliRsnCutKaonForPhi2010PP.cxx:11
 AliRsnCutKaonForPhi2010PP.cxx:12
 AliRsnCutKaonForPhi2010PP.cxx:13
 AliRsnCutKaonForPhi2010PP.cxx:14
 AliRsnCutKaonForPhi2010PP.cxx:15
 AliRsnCutKaonForPhi2010PP.cxx:16
 AliRsnCutKaonForPhi2010PP.cxx:17
 AliRsnCutKaonForPhi2010PP.cxx:18
 AliRsnCutKaonForPhi2010PP.cxx:19
 AliRsnCutKaonForPhi2010PP.cxx:20
 AliRsnCutKaonForPhi2010PP.cxx:21
 AliRsnCutKaonForPhi2010PP.cxx:22
 AliRsnCutKaonForPhi2010PP.cxx:23
 AliRsnCutKaonForPhi2010PP.cxx:24
 AliRsnCutKaonForPhi2010PP.cxx:25
 AliRsnCutKaonForPhi2010PP.cxx:26
 AliRsnCutKaonForPhi2010PP.cxx:27
 AliRsnCutKaonForPhi2010PP.cxx:28
 AliRsnCutKaonForPhi2010PP.cxx:29
 AliRsnCutKaonForPhi2010PP.cxx:30
 AliRsnCutKaonForPhi2010PP.cxx:31
 AliRsnCutKaonForPhi2010PP.cxx:32
 AliRsnCutKaonForPhi2010PP.cxx:33
 AliRsnCutKaonForPhi2010PP.cxx:34
 AliRsnCutKaonForPhi2010PP.cxx:35
 AliRsnCutKaonForPhi2010PP.cxx:36
 AliRsnCutKaonForPhi2010PP.cxx:37
 AliRsnCutKaonForPhi2010PP.cxx:38
 AliRsnCutKaonForPhi2010PP.cxx:39
 AliRsnCutKaonForPhi2010PP.cxx:40
 AliRsnCutKaonForPhi2010PP.cxx:41
 AliRsnCutKaonForPhi2010PP.cxx:42
 AliRsnCutKaonForPhi2010PP.cxx:43
 AliRsnCutKaonForPhi2010PP.cxx:44
 AliRsnCutKaonForPhi2010PP.cxx:45
 AliRsnCutKaonForPhi2010PP.cxx:46
 AliRsnCutKaonForPhi2010PP.cxx:47
 AliRsnCutKaonForPhi2010PP.cxx:48
 AliRsnCutKaonForPhi2010PP.cxx:49
 AliRsnCutKaonForPhi2010PP.cxx:50
 AliRsnCutKaonForPhi2010PP.cxx:51
 AliRsnCutKaonForPhi2010PP.cxx:52
 AliRsnCutKaonForPhi2010PP.cxx:53
 AliRsnCutKaonForPhi2010PP.cxx:54
 AliRsnCutKaonForPhi2010PP.cxx:55
 AliRsnCutKaonForPhi2010PP.cxx:56
 AliRsnCutKaonForPhi2010PP.cxx:57
 AliRsnCutKaonForPhi2010PP.cxx:58
 AliRsnCutKaonForPhi2010PP.cxx:59
 AliRsnCutKaonForPhi2010PP.cxx:60
 AliRsnCutKaonForPhi2010PP.cxx:61
 AliRsnCutKaonForPhi2010PP.cxx:62
 AliRsnCutKaonForPhi2010PP.cxx:63
 AliRsnCutKaonForPhi2010PP.cxx:64
 AliRsnCutKaonForPhi2010PP.cxx:65
 AliRsnCutKaonForPhi2010PP.cxx:66
 AliRsnCutKaonForPhi2010PP.cxx:67
 AliRsnCutKaonForPhi2010PP.cxx:68
 AliRsnCutKaonForPhi2010PP.cxx:69
 AliRsnCutKaonForPhi2010PP.cxx:70
 AliRsnCutKaonForPhi2010PP.cxx:71
 AliRsnCutKaonForPhi2010PP.cxx:72
 AliRsnCutKaonForPhi2010PP.cxx:73
 AliRsnCutKaonForPhi2010PP.cxx:74
 AliRsnCutKaonForPhi2010PP.cxx:75
 AliRsnCutKaonForPhi2010PP.cxx:76
 AliRsnCutKaonForPhi2010PP.cxx:77
 AliRsnCutKaonForPhi2010PP.cxx:78
 AliRsnCutKaonForPhi2010PP.cxx:79
 AliRsnCutKaonForPhi2010PP.cxx:80
 AliRsnCutKaonForPhi2010PP.cxx:81
 AliRsnCutKaonForPhi2010PP.cxx:82
 AliRsnCutKaonForPhi2010PP.cxx:83
 AliRsnCutKaonForPhi2010PP.cxx:84
 AliRsnCutKaonForPhi2010PP.cxx:85
 AliRsnCutKaonForPhi2010PP.cxx:86
 AliRsnCutKaonForPhi2010PP.cxx:87
 AliRsnCutKaonForPhi2010PP.cxx:88
 AliRsnCutKaonForPhi2010PP.cxx:89
 AliRsnCutKaonForPhi2010PP.cxx:90
 AliRsnCutKaonForPhi2010PP.cxx:91
 AliRsnCutKaonForPhi2010PP.cxx:92
 AliRsnCutKaonForPhi2010PP.cxx:93
 AliRsnCutKaonForPhi2010PP.cxx:94
 AliRsnCutKaonForPhi2010PP.cxx:95
 AliRsnCutKaonForPhi2010PP.cxx:96
 AliRsnCutKaonForPhi2010PP.cxx:97
 AliRsnCutKaonForPhi2010PP.cxx:98
 AliRsnCutKaonForPhi2010PP.cxx:99
 AliRsnCutKaonForPhi2010PP.cxx:100
 AliRsnCutKaonForPhi2010PP.cxx:101
 AliRsnCutKaonForPhi2010PP.cxx:102
 AliRsnCutKaonForPhi2010PP.cxx:103
 AliRsnCutKaonForPhi2010PP.cxx:104
 AliRsnCutKaonForPhi2010PP.cxx:105
 AliRsnCutKaonForPhi2010PP.cxx:106
 AliRsnCutKaonForPhi2010PP.cxx:107
 AliRsnCutKaonForPhi2010PP.cxx:108
 AliRsnCutKaonForPhi2010PP.cxx:109
 AliRsnCutKaonForPhi2010PP.cxx:110
 AliRsnCutKaonForPhi2010PP.cxx:111
 AliRsnCutKaonForPhi2010PP.cxx:112
 AliRsnCutKaonForPhi2010PP.cxx:113
 AliRsnCutKaonForPhi2010PP.cxx:114
 AliRsnCutKaonForPhi2010PP.cxx:115
 AliRsnCutKaonForPhi2010PP.cxx:116
 AliRsnCutKaonForPhi2010PP.cxx:117
 AliRsnCutKaonForPhi2010PP.cxx:118
 AliRsnCutKaonForPhi2010PP.cxx:119
 AliRsnCutKaonForPhi2010PP.cxx:120
 AliRsnCutKaonForPhi2010PP.cxx:121
 AliRsnCutKaonForPhi2010PP.cxx:122
 AliRsnCutKaonForPhi2010PP.cxx:123
 AliRsnCutKaonForPhi2010PP.cxx:124
 AliRsnCutKaonForPhi2010PP.cxx:125
 AliRsnCutKaonForPhi2010PP.cxx:126
 AliRsnCutKaonForPhi2010PP.cxx:127
 AliRsnCutKaonForPhi2010PP.cxx:128
 AliRsnCutKaonForPhi2010PP.cxx:129
 AliRsnCutKaonForPhi2010PP.cxx:130
 AliRsnCutKaonForPhi2010PP.cxx:131
 AliRsnCutKaonForPhi2010PP.cxx:132
 AliRsnCutKaonForPhi2010PP.cxx:133
 AliRsnCutKaonForPhi2010PP.cxx:134
 AliRsnCutKaonForPhi2010PP.cxx:135
 AliRsnCutKaonForPhi2010PP.cxx:136
 AliRsnCutKaonForPhi2010PP.cxx:137
 AliRsnCutKaonForPhi2010PP.cxx:138
 AliRsnCutKaonForPhi2010PP.cxx:139
 AliRsnCutKaonForPhi2010PP.cxx:140
 AliRsnCutKaonForPhi2010PP.cxx:141
 AliRsnCutKaonForPhi2010PP.cxx:142
 AliRsnCutKaonForPhi2010PP.cxx:143
 AliRsnCutKaonForPhi2010PP.cxx:144
 AliRsnCutKaonForPhi2010PP.cxx:145
 AliRsnCutKaonForPhi2010PP.cxx:146
 AliRsnCutKaonForPhi2010PP.cxx:147
 AliRsnCutKaonForPhi2010PP.cxx:148
 AliRsnCutKaonForPhi2010PP.cxx:149
 AliRsnCutKaonForPhi2010PP.cxx:150
 AliRsnCutKaonForPhi2010PP.cxx:151
 AliRsnCutKaonForPhi2010PP.cxx:152