]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG0/dNdPt/AlidNdPtEventCuts.cxx
Corrected compilation error with gcc 4.4
[u/mrichter/AliRoot.git] / PWG0 / dNdPt / AlidNdPtEventCuts.cxx
CommitLineData
0aaa8b91 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 "AliESDEvent.h"
21#include "AliESDVertex.h"
22#include "AliMCEvent.h"
23#include "AliHeader.h"
24#include "AliGenEventHeader.h"
25
0aaa8b91 26#include "AlidNdPtEventCuts.h"
27
28using namespace std;
29
30ClassImp(AlidNdPtEventCuts)
31
32//_____________________________________________________________________________
33AlidNdPtEventCuts::AlidNdPtEventCuts(const Char_t* name,const Char_t *title) :
34AliAnalysisCuts(name, title)
bad4ba69 35, fTriggerRequired(kTRUE)
0aaa8b91 36, fRecVertexRequired(kTRUE)
bad4ba69 37, fEventProcessType(AliPWG0Helper::kInvalidProcess)
0aaa8b91 38, fMinNContributors(0)
39, fMaxNContributors(0)
40, fMaxR(0)
41, fMinZv(0)
42, fMaxZv(0)
43, fMeanXv(0)
44, fMeanYv(0)
45, fMeanZv(0)
46, fSigmaMeanXv(0)
47, fSigmaMeanYv(0)
48, fSigmaMeanZv(0)
bad4ba69 49, fRedoTPCVertex(kTRUE)
50, fUseBeamSpotConstraint(kTRUE)
0aaa8b91 51{
52 // default constructor
53
54 // init data members with defaults
55 Init();
56}
57
58//_____________________________________________________________________________
59AlidNdPtEventCuts::~AlidNdPtEventCuts()
60{
61 // destructor
62}
63
64//_____________________________________________________________________________
65void AlidNdPtEventCuts::Init()
66{
67 // set default values
bad4ba69 68 SetTriggerRequired();
0aaa8b91 69 SetRecVertexRequired();
70 SetEventProcessType();
71 SetNContributorsRange();
72 SetMaxR();
73 SetZvRange();
74 SetMeanXYZv();
75 SetSigmaMeanXYZv();
bad4ba69 76 SetRedoTPCVertex();
77 SetUseBeamSpotConstraint();
0aaa8b91 78}
79
80//_____________________________________________________________________________
81Bool_t AlidNdPtEventCuts::AcceptEvent(AliESDEvent *esdEvent,AliMCEvent *mcEvent, const AliESDVertex *vtx)
82{
83 // Check event selection cuts
84 Bool_t retValue=kTRUE;
85
86 if(!esdEvent) return kFALSE;
87 if(!IsRecVertexRequired()) return kTRUE;
88 if(!vtx) return kFALSE;
89 if(!vtx->GetStatus()) return kFALSE;
90
91 if(mcEvent) {
92 // check MC event conditions
93 AliHeader* header = mcEvent->Header();
94 if(!header) return kFALSE;
95
96 // select event type (ND-non diffractive, SD-single diffractive, DD-double diffractive)
bad4ba69 97 if(fEventProcessType == AliPWG0Helper::kInvalidProcess) {
0aaa8b91 98 retValue=kTRUE;
99 }
bad4ba69 100 else if(fEventProcessType == AliPWG0Helper::kSD || fEventProcessType == AliPWG0Helper::kDD) {
101 AliPWG0Helper::MCProcessType processType = AliPWG0Helper::GetEventProcessType(header);
102 if(processType == AliPWG0Helper::kND) retValue=kFALSE;
0aaa8b91 103 else retValue=kTRUE;
104 }
bad4ba69 105 else if(fEventProcessType == AliPWG0Helper::GetEventProcessType(header)) {
0aaa8b91 106 retValue=kTRUE;
107 }
108 else
109 retValue=kFALSE;
110 }
111
112 Float_t R = TMath::Sqrt(vtx->GetXv()*vtx->GetXv()+vtx->GetYv()*vtx->GetYv());
113
114 if(vtx->GetNContributors() < fMinNContributors) return kFALSE;
115 if(vtx->GetNContributors() > fMaxNContributors) return kFALSE;
116 if(R > fMaxR) return kFALSE;
117 if(vtx->GetZv() < fMinZv) return kFALSE;
118 if(vtx->GetZv() > fMaxZv) return kFALSE;
119
120return retValue;
121}
122
123//_____________________________________________________________________________
124Bool_t AlidNdPtEventCuts::AcceptMCEvent(AliMCEvent *mcEvent)
125{
126 // Check event selection cuts
127 if(!mcEvent) return kFALSE;
128
129 Bool_t retValue=kTRUE;
130
131 // check MC event conditions
132 AliHeader* header = mcEvent->Header();
133 if(!header) return kFALSE;
134
135 AliGenEventHeader* genHeader = header->GenEventHeader();
136 if (!genHeader) {
137 AliDebug(AliLog::kError, "Could not retrieve genHeader from Header");
138 return kFALSE;
139 }
140 TArrayF vtxMC(3);
141 genHeader->PrimaryVertex(vtxMC);
142
143 // select event type (ND-non diffractive, SD-single diffractive, DD-double diffractive)
bad4ba69 144 if(fEventProcessType == AliPWG0Helper::kInvalidProcess) {
0aaa8b91 145 retValue=kTRUE;
146 } else {
bad4ba69 147 if(fEventProcessType == AliPWG0Helper::GetEventProcessType(header)) retValue=kTRUE;
0aaa8b91 148 else retValue=kFALSE;
149 }
150
151 Float_t R = TMath::Sqrt(vtxMC[0]*vtxMC[0]+vtxMC[1]*vtxMC[1]);
152
153 if(R > fMaxR) return kFALSE;
154 if(vtxMC[2] < fMinZv) return kFALSE;
155 if(vtxMC[2] > fMaxZv) return kFALSE;
156
157return retValue;
158}
159
160//_____________________________________________________________________________
161Long64_t AlidNdPtEventCuts::Merge(TCollection* list)
162{
163 // Merge list of objects (needed by PROOF)
164 if (!list)
165 return 0;
166
167 if (list->IsEmpty())
168 return 1;
169
170 TIterator* iter = list->MakeIterator();
171 TObject* obj = 0;
172
173 Int_t count=0;
174 while((obj = iter->Next()) != 0)
175 {
176 AlidNdPtEventCuts* entry = dynamic_cast<AlidNdPtEventCuts*>(obj);
177 if (entry == 0)
178 continue;
179
180 count++;
181 }
182
183return count;
184}