]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/RESONANCES/AliRsnCutDaughterD0.cxx
Merge branch 'master' into dev
[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   fPtDepPIDCut(kFALSE),
22   fPID(pid),
23   fCutQuality(Form("%sQuality", name)),
24   fPionTPCPIDCut(3.0),
25   fKaonTPCPIDCut(3.0),
26   fPionTOFPIDCut(3.0),
27   fKaonTOFPIDCut(3.0)
28 {
29   //
30   // Constructor
31   // Initialize track quality cuts to 2010 defaults
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   if(!fPtDepPIDCut){
98     // applies the cut differently depending on the PID and the momentum
99     if (isTOF) {
100       if (fPID == AliPID::kPion) {maxTPC = fPionTPCPIDCut; maxTOF = fPionTOFPIDCut;}
101       if (fPID == AliPID::kKaon) {maxTPC = fKaonTPCPIDCut; maxTOF = fKaonTOFPIDCut;}
102       return (nsTPC <= maxTPC && nsTOF <= maxTOF);
103     } else {
104       if (fPID == AliPID::kPion) maxTPC = fPionTPCPIDCut;
105       if (fPID == AliPID::kKaon) maxTPC = fKaonTPCPIDCut;
106       return (nsTPC <= maxTPC); 
107     }
108   } else {
109     // applies the cut differently depending on the PID and the momentum
110     if (isTOF) {
111       // TPC: 5sigma cut for all
112       if (nsTPC > 5.0) return kFALSE;
113       // TOF: 3sigma below 1.5 GeV, 2sigma above
114       if (p < 1.5) maxTOF = 3.0; else maxTOF = 2.0;
115       return (nsTOF <= maxTOF);
116     } else {
117       // TPC:
118       // all   below   350         MeV: 5sigma
119       // all   between 350 and 500 MeV: 3sigma
120       // pions above   500         MeV: 2sigma
121       // kaons between 500 and 700 MeV: 2sigma
122       // kaons above   700         MeV: rejected
123       if (pTPC <= 0.35)
124         maxTPC = 5.0;
125       else if (pTPC > 0.35 && pTPC <= 0.5)
126         maxTPC = 3.0;
127       else {
128         if (fPID == AliPID::kPion)
129           maxTPC = 2.0;
130         else if (fPID == AliPID::kKaon) {
131           if (pTPC <= 0.7)
132             maxTPC = 2.0;
133           else
134             return kFALSE;
135         }
136       }
137       return (nsTPC <= maxTPC);
138     } 
139   }    
140   
141   AliDebugClass(2, "...passed"); 
142   // if we reach this point, all checks were successful
143   AliDebugClass(2, "Good Pion/Kaon Candidate Found!!");
144 }