]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGDQ/dielectron/AliDielectronTrackCuts.cxx
New train files for Ashutosh's analysis
[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
9afa0f7e 135 Int_t nclr=TMath::Nint(vtrack->GetTPCClusterInfo(2,1));
fb7d2d99 136 if (fTPCNclRobustCut>0){
4a49f1b8 137 accept*=(nclr>fTPCNclRobustCut);
9afa0f7e 138 }
139 if (fTPCcrossedOverFindable > 0.) {
140 Int_t tpcNclsF = vtrack->GetTPCNclsF();
141 accept*=(tpcNclsF); //ESDtrackCut would return here true
142 if (tpcNclsF != 0) {//'accept' already negated above in this case above
143 accept*=(((Double_t)nclr/(Double_t)vtrack->GetTPCNclsF()) >= fTPCcrossedOverFindable);
4a49f1b8 144 }
fb7d2d99 145 }
67fd1119 146
4a49f1b8 147
67fd1119 148 // use filter bit to speed up the AOD analysis (track pre-filter)
149 // relevant filter bits are:
150 // kTPCqual==1 -> TPC quality cuts
151 // kTPCqualSPDany==4 -> + SPD any
152 // kTPCqualSPDanyPIDele==8 -> + nSigmaTPCele +-3 (inclusion)
153 if (track->IsA()==AliAODTrack::Class() && fAODFilterBit!=kSwitchOff) {
154 accept*=((AliAODTrack*)track)->TestFilterBit(fAODFilterBit);
155 }
156
164bfb53 157 return accept;
158}
159
160//______________________________________________
fb7d2d99 161void AliDielectronTrackCuts::SetV0DaughterCut(AliPID::EParticleType type, Bool_t negate/*=kFALSE*/)
164bfb53 162{
163 //
164 // Set V0 Daughter cut bit
165 //
166 const Int_t bitMap[5] = {14, -1, 15, -1, 16}; // convert the AliPID to bit positions
167 fV0DaughterCut=bitMap[type];
fb7d2d99 168 fNegateV0DauterCut=negate;
164bfb53 169}
170
171//____________________________________________________________________
172Bool_t AliDielectronTrackCuts::CheckITSClusterRequirement(ITSClusterRequirement req, Bool_t clusterL1, Bool_t clusterL2) const
173{
174 // checks if the cluster requirement is fullfilled (in this case: return kTRUE)
175
176 switch (req)
177 {
178 case kOff: return kTRUE;
179 case kNone: return !clusterL1 && !clusterL2;
180 case kAny: return clusterL1 || clusterL2;
181 case kFirst: return clusterL1;
182 case kOnlyFirst: return clusterL1 && !clusterL2;
183 case kSecond: return clusterL2;
184 case kOnlySecond: return clusterL2 && !clusterL1;
185 case kBoth: return clusterL1 && clusterL2;
186 }
187
188 return kFALSE;
189}
190
5720c765 191//______________________________________________
192Bool_t AliDielectronTrackCuts::CheckITSClusterCut(UChar_t itsBits) const
193{
194 // check the its cluster cut
195 switch (fITSclusterCutType){
196 case kOneOf: return itsBits & fITSclusterBitMap;
197 case kAtLeast: return (itsBits & fITSclusterBitMap)==fITSclusterBitMap;
198 case kExact: return (itsBits==fITSclusterBitMap);
199 }
200 return kTRUE;
201}