1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
20 #include "AliESDEvent.h"
21 #include "AliESDVertex.h"
22 #include "AliMCEvent.h"
23 #include "AliHeader.h"
24 #include "AliGenEventHeader.h"
26 #include "AlidNdPtEventCuts.h"
30 ClassImp(AlidNdPtEventCuts)
32 //_____________________________________________________________________________
33 AlidNdPtEventCuts::AlidNdPtEventCuts(const Char_t* name,const Char_t *title) :
34 AliAnalysisCuts(name, title)
35 , fTriggerRequired(kTRUE)
36 , fRecVertexRequired(kTRUE)
37 , fEventProcessType(AliPWG0Helper::kInvalidProcess)
38 , fMinNContributors(0)
39 , fMaxNContributors(0)
49 , fRedoTPCVertex(kTRUE)
50 , fUseBeamSpotConstraint(kTRUE)
51 , fEventSelectedRequired(kFALSE)
53 // default constructor
55 // init data members with defaults
59 //_____________________________________________________________________________
60 AlidNdPtEventCuts::~AlidNdPtEventCuts()
65 //_____________________________________________________________________________
66 void AlidNdPtEventCuts::Init()
70 SetRecVertexRequired();
71 SetEventProcessType();
72 SetNContributorsRange();
78 SetUseBeamSpotConstraint();
81 //_____________________________________________________________________________
82 Bool_t AlidNdPtEventCuts::AcceptEvent(AliESDEvent *esdEvent,AliMCEvent *mcEvent, const AliESDVertex *vtx)
84 // Check event selection cuts
85 Bool_t retValue=kTRUE;
87 if(!esdEvent) return kFALSE;
88 if(!IsRecVertexRequired()) return kTRUE;
89 if(!vtx) return kFALSE;
90 if(!vtx->GetStatus()) return kFALSE;
93 // check MC event conditions
94 AliHeader* header = mcEvent->Header();
95 if(!header) return kFALSE;
97 // select event type (ND-non diffractive, SD-single diffractive, DD-double diffractive)
98 if(fEventProcessType == AliPWG0Helper::kInvalidProcess) {
101 else if(fEventProcessType == AliPWG0Helper::kSD || fEventProcessType == AliPWG0Helper::kDD) {
102 AliPWG0Helper::MCProcessType processType = AliPWG0Helper::GetEventProcessType(header);
103 if(processType == AliPWG0Helper::kND) retValue=kFALSE;
106 else if(fEventProcessType == AliPWG0Helper::GetEventProcessType(header)) {
113 if(vtx->GetZv() < fMinZv) return kFALSE;
114 if(vtx->GetZv() > fMaxZv) return kFALSE;
119 //_____________________________________________________________________________
120 Bool_t AlidNdPtEventCuts::AcceptMCEvent(AliMCEvent *mcEvent)
122 // Check event selection cuts
123 if(!mcEvent) return kFALSE;
125 Bool_t retValue=kTRUE;
127 // check MC event conditions
128 AliHeader* header = mcEvent->Header();
129 if(!header) return kFALSE;
131 AliGenEventHeader* genHeader = header->GenEventHeader();
133 AliDebug(AliLog::kError, "Could not retrieve genHeader from Header");
137 genHeader->PrimaryVertex(vtxMC);
139 // select event type (ND-non diffractive, SD-single diffractive, DD-double diffractive)
140 if(fEventProcessType == AliPWG0Helper::kInvalidProcess) {
143 if(fEventProcessType == AliPWG0Helper::GetEventProcessType(header)) retValue=kTRUE;
144 else retValue=kFALSE;
148 Float_t R = TMath::Sqrt(vtxMC[0]*vtxMC[0]+vtxMC[1]*vtxMC[1]);
149 if(R > fMaxR) return kFALSE;
152 if(vtxMC[2] < fMinZv) return kFALSE;
153 if(vtxMC[2] > fMaxZv) return kFALSE;
158 //_____________________________________________________________________________
159 Long64_t AlidNdPtEventCuts::Merge(TCollection* list)
161 // Merge list of objects (needed by PROOF)
168 TIterator* iter = list->MakeIterator();
172 while((obj = iter->Next()) != 0)
174 AlidNdPtEventCuts* entry = dynamic_cast<AlidNdPtEventCuts*>(obj);