ROOT logo
//
// This cut implements all the checks done to accept a track as a Kaon
// for the PbPb 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 "AliLog.h"
#include "AliPID.h"
#include "AliPIDResponse.h"
#include "AliESDpid.h"
#include "AliAODpidUtil.h"
#include "AliRsnCutKaonForPhi2010.h"

ClassImp(AliRsnCutKaonForPhi2010)

//__________________________________________________________________________________________________
AliRsnCutKaonForPhi2010::AliRsnCutKaonForPhi2010
(const char *name, Double_t nSigmaTPC, Double_t nSigmaTOF, Double_t tofLimit) :
   AliRsnCut(name, AliRsnTarget::kDaughter),
   fMode(kDefaultPID),
   fCutTPC(nSigmaTPC),
   fCutTOF(nSigmaTOF),
   fTOFthreshold(tofLimit),
   fMyPID(0x0),
   fCutQuality(Form("%s_quality", 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);
}

//__________________________________________________________________________________________________
AliRsnCutKaonForPhi2010::AliRsnCutKaonForPhi2010(const AliRsnCutKaonForPhi2010 &copy) :
   AliRsnCut(copy),
   fMode(copy.fMode),
   fCutTPC(copy.fCutTPC),
   fCutTOF(copy.fCutTOF),
   fTOFthreshold(copy.fTOFthreshold),
   fMyPID(copy.fMyPID),
   fCutQuality(copy.fCutQuality)
{
//
// Copy constructor
//
}

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

   AliRsnCut::operator=(copy);
   if (this == &copy)
      return *this;
   fMode = copy.fMode;
   fCutTPC = copy.fCutTPC;
   fCutTOF = copy.fCutTOF;
   fTOFthreshold = copy.fTOFthreshold;
   fMyPID = copy.fMyPID;
   fCutQuality = copy.fCutQuality;

   return *this;
}

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

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

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

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

   // check track
   AliVTrack *track = fDaughter->Ref2Vtrack();
   if (!track) {
      if (!fDaughter->GetRef()) AliWarning("NULL ref");
      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;

   // check quality and reject always bad quality tracks
   if (!fCutQuality.IsSelected(obj)) {
      AliDebugClass(1, Form("[%s] Track quality is bad", GetName()));
      return kFALSE;
   }

   // initialize check variables
   Bool_t   accept = kFALSE;
   Bool_t   isTOF  = MatchTOF(track);
   Double_t nsTPC  = 1E20;
   Double_t nsTOF  = 1E20;

   // if PID is required, compute it check initialization of PID object
   if (fMode >= kOnlyTPC && fMode <= kDefaultPID) {
      AliPIDResponse *pid = fEvent->GetPIDResponse();
      if (!pid) {
         AliFatal("NULL PID response");
         return kFALSE;
      }
      // TPC PID
      if (fMyPID)
         nsTPC = TMath::Abs(fMyPID->NumberOfSigmasTPC(track, AliPID::kKaon));
      else
         nsTPC = TMath::Abs(pid->NumberOfSigmasTPC(track, AliPID::kKaon));
      // TOF PID
      nsTOF = TMath::Abs(pid->NumberOfSigmasTOF(track, AliPID::kKaon));
   }

   // decide cut result depending on mode
   switch (fMode) {
      case kQuality:
         // in this case, since bad quality tracks are rejected above,
         // all tracks arrived here can be accepted
         AliDebugClass(1, Form("[%s] Required only track quality", GetName()));
         accept = kTRUE;
         break;
      case kOnlyTPC:
         // in this case, only TPC PID is checked
         // all tracks have one, so nothing additional is checked
         AliDebugClass(1, Form("[%s] Checking only TPC: nsigma = %f - cut = %f", GetName(), nsTPC, fCutTPC));
         accept = (nsTPC <= fCutTPC);
         break;
      case kOnlyTOF:
         // in this case, only TOF PID is checked
         // additional check: we want that TOF is matched
         AliDebugClass(1, Form("[%s] Checking only TOF: nsigma = %f - cut = %f", GetName(), nsTOF, fCutTOF));
         if (isTOF) {
            accept = (nsTOF <= fCutTOF);
         } else {
            AliDebugClass(1, Form("[%s] TOF not matched", GetName()));
            accept = kFALSE;
         }
         break;
      case kDefaultPID:
         // in this case, default PID check is done
         // TPC PID is checked and tracks are rejected if it is not passed
         // if their momentum is below the TOF threshold, they are required
         // to be matched in TOF, otherwise TPC only is OK
         AliDebugClass(1, Form("[%s] Default PID TPC: nsigma = %f - cut = %f", GetName(), nsTPC, fCutTPC));
         AliDebugClass(1, Form("[%s] Default PID TOF: nsigma = %f - cut = %f", GetName(), nsTOF, fCutTOF));
         // step 0: check TPC
         if (nsTPC > fCutTPC) {
            AliDebugClass(1, Form("[%s] TPC PID cut not passed", GetName()));
            accept = kFALSE;
         } else {
            if (isTOF) {
               accept = (nsTOF <= fCutTOF);
            } else {
               if (track->P() >= fTOFthreshold) {
                  AliDebugClass(1, Form("[%s] p = %f above threshold: TOF is required but missing", GetName(), track->P()));
                  accept = kFALSE;
               } else {
                  AliDebugClass(1, Form("[%s] p = %f below threshold: TOF is not required", GetName(), track->P()));
                  accept = kTRUE;
               }
            }
         }
         break;
      default:
         AliDebugClass(1, Form("[%s] Wrong mode", GetName()));
         accept = kFALSE;
   }

   AliDebugClass(1, Form("[%s] Track %s", GetName(), (accept ? "accepted" : "rejected")));
   return accept;
}
 AliRsnCutKaonForPhi2010.cxx:1
 AliRsnCutKaonForPhi2010.cxx:2
 AliRsnCutKaonForPhi2010.cxx:3
 AliRsnCutKaonForPhi2010.cxx:4
 AliRsnCutKaonForPhi2010.cxx:5
 AliRsnCutKaonForPhi2010.cxx:6
 AliRsnCutKaonForPhi2010.cxx:7
 AliRsnCutKaonForPhi2010.cxx:8
 AliRsnCutKaonForPhi2010.cxx:9
 AliRsnCutKaonForPhi2010.cxx:10
 AliRsnCutKaonForPhi2010.cxx:11
 AliRsnCutKaonForPhi2010.cxx:12
 AliRsnCutKaonForPhi2010.cxx:13
 AliRsnCutKaonForPhi2010.cxx:14
 AliRsnCutKaonForPhi2010.cxx:15
 AliRsnCutKaonForPhi2010.cxx:16
 AliRsnCutKaonForPhi2010.cxx:17
 AliRsnCutKaonForPhi2010.cxx:18
 AliRsnCutKaonForPhi2010.cxx:19
 AliRsnCutKaonForPhi2010.cxx:20
 AliRsnCutKaonForPhi2010.cxx:21
 AliRsnCutKaonForPhi2010.cxx:22
 AliRsnCutKaonForPhi2010.cxx:23
 AliRsnCutKaonForPhi2010.cxx:24
 AliRsnCutKaonForPhi2010.cxx:25
 AliRsnCutKaonForPhi2010.cxx:26
 AliRsnCutKaonForPhi2010.cxx:27
 AliRsnCutKaonForPhi2010.cxx:28
 AliRsnCutKaonForPhi2010.cxx:29
 AliRsnCutKaonForPhi2010.cxx:30
 AliRsnCutKaonForPhi2010.cxx:31
 AliRsnCutKaonForPhi2010.cxx:32
 AliRsnCutKaonForPhi2010.cxx:33
 AliRsnCutKaonForPhi2010.cxx:34
 AliRsnCutKaonForPhi2010.cxx:35
 AliRsnCutKaonForPhi2010.cxx:36
 AliRsnCutKaonForPhi2010.cxx:37
 AliRsnCutKaonForPhi2010.cxx:38
 AliRsnCutKaonForPhi2010.cxx:39
 AliRsnCutKaonForPhi2010.cxx:40
 AliRsnCutKaonForPhi2010.cxx:41
 AliRsnCutKaonForPhi2010.cxx:42
 AliRsnCutKaonForPhi2010.cxx:43
 AliRsnCutKaonForPhi2010.cxx:44
 AliRsnCutKaonForPhi2010.cxx:45
 AliRsnCutKaonForPhi2010.cxx:46
 AliRsnCutKaonForPhi2010.cxx:47
 AliRsnCutKaonForPhi2010.cxx:48
 AliRsnCutKaonForPhi2010.cxx:49
 AliRsnCutKaonForPhi2010.cxx:50
 AliRsnCutKaonForPhi2010.cxx:51
 AliRsnCutKaonForPhi2010.cxx:52
 AliRsnCutKaonForPhi2010.cxx:53
 AliRsnCutKaonForPhi2010.cxx:54
 AliRsnCutKaonForPhi2010.cxx:55
 AliRsnCutKaonForPhi2010.cxx:56
 AliRsnCutKaonForPhi2010.cxx:57
 AliRsnCutKaonForPhi2010.cxx:58
 AliRsnCutKaonForPhi2010.cxx:59
 AliRsnCutKaonForPhi2010.cxx:60
 AliRsnCutKaonForPhi2010.cxx:61
 AliRsnCutKaonForPhi2010.cxx:62
 AliRsnCutKaonForPhi2010.cxx:63
 AliRsnCutKaonForPhi2010.cxx:64
 AliRsnCutKaonForPhi2010.cxx:65
 AliRsnCutKaonForPhi2010.cxx:66
 AliRsnCutKaonForPhi2010.cxx:67
 AliRsnCutKaonForPhi2010.cxx:68
 AliRsnCutKaonForPhi2010.cxx:69
 AliRsnCutKaonForPhi2010.cxx:70
 AliRsnCutKaonForPhi2010.cxx:71
 AliRsnCutKaonForPhi2010.cxx:72
 AliRsnCutKaonForPhi2010.cxx:73
 AliRsnCutKaonForPhi2010.cxx:74
 AliRsnCutKaonForPhi2010.cxx:75
 AliRsnCutKaonForPhi2010.cxx:76
 AliRsnCutKaonForPhi2010.cxx:77
 AliRsnCutKaonForPhi2010.cxx:78
 AliRsnCutKaonForPhi2010.cxx:79
 AliRsnCutKaonForPhi2010.cxx:80
 AliRsnCutKaonForPhi2010.cxx:81
 AliRsnCutKaonForPhi2010.cxx:82
 AliRsnCutKaonForPhi2010.cxx:83
 AliRsnCutKaonForPhi2010.cxx:84
 AliRsnCutKaonForPhi2010.cxx:85
 AliRsnCutKaonForPhi2010.cxx:86
 AliRsnCutKaonForPhi2010.cxx:87
 AliRsnCutKaonForPhi2010.cxx:88
 AliRsnCutKaonForPhi2010.cxx:89
 AliRsnCutKaonForPhi2010.cxx:90
 AliRsnCutKaonForPhi2010.cxx:91
 AliRsnCutKaonForPhi2010.cxx:92
 AliRsnCutKaonForPhi2010.cxx:93
 AliRsnCutKaonForPhi2010.cxx:94
 AliRsnCutKaonForPhi2010.cxx:95
 AliRsnCutKaonForPhi2010.cxx:96
 AliRsnCutKaonForPhi2010.cxx:97
 AliRsnCutKaonForPhi2010.cxx:98
 AliRsnCutKaonForPhi2010.cxx:99
 AliRsnCutKaonForPhi2010.cxx:100
 AliRsnCutKaonForPhi2010.cxx:101
 AliRsnCutKaonForPhi2010.cxx:102
 AliRsnCutKaonForPhi2010.cxx:103
 AliRsnCutKaonForPhi2010.cxx:104
 AliRsnCutKaonForPhi2010.cxx:105
 AliRsnCutKaonForPhi2010.cxx:106
 AliRsnCutKaonForPhi2010.cxx:107
 AliRsnCutKaonForPhi2010.cxx:108
 AliRsnCutKaonForPhi2010.cxx:109
 AliRsnCutKaonForPhi2010.cxx:110
 AliRsnCutKaonForPhi2010.cxx:111
 AliRsnCutKaonForPhi2010.cxx:112
 AliRsnCutKaonForPhi2010.cxx:113
 AliRsnCutKaonForPhi2010.cxx:114
 AliRsnCutKaonForPhi2010.cxx:115
 AliRsnCutKaonForPhi2010.cxx:116
 AliRsnCutKaonForPhi2010.cxx:117
 AliRsnCutKaonForPhi2010.cxx:118
 AliRsnCutKaonForPhi2010.cxx:119
 AliRsnCutKaonForPhi2010.cxx:120
 AliRsnCutKaonForPhi2010.cxx:121
 AliRsnCutKaonForPhi2010.cxx:122
 AliRsnCutKaonForPhi2010.cxx:123
 AliRsnCutKaonForPhi2010.cxx:124
 AliRsnCutKaonForPhi2010.cxx:125
 AliRsnCutKaonForPhi2010.cxx:126
 AliRsnCutKaonForPhi2010.cxx:127
 AliRsnCutKaonForPhi2010.cxx:128
 AliRsnCutKaonForPhi2010.cxx:129
 AliRsnCutKaonForPhi2010.cxx:130
 AliRsnCutKaonForPhi2010.cxx:131
 AliRsnCutKaonForPhi2010.cxx:132
 AliRsnCutKaonForPhi2010.cxx:133
 AliRsnCutKaonForPhi2010.cxx:134
 AliRsnCutKaonForPhi2010.cxx:135
 AliRsnCutKaonForPhi2010.cxx:136
 AliRsnCutKaonForPhi2010.cxx:137
 AliRsnCutKaonForPhi2010.cxx:138
 AliRsnCutKaonForPhi2010.cxx:139
 AliRsnCutKaonForPhi2010.cxx:140
 AliRsnCutKaonForPhi2010.cxx:141
 AliRsnCutKaonForPhi2010.cxx:142
 AliRsnCutKaonForPhi2010.cxx:143
 AliRsnCutKaonForPhi2010.cxx:144
 AliRsnCutKaonForPhi2010.cxx:145
 AliRsnCutKaonForPhi2010.cxx:146
 AliRsnCutKaonForPhi2010.cxx:147
 AliRsnCutKaonForPhi2010.cxx:148
 AliRsnCutKaonForPhi2010.cxx:149
 AliRsnCutKaonForPhi2010.cxx:150
 AliRsnCutKaonForPhi2010.cxx:151
 AliRsnCutKaonForPhi2010.cxx:152
 AliRsnCutKaonForPhi2010.cxx:153
 AliRsnCutKaonForPhi2010.cxx:154
 AliRsnCutKaonForPhi2010.cxx:155
 AliRsnCutKaonForPhi2010.cxx:156
 AliRsnCutKaonForPhi2010.cxx:157
 AliRsnCutKaonForPhi2010.cxx:158
 AliRsnCutKaonForPhi2010.cxx:159
 AliRsnCutKaonForPhi2010.cxx:160
 AliRsnCutKaonForPhi2010.cxx:161
 AliRsnCutKaonForPhi2010.cxx:162
 AliRsnCutKaonForPhi2010.cxx:163
 AliRsnCutKaonForPhi2010.cxx:164
 AliRsnCutKaonForPhi2010.cxx:165
 AliRsnCutKaonForPhi2010.cxx:166
 AliRsnCutKaonForPhi2010.cxx:167
 AliRsnCutKaonForPhi2010.cxx:168
 AliRsnCutKaonForPhi2010.cxx:169
 AliRsnCutKaonForPhi2010.cxx:170
 AliRsnCutKaonForPhi2010.cxx:171
 AliRsnCutKaonForPhi2010.cxx:172
 AliRsnCutKaonForPhi2010.cxx:173
 AliRsnCutKaonForPhi2010.cxx:174
 AliRsnCutKaonForPhi2010.cxx:175
 AliRsnCutKaonForPhi2010.cxx:176
 AliRsnCutKaonForPhi2010.cxx:177
 AliRsnCutKaonForPhi2010.cxx:178
 AliRsnCutKaonForPhi2010.cxx:179
 AliRsnCutKaonForPhi2010.cxx:180
 AliRsnCutKaonForPhi2010.cxx:181
 AliRsnCutKaonForPhi2010.cxx:182
 AliRsnCutKaonForPhi2010.cxx:183
 AliRsnCutKaonForPhi2010.cxx:184
 AliRsnCutKaonForPhi2010.cxx:185
 AliRsnCutKaonForPhi2010.cxx:186
 AliRsnCutKaonForPhi2010.cxx:187
 AliRsnCutKaonForPhi2010.cxx:188
 AliRsnCutKaonForPhi2010.cxx:189
 AliRsnCutKaonForPhi2010.cxx:190
 AliRsnCutKaonForPhi2010.cxx:191
 AliRsnCutKaonForPhi2010.cxx:192
 AliRsnCutKaonForPhi2010.cxx:193
 AliRsnCutKaonForPhi2010.cxx:194
 AliRsnCutKaonForPhi2010.cxx:195
 AliRsnCutKaonForPhi2010.cxx:196
 AliRsnCutKaonForPhi2010.cxx:197
 AliRsnCutKaonForPhi2010.cxx:198
 AliRsnCutKaonForPhi2010.cxx:199
 AliRsnCutKaonForPhi2010.cxx:200
 AliRsnCutKaonForPhi2010.cxx:201
 AliRsnCutKaonForPhi2010.cxx:202
 AliRsnCutKaonForPhi2010.cxx:203
 AliRsnCutKaonForPhi2010.cxx:204
 AliRsnCutKaonForPhi2010.cxx:205
 AliRsnCutKaonForPhi2010.cxx:206
 AliRsnCutKaonForPhi2010.cxx:207