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 "AlidNdPtHelper.h"
27 #include "AlidNdPtEventCuts.h"
31 ClassImp(AlidNdPtEventCuts)
33 //_____________________________________________________________________________
34 AlidNdPtEventCuts::AlidNdPtEventCuts(const Char_t* name,const Char_t *title) :
35 AliAnalysisCuts(name, title)
36 , fRecVertexRequired(kTRUE)
37 , fEventProcessType(AlidNdPtHelper::kInvalidProcess)
38 , fMinNContributors(0)
39 , fMaxNContributors(0)
50 // default constructor
52 // init data members with defaults
56 //_____________________________________________________________________________
57 AlidNdPtEventCuts::~AlidNdPtEventCuts()
62 //_____________________________________________________________________________
63 void AlidNdPtEventCuts::Init()
66 SetRecVertexRequired();
67 SetEventProcessType();
68 SetNContributorsRange();
75 //_____________________________________________________________________________
76 Bool_t AlidNdPtEventCuts::AcceptEvent(AliESDEvent *esdEvent,AliMCEvent *mcEvent, const AliESDVertex *vtx)
78 // Check event selection cuts
79 Bool_t retValue=kTRUE;
81 if(!esdEvent) return kFALSE;
82 if(!IsRecVertexRequired()) return kTRUE;
83 if(!vtx) return kFALSE;
84 if(!vtx->GetStatus()) return kFALSE;
87 // check MC event conditions
88 AliHeader* header = mcEvent->Header();
89 if(!header) return kFALSE;
91 // select event type (ND-non diffractive, SD-single diffractive, DD-double diffractive)
92 if(fEventProcessType == AlidNdPtHelper::kInvalidProcess) {
95 else if(fEventProcessType == AlidNdPtHelper::kDiffractiveProcess) {
96 AlidNdPtHelper::MCProcessType processType = AlidNdPtHelper::GetEventProcessType(header);
97 if(processType == AlidNdPtHelper::kND) retValue=kFALSE;
100 else if(fEventProcessType == AlidNdPtHelper::GetEventProcessType(header)) {
107 Float_t R = TMath::Sqrt(vtx->GetXv()*vtx->GetXv()+vtx->GetYv()*vtx->GetYv());
109 if(vtx->GetNContributors() < fMinNContributors) return kFALSE;
110 if(vtx->GetNContributors() > fMaxNContributors) return kFALSE;
111 if(R > fMaxR) return kFALSE;
112 if(vtx->GetZv() < fMinZv) return kFALSE;
113 if(vtx->GetZv() > fMaxZv) return kFALSE;
118 //_____________________________________________________________________________
119 Bool_t AlidNdPtEventCuts::AcceptMCEvent(AliMCEvent *mcEvent)
121 // Check event selection cuts
122 if(!mcEvent) return kFALSE;
124 Bool_t retValue=kTRUE;
126 // check MC event conditions
127 AliHeader* header = mcEvent->Header();
128 if(!header) return kFALSE;
130 AliGenEventHeader* genHeader = header->GenEventHeader();
132 AliDebug(AliLog::kError, "Could not retrieve genHeader from Header");
136 genHeader->PrimaryVertex(vtxMC);
138 // select event type (ND-non diffractive, SD-single diffractive, DD-double diffractive)
139 if(fEventProcessType == AlidNdPtHelper::kInvalidProcess) {
142 if(fEventProcessType == AlidNdPtHelper::GetEventProcessType(header)) retValue=kTRUE;
143 else retValue=kFALSE;
146 Float_t R = TMath::Sqrt(vtxMC[0]*vtxMC[0]+vtxMC[1]*vtxMC[1]);
148 if(R > fMaxR) return kFALSE;
149 if(vtxMC[2] < fMinZv) return kFALSE;
150 if(vtxMC[2] > fMaxZv) return kFALSE;
155 //_____________________________________________________________________________
156 Long64_t AlidNdPtEventCuts::Merge(TCollection* list)
158 // Merge list of objects (needed by PROOF)
165 TIterator* iter = list->MakeIterator();
169 while((obj = iter->Next()) != 0)
171 AlidNdPtEventCuts* entry = dynamic_cast<AlidNdPtEventCuts*>(obj);