]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/RESONANCES/AliRsnCutDelta.cxx
Corrected guard
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / AliRsnCutDelta.cxx
1 //
2 // This cut implements all the checks done to accept a track as a proton or pion
3 // for the pp 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.
6 //
7
8 #include <Riostream.h>
9
10 #include "AliPID.h"
11 #include "AliPIDResponse.h"
12 #include "AliRsnCutDelta.h"
13
14 ClassImp(AliRsnCutDelta)
15
16 //__________________________________________________________________________________________________
17 AliRsnCutDelta::AliRsnCutDelta(const char *name,AliPID::EParticleType pid, Bool_t TPCMethod) :
18    AliRsnCut(name, AliRsnTarget::kDaughter),
19    fPID(pid),
20    fNSigmaTPC(3.0),
21    fLimitTPC(0.350),
22    fNSigmaTOF(3.0),
23    fTPCMethod(TPCMethod),
24    fNSigmaTPCProton(3.0),
25    fNSigmaTPCPion(3.0),
26    fNSigmaTOFProton(3.0),
27    fNSigmaTOFPion(3.0),
28    fTPCMomProton(1.1),
29    fTOFMomProton(2.5),
30    fEtaRange(0.8),
31    fTPCNCluster(70),
32    fPtDepDCASigma(7.0),
33
34    fCutQuality(Form("%sQuality", name))
35 {
36 //
37 // Constructor
38 // Initialize the contained cuts and sets defaults
39 //
40     Double_t a=0; a=fPtDepDCASigma*0.0026; //This will be used in pt dep dca formula
41     Double_t b=0; b=fPtDepDCASigma*0.05;   //This will also be used in pt dep dca formula
42
43    // track quality 
44    fCutQuality.SetPtRange(0.15, 1E+20);
45    fCutQuality.SetEtaRange(-fEtaRange, fEtaRange);
46    fCutQuality.SetDCARPtFormula(Form("%f+%f/pt^1.01",a,b));    //("0.0182+0.0350/pt^1.01");
47    fCutQuality.SetDCAZmax(2.0);
48    fCutQuality.SetSPDminNClusters(1);
49    fCutQuality.SetITSminNClusters(0);
50    fCutQuality.SetITSmaxChi2(1E+20);
51    fCutQuality.SetTPCminNClusters(fTPCNCluster);
52    fCutQuality.SetTPCmaxChi2(4.0);
53    fCutQuality.SetRejectKinkDaughters();
54    fCutQuality.SetAODTestFilterBit(5);
55 }
56 //
57 //__________________________________________________________________________________________________
58 Bool_t AliRsnCutDelta::IsSelected(TObject *obj)
59 {
60 //
61 // Global check
62 //
63
64    // coherence check
65    if (!TargetOK(obj)) return kFALSE;
66    
67    // check track
68    AliVTrack *track = fDaughter->Ref2Vtrack();
69    if (!track) {
70       if (!fDaughter->GetRef()) AliWarning("NULL ref");
71       return kFALSE;
72    }
73    
74    // check flags
75    if ((track->GetStatus() & AliESDtrack::kTPCin   ) == 0) return kFALSE;
76    if ((track->GetStatus() & AliESDtrack::kTPCrefit) == 0) return kFALSE;
77    if ((track->GetStatus() & AliESDtrack::kITSrefit) == 0) return kFALSE;
78    
79    // quality
80    if (!fCutQuality.IsSelected(obj)) return kFALSE;
81
82
83    
84    // check initialization of PID object
85    AliPIDResponse *pid = fEvent->GetPIDResponse();
86    if (!pid) {
87       AliFatal("NULL PID response");
88       return kFALSE;
89    }
90    
91    // check if TOF is matched
92    // and computes all values used in the PID cut
93    Bool_t   isTOF               = MatchTOF(track);
94    Double_t pTPC                = track->GetTPCmomentum();
95    Double_t pTOF                = track->P();
96    Double_t nsTPC               = TMath::Abs(pid->NumberOfSigmasTPC(track, fPID));
97    Double_t nsTPCProton         = TMath::Abs(pid->NumberOfSigmasTPC(track, AliPID::kProton));
98    Double_t nsTPCPion           = TMath::Abs(pid->NumberOfSigmasTPC(track, AliPID::kPion));
99    Double_t nsTOFProton         = TMath::Abs(pid->NumberOfSigmasTOF(track, AliPID::kProton));
100    Double_t nsTOF               = TMath::Abs(pid->NumberOfSigmasTOF(track, fPID));
101    Double_t maxTPC              = 1E20;
102    Double_t maxTOF              = 1E20;
103
104         if (fTPCMethod) {
105                 if(fPID == AliPID::kPion) { 
106  
107                   if(nsTPCPion>fNSigmaTPCPion) return kFALSE;
108                   maxTPC = fNSigmaTPCPion; 
109                   if(nsTPC > maxTPC) return kFALSE;
110                   return kTRUE;
111
112                 }
113                 else if (fPID == AliPID::kProton) { 
114
115                   if(nsTPCPion<=fNSigmaTPCPion) return kFALSE;
116                   if(pTPC>=fTPCMomProton) return kFALSE; 
117                   if(nsTPCProton>fNSigmaTPCProton) return kFALSE;
118                   maxTPC = fNSigmaTPCProton; 
119                   if(nsTPC > maxTPC) return kFALSE;
120                   return kTRUE;
121
122                 }
123
124         } else {
125
126                 if(fPID == AliPID::kProton) {  
127
128                   if(!isTOF) return kFALSE;
129                   if(nsTPCProton>fNSigmaTPCProton) return kFALSE;
130                   if(pTOF >= fTOFMomProton) return kFALSE;
131                   if(nsTOFProton>fNSigmaTOFProton) return kFALSE;
132                   maxTOF = fNSigmaTOFProton;
133                   if (nsTOF > maxTOF) return kFALSE; 
134                   return kTRUE;
135
136                 }
137
138                 else if (fPID == AliPID::kPion) { 
139
140                   if(isTOF && nsTPCProton<=fNSigmaTPCProton && pTOF < fTOFMomProton && nsTOFProton<=fNSigmaTOFProton) return kFALSE; 
141
142                   if(nsTPCPion>fNSigmaTPCPion) return kFALSE;
143                   maxTPC = fNSigmaTPCPion;
144                   if (nsTPC > maxTPC) return kFALSE; 
145                   return kTRUE;
146
147                 }//pion pid
148
149         } //else tpcmethod
150 return kTRUE;
151 }
152
153 Bool_t AliRsnCutDelta::MatchTOF(const AliVTrack *vtrack)
154 {
155     //
156     // Checks if the track has matched the TOF detector
157     //
158     
159     if (!vtrack) {
160         AliWarning("NULL argument: impossible to check status");
161         return kFALSE;
162     }
163     
164     Bool_t isTOFout = ((vtrack->GetStatus() & AliESDtrack::kTOFout) != 0);
165     Bool_t isTIME   = ((vtrack->GetStatus() & AliESDtrack::kTIME) != 0);
166     
167     return (isTOFout && isTIME);
168 }
169