]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG3/dielectron/AliDielectronTrackCuts.cxx
Updating the functionality of AliAnalysisHadEtCorrections to accomodate centrality...
[u/mrichter/AliRoot.git] / PWG3 / 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
27de2dfb 16/* $Id$ */
17
18
164bfb53 19///////////////////////////////////////////////////////////////////////////
20// Dielectron TrackCuts //
21// //
22// //
23/*
24Detailed description
25
26
27*/
28// //
29///////////////////////////////////////////////////////////////////////////
30
31
32
33#include "AliDielectronTrackCuts.h"
34#include "AliVTrack.h"
fb7d2d99 35#include "AliESDtrack.h"
164bfb53 36
37ClassImp(AliDielectronTrackCuts)
38
39AliDielectronTrackCuts::AliDielectronTrackCuts() :
40 AliAnalysisCuts(),
41 fV0DaughterCut(0),
fb7d2d99 42 fNegateV0DauterCut(kFALSE),
164bfb53 43 fRequireITSRefit(kFALSE),
fb7d2d99 44 fRequireTPCRefit(kFALSE),
45 fTPCNclRobustCut(-1)
164bfb53 46{
47 //
48 // Default Constructor
49 //
50
51 for (Int_t i = 0; i < 3; i++)
52 fCutClusterRequirementITS[i] = kOff;
53
54}
55
56//______________________________________________
57AliDielectronTrackCuts::AliDielectronTrackCuts(const char* name, const char* title) :
58 AliAnalysisCuts(name, title),
59 fV0DaughterCut(0),
fb7d2d99 60 fNegateV0DauterCut(kFALSE),
164bfb53 61 fRequireITSRefit(kFALSE),
fb7d2d99 62 fRequireTPCRefit(kFALSE),
63 fTPCNclRobustCut(-1)
164bfb53 64{
65 //
66 // Named Constructor
67 //
68
69 for (Int_t i = 0; i < 3; i++)
70 fCutClusterRequirementITS[i] = kOff;
71
72}
73
74//______________________________________________
75AliDielectronTrackCuts::~AliDielectronTrackCuts()
76{
77 //
78 // Default Destructor
79 //
80
81}
82
83//______________________________________________
84Bool_t AliDielectronTrackCuts::IsSelected(TObject* track)
85{
86 //
87 // Apply configured cuts
88 //
89
90 AliVTrack *vtrack=dynamic_cast<AliVTrack*>(track);
91 if (!vtrack) return kFALSE;
92
93 Bool_t accept=kTRUE;
94 if (fV0DaughterCut) {
fb7d2d99 95 Bool_t isV0=track->TestBit(BIT(fV0DaughterCut));
96 if (fNegateV0DauterCut) isV0=!isV0;
97 accept*=isV0;
164bfb53 98 }
99
100 for (Int_t i=0;i<3;++i){
101 Bool_t layer1=TESTBIT(vtrack->GetITSClusterMap(),i*2);
102 Bool_t layer2=TESTBIT(vtrack->GetITSClusterMap(),i*2+1);
103 accept*=CheckITSClusterRequirement(fCutClusterRequirementITS[i], layer1, layer2);
104 }
105
106 if (fRequireITSRefit) accept*=(vtrack->GetStatus()&kITSrefit)>0;
107 if (fRequireTPCRefit) accept*=(vtrack->GetStatus()&kTPCrefit)>0;
fb7d2d99 108
109 if (fTPCNclRobustCut>0){
110 AliESDtrack *tr=dynamic_cast<AliESDtrack*>(track);
111 if (tr){
112 Int_t nclr=TMath::Nint(tr->GetTPCClusterInfo(2,1));
113 accept*=(nclr>fTPCNclRobustCut);
114 }
115 }
164bfb53 116 return accept;
117}
118
119//______________________________________________
fb7d2d99 120void AliDielectronTrackCuts::SetV0DaughterCut(AliPID::EParticleType type, Bool_t negate/*=kFALSE*/)
164bfb53 121{
122 //
123 // Set V0 Daughter cut bit
124 //
125 const Int_t bitMap[5] = {14, -1, 15, -1, 16}; // convert the AliPID to bit positions
126 fV0DaughterCut=bitMap[type];
fb7d2d99 127 fNegateV0DauterCut=negate;
164bfb53 128}
129
130//____________________________________________________________________
131Bool_t AliDielectronTrackCuts::CheckITSClusterRequirement(ITSClusterRequirement req, Bool_t clusterL1, Bool_t clusterL2) const
132{
133 // checks if the cluster requirement is fullfilled (in this case: return kTRUE)
134
135 switch (req)
136 {
137 case kOff: return kTRUE;
138 case kNone: return !clusterL1 && !clusterL2;
139 case kAny: return clusterL1 || clusterL2;
140 case kFirst: return clusterL1;
141 case kOnlyFirst: return clusterL1 && !clusterL2;
142 case kSecond: return clusterL2;
143 case kOnlySecond: return clusterL2 && !clusterL1;
144 case kBoth: return clusterL1 && clusterL2;
145 }
146
147 return kFALSE;
148}
149