]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG0/dNdPt/AlidNdPtEventCuts.cxx
current status of dNdPt analysis code
[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
695facdf 112 /*
0aaa8b91 113 Float_t R = TMath::Sqrt(vtx->GetXv()*vtx->GetXv()+vtx->GetYv()*vtx->GetYv());
0aaa8b91 114 if(vtx->GetNContributors() < fMinNContributors) return kFALSE;
115 if(vtx->GetNContributors() > fMaxNContributors) return kFALSE;
116 if(R > fMaxR) return kFALSE;
695facdf 117 */
118
0aaa8b91 119 if(vtx->GetZv() < fMinZv) return kFALSE;
120 if(vtx->GetZv() > fMaxZv) return kFALSE;
121
122return retValue;
123}
124
125//_____________________________________________________________________________
126Bool_t AlidNdPtEventCuts::AcceptMCEvent(AliMCEvent *mcEvent)
127{
128 // Check event selection cuts
129 if(!mcEvent) return kFALSE;
130
131 Bool_t retValue=kTRUE;
132
133 // check MC event conditions
134 AliHeader* header = mcEvent->Header();
135 if(!header) return kFALSE;
136
137 AliGenEventHeader* genHeader = header->GenEventHeader();
138 if (!genHeader) {
139 AliDebug(AliLog::kError, "Could not retrieve genHeader from Header");
140 return kFALSE;
141 }
142 TArrayF vtxMC(3);
143 genHeader->PrimaryVertex(vtxMC);
144
145 // select event type (ND-non diffractive, SD-single diffractive, DD-double diffractive)
bad4ba69 146 if(fEventProcessType == AliPWG0Helper::kInvalidProcess) {
0aaa8b91 147 retValue=kTRUE;
148 } else {
bad4ba69 149 if(fEventProcessType == AliPWG0Helper::GetEventProcessType(header)) retValue=kTRUE;
0aaa8b91 150 else retValue=kFALSE;
151 }
152
695facdf 153 /*
0aaa8b91 154 Float_t R = TMath::Sqrt(vtxMC[0]*vtxMC[0]+vtxMC[1]*vtxMC[1]);
0aaa8b91 155 if(R > fMaxR) return kFALSE;
695facdf 156 */
157
0aaa8b91 158 if(vtxMC[2] < fMinZv) return kFALSE;
159 if(vtxMC[2] > fMaxZv) return kFALSE;
160
161return retValue;
162}
163
164//_____________________________________________________________________________
165Long64_t AlidNdPtEventCuts::Merge(TCollection* list)
166{
167 // Merge list of objects (needed by PROOF)
168 if (!list)
169 return 0;
170
171 if (list->IsEmpty())
172 return 1;
173
174 TIterator* iter = list->MakeIterator();
175 TObject* obj = 0;
176
177 Int_t count=0;
178 while((obj = iter->Next()) != 0)
179 {
180 AlidNdPtEventCuts* entry = dynamic_cast<AlidNdPtEventCuts*>(obj);
181 if (entry == 0)
182 continue;
183
184 count++;
185 }
186
187return count;
188}