1 /*************************************************************************
2 * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 ///////////////////////////////////////////////////////////////////////////
17 // Dielectron TrackCuts //
26 ///////////////////////////////////////////////////////////////////////////
31 #include "AliDielectronTrackCuts.h"
32 #include "AliVTrack.h"
33 #include "AliAODTrack.h"
35 ClassImp(AliDielectronTrackCuts)
37 AliDielectronTrackCuts::AliDielectronTrackCuts() :
40 fNegateV0DauterCut(kFALSE),
42 fITSclusterCutType(kOneOf),
43 fRequireITSRefit(kFALSE),
44 fRequireTPCRefit(kFALSE),
46 fTPCcrossedOverFindable(-1.),
47 fAODFilterBit(kSwitchOff),
51 // Default Constructor
54 for (Int_t i = 0; i < 3; i++)
55 fCutClusterRequirementITS[i] = kOff;
59 //______________________________________________
60 AliDielectronTrackCuts::AliDielectronTrackCuts(const char* name, const char* title) :
61 AliAnalysisCuts(name, title),
63 fNegateV0DauterCut(kFALSE),
65 fITSclusterCutType(kOneOf),
66 fRequireITSRefit(kFALSE),
67 fRequireTPCRefit(kFALSE),
69 fTPCcrossedOverFindable(-1.),
70 fAODFilterBit(kSwitchOff),
77 for (Int_t i = 0; i < 3; i++)
78 fCutClusterRequirementITS[i] = kOff;
82 //______________________________________________
83 AliDielectronTrackCuts::~AliDielectronTrackCuts()
91 //______________________________________________
92 Bool_t AliDielectronTrackCuts::IsSelected(TObject* track)
95 // Apply configured cuts
98 AliVTrack *vtrack=dynamic_cast<AliVTrack*>(track);
99 if (!vtrack) return kFALSE;
102 if (fV0DaughterCut) {
103 Bool_t isV0=track->TestBit(BIT(fV0DaughterCut));
104 if (fNegateV0DauterCut) isV0=!isV0;
108 //ESD track cut like ITS cluster cut
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);
115 //more flexible ITS cluster cut
116 if (fITSclusterBitMap) accept*=CheckITSClusterCut(vtrack->GetITSClusterMap());
118 //different its cluster cut
119 if (fWaiveITSNcls > -1) {
121 Int_t requiredNcls = 7;
122 for(Int_t i=5; i>=0; i--) {
123 if(TESTBIT(vtrack->GetITSClusterMap(),i)) {
125 requiredNcls=6-fWaiveITSNcls-i;
128 accept*=(requiredNcls<=nITScls);
132 if (fRequireITSRefit) accept*=(vtrack->GetStatus()&AliVTrack::kITSrefit)>0;
133 if (fRequireTPCRefit) accept*=(vtrack->GetStatus()&AliVTrack::kTPCrefit)>0;
135 Int_t nclr=TMath::Nint(vtrack->GetTPCClusterInfo(2,1));
136 if (fTPCNclRobustCut>0){
137 accept*=(nclr>fTPCNclRobustCut);
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);
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);
160 //______________________________________________
161 void AliDielectronTrackCuts::SetV0DaughterCut(AliPID::EParticleType type, Bool_t negate/*=kFALSE*/)
164 // Set V0 Daughter cut bit
166 const Int_t bitMap[5] = {14, -1, 15, -1, 16}; // convert the AliPID to bit positions
167 fV0DaughterCut=bitMap[type];
168 fNegateV0DauterCut=negate;
171 //____________________________________________________________________
172 Bool_t AliDielectronTrackCuts::CheckITSClusterRequirement(ITSClusterRequirement req, Bool_t clusterL1, Bool_t clusterL2) const
174 // checks if the cluster requirement is fullfilled (in this case: return kTRUE)
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;
191 //______________________________________________
192 Bool_t AliDielectronTrackCuts::CheckITSClusterCut(UChar_t itsBits) const
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);