]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/RESONANCES/AliRsnCutDaughterSigmaStar2010PP.cxx
Added protection against invalid objects for AOD analysis
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / AliRsnCutDaughterSigmaStar2010PP.cxx
1 //
2 // All cuts for single pions in Sigma* analysis 2010,
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 "AliRsnCutDaughterSigmaStar2010PP.h"
14
15 ClassImp(AliRsnCutDaughterSigmaStar2010PP)
16
17 //__________________________________________________________________________________________________
18 AliRsnCutDaughterSigmaStar2010PP::AliRsnCutDaughterSigmaStar2010PP(const char *name, AliPID::EParticleType pid) :
19    AliRsnCut(name, AliRsnTarget::kDaughter),
20    fPID(pid),
21    fCutQuality(Form("%sQuality", name)),
22    fPIDCut(3.0),
23    fMinTPCcluster(70),
24    fDCARptFormula("")
25 {
26 //
27 // Constructor
28 // Initialize track quality cuts to 2010 defaults
29 //
30
31    fCutQuality.SetPtRange(0.15, 1E+20);
32    fCutQuality.SetEtaRange(-0.8, 0.8);
33    fCutQuality.SetDCARPtFormula(fDCARptFormula);
34    fCutQuality.SetDCAZmax(2.0);
35    fCutQuality.SetSPDminNClusters(1);
36    fCutQuality.SetITSminNClusters(0);
37    fCutQuality.SetITSmaxChi2(1E+20);
38    fCutQuality.SetTPCminNClusters(fMinTPCcluster);
39    fCutQuality.SetTPCmaxChi2(4.0);
40    fCutQuality.SetRejectKinkDaughters();
41    fCutQuality.SetAODTestFilterBit(5);
42 }
43
44 //__________________________________________________________________________________________________
45 Bool_t AliRsnCutDaughterSigmaStar2010PP::IsSelected(TObject *obj)
46 {
47 //
48 // Global check
49 //
50
51    // coherence check
52    if (!TargetOK(obj)) return kFALSE;
53
54    // check track
55    AliVTrack *track = fDaughter->Ref2Vtrack();
56    if (!track) {
57       if (!fDaughter->GetRef()) AliWarning("NULL ref");
58       return kFALSE;
59    }
60
61    AliDebugClass(2, "Checking status");
62
63
64    // check flags
65    if ((track->GetStatus() & AliESDtrack::kTPCin   ) == 0) return kFALSE;
66    if ((track->GetStatus() & AliESDtrack::kTPCrefit) == 0) return kFALSE;
67    if ((track->GetStatus() & AliESDtrack::kITSrefit) == 0) return kFALSE;
68
69    AliDebugClass(2, "Checking quality cuts");
70
71    // quality
72    if (!fCutQuality.IsSelected(obj)) return kFALSE;
73
74    AliDebugClass(2, "...passed");
75
76
77    // check initialization of PID object
78    AliPIDResponse *pid = fEvent->GetPIDResponse();
79    if (!pid) {
80       AliFatal("NULL PID response");
81       return kFALSE;
82    }
83
84    // check if TOF is matched
85    // and computes all values used in the PID cut
86    //Bool_t   isTOF  = MatchTOF(track);
87    //Double_t pTPC   = track->GetTPCmomentum();
88    //Double_t p      = track->P();
89    Double_t nsTPC  = TMath::Abs(pid->NumberOfSigmasTPC(track, fPID));
90    //Double_t nsTOF  = TMath::Abs(pid->NumberOfSigmasTOF(track, fPID));
91    Double_t maxTPC = 1E20;
92    //Double_t maxTOF = 1E20;
93
94    // applies the cut differently depending on the PID and the momentum
95    //if (isTOF) {
96    // TPC: 5sigma cut for all
97    //if (nsTPC > 5.0) return kFALSE;
98    // TOF: 3sigma below 1.5 GeV, 2sigma above
99    //if (p < 1.5) maxTOF = 3.0; else maxTOF = 2.0;
100    //return (nsTOF <= maxTOF);
101    //} else {
102
103    //For the moment TOF is not used - PID ONLY WITH TPC - 3 sigmas in the whole range
104
105    // TPC:
106    
107    maxTPC = fPIDCut;
108    return (nsTPC <= maxTPC);
109
110    AliDebugClass(2, "Good Pion (hallelujah)");
111    return kTRUE;
112 }