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