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