]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/RESONANCES/AliRsnCutSetDaughterParticle.cxx
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / AliRsnCutSetDaughterParticle.cxx
1 //
2 // Author: Francesca Bellini (fbellini@cern.ch)
3 //
4 //
5
6 #include <Riostream.h>
7
8 #include "AliPID.h"
9 #include "AliPIDResponse.h"
10 #include "AliRsnCutSetDaughterParticle.h"
11
12 class AliRsnCutPIDNSigma;
13 class AliRsnPIDRange;
14 class AliRsnCutPhi;
15
16 ClassImp(AliRsnCutSetDaughterParticle)
17
18 //__________________________________________________________________________________________________
19 AliRsnCutSetDaughterParticle::AliRsnCutSetDaughterParticle() :
20    AliRsnCutSet("AliRsnCutSetDaughterParticle", AliRsnTarget::kDaughter),
21    fPID(AliPID::kPion),
22    fAppliedCutSetID(AliRsnCutSetDaughterParticle::kNDaughterCuts),
23    fNsigmaTPC(1E20),
24    fNsigmaTOF(1E20),
25    fCutQuality(0x0),
26    fAODTrkCutFilterBit(0),
27    fCheckOnlyFilterBit(kTRUE),
28    fUseCustomQualityCuts(kFALSE),
29    fIsUse2011stdQualityCuts(kFALSE),  
30    fIsUse2011stdQualityCutsHighPt(kFALSE)
31 {
32    //
33    // Default constructor
34   SetPtRange(0.0, 1E20);
35   SetEtaRange(1E20, 1E20);
36 }
37
38 //__________________________________________________________________________________________________
39 AliRsnCutSetDaughterParticle::AliRsnCutSetDaughterParticle(const char *name, AliRsnCutSetDaughterParticle::ERsnDaughterCutSet cutSetID, AliPID::EParticleType pid, Float_t nSigmaFast = -1.0, Int_t AODfilterBit = 0, Bool_t useTPCCrossedRows=kTRUE) :
40    AliRsnCutSet(name, AliRsnTarget::kDaughter),
41    fPID(pid),
42    fAppliedCutSetID(cutSetID),
43    fNsigmaTPC(nSigmaFast),
44    fNsigmaTOF(nSigmaFast),
45    fCutQuality(new AliRsnCutTrackQuality("CutQuality")),
46    fAODTrkCutFilterBit(AODfilterBit),
47    fCheckOnlyFilterBit(kTRUE),
48    fUseCustomQualityCuts(kFALSE),
49    fIsUse2011stdQualityCuts(kFALSE),  
50    fIsUse2011stdQualityCutsHighPt(kFALSE)
51 {
52   //
53   // Constructor
54   //
55   //set here pt and eta range
56   SetPtRange(0.15, 20.0);
57   SetEtaRange(-0.8, 0.8);
58   
59   //if nsigma not specified, sets "no-PID" cuts
60   if (nSigmaFast<=0){
61     fNsigmaTPC=1e20;
62     fNsigmaTOF=1e20;
63     AliWarning("Requested fast n-sigma PID with negative value for n. --> Setting n = 1E20");
64   }
65   
66   //initialize quality std and PID cuts
67   InitStdQualityCuts(useTPCCrossedRows);
68   Init();
69 }
70
71 //__________________________________________________________________________________________________
72 AliRsnCutSetDaughterParticle::AliRsnCutSetDaughterParticle(const char *name, AliRsnCutTrackQuality *rsnTrackQualityCut, AliRsnCutSetDaughterParticle::ERsnDaughterCutSet cutSetID, AliPID::EParticleType pid, Float_t nSigmaFast = -1.0) :
73   AliRsnCutSet(name, AliRsnTarget::kDaughter),
74   fPID(pid),
75   fAppliedCutSetID(cutSetID),
76   fNsigmaTPC(nSigmaFast),
77   fNsigmaTOF(nSigmaFast),
78   fCutQuality(rsnTrackQualityCut),
79   fAODTrkCutFilterBit(0),
80   fCheckOnlyFilterBit(kFALSE),
81   fUseCustomQualityCuts(kFALSE),
82   fIsUse2011stdQualityCuts(kFALSE),  
83   fIsUse2011stdQualityCutsHighPt(kFALSE)
84 {
85   //
86   // Constructor: uses externally-defined track-quality cut object
87   //
88   if (!rsnTrackQualityCut) {
89     //if external track quality cut object not defined,
90     //sets default track quality to be initialised (with cut on TPC crossed rows) +
91     //sets here pt and eta cuts
92     InitStdQualityCuts(kTRUE);
93     SetPtRange(0.15, 20.0);
94     SetEtaRange(-0.8, 0.8);
95   } else {
96     //checks validity of passed quality-cut object
97     //if Ok, inherits all cuts including Pt and Eta cut
98     fCheckOnlyFilterBit=kFALSE;
99     fUseCustomQualityCuts = kTRUE;
100     SetPtRange(rsnTrackQualityCut->GetPtRange(0), rsnTrackQualityCut->GetPtRange(1));
101     SetEtaRange(rsnTrackQualityCut->GetEtaRange(0),rsnTrackQualityCut->GetEtaRange(1));
102     AliInfo("Custom quality cuts applied");
103     rsnTrackQualityCut->Print();
104   } 
105   
106   //if nsigma not specified, sets "no-PID" cuts
107   if (nSigmaFast<=0){
108     fNsigmaTPC=1e20;
109     fNsigmaTOF=1e20;
110     AliWarning("Requested fast n-sigma PID with negative value for n. --> Setting n = 1E20");
111   } 
112   
113   //initialize PID cuts
114   Init(); 
115 }
116
117
118 //__________________________________________________________________________________________________
119 AliRsnCutSetDaughterParticle::AliRsnCutSetDaughterParticle(const AliRsnCutSetDaughterParticle &copy) :
120   AliRsnCutSet(copy),
121   fPID(copy.fPID),
122   fAppliedCutSetID(copy.fAppliedCutSetID),
123   fNsigmaTPC(copy.fNsigmaTPC),
124   fNsigmaTOF(copy.fNsigmaTOF),
125   fCutQuality(copy.fCutQuality),
126   fAODTrkCutFilterBit(copy.fAODTrkCutFilterBit),
127   fCheckOnlyFilterBit(copy.fCheckOnlyFilterBit),
128   fUseCustomQualityCuts(copy.fUseCustomQualityCuts),
129   fIsUse2011stdQualityCuts(copy.fIsUse2011stdQualityCuts),  
130   fIsUse2011stdQualityCutsHighPt(copy.fIsUse2011stdQualityCutsHighPt)
131 {
132   //
133   // copy constructor
134   SetPtRange(copy.fPtRange[0], copy.fPtRange[1]);
135   SetEtaRange(copy.fEtaRange[0], copy.fEtaRange[1]);
136 }
137
138 //__________________________________________________________________________________________________
139 AliRsnCutSetDaughterParticle &AliRsnCutSetDaughterParticle::operator=(const AliRsnCutSetDaughterParticle &copy)
140 {
141    //
142    // operator =
143    //
144    AliRsnCutSet::operator=(copy);
145    if (this == &copy)
146       return *this;
147    fPID=copy.fPID;
148    fAppliedCutSetID=copy.fAppliedCutSetID;
149    fNsigmaTPC=copy.fNsigmaTPC;
150    fNsigmaTOF=copy.fNsigmaTOF;
151    fAODTrkCutFilterBit=copy.fAODTrkCutFilterBit;
152    fCheckOnlyFilterBit=copy.fCheckOnlyFilterBit;
153    fUseCustomQualityCuts=copy.fUseCustomQualityCuts;
154    fIsUse2011stdQualityCuts=copy.fIsUse2011stdQualityCuts;
155    fIsUse2011stdQualityCutsHighPt=copy.fIsUse2011stdQualityCutsHighPt; 
156    fCutQuality=copy.fCutQuality;
157    return (*this);
158 }
159
160 //----------------------------------------------------------------------------
161 AliRsnCutSetDaughterParticle::~AliRsnCutSetDaughterParticle()
162 {
163    //
164    //destructor
165    //
166    if (fCutQuality)
167       delete fCutQuality;
168 }
169
170 //----------------------------------------------------------------------------
171 void AliRsnCutSetDaughterParticle::Init()
172 {
173   
174   //define TOF match cut
175   AliRsnCutTOFMatch  *iCutTOFMatch     = new AliRsnCutTOFMatch("CutTOFMatch");
176   //define PID cuts
177   AliRsnCutPIDNSigma *iCutTPCNSigma    = new AliRsnCutPIDNSigma("CutTPCNSigma", fPID, AliRsnCutPIDNSigma::kTPC);//, AliRsnCutPIDNSigma::kTPCinnerP );
178   AliRsnCutPIDNSigma *iCutTPCTOFNSigma = new AliRsnCutPIDNSigma("CutTPCTOFNSigma", fPID, AliRsnCutPIDNSigma::kTPC);//, AliRsnCutPIDNSigma::kTPCinnerP );
179   AliRsnCutPIDNSigma *iCutTOFNSigma    = new AliRsnCutPIDNSigma("CutTOFNSigma", fPID, AliRsnCutPIDNSigma::kTOF);//, AliRsnCutPIDNSigma::kP );
180   //define phi (azimuthal angle) cuts for TRD presence
181   AliRsnCutPhi  *iCutPhiTRD2010        = new AliRsnCutPhi("CutPhiTRD2010","InTRD CheckTOF");
182   AliRsnCutPhi  *iCutPhiNoTRD2010      = new AliRsnCutPhi("CutPhiNoTRD2010","OutTRD CheckTOF");
183   
184   //
185   //defines cut schemes by combining quality cuts and PID cuts
186   //
187   switch (fAppliedCutSetID)
188     {
189       case AliRsnCutSetDaughterParticle::kNoCuts :
190          AliInfo("No cuts applied to daughter particle");
191          break;
192
193       case AliRsnCutSetDaughterParticle::kQualityStd2010 :
194          AddCut(fCutQuality);
195          SetCutScheme(fCutQuality->GetName());
196          break;
197
198       case AliRsnCutSetDaughterParticle::kQualityStd2011:
199          AddCut(fCutQuality);
200          SetCutScheme(fCutQuality->GetName());
201          break;
202
203     case AliRsnCutSetDaughterParticle::kQualityStd2011HighPt:
204          AddCut(fCutQuality);
205          SetCutScheme(fCutQuality->GetName());
206          break;
207
208       case AliRsnCutSetDaughterParticle::kTOFMatch :
209          AddCut(fCutQuality);
210          AddCut(iCutTOFMatch);
211          SetCutScheme( Form("%s&(%s)",fCutQuality->GetName(), iCutTOFMatch->GetName()) );
212          break;
213
214       case    AliRsnCutSetDaughterParticle::kFastTPCpidNsigma :
215          if (fNsigmaTPC <= 0.0) {
216             AliWarning(Form("Invalid number of sigmas required for %s. Setting default nSigma = 10",iCutTPCNSigma->GetName()));
217             SetNsigmaForFastTPCpid(10.0);
218          }
219          iCutTPCNSigma->SinglePIDRange(fNsigmaTPC);
220          AddCut(fCutQuality);
221          AddCut(iCutTPCNSigma);
222          SetCutScheme( Form("%s&%s",fCutQuality->GetName(), iCutTPCNSigma->GetName()) );
223          break;
224
225       case    AliRsnCutSetDaughterParticle::kFastTOFpidNsigma :
226          if (fNsigmaTOF <= 0.0) {
227             AliWarning(Form("Invalid number of sigmas required for %s. Setting default nSigma = 10",iCutTOFNSigma->GetName()));
228             SetNsigmaForFastTOFpid(10.0);
229          }
230          iCutTOFNSigma->SinglePIDRange(fNsigmaTOF);
231          //iCutTOFNSigma->AddPIDRange(3.0, 0.35, 1E20);
232          AddCut(fCutQuality);
233          AddCut(iCutTOFNSigma);
234          SetCutScheme( Form("%s&%s",fCutQuality->GetName(), iCutTOFNSigma->GetName()) );
235          break;
236
237       case    AliRsnCutSetDaughterParticle::kTPCTOFpidKstarPP2010 :
238          /* Set TPC  PID (if no TOF)*/
239          // all   below   350         MeV: 5sigma
240          // all   between 350 and 500 MeV: 3sigma
241          // pios above   500         MeV: 2sigma
242          // kaons between 500 and 700 MeV: 2sigma
243          // kaons above   700         MeV: rejected
244          iCutTPCNSigma->AddPIDRange(5.0, 0.0, 0.35);
245          iCutTPCNSigma->AddPIDRange(3.0, 0.35, 0.5);
246          if (fPID==AliPID::kPion)
247             iCutTPCNSigma->AddPIDRange(2.0, 0.5, 1E20);
248          if (fPID==AliPID::kKaon)
249             iCutTPCNSigma->AddPIDRange(2.0, 0.5, 0.7);
250
251          AddCut(fCutQuality);
252          AddCut(iCutTOFMatch);
253          AddCut(iCutTPCNSigma);
254
255          /* set TPC+TOF PID*/
256          iCutTPCTOFNSigma->SinglePIDRange(5.0);
257          iCutTOFNSigma->AddPIDRange(3.0, 0.0, 1.5);
258          iCutTOFNSigma->AddPIDRange(2.0, 1.5, 1E20);
259
260          AddCut(iCutTPCTOFNSigma);
261          AddCut(iCutTOFNSigma);
262
263          // scheme:
264          // quality & [ (TOF & TPCTOF) || (!TOFmatch & TPConly) ]
265          SetCutScheme( Form("%s&((%s&%s)|((!%s)&%s))",fCutQuality->GetName(), iCutTPCTOFNSigma->GetName(), iCutTOFNSigma->GetName(), iCutTOFMatch->GetName(), iCutTPCNSigma->GetName()) ) ;
266          break;
267
268       case AliRsnCutSetDaughterParticle::kTOFpidKstarPbPb2010:
269          if (fNsigmaTOF <= 0.0) {
270             AliWarning(Form("Invalid number of sigmas required for %s. Setting default nSigma = 10",iCutTOFNSigma->GetName()));
271             SetNsigmaForFastTOFpid(10.0);
272          }
273          iCutTOFNSigma->SinglePIDRange(fNsigmaTOF);
274          //iCutTOFNSigma->AddPIDRange(3.0, 0.35, 1E20);
275          iCutTPCTOFNSigma->SinglePIDRange(5.0); //5-sigma veto on tpc signal
276
277          AddCut(fCutQuality);
278          AddCut(iCutTOFNSigma);
279          AddCut(iCutTPCTOFNSigma);
280          SetCutScheme( Form("%s&%s&%s",fCutQuality->GetName(), iCutTOFNSigma->GetName(), iCutTPCTOFNSigma->GetName()) );
281          break;
282
283       case AliRsnCutSetDaughterParticle::kTOFTPCmismatchKstarPbPb2010:
284          iCutTPCTOFNSigma->SinglePIDRange(5.0); //5-sigma veto on tpc signal
285          AddCut(fCutQuality);
286          AddCut(iCutTOFMatch);
287          AddCut(iCutTPCTOFNSigma);
288          SetCutScheme( Form("%s&%s&%s",fCutQuality->GetName(), iCutTOFMatch->GetName(), iCutTPCTOFNSigma->GetName()) );
289          break;
290            
291    case AliRsnCutSetDaughterParticle::kTOFMatchTRD2010 :
292      AddCut(fCutQuality);
293      AddCut(iCutTOFMatch);
294      AddCut(iCutPhiTRD2010);
295      SetCutScheme( Form("%s&%s&%s",fCutQuality->GetName(), iCutTOFMatch->GetName(), iCutPhiTRD2010->GetName()) );
296      break;
297          
298    case AliRsnCutSetDaughterParticle::kTOFMatchNoTRD2010 :
299      AddCut(fCutQuality);
300      AddCut(iCutTOFMatch);
301      AddCut(iCutPhiNoTRD2010);
302      SetCutScheme( Form("%s&%s&%s",fCutQuality->GetName(), iCutTOFMatch->GetName(), iCutPhiNoTRD2010->GetName()) );
303      break;
304
305    case AliRsnCutSetDaughterParticle::kTOFpidKstarPbPbTRD2010:
306      if (fNsigmaTOF <= 0.0) {
307        AliWarning(Form("Invalid number of sigmas required for %s. Setting default nSigma = 10",iCutTOFNSigma->GetName()));
308        SetNsigmaForFastTOFpid(10.0);
309      }
310      iCutTOFNSigma->SinglePIDRange(fNsigmaTOF);
311      //iCutTOFNSigma->AddPIDRange(3.0, 0.35, 1E20);
312      iCutTPCTOFNSigma->SinglePIDRange(5.0); //5-sigma veto on tpc signal
313
314      AddCut(fCutQuality);
315      AddCut(iCutTOFNSigma);
316      AddCut(iCutTPCTOFNSigma);
317      AddCut(iCutPhiTRD2010);
318      SetCutScheme( Form("%s&%s&%s&%s",fCutQuality->GetName(), iCutTOFNSigma->GetName(), iCutTPCTOFNSigma->GetName(),iCutPhiTRD2010->GetName()) );
319      break;
320
321    case AliRsnCutSetDaughterParticle::kTOFpidKstarPbPbNoTRD2010:
322      if (fNsigmaTOF <= 0.0) {
323        AliWarning(Form("Invalid number of sigmas required for %s. Setting default nSigma = 10",iCutTOFNSigma->GetName()));
324        SetNsigmaForFastTOFpid(10.0);
325      }
326      iCutTOFNSigma->SinglePIDRange(fNsigmaTOF);
327      //iCutTOFNSigma->AddPIDRange(3.0, 0.35, 1E20);
328      iCutTPCTOFNSigma->SinglePIDRange(5.0); //5-sigma veto on tpc signal
329
330      AddCut(fCutQuality);
331      AddCut(iCutTOFNSigma);
332      AddCut(iCutTPCTOFNSigma);
333      AddCut(iCutPhiNoTRD2010);
334      SetCutScheme( Form("%s&%s&%s&%s",fCutQuality->GetName(), iCutTOFNSigma->GetName(), iCutTPCTOFNSigma->GetName(),iCutPhiNoTRD2010->GetName()) );
335      break;
336
337    case AliRsnCutSetDaughterParticle::kTOFMatchTPCpidNsigma :
338      if (fNsigmaTPC <= 0.0) {
339        AliWarning(Form("Invalid number of sigmas required for %s. Setting default nSigma = 10",iCutTPCNSigma->GetName()));
340        SetNsigmaForFastTPCpid(10.0);
341      }
342      iCutTPCNSigma->SinglePIDRange(fNsigmaTPC);
343      AddCut(fCutQuality);
344      AddCut(iCutTPCNSigma);
345      AddCut(iCutTOFMatch);      
346      SetCutScheme( Form("%s&%s&%s",fCutQuality->GetName(), iCutTPCNSigma->GetName(), iCutTOFMatch->GetName()) );
347      break;
348
349    case AliRsnCutSetDaughterParticle::kQualityStd2010TRD:
350      AddCut(fCutQuality);
351      AddCut(iCutPhiTRD2010);
352      SetCutScheme( Form("%s&%s",fCutQuality->GetName(),iCutPhiTRD2010->GetName()) );
353      break;
354      
355    case AliRsnCutSetDaughterParticle::kQualityStd2010NoTRD:
356      AddCut(fCutQuality);
357      AddCut(iCutPhiNoTRD2010);
358      SetCutScheme( Form("%s&%s",fCutQuality->GetName(),iCutPhiNoTRD2010->GetName()) );
359      break;
360    
361    case AliRsnCutSetDaughterParticle::kTOFMatchPPB2011: //pA analysis
362      AddCut(fCutQuality);
363      AddCut(iCutTOFMatch);
364      SetCutScheme( Form("%s&(%s)",fCutQuality->GetName(), iCutTOFMatch->GetName()) );
365      break;
366
367    case AliRsnCutSetDaughterParticle::kTPCpidKstarPPB2011:
368      if (fNsigmaTPC <= 0.0) {
369        AliWarning(Form("Invalid number of sigmas required for %s. Setting default nSigma = 10",iCutTPCNSigma->GetName()));
370        SetNsigmaForFastTPCpid(10.0);
371      }
372      iCutTPCNSigma->SinglePIDRange(fNsigmaTPC);
373      AddCut(fCutQuality);
374      AddCut(iCutTPCNSigma);
375      SetCutScheme( Form("%s&%s",fCutQuality->GetName(), iCutTPCNSigma->GetName()) );
376      break;
377     
378    case AliRsnCutSetDaughterParticle::kTOFpidKstarPPB2011:
379      if (fNsigmaTOF <= 0.0) {
380        AliWarning(Form("Invalid number of sigmas required for %s. Setting default nSigma = 10",iCutTOFNSigma->GetName()));
381        SetNsigmaForFastTOFpid(10.0);
382      }
383      iCutTOFNSigma->SinglePIDRange(fNsigmaTOF);
384      //iCutTOFNSigma->AddPIDRange(3.0, 0.35, 1E20);
385      iCutTPCTOFNSigma->SinglePIDRange(5.0); //5-sigma veto on tpc signal
386
387      AddCut(fCutQuality);
388      AddCut(iCutTOFNSigma);
389      AddCut(iCutTPCTOFNSigma);
390      SetCutScheme( Form("%s&%s&%s",fCutQuality->GetName(), iCutTOFNSigma->GetName(), iCutTPCTOFNSigma->GetName()) );
391      break;
392
393    case AliRsnCutSetDaughterParticle::kTPCTOFpidKstarPPB2011:
394      /* Set TPC  PID (if no TOF)*/
395      // all   below   350         MeV: 5sigma
396      // all   between 350 and 500 MeV: 3sigma
397      // pios above   500         MeV: 2sigma
398      // kaons between 500 and 700 MeV: 2sigma
399      // kaons above   700         MeV: rejected
400      iCutTPCNSigma->AddPIDRange(5.0, 0.0, 0.35);
401      iCutTPCNSigma->AddPIDRange(3.0, 0.35, 0.5);
402      if (fPID==AliPID::kPion)
403        iCutTPCNSigma->AddPIDRange(2.0, 0.5, 1E20);
404      if (fPID==AliPID::kKaon)
405        iCutTPCNSigma->AddPIDRange(2.0, 0.5, 0.7);
406
407      AddCut(fCutQuality);
408      AddCut(iCutTOFMatch);
409      AddCut(iCutTPCNSigma);
410
411      /* set TPC+TOF PID*/
412      iCutTPCTOFNSigma->SinglePIDRange(5.0);
413      iCutTOFNSigma->AddPIDRange(3.0, 0.0, 1.5);
414      iCutTOFNSigma->AddPIDRange(2.0, 1.5, 1E20);
415
416      AddCut(iCutTPCTOFNSigma);
417      AddCut(iCutTOFNSigma);
418          
419      // scheme:
420      // quality & [ (TOF & TPCTOF) || (!TOFmatch & TPConly) ]
421      SetCutScheme( Form("%s&((%s&%s)|((!%s)&%s))",fCutQuality->GetName(), iCutTPCTOFNSigma->GetName(), iCutTOFNSigma->GetName(), iCutTOFMatch->GetName(), iCutTPCNSigma->GetName()) ) ;
422      break;
423         
424            
425    case AliRsnCutSetDaughterParticle::kTPCTOFtightPidKStarPPB2011:
426      if (fNsigmaTPC <= 0.0) {
427        AliWarning(Form("Invalid number of sigmas required for %s. Setting nSigma = 5.0",iCutTPCNSigma->GetName()));
428        SetNsigmaForFastTPCpid(5.0);
429      }
430      iCutTPCNSigma->SinglePIDRange(fNsigmaTPC);
431      
432      if(fNsigmaTPC==3.0)
433        iCutTOFNSigma->SinglePIDRange(5.0);
434      if(fNsigmaTPC==2.0)
435        iCutTOFNSigma->SinglePIDRange(3.0);
436      
437      AddCut(fCutQuality);
438      AddCut(iCutTPCNSigma);
439      AddCut(iCutTOFNSigma);
440      
441      // scheme:
442      // quality & [ (TPCsigma & TOFsigma-2) ]
443      SetCutScheme( Form("%s&%s&%s",fCutQuality->GetName(),iCutTPCNSigma->GetName(),iCutTOFNSigma->GetName()) ) ;
444      break;
445      
446    case AliRsnCutSetDaughterParticle::kTPCpidMatchPPB2011:
447      if (fNsigmaTPC <= 0.0) {
448        AliWarning(Form("Invalid number of sigmas required for %s. Setting nSigma = 5.0",iCutTPCNSigma->GetName()));
449        SetNsigmaForFastTPCpid(5.0);
450      }
451      iCutTPCNSigma->SinglePIDRange(fNsigmaTPC);
452      AddCut(fCutQuality);
453      AddCut(iCutTPCNSigma);
454      AddCut(iCutTOFMatch);
455      SetCutScheme( Form("%s&%s&%s",fCutQuality->GetName(), iCutTPCNSigma->GetName(),iCutTOFMatch->GetName()) );
456      break;
457
458     case AliRsnCutSetDaughterParticle::kTPCpidTOFveto4s:
459       if (fNsigmaTPC <= 0.0) {
460         AliWarning(Form("Invalid number of sigmas required for %s. Setting nSigma = 5.0",iCutTPCNSigma->GetName()));
461         SetNsigmaForFastTPCpid(5.0);
462       }
463       iCutTPCNSigma->SinglePIDRange(fNsigmaTPC);
464       AddCut(fCutQuality);
465       iCutTOFNSigma->SinglePIDRange(4.0);
466
467       AddCut(iCutTPCNSigma);
468       AddCut(iCutTOFMatch);
469       AddCut(iCutTOFNSigma);
470       
471       // scheme:
472       // quality & [ (TPCsigma & !TOFmatch) | (TPCsigma & TOFsigma) ]
473       SetCutScheme( Form("%s&((%s&(!%s))|(%s&%s))",fCutQuality->GetName(), iCutTPCNSigma->GetName(), iCutTOFMatch->GetName(),iCutTOFNSigma->GetName(), iCutTPCNSigma->GetName()) ) ;
474        break;
475
476     case AliRsnCutSetDaughterParticle::kTPCpidTOFveto3s:
477       if (fNsigmaTPC <= 0.0) {
478         AliWarning(Form("Invalid number of sigmas required for %s. Setting nSigma = 5.0",iCutTPCNSigma->GetName()));
479         SetNsigmaForFastTPCpid(5.0);
480       }
481       iCutTPCNSigma->SinglePIDRange(fNsigmaTPC);
482       AddCut(fCutQuality);
483       iCutTOFNSigma->SinglePIDRange(3.0);
484
485       AddCut(iCutTPCNSigma);
486       AddCut(iCutTOFMatch);
487       AddCut(iCutTOFNSigma);
488       
489       // scheme:
490       // quality & [ (TPCsigma & !TOFmatch) | (TPCsigma & TOFsigma) ]
491       SetCutScheme( Form("%s&((%s&(!%s))|(%s&%s))",fCutQuality->GetName(), iCutTPCNSigma->GetName(), iCutTOFMatch->GetName(),iCutTOFNSigma->GetName(), iCutTPCNSigma->GetName()) ) ;
492        break;     
493
494     case AliRsnCutSetDaughterParticle::kCombinedPidBestPtDep:
495       /* Set TPC  PID (if no TOF)*/
496       // all   below  500 MeV: 3sigma
497       // all above 500 MeV: 2sigma
498       iCutTPCNSigma->AddPIDRange(3.0, 0.0, 0.5);
499       iCutTPCNSigma->AddPIDRange(2.0, 0.5, 1E20);
500       
501       AddCut(fCutQuality);
502       AddCut(iCutTOFMatch);
503       AddCut(iCutTPCNSigma);
504       
505       /* set TPC+TOF PID*/
506       // pions if TOF match: TPC 5 sigma & TOF 3 sigma
507       // kaons if TOF match: 
508       //            below 1.5GeV/c: TPC 5 sigma & TOF 3 sigma
509       //            above 1.5GeV/c: TPC 3 sigma & TOF 3 sigma
510
511       if (fPID==AliPID::kPion){
512         iCutTPCTOFNSigma->SinglePIDRange(5.0);
513       }
514       
515       if (fPID==AliPID::kKaon){
516         iCutTPCTOFNSigma->AddPIDRange(5.0, 0.0, 1.5);
517         iCutTPCTOFNSigma->AddPIDRange(3.0, 1.5, 1E20);
518       }
519       iCutTOFNSigma->AddPIDRange(3.0, 0.0, 1E20);
520       AddCut(iCutTPCTOFNSigma);
521       AddCut(iCutTOFNSigma);
522          
523      // scheme:
524      // quality & [ (TOF & TPCTOF) || (!TOFmatch & TPConly) ]
525      SetCutScheme( Form("%s&((%s&%s)|((!%s)&%s))",fCutQuality->GetName(), iCutTPCTOFNSigma->GetName(), iCutTOFNSigma->GetName(), iCutTOFMatch->GetName(), iCutTPCNSigma->GetName()) ) ;
526      break;
527       
528     case AliRsnCutSetDaughterParticle::kTPCPidPtDep:
529       /* Set TPC  PID (if no TOF)*/
530       // all   below  500 MeV: 3sigma
531       // all above 500 MeV: 2sigma
532       iCutTPCNSigma->AddPIDRange(3.0, 0.0, 0.5);
533       iCutTPCNSigma->AddPIDRange(2.0, 0.5, 1E20);
534       
535       AddCut(fCutQuality);
536       AddCut(iCutTPCNSigma);
537       // scheme:
538      // quality & TPConly
539      SetCutScheme( Form("%s&%s",fCutQuality->GetName(), iCutTPCNSigma->GetName()) ) ;
540      break;
541
542     case AliRsnCutSetDaughterParticle::kTOFPidPtDep:
543       /* Set TOF  PID */
544       // all   below  1500 MeV: 3sigma
545       // all above 1500 MeV: 2sigma
546       //TPC 5 sigma always to remove mismatch
547       iCutTPCTOFNSigma->SinglePIDRange(5.0);
548       iCutTOFNSigma->AddPIDRange(3.0, 0.0, 1.5);
549       iCutTOFNSigma->AddPIDRange(2.0, 1.5, 1E20);
550       
551       AddCut(fCutQuality);
552       AddCut(iCutTPCTOFNSigma);
553       AddCut(iCutTOFNSigma);
554       // scheme:
555       // quality & TPConly
556       SetCutScheme( Form("%s&%s&%s", fCutQuality->GetName(), iCutTPCTOFNSigma->GetName(), iCutTOFNSigma->GetName()) ) ;
557       break;
558
559     case AliRsnCutSetDaughterParticle::kTPCRejPtDepTOFNsigma:
560       /* Set TOF  PID */
561       // TPC mismatch rejection:
562       //             below  1.500 GeV: 5sigma
563       //             above  1.500 GeV: 3sigma
564       // TOF nsigma PID in full pT
565       iCutTPCTOFNSigma->AddPIDRange(5.0, 0.0, 1.5);
566       iCutTPCTOFNSigma->AddPIDRange(3.0, 1.5, 1E20);
567       
568       if (fNsigmaTOF <= 0.0) {
569         AliWarning(Form("Invalid number of sigmas required for %s. Setting default nSigma = 10",iCutTOFNSigma->GetName()));
570         SetNsigmaForFastTOFpid(10.0);
571       }
572       iCutTOFNSigma->SinglePIDRange(fNsigmaTOF);
573       
574       AddCut(fCutQuality);
575       AddCut(iCutTPCTOFNSigma);
576       AddCut(iCutTOFNSigma);
577       // scheme:
578       // quality & TPConly
579       SetCutScheme( Form("%s&%s&%s", fCutQuality->GetName(), iCutTPCTOFNSigma->GetName(), iCutTOFNSigma->GetName()) ) ;
580       break;
581       
582     case AliRsnCutSetDaughterParticle::kTPCNsigmaTOFVetoPtDep:
583       /* Set TPC  PID */
584       // TOF veto:
585       //             below  1.500 GeV: 5sigma
586       //             above  1.500 GeV: 3sigma
587       // TPC nsigma PID in full pT
588       if (fNsigmaTPC <= 0.0) {
589         AliWarning(Form("Invalid number of sigmas required for %s. Setting default nSigma = 10",iCutTPCNSigma->GetName()));
590         SetNsigmaForFastTPCpid(10.0);
591       }
592       iCutTPCNSigma->SinglePIDRange(fNsigmaTPC);
593       
594       iCutTOFNSigma->AddPIDRange(3.0, 0.0, 1.5);
595       iCutTOFNSigma->AddPIDRange(4.0, 1.5, 1E20);
596       
597       AddCut(fCutQuality);
598       AddCut(iCutTPCNSigma);
599       AddCut(iCutTOFMatch);
600       AddCut(iCutTOFNSigma);
601       
602       // scheme:
603       // quality & [ (TPCsigma & !TOFmatch) | (TPCsigma & TOFsigma) ]
604       SetCutScheme( Form("%s&((%s&(!%s))|(%s&%s))",fCutQuality->GetName(), iCutTPCNSigma->GetName(), iCutTOFMatch->GetName(),iCutTOFNSigma->GetName(), iCutTPCNSigma->GetName()) ) ;
605       break;
606       
607     case    AliRsnCutSetDaughterParticle::kTPCTOFpidLstar :      
608       if (fPID==AliPID::kProton) {
609         iCutTPCNSigma->AddPIDRange(fNsigmaTPC, 0.0, 1.1);
610       }
611       if (fPID==AliPID::kKaon) {
612         iCutTPCNSigma->AddPIDRange(fNsigmaTPC, 0.0, 0.6);
613       }
614       
615       AddCut(fCutQuality);
616       AddCut(iCutTOFMatch);
617       AddCut(iCutTPCNSigma);
618       
619       /* set TPC+TOF PID*/
620       iCutTPCTOFNSigma->SinglePIDRange(5.0);
621       iCutTOFNSigma->AddPIDRange(fNsigmaTOF, 0.0, 10);
622       
623       AddCut(iCutTPCTOFNSigma);
624       AddCut(iCutTOFNSigma);
625       
626       // scheme:
627       // quality & [ (TOF & TPCTOF) || (!TOFmatch & TPConly) ]
628       SetCutScheme( Form("%s&((%s&%s)|((!%s)&%s))",fCutQuality->GetName(), iCutTPCTOFNSigma->GetName(), iCutTOFNSigma->GetName(), iCutTOFMatch->GetName(), iCutTPCNSigma->GetName()) ) ;
629       break;
630       
631     default :
632       break;
633     }
634   
635 }
636
637
638 //-----------------------------------------------
639 void AliRsnCutSetDaughterParticle::PrintTrackQualityCuts()
640 {
641   //Prints track quality cuts
642   fCutQuality->Print();
643   return;
644 }
645
646 //-----------------------------------------------
647 void AliRsnCutSetDaughterParticle::InitStdQualityCuts(Bool_t useTPCCrossedRows)
648 {
649   // initialize quality std (if not externally defined) and PID cuts
650   // init cut sets by setting variable params
651   // 
652   // Bool_t isUse2011stdQualityCutsHighPt = ((fAppliedCutSetID==AliRsnCutSetDaughterParticle::kQualityStd2011HighPt) ||
653   //                                      (fAppliedCutSetID==AliRsnCutSetDaughterParticle::kTOFMatchPPB2011) || //pA analysis
654   //                                      (fAppliedCutSetID==AliRsnCutSetDaughterParticle::kTPCpidKstarPPB2011) ||
655   //                                      (fAppliedCutSetID==AliRsnCutSetDaughterParticle::kTOFpidKstarPPB2011) ||
656   //                                      (fAppliedCutSetID==AliRsnCutSetDaughterParticle::kTPCTOFpidKstarPPB2011) ||
657   //                                      (fAppliedCutSetID==AliRsnCutSetDaughterParticle::kTPCpidTOFvetoKStarPPB2011) ||
658   //                                      (fAppliedCutSetID==AliRsnCutSetDaughterParticle::kTPCpidMatchPPB2011));
659   
660   // Bool_t isUse2011stdQualityCuts = (fAppliedCutSetID==AliRsnCutSetDaughterParticle::kQualityStd2011);
661
662   if (fAppliedCutSetID==AliRsnCutSetDaughterParticle::kQualityStd2011) {
663     fIsUse2011stdQualityCuts = kTRUE;
664     fIsUse2011stdQualityCutsHighPt = kFALSE;
665   } 
666   if (fAppliedCutSetID==AliRsnCutSetDaughterParticle::kQualityStd2011HighPt) {
667     fIsUse2011stdQualityCuts = kFALSE;
668     fIsUse2011stdQualityCutsHighPt = kTRUE;
669   }
670   
671   if (fIsUse2011stdQualityCuts) {
672     AliInfo(Form("Using 2011 std quality cuts with cut on TPC %s",(useTPCCrossedRows?"crossed rows":"N clusters")));
673     fCutQuality->SetDefaults2011(useTPCCrossedRows, kFALSE);//uses filter bit 5 as default
674   } else {
675     if (fIsUse2011stdQualityCutsHighPt) {
676       AliInfo(Form("Using 2011 std quality cuts with cut on TPC %s for high-pT", (useTPCCrossedRows?"crossed rows":"N clusters")));
677       fCutQuality->SetDefaultsHighPt2011(useTPCCrossedRows, kFALSE);//uses filter bit 10 as default
678     } else {
679       AliInfo(Form("Using 2010 std quality cuts with cut on TPC %s", (useTPCCrossedRows?"crossed rows":"N clusters")));
680       fCutQuality->SetDefaults2010(useTPCCrossedRows, kFALSE);
681     }
682   }
683   fCutQuality->SetAODTestFilterBit(fAODTrkCutFilterBit); //changes default filter bit to the chosen filter bit
684   AliInfo(Form("Applying cut on AOD filter bit %i", fAODTrkCutFilterBit));
685   //apply pt and eta cuts
686   fCutQuality->SetPtRange(fPtRange[0], fPtRange[1]);
687   fCutQuality->SetEtaRange(fEtaRange[0], fEtaRange[1]);
688   AliInfo(Form("Pt range [%3.2f,%3.2f], Eta range [%3.2f, %3.2f]", fPtRange[0], fPtRange[1], fEtaRange[0], fEtaRange[1]));
689   return;
690 }