]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGDQ/dielectron/AliDielectronTrackCuts.cxx
o updats (Julian)
[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),
46 fAODFilterBit(kSwitchOff)
164bfb53 47{
48 //
49 // Default Constructor
50 //
51
52 for (Int_t i = 0; i < 3; i++)
53 fCutClusterRequirementITS[i] = kOff;
54
55}
56
57//______________________________________________
58AliDielectronTrackCuts::AliDielectronTrackCuts(const char* name, const char* title) :
59 AliAnalysisCuts(name, title),
60 fV0DaughterCut(0),
fb7d2d99 61 fNegateV0DauterCut(kFALSE),
5720c765 62 fITSclusterBitMap(0),
63 fITSclusterCutType(kOneOf),
164bfb53 64 fRequireITSRefit(kFALSE),
fb7d2d99 65 fRequireTPCRefit(kFALSE),
67fd1119 66 fTPCNclRobustCut(-1),
67 fAODFilterBit(kSwitchOff)
164bfb53 68{
69 //
70 // Named Constructor
71 //
72
73 for (Int_t i = 0; i < 3; i++)
74 fCutClusterRequirementITS[i] = kOff;
75
76}
77
78//______________________________________________
79AliDielectronTrackCuts::~AliDielectronTrackCuts()
80{
81 //
82 // Default Destructor
83 //
84
85}
86
87//______________________________________________
88Bool_t AliDielectronTrackCuts::IsSelected(TObject* track)
89{
90 //
91 // Apply configured cuts
92 //
93
94 AliVTrack *vtrack=dynamic_cast<AliVTrack*>(track);
95 if (!vtrack) return kFALSE;
96
97 Bool_t accept=kTRUE;
98 if (fV0DaughterCut) {
fb7d2d99 99 Bool_t isV0=track->TestBit(BIT(fV0DaughterCut));
100 if (fNegateV0DauterCut) isV0=!isV0;
101 accept*=isV0;
164bfb53 102 }
103
5720c765 104 //ESD track cut like ITS cluster cut
164bfb53 105 for (Int_t i=0;i<3;++i){
106 Bool_t layer1=TESTBIT(vtrack->GetITSClusterMap(),i*2);
107 Bool_t layer2=TESTBIT(vtrack->GetITSClusterMap(),i*2+1);
108 accept*=CheckITSClusterRequirement(fCutClusterRequirementITS[i], layer1, layer2);
109 }
110
5720c765 111 //more flexible ITS cluster cut
112 if (fITSclusterBitMap) accept*=CheckITSClusterCut(vtrack->GetITSClusterMap());
113
114 //its and tpc refit
115 if (fRequireITSRefit) accept*=(vtrack->GetStatus()&AliVTrack::kITSrefit)>0;
116 if (fRequireTPCRefit) accept*=(vtrack->GetStatus()&AliVTrack::kTPCrefit)>0;
fb7d2d99 117
118 if (fTPCNclRobustCut>0){
5720c765 119 Int_t nclr=TMath::Nint(vtrack->GetTPCClusterInfo(2,1));
120 accept*=(nclr>fTPCNclRobustCut);
fb7d2d99 121 }
67fd1119 122
123 // use filter bit to speed up the AOD analysis (track pre-filter)
124 // relevant filter bits are:
125 // kTPCqual==1 -> TPC quality cuts
126 // kTPCqualSPDany==4 -> + SPD any
127 // kTPCqualSPDanyPIDele==8 -> + nSigmaTPCele +-3 (inclusion)
128 if (track->IsA()==AliAODTrack::Class() && fAODFilterBit!=kSwitchOff) {
129 accept*=((AliAODTrack*)track)->TestFilterBit(fAODFilterBit);
130 }
131
164bfb53 132 return accept;
133}
134
135//______________________________________________
fb7d2d99 136void AliDielectronTrackCuts::SetV0DaughterCut(AliPID::EParticleType type, Bool_t negate/*=kFALSE*/)
164bfb53 137{
138 //
139 // Set V0 Daughter cut bit
140 //
141 const Int_t bitMap[5] = {14, -1, 15, -1, 16}; // convert the AliPID to bit positions
142 fV0DaughterCut=bitMap[type];
fb7d2d99 143 fNegateV0DauterCut=negate;
164bfb53 144}
145
146//____________________________________________________________________
147Bool_t AliDielectronTrackCuts::CheckITSClusterRequirement(ITSClusterRequirement req, Bool_t clusterL1, Bool_t clusterL2) const
148{
149 // checks if the cluster requirement is fullfilled (in this case: return kTRUE)
150
151 switch (req)
152 {
153 case kOff: return kTRUE;
154 case kNone: return !clusterL1 && !clusterL2;
155 case kAny: return clusterL1 || clusterL2;
156 case kFirst: return clusterL1;
157 case kOnlyFirst: return clusterL1 && !clusterL2;
158 case kSecond: return clusterL2;
159 case kOnlySecond: return clusterL2 && !clusterL1;
160 case kBoth: return clusterL1 && clusterL2;
161 }
162
163 return kFALSE;
164}
165
5720c765 166//______________________________________________
167Bool_t AliDielectronTrackCuts::CheckITSClusterCut(UChar_t itsBits) const
168{
169 // check the its cluster cut
170 switch (fITSclusterCutType){
171 case kOneOf: return itsBits & fITSclusterBitMap;
172 case kAtLeast: return (itsBits & fITSclusterBitMap)==fITSclusterBitMap;
173 case kExact: return (itsBits==fITSclusterBitMap);
174 }
175 return kTRUE;
176}