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)) {
114 Float_t R = TMath::Sqrt(vtx->GetXv()*vtx->GetXv()+vtx->GetYv()*vtx->GetYv());
115 if(vtx->GetNContributors() < fMinNContributors) return kFALSE;
116 if(vtx->GetNContributors() > fMaxNContributors) return kFALSE;
117 if(R > fMaxR) return kFALSE;
120 if(vtx->GetZv() < fMinZv) return kFALSE;
121 if(vtx->GetZv() > fMaxZv) return kFALSE;
126 //_____________________________________________________________________________
127 Bool_t AlidNdPtEventCuts::AcceptMCEvent(AliMCEvent *mcEvent)
129 // Check event selection cuts
130 if(!mcEvent) return kFALSE;
132 Bool_t retValue=kTRUE;
134 // check MC event conditions
135 AliHeader* header = mcEvent->Header();
136 if(!header) return kFALSE;
138 AliGenEventHeader* genHeader = header->GenEventHeader();
140 AliDebug(AliLog::kError, "Could not retrieve genHeader from Header");
144 genHeader->PrimaryVertex(vtxMC);
146 // select event type (ND-non diffractive, SD-single diffractive, DD-double diffractive)
147 if(fEventProcessType == AliPWG0Helper::kInvalidProcess) {
150 if(fEventProcessType == AliPWG0Helper::GetEventProcessType(header)) retValue=kTRUE;
151 else retValue=kFALSE;
155 Float_t R = TMath::Sqrt(vtxMC[0]*vtxMC[0]+vtxMC[1]*vtxMC[1]);
156 if(R > fMaxR) return kFALSE;
159 if(vtxMC[2] < fMinZv) return kFALSE;
160 if(vtxMC[2] > fMaxZv) return kFALSE;
165 //_____________________________________________________________________________
166 Long64_t AlidNdPtEventCuts::Merge(TCollection* list)
168 // Merge list of objects (needed by PROOF)
175 TIterator* iter = list->MakeIterator();
179 while((obj = iter->Next()) != 0)
181 AlidNdPtEventCuts* entry = dynamic_cast<AlidNdPtEventCuts*>(obj);