]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGDQ/dielectron/AliDielectronEventCuts.cxx
do correction in 2dimensions for 1D analysis for cross checking integrals
[u/mrichter/AliRoot.git] / PWGDQ / dielectron / AliDielectronEventCuts.cxx
CommitLineData
2a14a7b1 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 EventCuts //
18// //
19// //
20/*
21Detailed description
22
23
24*/
25// //
26///////////////////////////////////////////////////////////////////////////
27
5720c765 28
2a14a7b1 29#include <AliTriggerAnalysis.h>
30#include <AliESDVertex.h>
d327d9cd 31#include <AliAODVertex.h>
2a14a7b1 32#include <AliESDEvent.h>
d327d9cd 33#include <AliAODEvent.h>
ffbede40 34#include <AliMultiplicity.h>
ba15fdfb 35#include <AliCentrality.h>
2a14a7b1 36
37#include "AliDielectronEventCuts.h"
38
39ClassImp(AliDielectronEventCuts)
40
1bb1fef1 41const char* AliDielectronEventCuts::fgkVtxNames[AliDielectronEventCuts::kVtxTracksOrSPD+1] = {"Tracks", "SPD", "TPC", "Any", "TracksOrSPD"};
42
2a14a7b1 43AliDielectronEventCuts::AliDielectronEventCuts() :
44 AliAnalysisCuts(),
45 fVtxZmin(0.),
46 fVtxZmax(0.),
47 fRequireVtx(kFALSE),
48 fMinVtxContributors(0),
ffbede40 49 fMultITSTPC(kFALSE),
ba15fdfb 50 fCentMin(1.),
51 fCentMax(0.),
2a14a7b1 52 fVtxType(kVtxTracks),
53 fRequireV0and(0),
54 fTriggerAnalysis(0x0),
d327d9cd 55 fkVertex(0x0),
56 fkVertexAOD(0x0)
2a14a7b1 57{
58 //
59 // Default Constructor
60 //
61
62}
63
64//______________________________________________
65AliDielectronEventCuts::AliDielectronEventCuts(const char* name, const char* title) :
66 AliAnalysisCuts(name, title),
67 fVtxZmin(0.),
68 fVtxZmax(0.),
69 fRequireVtx(kFALSE),
70 fMinVtxContributors(0),
ffbede40 71 fMultITSTPC(kFALSE),
ba15fdfb 72 fCentMin(1.),
73 fCentMax(0.),
2a14a7b1 74 fVtxType(kVtxTracks),
75 fRequireV0and(0),
76 fTriggerAnalysis(0x0),
d327d9cd 77 fkVertex(0x0),
78 fkVertexAOD(0x0)
2a14a7b1 79{
80 //
81 // Named Constructor
82 //
83}
84
85//______________________________________________
86AliDielectronEventCuts::~AliDielectronEventCuts()
87{
88 //
89 // Default Destructor
90 //
91 if (fTriggerAnalysis) delete fTriggerAnalysis;
92}
93
94//______________________________________________
95Bool_t AliDielectronEventCuts::IsSelected(TObject* event)
96{
97 //
98 // check the cuts
99 //
100
d327d9cd 101 if(event->IsA() == AliESDEvent::Class()) return IsSelectedESD(event);
102 else if(event->IsA() == AliAODEvent::Class()) return IsSelectedAOD(event);
103 else return kFALSE;
104}
105//____________________________________________________________________
106Bool_t AliDielectronEventCuts::IsSelectedESD(TObject* event)
107{
108 //
109 // check the cuts
110 //
111
2a14a7b1 112 AliESDEvent *ev=dynamic_cast<AliESDEvent*>(event);
113 if (!ev) return kFALSE;
114
ba15fdfb 115 if (fCentMin<fCentMax){
116 AliCentrality *centrality=ev->GetCentrality();
117 Double_t centralityF=-1;
118 if (centrality) centralityF = centrality->GetCentralityPercentile("V0M");
119 if (centralityF<fCentMin || centralityF>=fCentMax) return kFALSE;
120 }
121
2a14a7b1 122 fkVertex=0x0;
5720c765 123
2a14a7b1 124 switch(fVtxType){
1201a1a9 125 case kVtxTracks:
126 case kVtxTracksOrSPD:
127 fkVertex=ev->GetPrimaryVertexTracks();
128 break;
2a14a7b1 129 case kVtxSPD: fkVertex=ev->GetPrimaryVertexSPD(); break;
130 case kVtxTPC: fkVertex=ev->GetPrimaryVertexTPC(); break;
131 case kVtxAny: fkVertex=ev->GetPrimaryVertex(); break;
132 }
133
134 if ((fRequireVtx||fVtxZmin<fVtxZmax||fMinVtxContributors>0)&&!fkVertex) return kFALSE;
135
2a14a7b1 136
137 if (fMinVtxContributors>0){
138 Int_t nCtrb = fkVertex->GetNContributors();
ba15fdfb 139 if (nCtrb<fMinVtxContributors){
140 if (fVtxType==kVtxTracksOrSPD){
141 fkVertex=ev->GetPrimaryVertexSPD();
142 nCtrb = fkVertex->GetNContributors();
143 if (nCtrb<fMinVtxContributors) return kFALSE;
144 } else {
145 return kFALSE;
146 }
147 }
2a14a7b1 148 }
149
ba15fdfb 150 if (fVtxZmin<fVtxZmax){
151 Double_t zvtx=fkVertex->GetZv();
152 if (zvtx<fVtxZmin||zvtx>fVtxZmax) return kFALSE;
153 }
154
2a14a7b1 155 if (fRequireV0and){
156 if (!fTriggerAnalysis) fTriggerAnalysis=new AliTriggerAnalysis;
157 Bool_t v0AND = kFALSE;
158 if (fRequireV0and==1){
159 Bool_t v0A = fTriggerAnalysis->IsOfflineTriggerFired(ev, AliTriggerAnalysis::kV0A);
160 Bool_t v0C = fTriggerAnalysis->IsOfflineTriggerFired(ev, AliTriggerAnalysis::kV0C);
161 v0AND = v0A && v0C;
162 }
163
164 if (fRequireV0and==2){
165 Bool_t v0AHW = (fTriggerAnalysis->V0Trigger(ev, AliTriggerAnalysis::kASide, kTRUE) == AliTriggerAnalysis::kV0BB);
166 Bool_t v0CHW = (fTriggerAnalysis->V0Trigger(ev, AliTriggerAnalysis::kCSide, kTRUE) == AliTriggerAnalysis::kV0BB);
167 v0AND = v0AHW && v0CHW;
168 }
169
170 if (!v0AND) return kFALSE;
171 }
ffbede40 172
173 if (fMultITSTPC){
174 const AliESDVertex *vtxESDTPC=ev->GetPrimaryVertexTPC();
175 const AliMultiplicity *multESD = ev->GetMultiplicity();
176 if ( vtxESDTPC && multESD && vtxESDTPC->GetNContributors() < (-10.+0.25*multESD->GetNumberOfITSClusters(0)) )
177 return kFALSE;
178 }
ba15fdfb 179
2a14a7b1 180
d327d9cd 181 return kTRUE;
182}
183//______________________________________________
184Bool_t AliDielectronEventCuts::IsSelectedAOD(TObject* event)
185{
186 //
187 // check the cuts
188 //
189
190 AliAODEvent *ev=dynamic_cast<AliAODEvent*>(event);
191 if (!ev) return kFALSE;
192
193 if (fCentMin<fCentMax){
194 AliCentrality *centrality=ev->GetCentrality();
195 Double_t centralityF=-1;
196 if (centrality) centralityF = centrality->GetCentralityPercentile("V0M");
197 if (centralityF<fCentMin || centralityF>=fCentMax) return kFALSE;
198 }
199
200 fkVertexAOD=0x0;
201
202 switch(fVtxType){
e4339752 203 case kVtxTracks: fkVertexAOD=0x0; break;
0df6826e 204 case kVtxTPC: fkVertexAOD=ev->GetVertex(AliAODVertex::kMainTPC); break;
d327d9cd 205 case kVtxSPD:
e4339752 206 case kVtxTracksOrSPD: fkVertexAOD=ev->GetPrimaryVertexSPD(); break;
207 case kVtxAny: fkVertexAOD=ev->GetPrimaryVertex(); break;
d327d9cd 208 }
209
210 if ((fRequireVtx||fVtxZmin<fVtxZmax||fMinVtxContributors>0)&&!fkVertexAOD) return kFALSE;
211
212 if (fMinVtxContributors>0){
213 Int_t nCtrb = fkVertexAOD->GetNContributors();
214 if (nCtrb<fMinVtxContributors){
a823f01b 215 // if (fVtxType==kVtxTracksOrSPD){
216 // fkVertexAOD=ev->GetVertex(AliAODVertex::kPrimary);
217 // nCtrb = fkVertexAOD->GetNContributors();
218 // if (nCtrb<fMinVtxContributors) return kFALSE;
219 // } else {
220 return kFALSE;
221 //}
d327d9cd 222 }
223 }
a823f01b 224
d327d9cd 225
226 if (fVtxZmin<fVtxZmax){
227 Double_t zvtx=fkVertexAOD->GetZ();
228 if (zvtx<fVtxZmin||zvtx>fVtxZmax) return kFALSE;
229 }
a823f01b 230
d327d9cd 231 /*
232 if (fRequireV0and){
233 // if (!fTriggerAnalysis) fTriggerAnalysis=new AliTriggerAnalysis;
234 Bool_t v0AND = kFALSE;
235 if (fRequireV0and==1){
236 Bool_t v0A = fTriggerAnalysis->IsOfflineTriggerFired(ev, AliTriggerAnalysis::kV0A);
237 Bool_t v0A = header->GetOfflineTrigger(); //TODO
238 Bool_t v0C = fTriggerAnalysis->IsOfflineTriggerFired(ev, AliTriggerAnalysis::kV0C);
239 v0AND = v0A && v0C;
240 }
241
242 if (fRequireV0and==2){
243 Bool_t v0AHW = (fTriggerAnalysis->V0Trigger(ev, AliTriggerAnalysis::kASide, kTRUE) == AliTriggerAnalysis::kV0BB);
244 Bool_t v0CHW = (fTriggerAnalysis->V0Trigger(ev, AliTriggerAnalysis::kCSide, kTRUE) == AliTriggerAnalysis::kV0BB);
245 v0AND = v0AHW && v0CHW;
246 }
247
248 if (!v0AND) return kFALSE;
249 }
250 */
251 /* if (fMultITSTPC){
252 const AliESDVertex *vtxESDTPC=ev->GetPrimaryVertexTPC();
253 const AliMultiplicity *multESD = ev->GetMultiplicity();
254 if ( vtxESDTPC && multESD && vtxESDTPC->GetNContributors() < (-10.+0.25*multESD->GetNumberOfITSClusters(0)) )
255 return kFALSE;
256 }
257 */
258
2a14a7b1 259 return kTRUE;
260}
261
1bb1fef1 262//________________________________________________________________________
263void AliDielectronEventCuts::Print(const Option_t* /*option*/) const
264{
265 //
266 // Print cuts and the range
267 //
268 printf("cut ranges for '%s'\n",GetTitle());
269 printf("All Cuts have to be fulfilled\n");
270
271 Int_t iCut=0;
272 if(fRequireVtx) {
273 printf("Cut %02d: vertex required \n",iCut); iCut++; }
274 printf("Cut %02d: vertex type: %s \n", iCut, fgkVtxNames[fVtxType]); iCut++;
275 if(fMinVtxContributors) {
276 printf("Cut %02d: vertex contributors >= %d \n", iCut, fMinVtxContributors); iCut++; }
277 if(fVtxZmin<fVtxZmax) {
278 printf("Cut %02d: %f < %s < %f\n", iCut, fVtxZmin, "Zvtx", fVtxZmax); iCut++;}
279 if(fCentMin<fCentMax) {
280 printf("Cut %02d: %f < %s < %f\n", iCut, fCentMin, "V0centrality", fCentMax);iCut++; }
281 if(fMultITSTPC) {
282 printf("Cut %02d: cut on multiplcity ITS vs. TPC \n", iCut); iCut++; }
283 if(fRequireV0and) {
284 printf("Cut %02d: require V0and type: %c \n", iCut, fRequireV0and); iCut++; }
285
286}
287