]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/RESONANCES/AliRsnCutDaughterD0.cxx
Added new class for D0 daughter cuts (Massimo)
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / AliRsnCutDaughterD0.cxx
1 //
2 // All cuts for single track in D0 analysis,
3 // based on track quality and particle identification
4 // with TPC and TOF.
5 // Author: Massimo Venaruzzo
6 //
7 //
8
9 #include <Riostream.h>
10
11 #include "AliPID.h"
12 #include "AliPIDResponse.h"
13 #include "AliRsnCutDaughterD0.h"
14
15 ClassImp(AliRsnCutDaughterD0)
16
17 //__________________________________________________________________________________________________
18 AliRsnCutDaughterD0::AliRsnCutDaughterD0(const char *name, AliPID::EParticleType pid) :
19 AliRsnCut(name, AliRsnTarget::kDaughter),
20   fNoPID(kFALSE),
21   fPID(pid),
22   fCutQuality(Form("%sQuality", name)),
23   fPionTPCPIDCut(3.0),
24   fKaonTPCPIDCut(3.0),
25   fPionTOFPIDCut(3.0),
26   fKaonTOFPIDCut(3.0)
27 {
28   //
29   // Constructor
30   // Initialize track quality cuts to 2010 defaults
31   //
32
33   fCutQuality.SetPtRange(0.15, 1E+20);
34   fCutQuality.SetEtaRange(-0.8, 0.8);
35   fCutQuality.SetDCARPtFormula("0.0105+0.0350/pt^1.1");
36   fCutQuality.SetDCARmin(0.0);
37   fCutQuality.SetDCAZmax(2.0);
38   fCutQuality.SetSPDminNClusters(1);
39   fCutQuality.SetITSminNClusters(0);
40   fCutQuality.SetITSmaxChi2(1E+20);
41   fCutQuality.SetTPCminNClusters(70);
42   fCutQuality.SetTPCmaxChi2(4.0);
43   fCutQuality.SetRejectKinkDaughters();
44   fCutQuality.SetAODTestFilterBit(5);
45 }
46
47 //__________________________________________________________________________________________________
48 Bool_t AliRsnCutDaughterD0::IsSelected(TObject *obj)
49 {
50   //
51   // Global check
52   //
53
54   // coherence check
55   if (!TargetOK(obj)) return kFALSE;
56
57   // check track
58   AliVTrack *track = dynamic_cast<AliVTrack *>(fDaughter->GetRef());
59   if (!track) return kFALSE;
60    
61   AliDebugClass(2, "Checking status...");
62   // check flags
63   if ((track->GetStatus() & AliESDtrack::kTPCin   ) == 0) return kFALSE;
64   if ((track->GetStatus() & AliESDtrack::kTPCrefit) == 0) return kFALSE;
65   if ((track->GetStatus() & AliESDtrack::kITSrefit) == 0) return kFALSE;
66   AliDebugClass(2, "...passed");
67   
68   // quality
69   AliDebugClass(2, "Checking quality cuts...");
70   if (!fCutQuality.IsSelected(obj)) return kFALSE;
71   AliDebugClass(2, "...passed");
72
73   // if no PID is required, accept
74   if (fNoPID) return kTRUE;
75   
76   // check initialization of PID object
77   AliPIDResponse *pid = fEvent->GetPIDResponse();
78   if (!pid) {
79     AliFatal("NULL PID response");
80     return kFALSE;
81   }
82   
83   AliDebugClass(2, "Checking TOF Matching..."); 
84   // check if TOF is matched
85   // and computes all values used in the PID cut
86   Bool_t   isTOF  = MatchTOF(track);   
87   AliDebugClass(2, "...passed");
88    
89   // Double_t pTPC   = track->GetTPCmomentum();
90   // Double_t p      = track->P();
91   Double_t nsTPC  = TMath::Abs(pid->NumberOfSigmasTPC(track, fPID));
92   Double_t nsTOF  = isTOF ? TMath::Abs(pid->NumberOfSigmasTOF(track, fPID)) : 1E20;
93   Double_t maxTPC = 1E20;
94   Double_t maxTOF = 1E20;
95   AliDebugClass(2, "Checking PID...");
96
97   // applies the cut differently depending on the PID and the momentum
98   if (isTOF) {
99     if (fPID == AliPID::kPion) {maxTPC = fPionTPCPIDCut; maxTOF = fPionTOFPIDCut;}
100     if (fPID == AliPID::kKaon) {maxTPC = fKaonTPCPIDCut; maxTOF = fKaonTOFPIDCut;}
101     return (nsTPC <= maxTPC && nsTOF <= maxTOF);
102   } else {
103     if (fPID == AliPID::kPion) maxTPC = fPionTPCPIDCut;
104     if (fPID == AliPID::kKaon) maxTPC = fKaonTPCPIDCut;
105     return (nsTPC <= maxTPC); 
106   }     
107   
108   AliDebugClass(2, "...passed"); 
109   // if we reach this point, all checks were successful
110   AliDebugClass(2, "Good Pion/Kaon Candidate Found!!");
111 }