]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG0/dNdPt/AlidNdPtAcceptanceCuts.cxx
-- changes by Michael Knichel
[u/mrichter/AliRoot.git] / PWG0 / dNdPt / AlidNdPtAcceptanceCuts.cxx
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 "AlidNdPtAcceptanceCuts.h"
26
27 using namespace std;
28
29 ClassImp(AlidNdPtAcceptanceCuts)
30
31 //_____________________________________________________________________________
32 AlidNdPtAcceptanceCuts::AlidNdPtAcceptanceCuts(const Char_t* name,const Char_t *title) : 
33 AliAnalysisCuts(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 , fCheckRange(kFALSE)
45 , fMaxDCAr(0)
46 , fMaxDCAz(0)
47 {
48   // default constructor 
49   
50   // init data members with defaults
51   Init();
52 }
53
54 //_____________________________________________________________________________
55 AlidNdPtAcceptanceCuts::~AlidNdPtAcceptanceCuts()  
56 {
57   // destructor
58 }
59
60 //_____________________________________________________________________________
61 void AlidNdPtAcceptanceCuts::Init()  
62 {
63   // set default values
64   SetEtaRange();
65   SetPhiRange();
66   SetPtRange();
67   SetMaxDCAr();
68   SetMaxDCAz();
69 }
70
71 //_____________________________________________________________________________
72 Bool_t AlidNdPtAcceptanceCuts::AcceptTrack(AliESDtrack *track)
73 {
74   // check acceptance cuts for AliESDtrack
75   if(!track) return kFALSE;
76
77   Float_t eta = track->Eta();
78   Float_t phi = track->Phi();
79   Float_t pt = track->Pt();
80
81   if(eta < fMinEta) return kFALSE;
82   if(eta > fMaxEta) return kFALSE;
83   if(phi < fMinPhi) return kFALSE;
84   if(phi > fMaxPhi) return kFALSE;
85   if(pt < fMinPt) return kFALSE;
86   if(pt > fMaxPt) return kFALSE;
87   
88   if (fCheckRange) {
89       if ((eta > fExcludeMinEta) && (eta < fExcludeMaxEta) && (phi > fExcludeMinPhi) && (phi < fExcludeMaxPhi)) { return kFALSE; }
90   }
91
92 return kTRUE;
93 }
94
95 //_____________________________________________________________________________
96 Bool_t AlidNdPtAcceptanceCuts::AcceptTrack(AliExternalTrackParam *track)
97 {
98   // check acceptance cuts for AliESDtrack
99   if(!track) return kFALSE;
100
101   Float_t eta = track->Eta();
102   Float_t phi = track->Phi();
103   Float_t pt = track->Pt();
104
105   if(eta < fMinEta) return kFALSE;
106   if(eta > fMaxEta) return kFALSE;
107   if(phi < fMinPhi) return kFALSE;
108   if(phi > fMaxPhi) return kFALSE;
109   if(pt < fMinPt) return kFALSE;
110   if(pt > fMaxPt) return kFALSE;
111
112 return kTRUE;
113 }
114
115 //_____________________________________________________________________________
116 Bool_t AlidNdPtAcceptanceCuts::AcceptTrack(TParticle *particle)
117 {
118   // check acceptance cuts for TParticle
119   if(!particle) return kFALSE;
120
121   Float_t eta = particle->Eta();
122   Float_t phi = particle->Phi();
123   Float_t pt = particle->Pt();
124
125   if(eta < fMinEta) return kFALSE;
126   if(eta > fMaxEta) return kFALSE;
127   if(phi < fMinPhi) return kFALSE;
128   if(phi > fMaxPhi) return kFALSE;
129   if(pt < fMinPt) return kFALSE;
130   if(pt > fMaxPt) return kFALSE;
131
132 return kTRUE;
133 }
134
135 //_____________________________________________________________________________
136 Long64_t AlidNdPtAcceptanceCuts::Merge(TCollection* list) 
137 {
138   // Merge list of objects (needed by PROOF)
139   if (!list)
140   return 0;
141
142   if (list->IsEmpty())
143   return 1;
144
145   TIterator* iter = list->MakeIterator();
146   TObject* obj = 0;
147
148   Int_t count=0;
149   while((obj = iter->Next()) != 0) 
150   {
151     AlidNdPtAcceptanceCuts* entry = dynamic_cast<AlidNdPtAcceptanceCuts*>(obj);
152     if (entry == 0)  
153       continue; 
154
155   count++;
156   }
157
158 return count;
159 }