]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGDQ/dielectron/AliDielectronTrackCuts.cxx
including switch to set on/off iso-track core removal, cleaning and bug fix
[u/mrichter/AliRoot.git] / PWGDQ / dielectron / AliDielectronTrackCuts.cxx
CommitLineData
164bfb53 1/*************************************************************************
2* Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
3* *
4* Author: The ALICE Off-line Project. *
5* Contributors are mentioned in the code where appropriate. *
6* *
7* Permission to use, copy, modify and distribute this software and its *
8* documentation strictly for non-commercial purposes is hereby granted *
9* without fee, provided that the above copyright notice appears in all *
10* copies and that both the copyright notice and this permission notice *
11* appear in the supporting documentation. The authors make no claims *
12* about the suitability of this software for any purpose. It is *
13* provided "as is" without express or implied warranty. *
14**************************************************************************/
15
16///////////////////////////////////////////////////////////////////////////
17// Dielectron TrackCuts //
18// //
19// //
20/*
21Detailed description
22
23
24*/
25// //
26///////////////////////////////////////////////////////////////////////////
27
28
5720c765 29#include <TMath.h>
164bfb53 30
31#include "AliDielectronTrackCuts.h"
32#include "AliVTrack.h"
67fd1119 33#include "AliAODTrack.h"
164bfb53 34
35ClassImp(AliDielectronTrackCuts)
36
37AliDielectronTrackCuts::AliDielectronTrackCuts() :
38 AliAnalysisCuts(),
39 fV0DaughterCut(0),
fb7d2d99 40 fNegateV0DauterCut(kFALSE),
5720c765 41 fITSclusterBitMap(0),
42 fITSclusterCutType(kOneOf),
164bfb53 43 fRequireITSRefit(kFALSE),
fb7d2d99 44 fRequireTPCRefit(kFALSE),
67fd1119 45 fTPCNclRobustCut(-1),
4a49f1b8 46 fTPCcrossedOverFindable(-1.),
08b801a6 47 fAODFilterBit(kSwitchOff),
48 fWaiveITSNcls(-1)
164bfb53 49{
50 //
51 // Default Constructor
52 //
53
54 for (Int_t i = 0; i < 3; i++)
55 fCutClusterRequirementITS[i] = kOff;
56
57}
58
59//______________________________________________
60AliDielectronTrackCuts::AliDielectronTrackCuts(const char* name, const char* title) :
61 AliAnalysisCuts(name, title),
62 fV0DaughterCut(0),
fb7d2d99 63 fNegateV0DauterCut(kFALSE),
5720c765 64 fITSclusterBitMap(0),
65 fITSclusterCutType(kOneOf),
164bfb53 66 fRequireITSRefit(kFALSE),
fb7d2d99 67 fRequireTPCRefit(kFALSE),
67fd1119 68 fTPCNclRobustCut(-1),
4a49f1b8 69 fTPCcrossedOverFindable(-1.),
08b801a6 70 fAODFilterBit(kSwitchOff),
71 fWaiveITSNcls(-1)
164bfb53 72{
73 //
74 // Named Constructor
75 //
76
77 for (Int_t i = 0; i < 3; i++)
78 fCutClusterRequirementITS[i] = kOff;
79
80}
81
82//______________________________________________
83AliDielectronTrackCuts::~AliDielectronTrackCuts()
84{
85 //
86 // Default Destructor
87 //
88
89}
90
91//______________________________________________
92Bool_t AliDielectronTrackCuts::IsSelected(TObject* track)
93{
94 //
95 // Apply configured cuts
96 //
97
98 AliVTrack *vtrack=dynamic_cast<AliVTrack*>(track);
99 if (!vtrack) return kFALSE;
100
101 Bool_t accept=kTRUE;
102 if (fV0DaughterCut) {
fb7d2d99 103 Bool_t isV0=track->TestBit(BIT(fV0DaughterCut));
104 if (fNegateV0DauterCut) isV0=!isV0;
105 accept*=isV0;
164bfb53 106 }
107
5720c765 108 //ESD track cut like ITS cluster cut
164bfb53 109 for (Int_t i=0;i<3;++i){
110 Bool_t layer1=TESTBIT(vtrack->GetITSClusterMap(),i*2);
111 Bool_t layer2=TESTBIT(vtrack->GetITSClusterMap(),i*2+1);
112 accept*=CheckITSClusterRequirement(fCutClusterRequirementITS[i], layer1, layer2);
113 }
114
5720c765 115 //more flexible ITS cluster cut
116 if (fITSclusterBitMap) accept*=CheckITSClusterCut(vtrack->GetITSClusterMap());
117
08b801a6 118 //different its cluster cut
119 if (fWaiveITSNcls > -1) {
120 Int_t nITScls = 0;
121 Int_t requiredNcls = 7;
122 for(Int_t i=5; i>=0; i--) {
123 if(TESTBIT(vtrack->GetITSClusterMap(),i)) {
124 nITScls++;
125 requiredNcls=6-fWaiveITSNcls-i;
126 }
127 }
128 accept*=(requiredNcls<=nITScls);
129 }
130
5720c765 131 //its and tpc refit
132 if (fRequireITSRefit) accept*=(vtrack->GetStatus()&AliVTrack::kITSrefit)>0;
133 if (fRequireTPCRefit) accept*=(vtrack->GetStatus()&AliVTrack::kTPCrefit)>0;
fb7d2d99 134
a94c2e7e 135 Int_t nclr=0;
fb7d2d99 136 if (fTPCNclRobustCut>0){
a94c2e7e 137 nclr=TMath::Nint(vtrack->GetTPCClusterInfo(2,1));
138 accept*=(nclr>fTPCNclRobustCut);
9afa0f7e 139 }
140 if (fTPCcrossedOverFindable > 0.) {
a94c2e7e 141 if(fTPCNclRobustCut<=0) nclr=TMath::Nint(vtrack->GetTPCClusterInfo(2,1));
142 Int_t tpcNclsF = vtrack->GetTPCNclsF();
143 accept*=(tpcNclsF); //ESDtrackCut would return here true
144 if (tpcNclsF != 0) {//'accept' already negated above in this case above
145 accept*=(((Double_t)nclr/(Double_t)vtrack->GetTPCNclsF()) >= fTPCcrossedOverFindable);
146 }
fb7d2d99 147 }
67fd1119 148
4a49f1b8 149
67fd1119 150 // use filter bit to speed up the AOD analysis (track pre-filter)
151 // relevant filter bits are:
152 // kTPCqual==1 -> TPC quality cuts
153 // kTPCqualSPDany==4 -> + SPD any
154 // kTPCqualSPDanyPIDele==8 -> + nSigmaTPCele +-3 (inclusion)
155 if (track->IsA()==AliAODTrack::Class() && fAODFilterBit!=kSwitchOff) {
156 accept*=((AliAODTrack*)track)->TestFilterBit(fAODFilterBit);
157 }
158
164bfb53 159 return accept;
160}
161
162//______________________________________________
fb7d2d99 163void AliDielectronTrackCuts::SetV0DaughterCut(AliPID::EParticleType type, Bool_t negate/*=kFALSE*/)
164bfb53 164{
165 //
166 // Set V0 Daughter cut bit
167 //
168 const Int_t bitMap[5] = {14, -1, 15, -1, 16}; // convert the AliPID to bit positions
169 fV0DaughterCut=bitMap[type];
fb7d2d99 170 fNegateV0DauterCut=negate;
164bfb53 171}
172
173//____________________________________________________________________
174Bool_t AliDielectronTrackCuts::CheckITSClusterRequirement(ITSClusterRequirement req, Bool_t clusterL1, Bool_t clusterL2) const
175{
176 // checks if the cluster requirement is fullfilled (in this case: return kTRUE)
177
178 switch (req)
179 {
180 case kOff: return kTRUE;
181 case kNone: return !clusterL1 && !clusterL2;
182 case kAny: return clusterL1 || clusterL2;
183 case kFirst: return clusterL1;
184 case kOnlyFirst: return clusterL1 && !clusterL2;
185 case kSecond: return clusterL2;
186 case kOnlySecond: return clusterL2 && !clusterL1;
187 case kBoth: return clusterL1 && clusterL2;
188 }
189
190 return kFALSE;
191}
192
5720c765 193//______________________________________________
194Bool_t AliDielectronTrackCuts::CheckITSClusterCut(UChar_t itsBits) const
195{
196 // check the its cluster cut
197 switch (fITSclusterCutType){
198 case kOneOf: return itsBits & fITSclusterBitMap;
199 case kAtLeast: return (itsBits & fITSclusterBitMap)==fITSclusterBitMap;
200 case kExact: return (itsBits==fITSclusterBitMap);
201 }
202 return kTRUE;
203}