]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGPP/AliFilteredTreeAcceptanceCuts.cxx
don't lie in the log!
[u/mrichter/AliRoot.git] / PWGPP / AliFilteredTreeAcceptanceCuts.cxx
CommitLineData
1059f583 1/**************************************************************************
2* Copyright(c) 1998-1999, 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// last change: 2011-04-04 by M.Knichel
16
17#include <iostream>
18#include <TList.h>
19
20#include "AliLog.h"
21#include "AliESDtrack.h"
22#include "AliExternalTrackParam.h"
23#include "TParticle.h"
24
25#include "AliFilteredTreeAcceptanceCuts.h"
26
27using namespace std;
28
29ClassImp(AliFilteredTreeAcceptanceCuts)
30
31//_____________________________________________________________________________
32AliFilteredTreeAcceptanceCuts::AliFilteredTreeAcceptanceCuts(const Char_t* name,const Char_t *title) :
33AliAnalysisCuts(name, title)
34, fMinEta(0)
35, fMaxEta(0)
36, fMinPhi(0)
37, fMaxPhi(0)
38, fMinPt(0)
39, fMaxPt(0)
40, fExcludeMinEta(0)
41, fExcludeMaxEta(0)
42, fExcludeMinPhi(0)
43, fExcludeMaxPhi(0)
44, fExcludeMinEta2(0)
45, fExcludeMaxEta2(0)
46, fExcludeMinPhi2(0)
47, fExcludeMaxPhi2(0)
48, fCheckRange(kFALSE)
49, fMaxDCAr(0)
50, fMaxDCAz(0)
51{
52 // default constructor
53
54 // init data members with defaults
55 Init();
56}
57
58//_____________________________________________________________________________
59AliFilteredTreeAcceptanceCuts::~AliFilteredTreeAcceptanceCuts()
60{
61 // destructor
62}
63
64//_____________________________________________________________________________
65void AliFilteredTreeAcceptanceCuts::Init()
66{
67 // set default values
68 SetEtaRange();
69 SetPhiRange();
70 SetPtRange();
71 SetMaxDCAr();
72 SetMaxDCAz();
73}
74
75//_____________________________________________________________________________
76Bool_t AliFilteredTreeAcceptanceCuts::AcceptTrack(AliESDtrack *track)
77{
78 // check acceptance cuts for AliESDtrack
79 if(!track) return kFALSE;
80
81 Float_t eta = track->Eta();
82 Float_t phi = track->Phi();
83 Float_t pt = track->Pt();
84
85 if(eta < fMinEta) return kFALSE;
86 if(eta > fMaxEta) return kFALSE;
87 if(phi < fMinPhi) return kFALSE;
88 if(phi > fMaxPhi) return kFALSE;
89 if(pt < fMinPt) return kFALSE;
90 if(pt > fMaxPt) return kFALSE;
91
92return kTRUE;
93}
94
95Bool_t AliFilteredTreeAcceptanceCuts::AcceptTrackLocalTPC(AliESDtrack *track)
96{
97 // check acceptance cuts for AliESDtrack
98 if(!track) return kFALSE;
99 const AliExternalTrackParam *innerParam = track->GetInnerParam();
100 if(!innerParam) return kFALSE;
101
102 Float_t eta = track->Eta();
103 Float_t phi = TMath::ATan2(innerParam->Py(),innerParam->Px());
104
105 if (fCheckRange) {
106 if ((eta > fExcludeMinEta) && (eta < fExcludeMaxEta) && (phi > fExcludeMinPhi) && (phi < fExcludeMaxPhi)) { return kFALSE; }
107 if ((eta > fExcludeMinEta2) && (eta < fExcludeMaxEta2) && (phi > fExcludeMinPhi2) && (phi < fExcludeMaxPhi2)) { return kFALSE; }
108 }
109
110return kTRUE;
111}
112
113//_____________________________________________________________________________
114Bool_t AliFilteredTreeAcceptanceCuts::AcceptTrack(AliExternalTrackParam *track)
115{
116 // check acceptance cuts for AliESDtrack
117 if(!track) return kFALSE;
118
119 Float_t eta = track->Eta();
120 Float_t phi = track->Phi();
121 Float_t pt = track->Pt();
122
123 if(eta < fMinEta) return kFALSE;
124 if(eta > fMaxEta) return kFALSE;
125 if(phi < fMinPhi) return kFALSE;
126 if(phi > fMaxPhi) return kFALSE;
127 if(pt < fMinPt) return kFALSE;
128 if(pt > fMaxPt) return kFALSE;
129
130return kTRUE;
131}
132
133//_____________________________________________________________________________
134Bool_t AliFilteredTreeAcceptanceCuts::AcceptTrack(TParticle *particle)
135{
136 // check acceptance cuts for TParticle
137 if(!particle) return kFALSE;
138
139 Float_t eta = particle->Eta();
140 Float_t phi = particle->Phi();
141 Float_t pt = particle->Pt();
142
143 if(eta < fMinEta) return kFALSE;
144 if(eta > fMaxEta) return kFALSE;
145 if(phi < fMinPhi) return kFALSE;
146 if(phi > fMaxPhi) return kFALSE;
147 if(pt < fMinPt) return kFALSE;
148 if(pt > fMaxPt) return kFALSE;
149
150return kTRUE;
151}
152
153//_____________________________________________________________________________
154Long64_t AliFilteredTreeAcceptanceCuts::Merge(TCollection* list)
155{
156 // Merge list of objects (needed by PROOF)
157 if (!list)
158 return 0;
159
160 if (list->IsEmpty())
161 return 1;
162
163 TIterator* iter = list->MakeIterator();
164 TObject* obj = 0;
165
166 Int_t count=0;
167 while((obj = iter->Next()) != 0)
168 {
169 AliFilteredTreeAcceptanceCuts* entry = dynamic_cast<AliFilteredTreeAcceptanceCuts*>(obj);
170 if (entry == 0)
171 continue;
172
173 count++;
174 }
175
176return count;
177}